VirtualBox

Changeset 24220 in vbox for trunk/src/VBox/Main/webservice


Ignore:
Timestamp:
Oct 30, 2009 10:06:30 PM (15 years ago)
Author:
vboxsync
Message:

split-soapC.cpp: warnings and seek checks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/webservice/split-soapC.cpp

    r23605 r24220  
    6161            break;
    6262        }
    63         fseek(pFileIn, 0, SEEK_END);
     63        int rc2 = fseek(pFileIn, 0, SEEK_END);
    6464        long cbFileIn = ftell(pFileIn);
    65         rewind(pFileIn);
     65        int rc3 = fseek(pFileIn, 0, SEEK_SET);
     66        if (rc3 == -1 || rc2 == -1 || cbFileIn < 0)
     67        {
     68            fprintf(stderr, "split-soapC: Seek failure.\n");
     69            rc = 2;
     70            break;
     71        }
    6672
    6773        if (!(pBuffer = (char*)malloc(cbFileIn + 1)))
     
    7278        }
    7379
    74         if (fread(pBuffer, 1, cbFileIn, pFileIn) != cbFileIn)
     80        if (fread(pBuffer, 1, cbFileIn, pFileIn) != (size_t)cbFileIn)
    7581        {
    7682            fprintf(stderr, "split-soapC: Failed to read %ld bytes from input file.\n", cbFileIn);
     
    96102                /* construct output filename */
    97103                char szFilename[1024];
    98                 sprintf(szFilename, "%s/soapC-%u.cpp", argv[2], ++cFiles);
     104                sprintf(szFilename, "%s/soapC-%lu.cpp", argv[2], ++cFiles);
    99105                szFilename[sizeof(szFilename)-1] = '\0';
    100                 printf("info: soapC-%u.cpp\n", cFiles);
     106                printf("info: soapC-%lu.cpp\n", cFiles);
    101107
    102108                /* create output file */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette