
# HG changeset patch
# User Fojtik
# Date 1668856713 -3600
# Node ID 728bffe80552e90f03ee4d1e99135b7e3f01dabb
# Parent  8c5cffdf36a64865712a57226eb231e344f0c408
Error in GIF reader that occurs on high endian architectires only.

--- wp2latex.git.orig/sources.cc/images/ras_gif.cc
+++ wp2latex.git/sources.cc/images/ras_gif.cc
@@ -135,8 +135,15 @@
      {
        RdFromFile();
      }
+#ifdef HI_ENDIAN
+     BitBuf |= ( (DWORD)(*(BYTE *)ptr) << 16 );
+     ptr++;
+     BitBuf |= ( (DWORD)(*(BYTE *)ptr) << 24 );
+     ptr++;
+#else
      BitBuf |= ( (DWORD)(*(WORD *)ptr) << 16 );
      ptr+=2;
+#endif
    }
  }
  u = BitBuf >> BitPos;
@@ -274,7 +281,6 @@
   if((OutCode=(BYTE *)malloc(4096))==NULL) goto FINISH;
   if((CompBuffer=(BYTE *)malloc(GIFBufSize))==NULL) goto FINISH;
   if((Prefix=(WORD *)calloc(4096,sizeof(WORD)))==NULL) goto FINISH;
-
   if((Suffix=(WORD *)calloc(4096,sizeof(WORD)))==NULL) goto FINISH;
 
   while(!feof(f))
@@ -288,7 +294,7 @@
        case 0x21:			   	/*?-Extended Bloks*/
 	  if(fread(OutCode,1,2,f)!=2) goto FINISH;
 	   //      WriteLn('Extension block type: ',Outcode^[0]);}
-	  CodeSize=OutCode[1];
+	  CodeSize = OutCode[1];
 	  while(CodeSize>0)
 	     {
 	     Nacteno=fread(OutCode,1,CodeSize+1,f);
@@ -304,7 +310,7 @@
 	  /*?-Image Descriptor*/
 	  //fprintf(F,"New raster W=%u, H=%u\n", GIFImageDescriptor.Width,GIFImageDescriptor.Height);
 
-	  Raster=CreateRaster2D(GIFImageDescriptor.Width,GIFImageDescriptor.Height,
+	  Raster = CreateRaster2D(GIFImageDescriptor.Width,GIFImageDescriptor.Height,
 		NearAvailPlanes((((GIFImageDescriptor.Flag & 0x80)?GIFImageDescriptor.Flag:GIFHeader.Flag) & 7) + 1));
 	  if(Raster==NULL) goto FINISH;
 
@@ -315,7 +321,7 @@
 		 if(LocalPalette==NULL) goto FINISH;
 		 if(LocalPalette->Data1D==NULL) goto FINISH;
 		 X*=3;
-		 Nacteno=fread(LocalPalette->Data1D,1,X,f);
+		 Nacteno = fread(LocalPalette->Data1D,1,X,f);
 		 if(Nacteno<X) goto FINISH;
 		 }
 
--- wp2latex.git.orig/sources.cc/wp2latex.h
+++ wp2latex.git/sources.cc/wp2latex.h
@@ -18,7 +18,7 @@
 #define LineLength   80		/* Split lines after more than LineLength charcters */
 
 #define VersionWP2L	"3.110"
-#define VersionDate	"7 Nov 2022"  /* day (space) month (space) full year */
+#define VersionDate	"19 Nov 2022"  /* day (space) month (space) full year */
 
 
 /* Constants for a flag InputPS */
