Browse Source

fix warnings

cxgeorge 24 years ago
parent
commit
e161452942
4 changed files with 22 additions and 5 deletions
  1. 9 2
      panda/src/pnm/bitio.c
  2. 3 2
      panda/src/pnm/libpgm2.c
  3. 1 1
      panda/src/pnm/libppm2.c
  4. 9 0
      panda/src/pnm/pbmplus.h

+ 9 - 2
panda/src/pnm/bitio.c

@@ -15,6 +15,9 @@
  * without express or implied warranty.
  *
  * $Log$
+ * Revision 1.3  2001/06/14 01:16:55  cxgeorge
+ * fix warnings
+ *
  * Revision 1.2  2001/05/25 16:13:01  drose
  * *** empty log message ***
  *
@@ -39,7 +42,7 @@
 \*/
 
 #include "bitio.h"
-
+#include <assert.h>
 struct bitstream
 {
         FILE *
@@ -156,7 +159,11 @@ pm_bitread(struct bitstream *b, unsigned long nbits, unsigned long *val)
         if(!b)
                 return -1;
 
-        while (b->nbitbuf < nbits)
+        #ifdef _DEBUG
+          assert(((signed long)nbits) > 0);
+        #endif
+        
+        while (b->nbitbuf < (signed long)nbits)
         {
                 if((c = getc(b->f)) == EOF)
                 {

+ 3 - 2
panda/src/pnm/libpgm2.c

@@ -56,7 +56,7 @@ putus( n, file )
     FILE* file;
     {
     if ( n >= 10 )
-        putus( n / 10, file );
+        putus((unsigned short)( n / 10), file );
     (void) putc( n % 10 + '0', file );
     }
 
@@ -101,7 +101,8 @@ pgm_writepgmrowplain(FILE* file,gray* grayrow,int cols,gray maxval)
         if ( *gP > maxval )
             pm_error( "value out of bounds (%u > %u)", *gP, maxval );
 #endif /*DEBUG*/
-        putus( (unsigned long) *gP, file );
+//        putus( (unsigned long) *gP, file );
+        putus( (unsigned short) *gP, file );
         charcount += 3;
         }
     if ( charcount > 0 )

+ 1 - 1
panda/src/pnm/libppm2.c

@@ -57,7 +57,7 @@ static void
 putus(unsigned short n, FILE* file)
     {
     if ( n >= 10 )
-        putus( n / 10, file );
+        putus( (unsigned short)(n / 10), file );
     (void) putc( n % 10 + '0', file );
     }
 

+ 9 - 0
panda/src/pnm/pbmplus.h

@@ -15,6 +15,10 @@
 
 #include <pandabase.h>
 
+#ifdef WIN32_VC
+#define MSDOS
+#endif
+
 #include <sys/types.h>
 #include <ctype.h>
 #include <stdio.h>
@@ -109,16 +113,21 @@ extern int rand();
 
 #else /* SYSV or AMIGA */
 
+#ifndef WIN32_VC
 #include <strings.h>
 extern void srandom();
 extern long random();
+#endif
 
 #endif /*SYSV or AMIGA*/
 
 #if (defined(MSDOS) || defined(AMIGA) )
+#include <string.h>
 #include <fcntl.h>
 #include <time.h>
 #include <stdlib.h>
+#define index(s,c) strchr(s,c)
+#define rindex(s,c) strrchr(s,c)
 #else
 #ifndef __cplusplus
 extern int atoi();