diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-03 20:58:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-03 20:58:06 +0300 |
commit | 709c727c510a85426b87a9a2fb7fb8517fef7de9 (patch) | |
tree | c4664d4773eb77cbf38ee264e9189a6557a310c4 /source/blender/imbuf | |
parent | 3326c0ca7523f5596a8ff96cb90a54b92e50ac5f (diff) |
replace 0 with NULL when used as a pointer
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r-- | source/blender/imbuf/intern/allocimbuf.c | 14 | ||||
-rw-r--r-- | source/blender/imbuf/intern/anim_movie.c | 26 | ||||
-rw-r--r-- | source/blender/imbuf/intern/bmp.c | 4 | ||||
-rw-r--r-- | source/blender/imbuf/intern/divers.c | 4 | ||||
-rw-r--r-- | source/blender/imbuf/intern/iris.c | 8 | ||||
-rw-r--r-- | source/blender/imbuf/intern/jpeg.c | 6 | ||||
-rw-r--r-- | source/blender/imbuf/intern/png.c | 20 | ||||
-rw-r--r-- | source/blender/imbuf/intern/readimage.c | 12 |
8 files changed, 47 insertions, 47 deletions
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index 93f4b7763d7..a8b9e21331d 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -128,7 +128,7 @@ static void freeencodedbufferImBuf(ImBuf *ibuf) if(ibuf->encodedbuffer && (ibuf->mall & IB_mem)) MEM_freeN(ibuf->encodedbuffer); - ibuf->encodedbuffer = 0; + ibuf->encodedbuffer = NULL; ibuf->encodedbuffersize = 0; ibuf->encodedsize = 0; ibuf->mall &= ~IB_mem; @@ -427,11 +427,11 @@ ImBuf *IMB_dupImBuf(ImBuf *ibuf1) // set malloc flag tbuf.mall = ibuf2->mall; - tbuf.c_handle = 0; + tbuf.c_handle = NULL; tbuf.refcounter = 0; // for now don't duplicate metadata - tbuf.metadata = 0; + tbuf.metadata = NULL; *ibuf2 = tbuf; @@ -450,12 +450,12 @@ static void imbuf_cache_destructor(void *data) IMB_freezbuffloatImBuf(ibuf); freeencodedbufferImBuf(ibuf); - ibuf->c_handle = 0; + ibuf->c_handle = NULL; } static MEM_CacheLimiterC **get_imbuf_cache_limiter(void) { - static MEM_CacheLimiterC *c = 0; + static MEM_CacheLimiterC *c = NULL; if(!c) c = new_MEM_CacheLimiter(imbuf_cache_destructor); @@ -466,7 +466,7 @@ static MEM_CacheLimiterC **get_imbuf_cache_limiter(void) void IMB_free_cache_limiter(void) { delete_MEM_CacheLimiter(*get_imbuf_cache_limiter()); - *get_imbuf_cache_limiter() = 0; + *get_imbuf_cache_limiter() = NULL; } void IMB_cache_limiter_insert(ImBuf *i) @@ -485,7 +485,7 @@ void IMB_cache_limiter_unmanage(ImBuf *i) { if(i->c_handle) { MEM_CacheLimiter_unmanage(i->c_handle); - i->c_handle = 0; + i->c_handle = NULL; } } diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index ce676d8c65f..a964f345b2b 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -353,7 +353,7 @@ void IMB_free_anim(struct anim * anim) { } void IMB_close_anim(struct anim * anim) { - if (anim == 0) return; + if (anim == NULL) return; IMB_free_anim(anim); } @@ -454,7 +454,7 @@ static int startavi (struct anim *anim) { } anim->duration = anim->avi->header->TotalFrames; - anim->params = 0; + anim->params = NULL; anim->x = anim->avi->header->Width; anim->y = anim->avi->header->Height; @@ -1034,9 +1034,9 @@ static void free_anim_redcode(struct anim * anim) { /* gelukt, haal dan eerste plaatje van animatie */ static struct ImBuf * anim_getnew(struct anim * anim) { - struct ImBuf *ibuf = 0; + struct ImBuf *ibuf = NULL; - if (anim == NULL) return(0); + if (anim == NULL) return(NULL); free_anim_movie(anim); free_anim_avi(anim); @@ -1051,7 +1051,7 @@ static struct ImBuf * anim_getnew(struct anim * anim) { #endif - if (anim->curtype != 0) return (0); + if (anim->curtype != 0) return (NULL); anim->curtype = imb_get_anim_type(anim->name); switch (anim->curtype) { @@ -1063,13 +1063,13 @@ static struct ImBuf * anim_getnew(struct anim * anim) { } break; case ANIM_MOVIE: - if (startmovie(anim)) return (0); + if (startmovie(anim)) return (NULL); ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0); /* fake */ break; case ANIM_AVI: if (startavi(anim)) { printf("couldnt start avi\n"); - return (0); + return (NULL); } ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0); break; @@ -1096,7 +1096,7 @@ static struct ImBuf * anim_getnew(struct anim * anim) { } struct ImBuf * IMB_anim_previewframe(struct anim * anim) { - struct ImBuf * ibuf = 0; + struct ImBuf * ibuf = NULL; int position = 0; ibuf = IMB_anim_absolute(anim, 0); @@ -1109,27 +1109,27 @@ struct ImBuf * IMB_anim_previewframe(struct anim * anim) { } struct ImBuf * IMB_anim_absolute(struct anim * anim, int position) { - struct ImBuf * ibuf = 0; + struct ImBuf * ibuf = NULL; char head[256], tail[256]; unsigned short digits; int pic; int filter_y; - if (anim == NULL) return(0); + if (anim == NULL) return(NULL); filter_y = (anim->ib_flags & IB_animdeinterlace); if (anim->curtype == 0) { ibuf = anim_getnew(anim); if (ibuf == NULL) { - return (0); + return(NULL); } IMB_freeImBuf(ibuf); /* ???? */ ibuf= NULL; } - if (position < 0) return(0); - if (position >= anim->duration) return(0); + if (position < 0) return(NULL); + if (position >= anim->duration) return(NULL); switch(anim->curtype) { case ANIM_SEQUENCE: diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index 3d9af0b9f97..d79acc88a80 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -108,7 +108,7 @@ int imb_is_a_bmp(unsigned char *buf) { struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags) { - struct ImBuf *ibuf = 0; + struct ImBuf *ibuf = NULL; BMPINFOHEADER bmi; int x, y, depth, skip, i; unsigned char *bmp, *rect; @@ -116,7 +116,7 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags) (void)size; /* unused */ - if (checkbmp(mem) == 0) return(0); + if (checkbmp(mem) == 0) return(NULL); if ((mem[0] == 'B') && (mem[1] == 'M')) { /* skip fileheader */ diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index cbeda1b3399..ff98ac60166 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -52,7 +52,7 @@ void IMB_de_interlace(struct ImBuf *ibuf) { struct ImBuf * tbuf1, * tbuf2; - if (ibuf == 0) return; + if (ibuf == NULL) return; if (ibuf->flags & IB_fields) return; ibuf->flags |= IB_fields; @@ -79,7 +79,7 @@ void IMB_interlace(struct ImBuf *ibuf) { struct ImBuf * tbuf1, * tbuf2; - if (ibuf == 0) return; + if (ibuf == NULL) return; ibuf->flags &= ~IB_fields; ibuf->y *= 2; diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index 8370f1934c8..adbf3659d3a 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -221,7 +221,7 @@ static void test_endian_zbuf(struct ImBuf *ibuf) int *zval; if( BIG_LONG(1) == 1 ) return; - if(ibuf->zbuf==0) return; + if(ibuf->zbuf == NULL) return; len= ibuf->x*ibuf->y; zval= ibuf->zbuf; @@ -276,14 +276,14 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) readheader(inf, &image); if(image.imagic != IMAGIC) { fprintf(stderr,"longimagedata: bad magic number in image file\n"); - return(0); + return(NULL); } rle = ISRLE(image.type); bpp = BPP(image.type); if(bpp != 1 && bpp != 2) { fprintf(stderr,"longimagedata: image must have 1 or 2 byte per pix chan\n"); - return(0); + return(NULL); } xsize = image.xsize; @@ -826,7 +826,7 @@ int imb_saveiris(struct ImBuf * ibuf, const char *name, int flags) int ret; zsize = (ibuf->depth + 7) >> 3; - if (flags & IB_zbuf && ibuf->zbuf != 0) zsize = 8; + if (flags & IB_zbuf && ibuf->zbuf != NULL) zsize = 8; IMB_convert_rgba_to_abgr(ibuf); test_endian_zbuf(ibuf); diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index 24ddd2a85a9..93ebd0efcb0 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -271,10 +271,10 @@ handle_app1 (j_decompress_ptr cinfo) static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int flags) { JSAMPARRAY row_pointer; - JSAMPLE * buffer = 0; + JSAMPLE * buffer = NULL; int row_stride; int x, y, depth, r, g, b, k; - struct ImBuf * ibuf = 0; + struct ImBuf * ibuf = NULL; uchar * rect; jpeg_saved_marker_ptr marker; char *str, *key, *value; @@ -470,7 +470,7 @@ ImBuf * imb_load_jpeg (unsigned char * buffer, size_t size, int flags) static void write_jpeg(struct jpeg_compress_struct * cinfo, struct ImBuf * ibuf) { - JSAMPLE * buffer = 0; + JSAMPLE * buffer = NULL; JSAMPROW row_pointer[1]; uchar * rect; int x, y; diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index 8be2c26c64f..200ff0af9af 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -104,11 +104,11 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) png_structp png_ptr; png_infop info_ptr; - unsigned char *pixels = 0; + unsigned char *pixels = NULL; unsigned char *from, *to; - png_bytepp row_pointers = 0; + png_bytepp row_pointers = NULL; int i, bytesperpixel, color_type = PNG_COLOR_TYPE_GRAY; - FILE *fp = 0; + FILE *fp = NULL; /* use the jpeg quality setting for compression */ int compression; @@ -299,11 +299,11 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags) { - struct ImBuf *ibuf = 0; + struct ImBuf *ibuf = NULL; png_structp png_ptr; png_infop info_ptr; - unsigned char *pixels = 0; - png_bytepp row_pointers = 0; + unsigned char *pixels = NULL; + png_bytepp row_pointers = NULL; png_uint_32 width, height; int bit_depth, color_type; PNGReadStruct ps; @@ -311,13 +311,13 @@ struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags) unsigned char *from, *to; int i, bytesperpixel; - if (imb_is_a_png(mem) == 0) return(0); + if (imb_is_a_png(mem) == 0) return(NULL); png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr == NULL) { printf("Cannot png_create_read_struct\n"); - return 0; + return NULL; } info_ptr = png_create_info_struct(png_ptr); @@ -325,7 +325,7 @@ struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags) png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL); printf("Cannot png_create_info_struct\n"); - return 0; + return NULL; } ps.size = size; /* XXX, 4gig limit! */ @@ -339,7 +339,7 @@ struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags) if (pixels) MEM_freeN(pixels); if (row_pointers) MEM_freeN(row_pointers); if (ibuf) IMB_freeImBuf(ibuf); - return 0; + return NULL; } // png_set_sig_bytes(png_ptr, 8); diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c index a43fa7fb802..849b3ff0ce2 100644 --- a/source/blender/imbuf/intern/readimage.c +++ b/source/blender/imbuf/intern/readimage.c @@ -86,14 +86,14 @@ ImBuf *IMB_loadifffile(int file, int flags) unsigned char *mem; size_t size; - if(file == -1) return 0; + if(file == -1) return NULL; size= BLI_filesize(file); - mem= mmap(0, size, PROT_READ, MAP_SHARED, file, 0); + mem= mmap(NULL, size, PROT_READ, MAP_SHARED, file, 0); if(mem==(unsigned char*)-1) { fprintf(stderr, "Couldn't get mapping\n"); - return 0; + return NULL; } ibuf= IMB_ibImageFromMemory(mem, size, flags); @@ -128,7 +128,7 @@ ImBuf *IMB_loadiffname(const char *name, int flags) imb_cache_filename(filename, name, flags); file = open(filename, O_BINARY|O_RDONLY); - if(file < 0) return 0; + if(file < 0) return NULL; ibuf= IMB_loadifffile(file, flags); @@ -154,7 +154,7 @@ ImBuf *IMB_testiffname(char *name, int flags) imb_cache_filename(filename, name, flags); file = open(filename,O_BINARY|O_RDONLY); - if(file < 0) return 0; + if(file < 0) return NULL; ibuf=IMB_loadifffile(file, flags|IB_test|IB_multilayer); if(ibuf) { @@ -177,7 +177,7 @@ static void imb_loadtilefile(ImBuf *ibuf, int file, int tx, int ty, unsigned int size= BLI_filesize(file); - mem= mmap(0, size, PROT_READ, MAP_SHARED, file, 0); + mem= mmap(NULL, size, PROT_READ, MAP_SHARED, file, 0); if(mem==(unsigned char*)-1) { fprintf(stderr, "Couldn't get memory mapping for %s\n", ibuf->cachename); return; |