diff options
Diffstat (limited to 'source/blender/imbuf/intern/cineon/cineonlib.c')
-rw-r--r-- | source/blender/imbuf/intern/cineon/cineonlib.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c index 4b9ca1dd539..1481b2aaa66 100644 --- a/source/blender/imbuf/intern/cineon/cineonlib.c +++ b/source/blender/imbuf/intern/cineon/cineonlib.c @@ -75,7 +75,7 @@ static void fillCineonMainHeader(LogImageFile *cineon, CineonMainHeader *header, strcpy(header->fileHeader.version, "v4.5"); strncpy(header->fileHeader.file_name, filename, 99); header->fileHeader.file_name[99] = 0; - fileClock = time(0); + fileClock = time(NULL); fileTime = localtime(&fileClock); strftime(header->fileHeader.creation_date, 12, "%Y:%m:%d", fileTime); strftime(header->fileHeader.creation_time, 12, "%H:%M:%S%Z", fileTime); @@ -142,28 +142,28 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t int i; unsigned int dataOffset; - if (cineon == 0) { + if (cineon == NULL) { if (verbose) printf("Cineon: Failed to malloc cineon file structure.\n"); - return 0; + return NULL; } /* zero the header */ memset(&header, 0, sizeof(CineonMainHeader)); /* for close routine */ - cineon->file = 0; + cineon->file = NULL; if (fromMemory == 0) { /* byteStuff is then the filename */ cineon->file = BLI_fopen(filename, "rb"); - if (cineon->file == 0) { + if (cineon->file == NULL) { if (verbose) printf("Cineon: Failed to open file \"%s\".\n", filename); logImageClose(cineon); - return 0; + return NULL; } /* not used in this case */ - cineon->memBuffer = 0; - cineon->memCursor = 0; + cineon->memBuffer = NULL; + cineon->memCursor = NULL; cineon->memBufferSize = 0; } else { @@ -175,7 +175,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t if (logimage_fread(&header, sizeof(header), 1, cineon) == 0) { if (verbose) printf("Cineon: Not enough data for header in \"%s\".\n", byteStuff); logImageClose(cineon); - return 0; + return NULL; } /* endianness determination */ @@ -191,7 +191,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t if (verbose) printf("Cineon: Bad magic number %lu in \"%s\".\n", (unsigned long)header.fileHeader.magic_num, byteStuff); logImageClose(cineon); - return 0; + return NULL; } cineon->width = swap_uint(header.imageHeader.element[0].pixels_per_line, cineon->isMSB); @@ -200,7 +200,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t if (cineon->width == 0 || cineon->height == 0) { if (verbose) printf("Cineon: Wrong image dimension: %dx%d\n", cineon->width, cineon->height); logImageClose(cineon); - return 0; + return NULL; } cineon->depth = header.imageHeader.elements_per_image; @@ -213,7 +213,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t else { if (verbose) printf("Cineon: Data interleave not supported: %d\n", header.imageHeader.interleave); logImageClose(cineon); - return 0; + return NULL; } if (cineon->depth == 1) { @@ -244,7 +244,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t else { if (verbose) printf("Cineon: Cineon image depth unsupported: %d\n", cineon->depth); logImageClose(cineon); - return 0; + return NULL; } dataOffset = swap_uint(header.fileHeader.offset, cineon->isMSB); @@ -274,7 +274,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t /* Not supported */ if (verbose) printf("Cineon: packing unsupported: %d\n", header.imageHeader.packing); logImageClose(cineon); - return 0; + return NULL; } if (cineon->element[i].refLowData == CINEON_UNDEFINED_U32 || isnan(cineon->element[i].refLowData)) @@ -329,20 +329,20 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t LogImageFile *cineonCreate(const char *filename, int width, int height, int bitsPerSample, const char *creator) { CineonMainHeader header; - const char *shortFilename = 0; + const char *shortFilename = NULL; /* unsigned char pad[6044]; */ LogImageFile *cineon = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__); - if (cineon == 0) { + if (cineon == NULL) { if (verbose) printf("cineon: Failed to malloc cineon file structure.\n"); - return 0; + return NULL; } /* Only 10 bits Cineon are supported */ if (bitsPerSample != 10) { if (verbose) printf("cineon: Only 10 bits Cineon are supported.\n"); logImageClose(cineon); - return 0; + return NULL; } cineon->width = width; @@ -366,16 +366,16 @@ LogImageFile *cineonCreate(const char *filename, int width, int height, int bits cineon->gamma = 1.7f; shortFilename = strrchr(filename, '/'); - if (shortFilename == 0) + if (shortFilename == NULL) shortFilename = filename; else shortFilename++; cineon->file = BLI_fopen(filename, "wb"); - if (cineon->file == 0) { + if (cineon->file == NULL) { if (verbose) printf("cineon: Couldn't open file %s\n", filename); logImageClose(cineon); - return 0; + return NULL; } fillCineonMainHeader(cineon, &header, shortFilename, creator); @@ -383,7 +383,7 @@ LogImageFile *cineonCreate(const char *filename, int width, int height, int bits if (fwrite(&header, sizeof(header), 1, cineon->file) == 0) { if (verbose) printf("cineon: Couldn't write image header\n"); logImageClose(cineon); - return 0; + return NULL; } return cineon; |