Bug 1202971 (part 1) - Fix compile warnings in libmar. r=rstrong.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 15 Sep 2015 17:39:11 -0700
changeset 262697 3da17eef27503f8a48a0ff14fe591ae99f4849ae
parent 262696 5b5a5360cc2924cbdf0e16c610d61efc764361f1
child 262698 84ffd9ae7cf1dfdfa58592ba632bae6029f4ac9e
push id65099
push usernnethercote@mozilla.com
push dateWed, 16 Sep 2015 00:40:57 +0000
treeherdermozilla-inbound@84ffd9ae7cf1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrstrong
bugs1202971
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1202971 (part 1) - Fix compile warnings in libmar. r=rstrong. Also remove ALLOW_COMPILER_WARNINGS=True so they don't come back.
modules/libmar/sign/moz.build
modules/libmar/sign/nss_secutil.c
modules/libmar/src/mar_read.c
modules/libmar/src/moz.build
modules/libmar/tool/mar.c
modules/libmar/tool/moz.build
--- a/modules/libmar/sign/moz.build
+++ b/modules/libmar/sign/moz.build
@@ -17,11 +17,8 @@ LOCAL_INCLUDES += [
     '../src',
     '../verify',
 ]
 
 DEFINES['MAR_NSS'] = True
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     USE_STATIC_LIBS = True
-
-# XXX: We should fix these warnings.
-ALLOW_COMPILER_WARNINGS = True
--- a/modules/libmar/sign/nss_secutil.c
+++ b/modules/libmar/sign/nss_secutil.c
@@ -76,17 +76,20 @@ GetPasswordString(void *arg, char *promp
   }
 #endif 
 
   if (isInputTerminal) {
     fprintf(stdout, "Please enter your password:\n");
     fflush(stdout);
   }
 
-  QUIET_FGETS (phrase, sizeof(phrase), input);
+  if (!QUIET_FGETS(phrase, sizeof(phrase), input)) {
+    fprintf(stderr, "QUIET_FGETS failed\n");
+    return NULL;
+  }
 
   if (isInputTerminal) {
     fprintf(stdout, "\n");
   }
 
 #ifndef _WINDOWS
   if (isInputTerminal) {
     fclose(input);
--- a/modules/libmar/src/mar_read.c
+++ b/modules/libmar/src/mar_read.c
@@ -332,17 +332,17 @@ int get_mar_file_info_fp(FILE *fp,
       return -1;
     }
     signatureLen = ntohl(signatureLen);
     if (fseek(fp, signatureLen, SEEK_CUR)) {
       return -1;
     }
   }
 
-  if (ftell(fp) == offsetToContent) {
+  if ((int64_t)ftell(fp) == (int64_t)offsetToContent) {
     *hasAdditionalBlocks = 0;
   } else {
     if (numAdditionalBlocks) {
       /* We have an additional block, so read in the number of additional blocks
          and set the offset. */
       *hasAdditionalBlocks = 1;
       if (fread(numAdditionalBlocks, sizeof(uint32_t), 1, fp) != 1) {
         return -1;
--- a/modules/libmar/src/moz.build
+++ b/modules/libmar/src/moz.build
@@ -23,11 +23,8 @@ UNIFIED_SOURCES += [
     'mar_extract.c',
     'mar_read.c',
 ]
 
 FORCE_STATIC_LIB = True
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     USE_STATIC_LIBS = True
-
-# XXX: We should fix these warnings.
-ALLOW_COMPILER_WARNINGS = True
--- a/modules/libmar/tool/mar.c
+++ b/modules/libmar/tool/mar.c
@@ -156,17 +156,19 @@ int main(int argc, char **argv) {
         argv[1][1] == 't' || argv[1][1] == 'x' || 
         argv[1][1] == 'v' || argv[1][1] == 's' ||
         argv[1][1] == 'i' || argv[1][1] == 'T' ||
         argv[1][1] == 'r' || argv[1][1] == 'X' ||
         argv[1][1] == 'I')) {
       break;
     /* -C workingdirectory */
     } else if (argv[1][0] == '-' && argv[1][1] == 'C') {
-      chdir(argv[2]);
+      if (chdir(argv[2]) != 0) {
+        return -1;
+      }
       argv += 2;
       argc -= 2;
     } 
 #if !defined(NO_SIGN_VERIFY) && ((!defined(MAR_NSS) && defined(XP_WIN)) || \
                                  defined(XP_MACOSX))
     /* -D DERFilePath, also matches -D[index] DERFilePath
        We allow an index for verifying to be symmetric
        with the import and export command line arguments. */
--- a/modules/libmar/tool/moz.build
+++ b/modules/libmar/tool/moz.build
@@ -53,15 +53,12 @@ elif CONFIG['OS_ARCH'] == 'Darwin':
       '-framework Security',
     ]
 
 if CONFIG['HOST_OS_ARCH'] == 'WINNT':
     HOST_OS_LIBS += [
         'ws2_32',
     ]
 
-# XXX: We should fix these warnings.
-ALLOW_COMPILER_WARNINGS = True
-
 HOST_DEFINES['NO_SIGN_VERIFY'] = True
 
 if CONFIG['CROSS_COMPILE'] and CONFIG['HOST_NSPR_MDCPUCFG']:
     HOST_DEFINES['MDCPUCFG'] = CONFIG['HOST_NSPR_MDCPUCFG']