for (i = 0; i < 3; i++) {
strncpy(OneFileName, FileName, sizeof(OneFileName)-1);
- /* cppcheck-suppress uninitstring */
strncat(OneFileName, Postfixes[i],
sizeof(OneFileName) - 1 - strlen(OneFileName));
}
fclose(rgbfp[0]);
- // cppcheck-suppress useClosedFile
fclose(rgbfp[1]);
- // cppcheck-suppress useClosedFile
fclose(rgbfp[2]);
}
}
Width, Height, ExpColorMapSize, 0,
OutputColorMap) == GIF_ERROR ||
EGifPutImageDesc(GifFile,
- 0, 0, Width, Height, false, NULL) ==
- GIF_ERROR)
+ 0, 0, Width, Height, false, NULL) == GIF_ERROR) {
PrintGifError(Error);
- if (GifFile != NULL) {
- EGifCloseFile(GifFile, NULL);
- }
exit(EXIT_FAILURE);
+ }
GifQprintf("\n%s: Image 1 at (%d, %d) [%dx%d]: ",
PROGRAM_NAME, GifFile->Image.Left, GifFile->Image.Top,
for (i = 0; i < Height; i++) {
if (EGifPutLine(GifFile, Ptr, Width) == GIF_ERROR)
- {
- if (GifFile != NULL) {
- EGifCloseFile(GifFile, NULL);
- }
exit(EXIT_FAILURE);
- }
GifQprintf("\b\b\b\b%-4d", Height - i - 1);
Ptr += Width;
}
- if (EGifCloseFile(GifFile, &Error) == GIF_ERROR)
+ if (EGifCloseFile(GifFile, &Error) == GIF_ERROR) {
PrintGifError(Error);
- if (GifFile != NULL) {
- EGifCloseFile(GifFile, NULL);
- }
exit(EXIT_FAILURE);
+ }
}
/******************************************************************************
for (i = 0; i < 3; i++) {
strncpy(OneFileName, FileName, sizeof(OneFileName)-1);
- /* cppcheck-suppress uninitstring */
strncat(OneFileName, Postfixes[i],
sizeof(OneFileName) - 1 - strlen(OneFileName));
rgbfp[0] = stdout;
}
+ if (ColorMap == NULL) {
+ fprintf(stderr, "Color map pointer is NULL.\n");
+ exit(EXIT_FAILURE);
+ }
+
if (OneFileFlag) {
unsigned char *Buffer, *BufferP;
free((char *) Buffers[1]);
free((char *) Buffers[2]);
fclose(rgbfp[0]);
- // cppcheck-suppress useClosedFile
fclose(rgbfp[1]);
- // cppcheck-suppress useClosedFile
fclose(rgbfp[2]);
}
}
}
}
+ if (GifFile->SHeight == 0 || GifFile->SWidth == 0) {
+ fprintf(stderr, "Image of width or height 0\n");
+ exit(EXIT_FAILURE);
+ }
+
/*
* Allocate the screen as vector of column of rows. Note this
* screen is device independent - it's the screen defined by the
break;
}
} while (RecordType != TERMINATE_RECORD_TYPE);
-
+
/* Lets dump it - set the global variables required and do it: */
ColorMap = (GifFile->Image.ColorMap
? GifFile->Image.ColorMap