Commit a804eaa4 authored by Rémi Duraffort's avatar Rémi Duraffort

Test pointers against NULL instead of 0.

parent a02b83a7
...@@ -499,7 +499,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw ...@@ -499,7 +499,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw
ret = acmDriverOpen(&had, (HACMDRIVERID)wadi, 0L); ret = acmDriverOpen(&had, (HACMDRIVERID)wadi, 0L);
if (ret == MMSYSERR_NOERROR) { if (ret == MMSYSERR_NOERROR) {
if ((wad = MSACM_GetDriver(had)) != 0) { if ((wad = MSACM_GetDriver(had)) != NULL) {
was->obj.pACMDriverID = wad->obj.pACMDriverID; was->obj.pACMDriverID = wad->obj.pACMDriverID;
was->pDrv = wad; was->pDrv = wad;
was->hAcmDriver = had; was->hAcmDriver = had;
......
...@@ -95,7 +95,7 @@ static int needs_free=0; ...@@ -95,7 +95,7 @@ static int needs_free=0;
void SetCodecPath(const char* path) void SetCodecPath(const char* path)
{ {
if(needs_free)free(def_path); if(needs_free)free(def_path);
if(path==0) if(path==NULL)
{ {
def_path=WIN32_PATH; def_path=WIN32_PATH;
needs_free=0; needs_free=0;
......
...@@ -142,7 +142,7 @@ LPSTR WINAPI lstrcpynWtoA(LPSTR dest, LPCWSTR src, INT count) ...@@ -142,7 +142,7 @@ LPSTR WINAPI lstrcpynWtoA(LPSTR dest, LPCWSTR src, INT count)
{ {
LPSTR result = dest; LPSTR result = dest;
int moved=0; int moved=0;
if((dest==0) || (src==0)) if((dest==NULL) || (src==NULL))
return 0; return 0;
while(moved<count) while(moved<count)
{ {
...@@ -204,7 +204,7 @@ LPWSTR HEAP_strdupAtoW(HANDLE heap, DWORD flags, LPCSTR string) ...@@ -204,7 +204,7 @@ LPWSTR HEAP_strdupAtoW(HANDLE heap, DWORD flags, LPCSTR string)
{ {
int size, i; int size, i;
WCHAR* answer; WCHAR* answer;
if(string==0) if(string==NULL)
return 0; return 0;
size=strlen(string); size=strlen(string);
answer = (WCHAR*) malloc(sizeof(WCHAR) * (size + 1)); answer = (WCHAR*) malloc(sizeof(WCHAR) * (size + 1));
...@@ -216,7 +216,7 @@ LPSTR HEAP_strdupWtoA(HANDLE heap, DWORD flags, LPCWSTR string) ...@@ -216,7 +216,7 @@ LPSTR HEAP_strdupWtoA(HANDLE heap, DWORD flags, LPCWSTR string)
{ {
int size, i; int size, i;
char* answer; char* answer;
if(string==0) if(string==NULL)
return 0; return 0;
size=0; size=0;
while(string[size]) while(string[size])
...@@ -396,7 +396,7 @@ HANDLE WINAPI CreateFileMappingA(HANDLE handle, LPSECURITY_ATTRIBUTES lpAttr, ...@@ -396,7 +396,7 @@ HANDLE WINAPI CreateFileMappingA(HANDLE handle, LPSECURITY_ATTRIBUTES lpAttr,
close(hFile); close(hFile);
if(answer!=(LPVOID)-1) if(answer!=(LPVOID)-1)
{ {
if(fm==0) if(fm==NULL)
{ {
fm = (file_mapping*) malloc(sizeof(file_mapping)); fm = (file_mapping*) malloc(sizeof(file_mapping));
fm->prev=NULL; fm->prev=NULL;
...@@ -428,7 +428,7 @@ WIN_BOOL WINAPI UnmapViewOfFile(LPVOID handle) ...@@ -428,7 +428,7 @@ WIN_BOOL WINAPI UnmapViewOfFile(LPVOID handle)
{ {
file_mapping* p; file_mapping* p;
int result; int result;
if(fm==0) if(fm==NULL)
return 0; return 0;
for(p=fm; p; p=p->next) for(p=fm; p; p=p->next)
{ {
...@@ -489,7 +489,7 @@ LPVOID WINAPI VirtualAlloc(LPVOID address, DWORD size, DWORD type, DWORD protec ...@@ -489,7 +489,7 @@ LPVOID WINAPI VirtualAlloc(LPVOID address, DWORD size, DWORD type, DWORD protec
if (type&MEM_RESERVE && size<0x10000) size = 0x10000; if (type&MEM_RESERVE && size<0x10000) size = 0x10000;
if (size%pgsz) size += pgsz - size%pgsz; if (size%pgsz) size += pgsz - size%pgsz;
if(address!=0) if(address!=NULL)
{ {
//check whether we can allow to allocate this //check whether we can allow to allocate this
virt_alloc* str=vm; virt_alloc* str=vm;
...@@ -593,14 +593,14 @@ INT WINAPI WideCharToMultiByte(UINT codepage, DWORD flags, LPCWSTR src, ...@@ -593,14 +593,14 @@ INT WINAPI WideCharToMultiByte(UINT codepage, DWORD flags, LPCWSTR src,
INT srclen,LPSTR dest, INT destlen, LPCSTR defch, WIN_BOOL* used_defch) INT srclen,LPSTR dest, INT destlen, LPCSTR defch, WIN_BOOL* used_defch)
{ {
int i; int i;
if(src==0) if(src==NULL)
return 0; return 0;
if ((srclen==-1)&&(dest==0)) return 0; if ((srclen==-1)&&(dest==NULL)) return 0;
if(srclen==-1){srclen=0; while(src[srclen++]);} if(srclen==-1){srclen=0; while(src[srclen++]);}
// for(i=0; i<srclen; i++) // for(i=0; i<srclen; i++)
// printf("%c", src[i]); // printf("%c", src[i]);
// printf("\n"); // printf("\n");
if(dest==0) if(dest==NULL)
{ {
for(i=0; i<srclen; i++) for(i=0; i<srclen; i++)
{ {
...@@ -630,13 +630,13 @@ INT WINAPI MultiByteToWideChar(UINT codepage,DWORD flags, LPCSTR src, INT srclen ...@@ -630,13 +630,13 @@ INT WINAPI MultiByteToWideChar(UINT codepage,DWORD flags, LPCSTR src, INT srclen
HANDLE WINAPI OpenFileMappingA(DWORD access, WIN_BOOL prot, LPCSTR name) HANDLE WINAPI OpenFileMappingA(DWORD access, WIN_BOOL prot, LPCSTR name)
{ {
file_mapping* p; file_mapping* p;
if(fm==0) if(fm==NULL)
return (HANDLE)0; return (HANDLE)0;
if(name==0) if(name==NULL)
return (HANDLE)0; return (HANDLE)0;
for(p=fm; p; p=p->prev) for(p=fm; p; p=p->prev)
{ {
if(p->name==0) if(p->name==NULL)
continue; continue;
if(strcmp(p->name, name)==0) if(strcmp(p->name, name)==0)
return (HANDLE)p->handle; return (HANDLE)p->handle;
......
...@@ -298,7 +298,7 @@ ldt_fs_t* Setup_LDT_Keeper(void) ...@@ -298,7 +298,7 @@ ldt_fs_t* Setup_LDT_Keeper(void)
void Restore_LDT_Keeper(ldt_fs_t* ldt_fs) void Restore_LDT_Keeper(ldt_fs_t* ldt_fs)
{ {
if (ldt_fs == NULL || ldt_fs->fs_seg == 0) if (ldt_fs == NULL || ldt_fs->fs_seg == NULL)
return; return;
free(ldt_fs->prev_struct); free(ldt_fs->prev_struct);
munmap((char*)ldt_fs->fs_seg, getpagesize()); munmap((char*)ldt_fs->fs_seg, getpagesize());
......
...@@ -96,9 +96,9 @@ WINE_MODREF* MODULE_FindModule(LPCSTR m) ...@@ -96,9 +96,9 @@ WINE_MODREF* MODULE_FindModule(LPCSTR m)
static void MODULE_RemoveFromList(WINE_MODREF *mod) static void MODULE_RemoveFromList(WINE_MODREF *mod)
{ {
modref_list* list=local_wm; modref_list* list=local_wm;
if(list==0) if(list==NULL)
return; return;
if(mod==0) if(mod==NULL)
return; return;
if((list->prev==NULL)&&(list->next==NULL)) if((list->prev==NULL)&&(list->next==NULL))
{ {
...@@ -396,7 +396,7 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) ...@@ -396,7 +396,7 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags)
// if(fs_installed==0) // if(fs_installed==0)
// install_fs(); // install_fs();
while (wm == 0 && listpath[++i]) while (wm == NULL && listpath[++i])
{ {
if (i < 2) if (i < 2)
{ {
......
...@@ -125,7 +125,7 @@ static void open_registry(void) ...@@ -125,7 +125,7 @@ static void open_registry(void)
read(fd,&regs[i].type,4); read(fd,&regs[i].type,4);
read(fd,&len,4); read(fd,&len,4);
regs[i].name=(char*)malloc(len+1); regs[i].name=(char*)malloc(len+1);
if(regs[i].name==0) if(regs[i].name==NULL)
{ {
reg_size=i+1; reg_size=i+1;
goto error; goto error;
...@@ -134,7 +134,7 @@ static void open_registry(void) ...@@ -134,7 +134,7 @@ static void open_registry(void)
regs[i].name[len]=0; regs[i].name[len]=0;
read(fd,&regs[i].len,4); read(fd,&regs[i].len,4);
regs[i].value=(char*)malloc(regs[i].len+1); regs[i].value=(char*)malloc(regs[i].len+1);
if(regs[i].value==0) if(regs[i].value==NULL)
{ {
free(regs[i].name); free(regs[i].name);
reg_size=i+1; reg_size=i+1;
...@@ -247,7 +247,7 @@ static reg_handle_t* insert_handle(long handle, const char* name) ...@@ -247,7 +247,7 @@ static reg_handle_t* insert_handle(long handle, const char* name)
{ {
reg_handle_t* t; reg_handle_t* t;
t=(reg_handle_t*)malloc(sizeof(reg_handle_t)); t=(reg_handle_t*)malloc(sizeof(reg_handle_t));
if(head==0) if(head==NULL)
{ {
t->prev=0; t->prev=0;
} }
...@@ -267,7 +267,7 @@ static char* build_keyname(long key, const char* subkey) ...@@ -267,7 +267,7 @@ static char* build_keyname(long key, const char* subkey)
{ {
char* full_name; char* full_name;
reg_handle_t* t; reg_handle_t* t;
if((t=find_handle(key))==0) if((t=find_handle(key))==NULL)
{ {
TRACE("Invalid key\n"); TRACE("Invalid key\n");
return NULL; return NULL;
...@@ -291,10 +291,10 @@ static struct reg_value* insert_reg_value(int handle, const char* name, int type ...@@ -291,10 +291,10 @@ static struct reg_value* insert_reg_value(int handle, const char* name, int type
return NULL; return NULL;
} }
if((v=find_value_by_name(fullname))==0) if((v=find_value_by_name(fullname))==NULL)
//creating new value in registry //creating new value in registry
{ {
if(regs==0) if(regs==NULL)
create_registry(); create_registry();
regs=(struct reg_value*)realloc(regs, sizeof(struct reg_value)*(reg_size+1)); regs=(struct reg_value*)realloc(regs, sizeof(struct reg_value)*(reg_size+1));
//regs=(struct reg_value*)my_realloc(regs, sizeof(struct reg_value)*(reg_size+1)); //regs=(struct reg_value*)my_realloc(regs, sizeof(struct reg_value)*(reg_size+1));
...@@ -334,7 +334,7 @@ static void init_registry(void) ...@@ -334,7 +334,7 @@ static void init_registry(void)
// registry.c is holding its own internal pointer // registry.c is holding its own internal pointer
// localregpathname - which is being allocate/deallocated // localregpathname - which is being allocate/deallocated
if (localregpathname == 0) if (localregpathname == NULL)
{ {
const char* pthn = regpathname; const char* pthn = regpathname;
if (!regpathname) if (!regpathname)
...@@ -360,7 +360,7 @@ static reg_handle_t* find_handle_2(long key, const char* subkey) ...@@ -360,7 +360,7 @@ static reg_handle_t* find_handle_2(long key, const char* subkey)
{ {
char* full_name; char* full_name;
reg_handle_t* t; reg_handle_t* t;
if((t=find_handle(key))==0) if((t=find_handle(key))==NULL)
{ {
TRACE("Invalid key\n"); TRACE("Invalid key\n");
return (reg_handle_t*)-1; return (reg_handle_t*)-1;
...@@ -414,7 +414,7 @@ long __stdcall RegCloseKey(long key) ...@@ -414,7 +414,7 @@ long __stdcall RegCloseKey(long key)
if(key==(long)HKEY_CURRENT_USER) if(key==(long)HKEY_CURRENT_USER)
return 0; return 0;
handle=find_handle(key); handle=find_handle(key);
if(handle==0) if(handle==NULL)
return 0; return 0;
if(handle->prev) if(handle->prev)
handle->prev->next=handle->next; handle->prev->next=handle->next;
...@@ -440,7 +440,7 @@ long __stdcall RegQueryValueExA(long key, const char* value, int* reserved, int* ...@@ -440,7 +440,7 @@ long __stdcall RegQueryValueExA(long key, const char* value, int* reserved, int*
return 1; return 1;
t=find_value_by_name(c); t=find_value_by_name(c);
free(c); free(c);
if (t==0) if (t==NULL)
return 2; return 2;
if (type) if (type)
*type=t->type; *type=t->type;
...@@ -476,7 +476,7 @@ long __stdcall RegCreateKeyExA(long key, const char* name, long reserved, ...@@ -476,7 +476,7 @@ long __stdcall RegCreateKeyExA(long key, const char* name, long reserved,
return 1; return 1;
TRACE("Creating/Opening key %s\n", fullname); TRACE("Creating/Opening key %s\n", fullname);
v=find_value_by_name(fullname); v=find_value_by_name(fullname);
if(v==0) if(v==NULL)
{ {
int qw=45708; int qw=45708;
v=insert_reg_value(key, name, DIR, &qw, 4); v=insert_reg_value(key, name, DIR, &qw, 4);
......
...@@ -2134,7 +2134,7 @@ static picture_t *video_new_buffer( vlc_object_t *p_this, picture_t **pp_ring, ...@@ -2134,7 +2134,7 @@ static picture_t *video_new_buffer( vlc_object_t *p_this, picture_t **pp_ring,
/* Find an empty space in the picture ring buffer */ /* Find an empty space in the picture ring buffer */
for( i = 0; i < PICTURE_RING_SIZE; i++ ) for( i = 0; i < PICTURE_RING_SIZE; i++ )
{ {
if( pp_ring[i] != 0 && pp_ring[i]->i_status == DESTROYED_PICTURE ) if( pp_ring[i] != NULL && pp_ring[i]->i_status == DESTROYED_PICTURE )
{ {
pp_ring[i]->i_status = RESERVED_PICTURE; pp_ring[i]->i_status = RESERVED_PICTURE;
return pp_ring[i]; return pp_ring[i];
...@@ -2142,7 +2142,7 @@ static picture_t *video_new_buffer( vlc_object_t *p_this, picture_t **pp_ring, ...@@ -2142,7 +2142,7 @@ static picture_t *video_new_buffer( vlc_object_t *p_this, picture_t **pp_ring,
} }
for( i = 0; i < PICTURE_RING_SIZE; i++ ) for( i = 0; i < PICTURE_RING_SIZE; i++ )
{ {
if( pp_ring[i] == 0 ) break; if( pp_ring[i] == NULL ) break;
} }
if( i == PICTURE_RING_SIZE && p_sys->i_threads >= 1 ) if( i == PICTURE_RING_SIZE && p_sys->i_threads >= 1 )
...@@ -2159,7 +2159,7 @@ static picture_t *video_new_buffer( vlc_object_t *p_this, picture_t **pp_ring, ...@@ -2159,7 +2159,7 @@ static picture_t *video_new_buffer( vlc_object_t *p_this, picture_t **pp_ring,
/* Find an empty space in the picture ring buffer */ /* Find an empty space in the picture ring buffer */
for( i = 0; i < PICTURE_RING_SIZE; i++ ) for( i = 0; i < PICTURE_RING_SIZE; i++ )
{ {
if( pp_ring[i] != 0 && pp_ring[i]->i_status == DESTROYED_PICTURE ) if( pp_ring[i] != NULL && pp_ring[i]->i_status == DESTROYED_PICTURE )
{ {
pp_ring[i]->i_status = RESERVED_PICTURE; pp_ring[i]->i_status = RESERVED_PICTURE;
return pp_ring[i]; return pp_ring[i];
...@@ -2167,7 +2167,7 @@ static picture_t *video_new_buffer( vlc_object_t *p_this, picture_t **pp_ring, ...@@ -2167,7 +2167,7 @@ static picture_t *video_new_buffer( vlc_object_t *p_this, picture_t **pp_ring,
} }
for( i = 0; i < PICTURE_RING_SIZE; i++ ) for( i = 0; i < PICTURE_RING_SIZE; i++ )
{ {
if( pp_ring[i] == 0 ) break; if( pp_ring[i] == NULL ) break;
} }
} }
......
...@@ -495,7 +495,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date ) ...@@ -495,7 +495,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
if ( !p_es->b_empty ) if ( !p_es->b_empty )
{ {
i_numpics ++; i_numpics ++;
if( p_sys->i_order_length && p_es->psz_id != 0 ) if( p_sys->i_order_length && p_es->psz_id != NULL )
{ {
/* We also want to leave slots for images given in /* We also want to leave slots for images given in
* mosaic-order that are not available in p_vout_picture */ * mosaic-order that are not available in p_vout_picture */
......
...@@ -522,7 +522,7 @@ int load_preset_file(char * pathname, preset_t * preset) { ...@@ -522,7 +522,7 @@ int load_preset_file(char * pathname, preset_t * preset) {
return FAILURE; return FAILURE;
/* Open the file corresponding to pathname */ /* Open the file corresponding to pathname */
if ((fs = utf8_fopen(pathname, "r")) == 0) { if ((fs = utf8_fopen(pathname, "r")) == NULL) {
if (PRESET_DEBUG) printf("load_preset_file: loading of file %s failed!\n", pathname); if (PRESET_DEBUG) printf("load_preset_file: loading of file %s failed!\n", pathname);
return ERROR; return ERROR;
} }
...@@ -793,7 +793,7 @@ void savePreset(char * filename) { ...@@ -793,7 +793,7 @@ void savePreset(char * filename) {
return; return;
/* Open the file corresponding to pathname */ /* Open the file corresponding to pathname */
if ((fs = utf8_fopen(filename, "w+")) == 0) { if ((fs = utf8_fopen(filename, "w+")) == NULL) {
if (PRESET_DEBUG) printf("savePreset: failed to create filename \"%s\"!\n", filename); if (PRESET_DEBUG) printf("savePreset: failed to create filename \"%s\"!\n", filename);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment