Used splint:
authorJörg Hoh <hohjg@users.sourceforge.net>
Sun, 19 Mar 2006 17:23:06 +0000 (18:23 +0100)
committerJörg Hoh <hohjg@users.sourceforge.net>
Sun, 19 Mar 2006 17:23:06 +0000 (18:23 +0100)
 - replaced some sprintf-calls with snprintf (and appropriate size value)
 - eliminated some unused variables

splint still complains about a lot of signedness errors (comparisons and assignments),
will do more checks soon

libexif/exif-content.c
libexif/exif.c

index 2b3d3ea..f60215c 100644 (file)
@@ -122,7 +122,7 @@ exif_content_dump (ExifContent *content, unsigned int indent)
        if (!content)
                return;
 
-       printf ("%sDumping exif content (%i entries)...\n", buf,
+       printf ("%sDumping exif content (%u entries)...\n", buf,
                content->count);
        for (i = 0; i < content->count; i++)
                exif_entry_dump (content->entries[i], indent + 1);
index 4181b26..1c84071 100644 (file)
@@ -626,7 +626,7 @@ ProcessAperture(ImageInfoType *ImageInfo,
        if (exif_find_record(ImageInfo->d, "FNumber") == NULL) {
                /* Convert aperture to F-stop. */
                fstop = pow(sqrt(2), ((double)rd.r.num)/((double)rd.r.denom));
-               sprintf(label, "f%.1g", fstop);
+               snprintf(label,32, "f%.1g", fstop);
                rd.s = strdup(label);
                exif_append_data(&ImageInfo->d,
                                                 "FNumber",
@@ -673,7 +673,7 @@ ProcessCanonMakerNote(ImageInfoType *ImageInfo,
                rec_type = ConvertAnyFormat2(OffsetPtr, ByteCount, format,
                                                                         ImageInfo->MotorolaOrder,
                                                                         &rd);
-               sprintf(label, "MakerNote%04x", tag);
+               snprintf(label, 32, "MakerNote%04x", tag);
                exif_append_data(&ImageInfo->d,
                                                 label,
                                                 rec_type,
@@ -819,11 +819,10 @@ static int
 ProcessExifDir(ImageInfoType *ImageInfo, char *DirStart, char *OffsetBase, unsigned ExifLength, char *LastExifRefd)
 {
     int de;
-    int a;
     int NumDirEntries;
     exif_rec_data_t rd;
-       char rec_type;
-       char label[32];
+    char rec_type;
+    char label[32];
 
     NumDirEntries = Get16u(DirStart, ImageInfo->MotorolaOrder);
 
@@ -912,7 +911,7 @@ ProcessExifDir(ImageInfoType *ImageInfo, char *DirStart, char *OffsetBase, unsig
                        rec_type = ConvertAnyFormat2(ValuePtr, ByteCount, Format,
                                                                                 ImageInfo->MotorolaOrder,
                                                                                 &rd);
-                       sprintf(label, "0x%04x", Tag);
+                       snprintf(label, 32, "0x%04x", Tag);
                        exif_append_data(&ImageInfo->d,
                                                         label,
                                                         rec_type,
@@ -931,7 +930,6 @@ static int
 process_EXIF (ImageInfoType *ImageInfo, char *CharBuf, unsigned int length, char *LastExifRefd)
 {
        int cc;
-       exif_rec_data_t rd;
        LastExifRefd = CharBuf;
 
        {   /* Check the EXIF header component */
@@ -1127,9 +1125,6 @@ ReadJpegFile(ImageInfoType *ImageInfo, Section_t *Sections,
 {
     FILE *infile;
     int ret;
-       char *tmp;
-       char **p_argv;
-       int p_argc;
 
     infile = fdopen(fd, "rb"); /* Unix ignores 'b', windows needs it. */
 
@@ -1163,7 +1158,6 @@ read_jpeg_exif(ImageInfoType *ImageInfo, int fd, int ReadAll)
        int SectionsRead;
        char *LastExifRefd=NULL;
        int ret;
-       int thumbsize=0;
 
        ret = ReadJpegFile(ImageInfo, Sections, &SectionsRead, fd, ReadAll, LastExifRefd); 
 #if 0