[pcre-dev] [Bug 707] New: Patch: incorrect printf flags, co…

Page principale
Supprimer ce message
Auteur: Yang Zhang
Date:  
À: pcre-dev
Nouveaux-sujets: [pcre-dev] [Bug 707] Patch: incorrect printf flags, comparing string literals
Sujet: [pcre-dev] [Bug 707] New: Patch: incorrect printf flags, comparing string literals
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=707
           Summary: Patch: incorrect printf flags, comparing string literals
           Product: PCRE
           Version: N/A
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
        AssignedTo: ph10@???
        ReportedBy: yang.eximbugs@???
                CC: pcre-dev@???



The first change is due to a gcc warning against comparing string literals.
The second is due to the incorrect flags being used for a ptrdiff_t (matters
on, say, x86_64).

diff -ur real/pcre-7.7/pcrecpp.cc pcre-7.7/pcrecpp.cc
--- real/pcre-7.7/pcrecpp.cc    2008-04-05 11:37:03.000000000 -0400
+++ pcre-7.7/pcrecpp.cc 2008-05-13 15:13:55.000000000 -0400
@@ -372,7 +372,7 @@
     else if (newline == -2)
       newline_mode = PCRE_NEWLINE_ANYCRLF;
     else
-      assert("" == "Unexpected return value from pcre_config(NEWLINE)");
+      assert(0 == "Unexpected return value from pcre_config(NEWLINE)");
   }
   return newline_mode;
 }
diff -ur real/pcre-7.7/pcregrep.c pcre-7.7/pcregrep.c
--- real/pcre-7.7/pcregrep.c    2008-04-28 11:06:46.000000000 -0400
+++ pcre-7.7/pcregrep.c 2008-05-13 15:12:24.000000000 -0400
@@ -1054,10 +1054,10 @@
         if (printname != NULL) fprintf(stdout, "%s:", printname);
         if (number) fprintf(stdout, "%d:", linenumber);
         if (line_offsets)
-          fprintf(stdout, "%d,%d", matchptr + offsets[0] - ptr,
+          fprintf(stdout, "%td,%d", matchptr + offsets[0] - ptr,
             offsets[1] - offsets[0]);
         else if (file_offsets)
-          fprintf(stdout, "%d,%d", filepos + matchptr + offsets[0] - ptr,
+          fprintf(stdout, "%td,%d", filepos + matchptr + offsets[0] - ptr,
             offsets[1] - offsets[0]);
         else
           fwrite(matchptr + offsets[0], 1, offsets[1] - offsets[0], stdout);



--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email