I didn't see any tags for rc2 in mercurial, so I made this patch which
gives changes I made against rc2 -- which I think will allow you better see
the incremental changes I made.
I am using gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
---
Changes of note:
- I added more warnings for UNIX in CMakeLists.txt, you may or may not want
to leave those in, or put them in a more appropriate place in the file.
- bmp.c -- I made some minor structural changes to handle the case where
height in the bmp header is negative and not properly handled by the
unsigned integers.  I didn't test it on a bmp image file.
- PTcommon.c -- here the call to nextWord at about line 874 was throwing a
warning, to eliminate the warning I chose to pass a flag to the nextWord
function itself in parser.c   It seems like overkill to me to eliminate the
warning, but I didn't want to change the basic nextWord function in other
ways.  Personally I think I'd keep the original nextWord logic and just
live with the warning, knowing there is no logical bug.  If that's what you
would like let me know and I'll restore it.

Other than that it's mostly initializing some variables, handling a few
signed/unsigned conflicts, and simple reformatting of "if" statements to
keep the compiler happy and make the code a bit more intuitive as you see
it displayed.

I like to use #ifdef's to "comment out" large blocks of code that may have
a use in the future.   You might prefer to just delete those sections of
code...

Hope this is helpful,
Jeff

On Wed, Aug 16, 2023 at 8:08 AM Jeff Welty <[email protected]> wrote:

> I'll try the mercurial merge request on sourceforge (something new for me).
>
> I was in the tarball mode because I use meld on two separate folders to
> track changes on a small project like this.
>
> Jeff
>
> On Wed, Aug 16, 2023 at 5:56 AM Bruno Postle <[email protected]> wrote:
>
>> Thanks everyone for testing.
>>
>> Yes ideally fixes should be a mercurial merge request on sourceforge, but
>> a diff/patch is nearly as good. A tarball is ok, but the first thing we
>> would do is extract it to generate a diff - a diff has the advantage that
>> you can see exactly what you are proposing to change, and not including
>> debug cruft or unrelated formatting changes.
>>
>> --
>> Bruno
>>
>> --
>> A list of frequently asked questions is available at:
>> http://wiki.panotools.org/Hugin_FAQ
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "hugin and other free panoramic software" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/hugin-ptx/CAJV99Zj8ovrASTxhEVBtdE5fo%3DcYq2%2Bt1gKnGNAXQomvDy%3DV1A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/hugin-ptx/CAJV99Zj8ovrASTxhEVBtdE5fo%3DcYq2%2Bt1gKnGNAXQomvDy%3DV1A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
--- 
You received this message because you are subscribed to the Google Groups 
"hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/hugin-ptx/CAPc%2BVuLA10TDrab%2BrD%3D%2BXTCVqrKvo%2BNZ-OhmqKBvpmkGqw5YCw%40mail.gmail.com.
diff -ruN libpano13-2.9.22_rc2/bmp.c libpano13-2.9.22_rc2_fixed_warnings/bmp.c
--- libpano13-2.9.22_rc2/bmp.c	2021-04-14 15:50:09.000000000 -0700
+++ libpano13-2.9.22_rc2_fixed_warnings/bmp.c	2023-08-15 15:12:59.510055055 -0700
@@ -9,7 +9,7 @@
 #include "metadata.h"
 #include "file.h"
 
-static int readBMPFileHeader(Image *im, file_spec input);
+static int readBMPFileHeader(Image *im, file_spec input, int *reverse);
 
 
 #pragma pack(push, 1) 
@@ -180,16 +180,11 @@
 
 	// Read bitmap file header
 
-	if( readBMPFileHeader(im, input)  )
+	if( readBMPFileHeader(im, input, &reverse)  )
 	{
 		PrintError("readBMP, error reading bitmap file header");
 		return -1;
 	}
-	if(0 > im->height) //JMW  BMP has rows from bottom to top
-	{
-		im->height = -im->height;
-		reverse = 1;
-	}
 
 	scanLength = (im->width * 3 + 1)/2;
 	scanLength *= 2;
@@ -250,7 +245,7 @@
 
 
 // Read bitmap file header
-static int readBMPFileHeader(Image *im, file_spec input)
+static int readBMPFileHeader(Image *im, file_spec input, int *reverse)
 {
 	win3xHead header;						// First part of bitmap header
 	win3xBitmapInfoHeader iheader;			// Second part of bitmap header
@@ -304,13 +299,19 @@
 	SetImageDefaults( im );
 	
 	// Setup height and width
-	im->height = iheader.ImageHeight;
+	if(iheader.ImageHeight > 0) {
+	    im->height = iheader.ImageHeight;
+	    *reverse=0 ;
+	} else {
+	    im->height = -iheader.ImageHeight;
+	    *reverse=1 ;
+	}
 	im->width  = iheader.ImageWidth;
 	
 	im->bitsPerPixel = 32;
 	im->bytesPerLine = im->width * 4;
 	// JMW Negative height BMP have rows bottom to top
-	im->dataSize = im->bytesPerLine * abs(im->height);
+	im->dataSize = im->bytesPerLine * im->height;
 	
 	// Advance file pointer to start of image data
 	fseek( input, header.ImageDataOffset, SEEK_SET );
diff -ruN libpano13-2.9.22_rc2/CMakeLists.txt libpano13-2.9.22_rc2_fixed_warnings/CMakeLists.txt
--- libpano13-2.9.22_rc2/CMakeLists.txt	2023-01-21 02:50:21.000000000 -0800
+++ libpano13-2.9.22_rc2_fixed_warnings/CMakeLists.txt	2023-08-15 16:21:21.761959160 -0700
@@ -190,6 +190,11 @@
   ENDIF(MINGW)
 ENDIF(UNIX)
 
+IF(UNIX)
+  #ADD_DEFINITIONS(-Wall -Wabsolute-value -Wpointer-sign -Wtautological-constant-out-of-range-compare)
+  ADD_DEFINITIONS(-Wall -Wabsolute-value -Wpointer-sign -Wtype-limits -Wno-stringop-truncation -Wno-format-truncation)
+ENDIF(UNIX)
+
 ##
 ## Here is the part that builds libpano
 ##
diff -ruN libpano13-2.9.22_rc2/file.c libpano13-2.9.22_rc2_fixed_warnings/file.c
--- libpano13-2.9.22_rc2/file.c	2023-08-10 23:55:01.000000000 -0700
+++ libpano13-2.9.22_rc2_fixed_warnings/file.c	2023-08-15 15:33:36.256538922 -0700
@@ -70,7 +70,6 @@
 static int              writeLayerAndMask       ( Image *im, file_spec fnum, Boolean bBig );
 static void             getImageRectangle       ( Image *im, PTRect *r );
 static int              fileCopy                ( file_spec src, file_spec dest, size_t numBytes, unsigned char *buf);
-static void             orAlpha                 ( unsigned char* alpha, unsigned char *buf, Image *im, PTRect *r );
 static void             writeWhiteBackground    ( uint32_t width, uint32_t height, file_spec fnum, Boolean bBig  );
 static int              addLayer                ( Image *im, file_spec src, file_spec fnum , stBuf *sB, Boolean bBig );
 static int              hasFeather              ( Image *im );
@@ -1203,12 +1202,14 @@
     {
         for(y=theRect->top; y<theRect->bottom;y++)
         {
-            idy = (y - panoImageOffsetY(im)) * im->bytesPerLine;
+	    int32_t s_idy=((int32_t)y - (int32_t)panoImageOffsetY(im)) * (int32_t)im->bytesPerLine;
 
-            if (idy < 0) {  //should never happen
+            if (s_idy < 0) {  //should never happen
                 PrintError("writeChannelData: index error");
                 return 1;
             }
+
+            idy = s_idy ;
             
             for(x=theRect->left; x<theRect->right;x++)
             {
@@ -1222,13 +1223,15 @@
         unsigned short storage;
         for(y=theRect->top; y<theRect->bottom;y++)
         {
-            idy = (y - panoImageOffsetY(im)) * im->bytesPerLine;
-            
-            if (idy < 0) {  //should never happen
+	    int32_t s_idy=((int32_t)y - (int32_t)panoImageOffsetY(im)) * (int32_t)im->bytesPerLine;
+
+            if (s_idy < 0) {  //should never happen
                 PrintError("writeChannelData: index error");
                 return 1;
             }
 
+            idy = s_idy ;
+
             for(x=theRect->left; x<theRect->right;x++)
             {
                 idx = ((x - panoImageOffsetX(im)) * bpp);
@@ -1740,6 +1743,9 @@
             fileCopy( src, fnum, chlength[i], *buf );
             //printf("Compression Layer %d Channel %d: %d\n", i,k,(int)*((short*)*buf));
             
+#ifdef IMPOSSIBLE_chid_IS_UNSIGNED
+#define NEED_orAlpha
+static void             orAlpha                 ( unsigned char* alpha, unsigned char *buf, Image *im, PTRect *r );
             if( chid[i*5 +k] == -1 )    // found an alpha channel
             {
                 if( alpha!= NULL )
@@ -1747,6 +1753,7 @@
                     orAlpha( *alpha, &((*buf)[2]), im, &(nRect[i]) );
                 }
             }
+#endif
         }
         myfree( (void**)buf );
     }
@@ -2284,6 +2291,7 @@
 }
 
 
+#ifdef NEED_orAlpha
 // Or two alpha channels: one in alpha (same size as image im)
 // one in buf comprising the rectangle top,bottom,left,right
 // store result in alpha
@@ -2345,6 +2353,7 @@
         }
     }
 }
+#endif
 
 
 
diff -ruN libpano13-2.9.22_rc2/filter.c libpano13-2.9.22_rc2_fixed_warnings/filter.c
--- libpano13-2.9.22_rc2/filter.c	2021-09-12 14:07:17.000000000 -0700
+++ libpano13-2.9.22_rc2_fixed_warnings/filter.c	2023-08-15 16:16:59.157572942 -0700
@@ -1124,7 +1124,7 @@
        Copy the metadata, allocate memory as needed
      */
     int result;
-    char *temp;
+    char *temp = NULL;
 
     assert(from != NULL);
     assert(to != NULL);
@@ -1405,7 +1405,7 @@
         return panoReadINT64( fnum, pLongLong );
     else
     {
-        uint32_t Long;
+        uint32_t Long=0;
         Boolean bRtn = panoReadINT32( fnum, &Long );
         *pLongLong = (int64_t)Long;
         return bRtn;
diff -ruN libpano13-2.9.22_rc2/filter.h libpano13-2.9.22_rc2_fixed_warnings/filter.h
--- libpano13-2.9.22_rc2/filter.h	2023-08-10 23:55:01.000000000 -0700
+++ libpano13-2.9.22_rc2_fixed_warnings/filter.h	2023-08-16 09:47:41.334992429 -0700
@@ -747,7 +747,7 @@
 PANO13_IMPEX int 	readAdjust		( aPrefs *p,  fullPath* sfile, int insert, sPrefs *sP );
 PANO13_IMPEX void 	readControlPoints	(char* script, controlPoint *c );
 PANO13_IMPEX int	getVRPanoOptions	( VRPanoOptions *v, char *line );
-PANO13_IMPEX void 	nextWord			( register char* word, char** ch );
+PANO13_IMPEX void 	nextWord			( register char* word, char** ch, uint8_t pre_increment );
 PANO13_IMPEX void 	nextLine			( register char* line, char** ch );
 PANO13_IMPEX int 	numLines			( char* script, char first );
 
diff -ruN libpano13-2.9.22_rc2/fourier.c libpano13-2.9.22_rc2_fixed_warnings/fourier.c
--- libpano13-2.9.22_rc2/fourier.c	2021-09-12 14:07:17.000000000 -0700
+++ libpano13-2.9.22_rc2_fixed_warnings/fourier.c	2023-08-15 10:42:46.303127551 -0700
@@ -623,8 +623,15 @@
 		}
 	}
 	// Dangerous, but should be ok
-	if( glu.DeGamma ) free( glu.DeGamma ); glu.DeGamma 	= NULL;
-	if( glu.Gamma )	free( glu.Gamma );	glu.Gamma 	= NULL;
+	if( glu.DeGamma )
+	    free( glu.DeGamma );
+
+	glu.DeGamma 	= NULL;
+
+	if( glu.Gamma )
+	    free( glu.Gamma );
+
+	glu.Gamma 	= NULL;
 }
 
 
diff -ruN libpano13-2.9.22_rc2/morpher.c libpano13-2.9.22_rc2_fixed_warnings/morpher.c
--- libpano13-2.9.22_rc2/morpher.c	2021-04-14 15:50:09.000000000 -0700
+++ libpano13-2.9.22_rc2_fixed_warnings/morpher.c	2023-08-15 13:32:02.134871710 -0700
@@ -159,7 +159,7 @@
 int tmorph( double x_dest,double  y_dest, double* x_src, double* y_src, void* params )
 {
 	static int CurTriangle = 0;
-	double c[2];
+	double c[2] = {0.,0.};
 	PTTriangle *s, *td = ((PTTriangle**)params)[0] ,*ts= ((PTTriangle**)params)[1];
 	int nt = *((int**)params)[2];
 	
diff -ruN libpano13-2.9.22_rc2/parser.c libpano13-2.9.22_rc2_fixed_warnings/parser.c
--- libpano13-2.9.22_rc2/parser.c	2023-08-10 23:55:01.000000000 -0700
+++ libpano13-2.9.22_rc2_fixed_warnings/parser.c	2023-08-16 09:47:23.335160701 -0700
@@ -71,14 +71,14 @@
                                                 goto fail;                          \
                                             }                                       \
 
-#define READ_VAR(format, ptr )      nextWord( buf, &li );           \
+#define READ_VAR(format, ptr )      nextWord( buf, &li, 1);           \
                                     MY_SSCANF( buf, format, ptr );
                                     
                                 
                                 
 
 
-#define READ_OPT_VAR(var)       nextWord( buf, &li );           \
+#define READ_OPT_VAR(var)       nextWord( buf, &li, 1);           \
                                 MY_SSCANF( buf, "%d", &k);      \
                                 if( k<0 || k>= numIm )          \
                                 {                               \
@@ -107,7 +107,7 @@
 {
     if (*(li+1) == '=') {
         li++; // point to next character
-        nextWord( buf, &li );
+        nextWord( buf, &li, 1);
         if( sscanf( buf, "%d", indirectVar ) != 1 ) {                                       
             PrintError("Syntax error in script: Line %d\nCould not link variable %s with \"%s\"", lineNum, varName, buf);
             return NULL;
@@ -119,7 +119,7 @@
         };
         (*indirectVar)+=2; //its offset should be increased by 2... arghh
     } else {
-        nextWord( buf, &li );
+        nextWord( buf, &li, 1);
 
         if( sscanf( buf, " %lf", var ) != 1 ) {                                       
             PrintError("Syntax error in script: Line %d\nCould not assign variable %s content \"%s\"", lineNum, varName, buf);
@@ -397,7 +397,7 @@
                         }
                         break;
                     case 'n':           // Set filename
-                        nextWord( buf, &li );
+                        nextWord( buf, &li, 1);
                         snprintf( im->name, sizeof(im->name)-1, "%s", buf );
                         break;
                     case 'm':  // Frame
@@ -425,17 +425,17 @@
                         break;
                     case 'Z':   READ_VAR( "%lf", &ci->x[2] );
                         break;
-                    case 'S':   nextWord( buf, &li );       
+                    case 'S':   nextWord( buf, &li, 1);       
                         sscanf( buf, "%d,%d,%d,%d", &im->selection.left, &im->selection.right, &im->selection.top, &im->selection.bottom );
                         break;
-                    case 'C':   nextWord( buf, &li );       
+                    case 'C':   nextWord( buf, &li, 1);       
                         sscanf( buf, "%d,%d,%d,%d", &im->selection.left, &im->selection.right, &im->selection.top, &im->selection.bottom );
                         im->cP.cutFrame = TRUE;
                         break;
                     case 'V':
                     case 'K':
                         // Ignore V variables in i
-                        nextWord( buf, &li );       
+                        nextWord( buf, &li, 1);       
                     break;
                     default: 
                         li++;
@@ -462,9 +462,9 @@
                                 li--;
                                 READ_VAR( "%d", &(gl->t[nt].vert[i]) ); 
                                 i++;
-                            }
-                        else
-                            li++;
+                            } else {
+				li++;
+			    }
                             break;
                         }
                 }
@@ -615,7 +615,7 @@
                         default:
                             if (!isspace(*li))
                             {
-                                --li; nextWord(buf, &li);
+                                --li; nextWord(buf, &li, 1);
                                 PrintError("Unknown variable name to optimize %s in script: Line %d", buf, lineNum);
                                 goto fail;
                             }
@@ -1491,12 +1491,13 @@
 
 // Fill 'word' with word starting at (*ch). Advance *ch
 
-void nextWord( register char* word, char** ch )
+void nextWord( register char* word, char** ch, uint8_t pre_increment )
 {
     register char *c;
     c = *ch;
     
-    c++;
+    if(pre_increment == 1) c++;
+
     if( *c == '\"' )
     {
         c++;
@@ -1534,7 +1535,7 @@
     
     //Increased by Max Lyons (January 12, 2003) to increase size of optimizer
     //lines that can be read (previously hard-coded to 255 characters).
-    while( *c != 0 && *c != '\n' && i++<LINE_LENGTH)
+    while( *c != 0 && *c != '\n' && i++<(LINE_LENGTH-1))
         *line++ = *c++;
     *line = 0;
     *ch = c;
@@ -1571,7 +1572,7 @@
     }
 
 #undef READ_VAR
-#define READ_VAR(format, ptr )      nextWord( buf, &ch );           \
+#define READ_VAR(format, ptr )      nextWord( buf, &ch, 1);           \
                                     MY_SSCANF( buf, format, ptr );
 
 
@@ -1800,11 +1801,11 @@
                 return -1;
             }
             break;
-        case '+':   nextWord( buf, &ch );
+        case '+':   nextWord( buf, &ch, 1);
             PrintError("Obsolete + parameter is ignored in image description");
             snprintf( sBuf.srcName, sizeof(sBuf.srcName)-1, "%s", buf);
             break;
-        case '-':   nextWord( buf, &ch );
+        case '-':   nextWord( buf, &ch, 1);
             PrintError("Obsolete - parameter is ignored in image description");
             snprintf( sBuf.destName, sizeof(sBuf.destName)-1, "%s", buf );
             break;
@@ -1814,24 +1815,24 @@
             if (cropping) {
                 PrintError("Contradictory cropping specified. S cropping ignored\n");
                 // Eat next token
-                nextWord( buf, &ch );       
+                nextWord( buf, &ch, 1);       
                 break;
             }
             cropping = 1;
             
-            nextWord( buf, &ch );       
+            nextWord( buf, &ch, 1);       
             sscanf( buf, "%d,%d,%d,%d", &im.selection.left, &im.selection.right, &im.selection.top, &im.selection.bottom );
             break;
         case 'C':  
             if (cropping) {
                 PrintError("Contradictory cropping specified. C cropping ignored\n");
                 // Eat next token
-                nextWord( buf, &ch );       
+                nextWord( buf, &ch, 1);       
                 break;
             }
             cropping = 1;
             
-            nextWord( buf, &ch );       
+            nextWord( buf, &ch, 1);       
             sscanf( buf, "%d,%d,%d,%d", &im.selection.left, &im.selection.right, &im.selection.top, &im.selection.bottom );
             im.cP.cutFrame = TRUE;
             break;
@@ -1899,13 +1900,13 @@
         case 'h':   READ_VAR( "%ud", &im.height );
             break;
         case 'n':  // Name string (used for input image name)
-            nextWord( buf, &ch );
+            nextWord( buf, &ch, 1);
             strcpy( im.name, buf );
             break;  
         case 'K':
         case 'V':
             // Used by Hugin. Silently ignore until next space. This way we can accept .pto files for processing
-            nextWord( buf, &ch );       
+            nextWord( buf, &ch, 1);       
         break;
         case ' ':
         case '\t':
@@ -1968,7 +1969,7 @@
             im.cP.correction_mode |= correction_mode_vertical;
         break;
         case 'P':
-        nextWord(buf, &ch);
+        nextWord(buf, &ch, 1);
         b = strtok(buf, " \"");
         if (b != NULL) {
             while (b != NULL) {
@@ -1990,7 +1991,7 @@
         break;
         
         case 'n':  // Name string (used for panorama format)
-        nextWord( buf, &ch );
+        nextWord( buf, &ch, 1);
         strcpy( im.name, buf );
         break;  
         
diff -ruN libpano13-2.9.22_rc2/PTcommon.c libpano13-2.9.22_rc2_fixed_warnings/PTcommon.c
--- libpano13-2.9.22_rc2/PTcommon.c	2021-09-12 14:07:17.000000000 -0700
+++ libpano13-2.9.22_rc2_fixed_warnings/PTcommon.c	2023-08-16 09:47:03.347346189 -0700
@@ -525,7 +525,7 @@
     //needed here, but for now include some representative interior points as well.
     for (y = 0; y <= TrPtr->src->height; y += 1) {
         
-        x_jump = (y==0 || y==TrPtr->src->height || abs(y - TrPtr->src->height/2)<=5) ? 1 : TrPtr->src->width/2; 
+        x_jump = (y==0 || y==TrPtr->src->height || abs((int32_t)y - (int32_t)(TrPtr->src->height)/2)<=5) ? 1 : TrPtr->src->width/2; 
 
                 for (x = 0; x <= TrPtr->src->width; x += x_jump) {
                         //convert source coordinates to cartesian coordinates (i.e. origin at center of image)
@@ -698,7 +698,6 @@
     aPrefs *prefs;
     int var01;
     int var00;
-    int colourCorrection;
 
     int lines;
     fullPath *fullPathImages;
@@ -718,7 +717,7 @@
     Image image1;               //Input Image
 
     FILE *regFile;
-    char *regScript;
+    char *regScript = NULL;
     unsigned int regLen;
     unsigned int regWritten;
 
@@ -735,7 +734,6 @@
     pano_ImageMetadata metadata;
 
     /* Variables */
-    colourCorrection = 0;       // can have values of 1 2 or 3
     var00 = 0;
     var01 = 0;
 
@@ -840,13 +838,13 @@
 
 
 
-        colourCorrection = prefs->sBuf.colcorrect;
+        //int32_t colourCorrection = prefs->sBuf.colcorrect;
         // This is a strange value:
         // colourCorrection == (i & 3) + (i+1)*4;
         // where i is the number of the reference image
         
-        assert(colourCorrection >= 0
-               && colourCorrection < (counterImageFiles + 1) * 4);
+        assert(prefs->sBuf.colcorrect >= 0
+               && prefs->sBuf.colcorrect < (counterImageFiles + 1) * 4);
         if (prefs->pano.cP.radial != 0) {
             
             var00 = prefs->pano.cP.radial_params[0][2]; // what is this for, I have NO idea.
@@ -872,14 +870,16 @@
         
         //panoName.name contains the n"XXX" value from the script "p" lines (e.g. n"TIFF_m" or n"QTVR w400 h300 c1")
         tempString = panoName.name;
+#ifdef OLD_CODE_FIXED
         --tempString;           /* nextWord does ++ before testing anything, this guarantess proper execution */
-        nextWord(output_file_format, &tempString);
+#endif
+        nextWord(output_file_format, &tempString, 0);
         
         if (strcmp(output_file_format, "TIFF_m") == 0 ) {
             // CHeck if we are suppose to do cropped or uncropped
             croppedTIFFIntermediate = 1;
             if(strcmp(tempString, "") != 0) {
-              nextWord(output_file_format, &tempString);
+              nextWord(output_file_format, &tempString, 1);
               if (strcmp(output_file_format, "") == 0 || 
                   strcmp(output_file_format, "r:CROP") == 0
                   ) {
@@ -1346,7 +1346,8 @@
     // FUNCTION ENDS HERE
 
   mainError:
-    free(regScript);
+    if(regScript != NULL)
+	free(regScript);
 
     return (-1);
 }
diff -ruN libpano13-2.9.22_rc2/ptfeather.c libpano13-2.9.22_rc2_fixed_warnings/ptfeather.c
--- libpano13-2.9.22_rc2/ptfeather.c	2021-04-14 15:50:09.000000000 -0700
+++ libpano13-2.9.22_rc2_fixed_warnings/ptfeather.c	2023-08-15 16:18:44.974528965 -0700
@@ -415,7 +415,7 @@
     unsigned char *savedAlphaChannel;
     int column;
     int row;
-    int gradient;
+    int gradient=-1;
 
     int bytesPerPixel;
     int bytesPerLine;
diff -ruN libpano13-2.9.22_rc2/ptstitch.c libpano13-2.9.22_rc2_fixed_warnings/ptstitch.c
--- libpano13-2.9.22_rc2/ptstitch.c	2023-01-21 02:50:21.000000000 -0800
+++ libpano13-2.9.22_rc2_fixed_warnings/ptstitch.c	2023-08-15 13:19:59.375685161 -0700
@@ -1015,11 +1015,11 @@
                 for (index = 0; index < 3; index++) {
                     colours[index] += (*(ptrPixel + index) * alphaContribution) / 0xff; // 
 
-                    if (!(colours[index] >= 0 && colours[index] <= 0xff)) {
+                    if (!(colours[index] <= 0xff)) {
                         printf("PPPPPPPPPPPPPPPPPanic %d index [%d]\n",
                                colours[index], index);
                     }
-                    assert(colours[index] >= 0 && colours[index] <= 0xff);
+                    assert(colours[index] <= 0xff);
                 }
 
                 // We don't need to continue if the alpha channel is at the max
@@ -1143,7 +1143,7 @@
 
                 for (index = 0; index < 3; index++) {
                     colours[index] += (*(ptrPixel + index) * alphaContribution) / 0xffff;       // 
-                    if (!(colours[index] >= 0 && colours[index] <= 0xffff)) {
+                    if (!(colours[index] <= 0xffff)) {
                         printf("PPPPPPPPPPPPPPPPPanic %lld index [%d]\n",
                                colours[index], index);
                     }
diff -ruN libpano13-2.9.22_rc2/resample.c libpano13-2.9.22_rc2_fixed_warnings/resample.c
--- libpano13-2.9.22_rc2/resample.c	2021-09-12 14:07:17.000000000 -0700
+++ libpano13-2.9.22_rc2_fixed_warnings/resample.c	2023-08-15 17:48:51.380848337 -0700
@@ -1262,7 +1262,7 @@
 		if( fp != NULL ) {
 			// parse the file
 			s = fgets( s, 98, fp );
-			while( !feof(fp) && buf != NULL ) {
+			while( !feof(fp) && s != NULL ) {
 				//s = strupr( buf );	commented out because it causes linking problems with the microsoft compiler
 				if( strncmp( s, "FAST_TRANSFORM", 14 )  == 0 )
 					FastTransform = FAST_TRANSFORM_STEP_NORMAL;
@@ -1478,7 +1478,7 @@
                     }
                     else
                     {
-                        char*   ptr = &(dest[ coeff ]);
+                        unsigned char*   ptr = &(dest[ coeff ]);
                     
                         if(color < 4) // R or G or B
                         {
@@ -1520,8 +1520,12 @@
 Trform_exit:
 	if( rgb ) 		free( rgb );
 	if( cdata ) 		free( cdata );
-	if( glu.DeGamma )	free( glu.DeGamma ); 	glu.DeGamma 	= NULL;
-	if( glu.Gamma )		free( glu.Gamma );	glu.Gamma 	= NULL;
+
+	if( glu.DeGamma )	free( glu.DeGamma );
+	glu.DeGamma 	= NULL;
+
+	if( glu.Gamma )		free( glu.Gamma );
+	glu.Gamma 	= NULL;
 
 	// FS+
 	if( ax != NULL ) free( ax );
@@ -1795,6 +1799,7 @@
   return(0.0);
 }
 
+#ifdef LANCZOS
 static double Lanczos(const double x,const double support)
 {
   if (x < -3.0)
@@ -1805,6 +1810,7 @@
     return(Sinc(x,support)*Sinc(x/3.0,support));
   return(0.0);
 }
+#endif
 
 static double Mitchell(const double x,const double support)
 {
@@ -1968,16 +1974,16 @@
 	
 	// Some things for the floodfill algorithm
 	
-	invCacheItem *invCache;
+	invCacheItem *invCache = NULL ;
 
 	ffQueueItem ffItem;
 
 	int ptmod_last=0,ptmod_first=0;
 	int ffStackTop=0,ffIsInQueueSize;
-	ffQueueItem *ffStack;
+	ffQueueItem *ffStack = NULL ;
 	int			srcWidth; 
 	int			srcHeight; 
-	uint32_t *ffIsInQueue;
+	uint32_t *ffIsInQueue = NULL ;
 
 	int ccx,ccy;
 	double d,sd,ox,oy;
@@ -2462,7 +2468,7 @@
                     }
                     else
                     {
-                        char*   ptr = &(dest[ coeff ]);
+                        unsigned char*   ptr = &(dest[ coeff ]);
                     
                         if(color < 4) // R or G or B
                         {
@@ -2497,8 +2503,11 @@
 
 
 Trform_exit:
-	if( glu.DeGamma )	free( glu.DeGamma ); 	glu.DeGamma 	= NULL;
-	if( glu.Gamma )		free( glu.Gamma );	glu.Gamma 	= NULL;
+	if( glu.DeGamma )	free( glu.DeGamma );
+	glu.DeGamma 	= NULL;
+
+	if( glu.Gamma )		free( glu.Gamma );
+	glu.Gamma 	= NULL;
 
 	if(invCache != NULL) free(invCache);
 	if(ffStack != NULL) free(ffStack);
diff -ruN libpano13-2.9.22_rc2/tiff.c libpano13-2.9.22_rc2_fixed_warnings/tiff.c
--- libpano13-2.9.22_rc2/tiff.c	2023-01-21 02:50:21.000000000 -0800
+++ libpano13-2.9.22_rc2_fixed_warnings/tiff.c	2023-08-15 10:52:13.532647077 -0700
@@ -843,14 +843,15 @@
 
     if (!panoTiffIsCropped(file))
         return TRUE;
-	//MRDL: Photoshop sometimes writes out files with a TIFFTAG_XRESOLUTION of 0.
-	//If input files are from Photoshop, this values propogates from input
-	//file to metadata, and can mess up setting of XPOSITION here...
-	if (metadata->xPixelsPerResolution == 0 || metadata->yPixelsPerResolution == 0)
-	{
-		metadata->xPixelsPerResolution = PANO_DEFAULT_PIXELS_PER_RESOLUTION;
-		metadata->yPixelsPerResolution = PANO_DEFAULT_PIXELS_PER_RESOLUTION;
-	}
+
+    //MRDL: Photoshop sometimes writes out files with a TIFFTAG_XRESOLUTION of 0.
+    //If input files are from Photoshop, this values propogates from input
+    //file to metadata, and can mess up setting of XPOSITION here...
+    if (metadata->xPixelsPerResolution == 0 || metadata->yPixelsPerResolution == 0)
+    {
+	    metadata->xPixelsPerResolution = PANO_DEFAULT_PIXELS_PER_RESOLUTION;
+	    metadata->yPixelsPerResolution = PANO_DEFAULT_PIXELS_PER_RESOLUTION;
+    }
 
     //The X offset in ResolutionUnits of the left side of the image, with 
     //respect to the left side of the page.
diff -ruN libpano13-2.9.22_rc2/tools/PTblender.c libpano13-2.9.22_rc2_fixed_warnings/tools/PTblender.c
--- libpano13-2.9.22_rc2/tools/PTblender.c	2021-04-14 15:50:09.000000000 -0700
+++ libpano13-2.9.22_rc2_fixed_warnings/tools/PTblender.c	2023-08-15 13:05:04.001165880 -0700
@@ -77,7 +77,6 @@
     fullPath *ptrInputFiles   = NULL;
     fullPath *ptrOutputFiles  = NULL;
 
-    int counter;
     char outputPrefix[MAX_PATH_LENGTH];
     char *endPtr;
     int filesCount = 0;
@@ -88,8 +87,6 @@
     int ptForceProcessing = 0;
     int ptDeleteSources = 0;
 
-    counter = 0;
-
     printf(PT_BLENDER_VERSION);
 
 
diff -ruN libpano13-2.9.22_rc2/tools/PTmasker.c libpano13-2.9.22_rc2_fixed_warnings/tools/PTmasker.c
--- libpano13-2.9.22_rc2/tools/PTmasker.c	2021-04-14 15:50:09.000000000 -0700
+++ libpano13-2.9.22_rc2_fixed_warnings/tools/PTmasker.c	2023-08-15 13:04:10.616959742 -0700
@@ -89,7 +89,6 @@
     fullPath *ptrInputFiles   = NULL;
     fullPath *ptrOutputFiles  = NULL;
     
-    int counter;
     char outputPrefix[MAX_PATH_LENGTH];
     int filesCount = 0;
     int base = 0;
@@ -101,7 +100,6 @@
     int focusEstimationMaskType = -1;
     int focusEstimationSmoothingWindowSize = 0;
 
-    counter = 0;
     outputPrefix[0] = 0;
 
     printf(PT_MASKER_VERSION);
diff -ruN libpano13-2.9.22_rc2/tools/PTroller.c libpano13-2.9.22_rc2_fixed_warnings/tools/PTroller.c
--- libpano13-2.9.22_rc2/tools/PTroller.c	2021-04-14 15:50:09.000000000 -0700
+++ libpano13-2.9.22_rc2_fixed_warnings/tools/PTroller.c	2023-08-15 13:04:42.941085959 -0700
@@ -68,7 +68,6 @@
     fullPath *ptrInputFiles   = NULL;
     fullPath *ptrOutputFiles  = NULL;
     
-    int counter;
     char flatOutputFileName[MAX_PATH_LENGTH];
     int filesCount = 0;
     int base = 0;
@@ -76,8 +75,6 @@
     int ptForceProcessing = 0;
     int ptDeleteSources = 0;
 
-    counter = 0;
-
     printf(PT_ROLLER_VERSION);
 
     strcpy(flatOutputFileName, DEFAULT_FILENAME);
diff -ruN libpano13-2.9.22_rc2/tools/PTtiff2psd.c libpano13-2.9.22_rc2_fixed_warnings/tools/PTtiff2psd.c
--- libpano13-2.9.22_rc2/tools/PTtiff2psd.c	2021-09-12 14:07:17.000000000 -0700
+++ libpano13-2.9.22_rc2_fixed_warnings/tools/PTtiff2psd.c	2023-08-15 13:05:38.957294742 -0700
@@ -75,7 +75,6 @@
     int opt;
     char *endPtr;
     fullPath *ptrInputFiles;
-    int counter;
     fullPath outputFilename;
     int filesCount;
     int base = 0;
@@ -90,7 +89,6 @@
     bzero(&flatteningParms, sizeof(flatteningParms));
 
     ptrInputFiles = NULL;
-    counter = 0;
 
     printf(PT_TIFF2PSD_VERSION);
 

Reply via email to