Test pointers against NULL instead of 0.
authorRémi Duraffort <ivoire@videolan.org>
Mon, 19 Jan 2009 21:07:37 +0000 (22:07 +0100)
committerRémi Duraffort <ivoire@videolan.org>
Mon, 19 Jan 2009 21:07:37 +0000 (22:07 +0100)
libs/loader/afl.c
libs/loader/driver.c
libs/loader/ext.c
libs/loader/ldt_keeper.c
libs/loader/module.c
libs/loader/registry.c
modules/stream_out/transcode.c
modules/video_filter/mosaic.c
modules/visualization/galaktos/preset.c

index 8800df1..7cb0eb8 100644 (file)
@@ -499,7 +499,7 @@ MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pw
 
            ret = acmDriverOpen(&had, (HACMDRIVERID)wadi, 0L);
            if (ret == MMSYSERR_NOERROR) {
-               if ((wad = MSACM_GetDriver(had)) != 0) {
+               if ((wad = MSACM_GetDriver(had)) != NULL) {
                    was->obj.pACMDriverID = wad->obj.pACMDriverID;
                    was->pDrv = wad;
                    was->hAcmDriver = had;
index 24c8715..dde6a1d 100644 (file)
@@ -95,7 +95,7 @@ static int needs_free=0;
 void SetCodecPath(const char* path)
 {
     if(needs_free)free(def_path);
-    if(path==0)
+    if(path==NULL)
     {
        def_path=WIN32_PATH;
        needs_free=0;
index 3680dc3..3d6b9a7 100644 (file)
@@ -142,7 +142,7 @@ LPSTR WINAPI lstrcpynWtoA(LPSTR dest, LPCWSTR src, INT count)
 {
     LPSTR result = dest;
     int moved=0;
-    if((dest==0) || (src==0))
+    if((dest==NULL) || (src==NULL))
        return 0;
     while(moved<count)
     {
@@ -204,7 +204,7 @@ LPWSTR HEAP_strdupAtoW(HANDLE heap, DWORD flags, LPCSTR string)
 {
     int size, i;
     WCHAR* answer;
-    if(string==0)
+    if(string==NULL)
        return 0;
     size=strlen(string);
     answer = (WCHAR*) malloc(sizeof(WCHAR) * (size + 1));
@@ -216,7 +216,7 @@ LPSTR HEAP_strdupWtoA(HANDLE heap, DWORD flags, LPCWSTR string)
 {
     int size, i;
     char* answer;
-    if(string==0)
+    if(string==NULL)
        return 0;
     size=0;
     while(string[size])
@@ -396,7 +396,7 @@ HANDLE WINAPI CreateFileMappingA(HANDLE handle, LPSECURITY_ATTRIBUTES lpAttr,
         close(hFile);
     if(answer!=(LPVOID)-1)
     {
-       if(fm==0)
+       if(fm==NULL)
        {
            fm = (file_mapping*) malloc(sizeof(file_mapping));
            fm->prev=NULL;
@@ -428,7 +428,7 @@ WIN_BOOL WINAPI UnmapViewOfFile(LPVOID handle)
 {
     file_mapping* p;
     int result;
-    if(fm==0)
+    if(fm==NULL)
        return 0;
     for(p=fm; p; p=p->next)
     {
@@ -489,7 +489,7 @@ LPVOID WINAPI VirtualAlloc(LPVOID address, DWORD size, DWORD type,  DWORD protec
     if (type&MEM_RESERVE && size<0x10000) size = 0x10000;
     if (size%pgsz) size += pgsz - size%pgsz;
 
-    if(address!=0)
+    if(address!=NULL)
     {
     //check whether we can allow to allocate this
         virt_alloc* str=vm;
@@ -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 i;
-    if(src==0)
+    if(src==NULL)
        return 0;
-    if ((srclen==-1)&&(dest==0)) return 0;
+    if ((srclen==-1)&&(dest==NULL)) return 0;
     if(srclen==-1){srclen=0; while(src[srclen++]);}
 //    for(i=0; i<srclen; i++)
 //     printf("%c", src[i]);
 //    printf("\n");
-    if(dest==0)
+    if(dest==NULL)
     {
     for(i=0; i<srclen; i++)
     {
@@ -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)
 {
     file_mapping* p;
-    if(fm==0)
+    if(fm==NULL)
        return (HANDLE)0;
-    if(name==0)
+    if(name==NULL)
        return (HANDLE)0;
     for(p=fm; p; p=p->prev)
     {
-       if(p->name==0)
+       if(p->name==NULL)
            continue;
        if(strcmp(p->name, name)==0)
            return (HANDLE)p->handle;
index 2b524f0..4bf5d04 100644 (file)
@@ -298,7 +298,7 @@ ldt_fs_t* Setup_LDT_Keeper(void)
 
 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;
     free(ldt_fs->prev_struct);
     munmap((char*)ldt_fs->fs_seg, getpagesize());
index 2e42dff..635f4b5 100644 (file)
@@ -96,9 +96,9 @@ WINE_MODREF* MODULE_FindModule(LPCSTR m)
 static void MODULE_RemoveFromList(WINE_MODREF *mod)
 {
     modref_list* list=local_wm;
-    if(list==0)
+    if(list==NULL)
        return;
-    if(mod==0)
+    if(mod==NULL)
        return;
     if((list->prev==NULL)&&(list->next==NULL))
     {
@@ -396,7 +396,7 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags)
 //     if(fs_installed==0)
 //         install_fs();
 
-       while (wm == 0 && listpath[++i])
+       while (wm == NULL && listpath[++i])
        {
            if (i < 2)
            {
index 967f52f..5bc802f 100644 (file)
@@ -125,7 +125,7 @@ static void open_registry(void)
                read(fd,&regs[i].type,4);
                read(fd,&len,4);
                regs[i].name=(char*)malloc(len+1);
-               if(regs[i].name==0)
+               if(regs[i].name==NULL)
                {
                        reg_size=i+1;
                        goto error;
@@ -134,7 +134,7 @@ static void open_registry(void)
                regs[i].name[len]=0;
                read(fd,&regs[i].len,4);
                regs[i].value=(char*)malloc(regs[i].len+1);
-               if(regs[i].value==0)
+               if(regs[i].value==NULL)
                {
                        free(regs[i].name);
                        reg_size=i+1;
@@ -247,7 +247,7 @@ static reg_handle_t* insert_handle(long handle, const char* name)
 {
        reg_handle_t* t;
        t=(reg_handle_t*)malloc(sizeof(reg_handle_t));
-       if(head==0)
+       if(head==NULL)
        {
                t->prev=0;
        }
@@ -267,7 +267,7 @@ static char* build_keyname(long key, const char* subkey)
 {
        char* full_name;
        reg_handle_t* t;
-       if((t=find_handle(key))==0)
+        if((t=find_handle(key))==NULL)
        {
                TRACE("Invalid key\n");
                return NULL;
@@ -291,10 +291,10 @@ static struct reg_value* insert_reg_value(int handle, const char* name, int type
                return NULL;
        }
 
-       if((v=find_value_by_name(fullname))==0)
+       if((v=find_value_by_name(fullname))==NULL)
        //creating new value in registry
        {
-               if(regs==0)
+               if(regs==NULL)
                    create_registry();
                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));
@@ -334,7 +334,7 @@ static void init_registry(void)
        // registry.c is holding its own internal pointer
        // localregpathname  - which is being allocate/deallocated
 
-       if (localregpathname == 0)
+       if (localregpathname == NULL)
        {
             const char* pthn = regpathname;
            if (!regpathname)
@@ -360,7 +360,7 @@ static reg_handle_t* find_handle_2(long key, const char* subkey)
 {
        char* full_name;
        reg_handle_t* t;
-       if((t=find_handle(key))==0)
+        if((t=find_handle(key))==NULL)
        {
                TRACE("Invalid key\n");
                return (reg_handle_t*)-1;
@@ -414,7 +414,7 @@ long __stdcall RegCloseKey(long key)
     if(key==(long)HKEY_CURRENT_USER)
        return 0;
     handle=find_handle(key);
-    if(handle==0)
+    if(handle==NULL)
        return 0;
     if(handle->prev)
        handle->prev->next=handle->next;
@@ -440,7 +440,7 @@ long __stdcall RegQueryValueExA(long key, const char* value, int* reserved, int*
        return 1;
     t=find_value_by_name(c);
     free(c);
-    if (t==0)
+    if (t==NULL)
        return 2;
     if (type)
        *type=t->type;
@@ -476,7 +476,7 @@ long __stdcall RegCreateKeyExA(long key, const char* name, long reserved,
        return 1;
     TRACE("Creating/Opening key %s\n", fullname);
     v=find_value_by_name(fullname);
-    if(v==0)
+    if(v==NULL)
     {
        int qw=45708;
        v=insert_reg_value(key, name, DIR, &qw, 4);
index 276e0d5..afcd0fe 100644 (file)
@@ -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 */
     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;
             return pp_ring[i];
@@ -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++ )
     {
-        if( pp_ring[i] == 0 ) break;
+        if( pp_ring[i] == NULL ) break;
     }
 
     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,
         /* Find an empty space in the picture ring buffer */
         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;
                 return pp_ring[i];
@@ -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++ )
         {
-            if( pp_ring[i] == 0 ) break;
+            if( pp_ring[i] == NULL ) break;
         }
     }
 
index 438125e..4a16f22 100644 (file)
@@ -495,7 +495,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
             if ( !p_es->b_empty )
             {
                 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
                      * mosaic-order that are not available in p_vout_picture */
index cbb1046..e7aea34 100644 (file)
@@ -522,7 +522,7 @@ int load_preset_file(char * pathname, preset_t * preset) {
          return FAILURE;
   
   /* 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);
     return ERROR;      
   }
@@ -793,7 +793,7 @@ void savePreset(char * filename) {
     return;
   
   /* 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);
     return;    
   }