about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-10-02 15:07:56 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-10-02 15:07:56 +0000
commitaff96efb7cec324d8b4982a653a6c4be99b73017 (patch)
treeb49c08dc3e44c94a903ba06b441a2f75eac6a893 /lib
parenta3604ea70095b51eb25f254650191efec49e6e07 (diff)
downloadnetpbm-mirror-aff96efb7cec324d8b4982a653a6c4be99b73017.tar.gz
netpbm-mirror-aff96efb7cec324d8b4982a653a6c4be99b73017.tar.xz
netpbm-mirror-aff96efb7cec324d8b4982a653a6c4be99b73017.zip
whitespace
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3370 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib')
-rw-r--r--lib/pmfileio.c104
1 files changed, 52 insertions, 52 deletions
diff --git a/lib/pmfileio.c b/lib/pmfileio.c
index cfdac10d..738ba336 100644
--- a/lib/pmfileio.c
+++ b/lib/pmfileio.c
@@ -14,10 +14,10 @@
 #define _BSD_SOURCE    /* Make sure strdup is defined */
 #define _XOPEN_SOURCE 500    /* Make sure ftello, fseeko, strdup are defined */
 #define _LARGEFILE_SOURCE 1  /* Make sure ftello, fseeko are defined */
-#define _LARGEFILE64_SOURCE 1 
+#define _LARGEFILE64_SOURCE 1
 #define _FILE_OFFSET_BITS 64
     /* This means ftello() is really ftello64() and returns a 64 bit file
-       position.  Unless the C library doesn't have ftello64(), in which 
+       position.  Unless the C library doesn't have ftello64(), in which
        case ftello() is still just ftello().
 
        Likewise for all the other C library file functions.
@@ -25,7 +25,7 @@
        And off_t and fpos_t are 64 bit types instead of 32.  Consequently,
        pm_filepos_t might be 64 bits instead of 32.
     */
-#define _LARGE_FILES  
+#define _LARGE_FILES
     /* This does for AIX what _FILE_OFFSET_BITS=64 does for GNU */
 #define _LARGE_FILE_API
     /* This makes the the x64() functions available on AIX */
@@ -60,9 +60,9 @@ pm_openr(const char * const name) {
         f = stdin;
     else {
         f = fopen(name, "rb");
-        if (f == NULL) 
+        if (f == NULL)
             pm_error("Unable to open file '%s' for reading.  "
-                     "fopen() returns errno %d (%s)", 
+                     "fopen() returns errno %d (%s)",
                      name, errno, strerror(errno));
     }
     return f;
@@ -78,9 +78,9 @@ pm_openw(const char * const name) {
         f = stdout;
     else {
         f = fopen(name, "wb");
-        if (f == NULL) 
+        if (f == NULL)
             pm_error("Unable to open file '%s' for writing.  "
-                     "fopen() returns errno %d (%s)", 
+                     "fopen() returns errno %d (%s)",
                      name, errno, strerror(errno));
     }
     return f;
@@ -118,7 +118,7 @@ tmpDir(void) {
 static int
 tempFileOpenFlags(void) {
 /*----------------------------------------------------------------------------
-  Open flags (argument to open()) suitable for a new temporary file  
+  Open flags (argument to open()) suitable for a new temporary file
 -----------------------------------------------------------------------------*/
     int retval;
 
@@ -182,11 +182,11 @@ mkstempx(char * const filenameBuffer) {
             } else {
                 if (errno == EEXIST) {
                     /* We'll just have to keep trying */
-                } else 
+                } else
                     error = TRUE;
             }
         }
-    }    
+    }
     if (gotFile)
         retval = fd;
     else
@@ -216,7 +216,7 @@ makeTmpfileWithTemplate(const char *  const filenameTemplate,
                         int *         const fdP,
                         const char ** const filenameP,
                         const char ** const errorP) {
-    
+
     char * filenameBuffer;  /* malloc'ed */
 
     filenameBuffer = strdup(filenameTemplate);
@@ -226,9 +226,9 @@ makeTmpfileWithTemplate(const char *  const filenameTemplate,
                     "file name");
     else {
         int rc;
-        
+
         rc = mkstemp2(filenameBuffer);
-        
+
         if (rc < 0)
             pm_asprintf(errorP,
                         "Unable to create temporary file according to name "
@@ -261,8 +261,8 @@ pm_make_tmpfile_fd(int *         const fdP,
         dirseparator = "";
     else
         dirseparator = "/";
-    
-    pm_asprintf(&filenameTemplate, "%s%s%s%s", 
+
+    pm_asprintf(&filenameTemplate, "%s%s%s%s",
                 tmpdir, dirseparator, pm_progname, "_XXXXXX");
 
     if (filenameTemplate == pm_strsol)
@@ -291,7 +291,7 @@ pm_make_tmpfile(FILE **       const filePP,
     pm_make_tmpfile_fd(&fd, filenameP);
 
     *filePP = fdopen(fd, "w+b");
-    
+
     if (*filePP == NULL) {
         close(fd);
         unlink(*filenameP);
@@ -305,7 +305,7 @@ pm_make_tmpfile(FILE **       const filePP,
 
 
 
-bool const canUnlinkOpen = 
+bool const canUnlinkOpen =
 #if CAN_UNLINK_OPEN
     1
 #else
@@ -394,7 +394,7 @@ scheduleUnlinkAtExit(const char * const fileName,
    code too badly for Unix.
 -----------------------------------------------------------------------------*/
     static bool unlinkListEstablished = false;
-    
+
     if (!unlinkListEstablished) {
         atexit(unlinkTempFiles);
         unlinkListP = NULL;
@@ -418,7 +418,7 @@ arrangeUnlink(const char * const fileName,
 
 
 
-FILE * 
+FILE *
 pm_tmpfile(void) {
 
     FILE * fileP;
@@ -473,7 +473,7 @@ pm_openr_seekable(const char name[]) {
 
     original_file = pm_openr((char *) name);
 
-    /* I would use fseek() to determine if the file is seekable and 
+    /* I would use fseek() to determine if the file is seekable and
        be a little more general than checking the type of file, but I
        don't have reliable information on how to do that.  I have seen
        streams be partially seekable -- you can, for example seek to
@@ -488,16 +488,16 @@ pm_openr_seekable(const char name[]) {
     stat_rc = fstat(fileno(original_file), &statbuf);
     if (stat_rc == 0 && S_ISREG(statbuf.st_mode))
         seekable = TRUE;
-    else 
+    else
         seekable = FALSE;
 
     if (seekable) {
         seekable_file = original_file;
     } else {
         seekable_file = pm_tmpfile();
-        
+
         /* Copy the input into the temporary seekable file */
-        while (!feof(original_file) && !ferror(original_file) 
+        while (!feof(original_file) && !ferror(original_file)
                && !ferror(seekable_file)) {
             char buffer[4096];
             int bytes_read;
@@ -537,7 +537,7 @@ pm_close(FILE * const f) {
 
 
 
-/* The pnmtopng package uses pm_closer() and pm_closew() instead of 
+/* The pnmtopng package uses pm_closer() and pm_closew() instead of
    pm_close(), apparently because the 1999 Pbmplus package has them.
    I don't know what the difference is supposed to be.
 */
@@ -601,7 +601,7 @@ getcNofail(FILE * const ifP) {
 void
 pm_readchar(FILE * const ifP,
             char * const cP) {
-    
+
     *cP = (char)getcNofail(ifP);
 }
 
@@ -617,7 +617,7 @@ pm_writechar(FILE * const ofP,
 
 
 int
-pm_readbigshort(FILE *  const ifP, 
+pm_readbigshort(FILE *  const ifP,
                 short * const sP) {
 
     unsigned short s;
@@ -633,7 +633,7 @@ pm_readbigshort(FILE *  const ifP,
 
 
 int
-pm_writebigshort(FILE * const ofP, 
+pm_writebigshort(FILE * const ofP,
                  short  const s) {
 
     putc((s >> 8) & 0xff, ofP);
@@ -645,7 +645,7 @@ pm_writebigshort(FILE * const ofP,
 
 
 int
-pm_readbiglong(FILE * const ifP, 
+pm_readbiglong(FILE * const ifP,
                long * const lP) {
 
     unsigned long l;
@@ -680,7 +680,7 @@ pm_readbiglong2(FILE *    const ifP,
 
 
 int
-pm_writebiglong(FILE * const ofP, 
+pm_writebiglong(FILE * const ofP,
                 long   const l) {
 
     putc((l >> 24) & 0xff, ofP);
@@ -694,7 +694,7 @@ pm_writebiglong(FILE * const ofP,
 
 
 int
-pm_readlittleshort(FILE *  const ifP, 
+pm_readlittleshort(FILE *  const ifP,
                    short * const sP) {
     unsigned short s;
 
@@ -709,7 +709,7 @@ pm_readlittleshort(FILE *  const ifP,
 
 
 int
-pm_writelittleshort(FILE * const ofP, 
+pm_writelittleshort(FILE * const ofP,
                     short  const s) {
 
     putc((s >> 0) & 0xff, ofP);
@@ -721,7 +721,7 @@ pm_writelittleshort(FILE * const ofP,
 
 
 int
-pm_readlittlelong(FILE * const ifP, 
+pm_readlittlelong(FILE * const ifP,
                   long * const lP) {
     unsigned long l;
 
@@ -755,7 +755,7 @@ pm_readlittlelong2(FILE *    const ifP,
 
 
 int
-pm_writelittlelong(FILE * const ofP, 
+pm_writelittlelong(FILE * const ofP,
                    long   const l) {
 
     putc((l >>  0) & 0xff, ofP);
@@ -768,7 +768,7 @@ pm_writelittlelong(FILE * const ofP,
 
 
 
-int 
+int
 pm_readmagicnumber(FILE * const ifP) {
 
     int ich1, ich2;
@@ -805,7 +805,7 @@ pm_readmagicnumber(FILE * const ifP) {
                                   than this. */
 
 char *
-pm_read_unknown_size(FILE * const file, 
+pm_read_unknown_size(FILE * const file,
                      long * const nread) {
     long nalloc;
     char * buf;
@@ -831,7 +831,7 @@ pm_read_unknown_size(FILE * const file,
         val = getc(file);
         if (val == EOF)
             eof = TRUE;
-        else 
+        else
             buf[(*nread)++] = val;
     }
     return buf;
@@ -879,7 +879,7 @@ pm_bs_long(long const l) {
 
 
 void
-pm_tell2(FILE *       const fileP, 
+pm_tell2(FILE *       const fileP,
          void *       const fileposP,
          unsigned int const fileposSize) {
 /*----------------------------------------------------------------------------
@@ -911,7 +911,7 @@ pm_tell2(FILE *       const fileP,
         }
     } else
         pm_error("File position size passed to pm_tell() is invalid: %u.  "
-                 "Valid sizes are %u and %u", 
+                 "Valid sizes are %u and %u",
                  fileposSize, (unsigned int)sizeof(pm_filepos),
                  (unsigned int) sizeof(long));
 }
@@ -920,7 +920,7 @@ pm_tell2(FILE *       const fileP,
 
 unsigned int
 pm_tell(FILE * const fileP) {
-    
+
     long filepos;
 
     pm_tell2(fileP, &filepos, sizeof(filepos));
@@ -931,14 +931,14 @@ pm_tell(FILE * const fileP) {
 
 
 void
-pm_seek2(FILE *             const fileP, 
+pm_seek2(FILE *             const fileP,
          const pm_filepos * const fileposP,
          unsigned int       const fileposSize) {
 /*----------------------------------------------------------------------------
    Position file *fileP to position *fileposP.  Abort if error, including
    if *fileP isn't a seekable file.
 -----------------------------------------------------------------------------*/
-    if (fileposSize == sizeof(pm_filepos)) 
+    if (fileposSize == sizeof(pm_filepos))
         /* Note: FSEEKO() is either fseeko() or fseek(), depending on the
            capabilities of the underlying C library.  It is defined in
            pm_config.h.  fseeko(), in turn, may be either fseek() or
@@ -950,7 +950,7 @@ pm_seek2(FILE *             const fileP,
         fseek(fileP, fileposLong, SEEK_SET);
     } else
         pm_error("File position size passed to pm_seek() is invalid: %u.  "
-                 "Valid sizes are %u and %u", 
+                 "Valid sizes are %u and %u",
                  fileposSize, (unsigned int)sizeof(pm_filepos),
                  (unsigned int) sizeof(long));
 }
@@ -977,7 +977,7 @@ pm_nextimage(FILE * const file, int * const eofP) {
    Position the file 'file' to the next image in the stream, assuming it is
    now positioned just after the current image.  I.e. read off any white
    space at the end of the current image's raster.  Note that the raw formats
-   don't permit such white space, but this routine tolerates it anyway, 
+   don't permit such white space, but this routine tolerates it anyway,
    because the plain formats do permit white space after the raster.
 
    Iff there is no next image, return *eofP == TRUE.
@@ -1002,7 +1002,7 @@ pm_nextimage(FILE * const file, int * const eofP) {
         int c;
         c = getc(file);
         if (c == EOF) {
-            if (feof(file)) 
+            if (feof(file))
                 eof = TRUE;
             else
                 pm_error("File error on getc() to position to image");
@@ -1013,10 +1013,10 @@ pm_nextimage(FILE * const file, int * const eofP) {
                 nonWhitespaceFound = TRUE;
 
                 /* Have to put the non-whitespace character back in
-                   the stream -- it's part of the next image.  
+                   the stream -- it's part of the next image.
                 */
                 rc = ungetc(c, file);
-                if (rc == EOF) 
+                if (rc == EOF)
                     pm_error("File error doing ungetc() "
                              "to position to image.");
             }
@@ -1028,8 +1028,8 @@ pm_nextimage(FILE * const file, int * const eofP) {
 
 
 void
-pm_check(FILE *               const file, 
-         enum pm_check_type   const check_type, 
+pm_check(FILE *               const file,
+         enum pm_check_type   const check_type,
          pm_filepos           const need_raster_size,
          enum pm_check_code * const retval_p) {
 /*----------------------------------------------------------------------------
@@ -1047,9 +1047,9 @@ pm_check(FILE *               const file,
     curpos = FTELLO(file);
     if (curpos >= 0) {
         /* This type of file has a current position */
-            
+
         rc = fstat(fileno(file), &statbuf);
-        if (rc != 0) 
+        if (rc != 0)
             pm_error("fstat() failed to get size of file, though ftello() "
                      "successfully identified\n"
                      "the current position.  Errno=%s (%d)",
@@ -1059,12 +1059,12 @@ pm_check(FILE *               const file,
             if (retval_p) *retval_p = PM_CHECK_UNCHECKABLE;
         } else {
             pm_filepos const have_raster_size = statbuf.st_size - curpos;
-            
+
             if (have_raster_size < need_raster_size)
                 pm_error("File has invalid format.  The raster should "
                          "contain %u bytes, but\n"
                          "the file ends after only %u bytes.",
-                         (unsigned int) need_raster_size, 
+                         (unsigned int) need_raster_size,
                          (unsigned int) have_raster_size);
             else if (have_raster_size > need_raster_size) {
                 if (retval_p) *retval_p = PM_CHECK_TOO_LONG;