{
static int CrntPlace = 0;
static long CodeCount = 0;
- int i, Percent, Len;
- long NumBytes;
+ int i, Len;
if (Reset || CodeBlock == NULL) {
if (CodeBlock == NULL) {
+ long NumBytes = 0;
if (CrntPlace > 0) {
printf("\n");
CodeCount += CrntPlace - 16;
if (GifFile->Image.ColorMap)
NumBytes = ((((long) GifFile->Image.Width) * GifFile->Image.Height)
* GifFile->Image.ColorMap->BitsPerPixel) / 8;
- else
+ else if (GifFile->SColorMap != NULL)
NumBytes = ((((long) GifFile->Image.Width) * GifFile->Image.Height)
* GifFile->SColorMap->BitsPerPixel) / 8;
- Percent = 100 * CodeCount / NumBytes;
- printf("\nCompression ratio: %ld/%ld (%d%%).\n",
+ /* FIXME: What should the compression ratio be if no color table? */
+ if (NumBytes > 0) {
+ int Percent = 100 * CodeCount / NumBytes;
+ printf("\nCompression ratio: %ld/%ld (%d%%).\n",
CodeCount, NumBytes, Percent);
+ }
return;
}
CrntPlace = 0;