diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-07-22 07:17:23 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-07-22 07:18:36 +0200 |
commit | 8be5ec39051cc0eb70ec9882a45a95c661f7398f (patch) | |
tree | 01ea25c3d20dbb62d931fd77702a275e1c287f81 | |
parent | b59955bf2124b558147033782bf067a3723e4730 (diff) |
online update: Fix many warnings.
Not all yet, though.
Change-Id: Ic4f0fe3ded31d585faefd8bda8ab87f54b88dc6c
-rw-r--r-- | onlineupdate/source/libmar/inc/mozilla/Attributes.h | 2 | ||||
-rw-r--r-- | onlineupdate/source/libmar/sign/nss_secutil.c | 2 | ||||
-rw-r--r-- | onlineupdate/source/libmar/src/mar_extract.c | 2 | ||||
-rw-r--r-- | onlineupdate/source/libmar/tool/mar.c | 6 | ||||
-rw-r--r-- | onlineupdate/source/libmar/verify/cryptox.h | 2 | ||||
-rw-r--r-- | onlineupdate/source/libmar/verify/mar_verify.c | 3 | ||||
-rw-r--r-- | onlineupdate/source/update/common/updatelogging.cxx | 8 | ||||
-rw-r--r-- | onlineupdate/source/update/inc/mozilla/Attributes.h | 2 | ||||
-rw-r--r-- | onlineupdate/source/update/src/mar_extract.c | 2 | ||||
-rw-r--r-- | onlineupdate/source/update/updater/progressui_gtk.cxx | 4 | ||||
-rw-r--r-- | onlineupdate/source/update/updater/updater.cxx | 22 |
11 files changed, 29 insertions, 26 deletions
diff --git a/onlineupdate/source/libmar/inc/mozilla/Attributes.h b/onlineupdate/source/libmar/inc/mozilla/Attributes.h index b34e7d5af07a..4d38632dbc4b 100644 --- a/onlineupdate/source/libmar/inc/mozilla/Attributes.h +++ b/onlineupdate/source/libmar/inc/mozilla/Attributes.h @@ -83,7 +83,7 @@ # define MOZ_HAVE_NORETURN __attribute__((noreturn)) # endif #elif defined(__GNUC__) -# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L +# if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplusplus >= 201103L) # define MOZ_HAVE_CXX11_CONSTEXPR # if MOZ_GCC_VERSION_AT_LEAST(4, 8, 0) # define MOZ_HAVE_CXX11_CONSTEXPR_IN_TEMPLATES diff --git a/onlineupdate/source/libmar/sign/nss_secutil.c b/onlineupdate/source/libmar/sign/nss_secutil.c index caa124e651d7..ac8954ceb953 100644 --- a/onlineupdate/source/libmar/sign/nss_secutil.c +++ b/onlineupdate/source/libmar/sign/nss_secutil.c @@ -66,6 +66,8 @@ GetPasswordString(void *arg, char *prompt) char phrase[200] = {'\0'}; int isInputTerminal = isatty(fileno(stdin)); + (void) arg; (void) prompt; // avoid warnings + #ifndef _WINDOWS if (isInputTerminal) { input = fopen(consoleName, "r"); diff --git a/onlineupdate/source/libmar/src/mar_extract.c b/onlineupdate/source/libmar/src/mar_extract.c index f3512e99122c..af2276614bdb 100644 --- a/onlineupdate/source/libmar/src/mar_extract.c +++ b/onlineupdate/source/libmar/src/mar_extract.c @@ -40,6 +40,8 @@ static int mar_test_callback(MarFile *mar, const MarItem *item, void *unused) { char buf[BLOCKSIZE]; int fd, len, offset = 0; + (void) unused; // avoid warnings + if (mar_ensure_parent_dir(item->name)) return -1; diff --git a/onlineupdate/source/libmar/tool/mar.c b/onlineupdate/source/libmar/tool/mar.c index 9a961ae9aabd..d14690f5cbe4 100644 --- a/onlineupdate/source/libmar/tool/mar.c +++ b/onlineupdate/source/libmar/tool/mar.c @@ -35,12 +35,12 @@ int mar_repackage_and_sign(const char *NSSConfigDir, const char *src, const char * dest); -static void print_version() { +static void print_version(void) { printf("Version: %s\n", MOZ_APP_VERSION); printf("Default Channel ID: %s\n", MAR_CHANNEL_ID); } -static void print_usage() { +static void print_usage(void) { printf("usage:\n"); printf("Create a MAR file:\n"); printf(" mar [-H MARChannelID] [-V ProductVersion] [-C workingDir] " @@ -99,6 +99,8 @@ static void print_usage() { static int mar_test_callback(MarFile *mar, const MarItem *item, void *unused) { + (void) mar; (void) unused; // avoid warnings + printf("%u\t0%o\t%s\n", item->length, item->flags, item->name); return 0; } diff --git a/onlineupdate/source/libmar/verify/cryptox.h b/onlineupdate/source/libmar/verify/cryptox.h index 8b926814a70b..acecae64ccb0 100644 --- a/onlineupdate/source/libmar/verify/cryptox.h +++ b/onlineupdate/source/libmar/verify/cryptox.h @@ -57,7 +57,7 @@ CryptoX_Result NSS_VerifySignature(VFYContext * const *ctx , #define CryptoX_FreeCertificate(cert) \ CERT_DestroyCertificate(*cert) -#elif MACOSX +#elif defined(MACOSX) #define CryptoX_InvalidHandleValue NULL #define CryptoX_ProviderHandle void* diff --git a/onlineupdate/source/libmar/verify/mar_verify.c b/onlineupdate/source/libmar/verify/mar_verify.c index 954fbbb5e659..c9f715a4dc65 100644 --- a/onlineupdate/source/libmar/verify/mar_verify.c +++ b/onlineupdate/source/libmar/verify/mar_verify.c @@ -194,7 +194,6 @@ mar_extract_and_verify_signatures_fp(FILE *fp, CryptoX_ProviderHandle provider, CryptoX_PublicKey *keys, uint32_t keyCount) { - char buf[5] = {0}; uint32_t signatureCount, signatureLen, numVerified = 0; uint32_t signatureAlgorithmIDs[MAX_SIGNATURES]; int rv = -1; @@ -346,6 +345,8 @@ mar_verify_signatures_for_fp(FILE *fp, uint32_t i; int rv = CryptoX_Error; + (void) provider; (void) keys; // avoid warnings + memset(signatureHandles, 0, sizeof(signatureHandles)); memset(signatureLengths, 0, sizeof(signatureLengths)); diff --git a/onlineupdate/source/update/common/updatelogging.cxx b/onlineupdate/source/update/common/updatelogging.cxx index 9ed8f3e8fcea..4044e26882bc 100644 --- a/onlineupdate/source/update/common/updatelogging.cxx +++ b/onlineupdate/source/update/common/updatelogging.cxx @@ -18,7 +18,7 @@ UpdateLog::UpdateLog() : logFP(nullptr) { } -void UpdateLog::Init(NS_tchar* sourcePath, +void UpdateLog::Init(NS_tchar* sourcePathParam, const NS_tchar* fileName, const NS_tchar* alternateFileName, bool append) @@ -26,14 +26,14 @@ void UpdateLog::Init(NS_tchar* sourcePath, if (logFP) return; - this->sourcePath = sourcePath; + sourcePath = sourcePathParam; NS_tchar logFile[MAXPATHLEN]; NS_tsnprintf(logFile, sizeof(logFile)/sizeof(logFile[0]), - NS_T("%s/%s"), sourcePath, fileName); + NS_T("%s/%s"), sourcePathParam, fileName); if (alternateFileName && NS_taccess(logFile, F_OK)) { NS_tsnprintf(logFile, sizeof(logFile)/sizeof(logFile[0]), - NS_T("%s/%s"), sourcePath, alternateFileName); + NS_T("%s/%s"), sourcePathParam, alternateFileName); } logFP = NS_tfopen(logFile, append ? NS_T("a") : NS_T("w")); diff --git a/onlineupdate/source/update/inc/mozilla/Attributes.h b/onlineupdate/source/update/inc/mozilla/Attributes.h index b34e7d5af07a..4d38632dbc4b 100644 --- a/onlineupdate/source/update/inc/mozilla/Attributes.h +++ b/onlineupdate/source/update/inc/mozilla/Attributes.h @@ -83,7 +83,7 @@ # define MOZ_HAVE_NORETURN __attribute__((noreturn)) # endif #elif defined(__GNUC__) -# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L +# if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplusplus >= 201103L) # define MOZ_HAVE_CXX11_CONSTEXPR # if MOZ_GCC_VERSION_AT_LEAST(4, 8, 0) # define MOZ_HAVE_CXX11_CONSTEXPR_IN_TEMPLATES diff --git a/onlineupdate/source/update/src/mar_extract.c b/onlineupdate/source/update/src/mar_extract.c index f3512e99122c..af2276614bdb 100644 --- a/onlineupdate/source/update/src/mar_extract.c +++ b/onlineupdate/source/update/src/mar_extract.c @@ -40,6 +40,8 @@ static int mar_test_callback(MarFile *mar, const MarItem *item, void *unused) { char buf[BLOCKSIZE]; int fd, len, offset = 0; + (void) unused; // avoid warnings + if (mar_ensure_parent_dir(item->name)) return -1; diff --git a/onlineupdate/source/update/updater/progressui_gtk.cxx b/onlineupdate/source/update/updater/progressui_gtk.cxx index 362b3ba5ba19..29ed219d9e35 100644 --- a/onlineupdate/source/update/updater/progressui_gtk.cxx +++ b/onlineupdate/source/update/updater/progressui_gtk.cxx @@ -26,7 +26,7 @@ static GtkWidget *sProgressBar; static const char *sProgramPath; static gboolean -UpdateDialog(gpointer data) +UpdateDialog(gpointer /*data*/) { if (sQuit) { @@ -43,7 +43,7 @@ UpdateDialog(gpointer data) } static gboolean -OnDeleteEvent(GtkWidget *widget, GdkEvent *event, gpointer user_data) +OnDeleteEvent(GtkWidget * /*widget*/, GdkEvent * /*event*/, gpointer /*user_data*/) { return TRUE; } diff --git a/onlineupdate/source/update/updater/updater.cxx b/onlineupdate/source/update/updater/updater.cxx index 1685995c6fdf..67773bdce36d 100644 --- a/onlineupdate/source/update/updater/updater.cxx +++ b/onlineupdate/source/update/updater/updater.cxx @@ -64,7 +64,9 @@ #define PROGRESS_FINISH_SIZE 5.0f // Amount of time in ms to wait for the parent process to close +#ifdef WNT #define PARENT_WAIT 5000 +#endif #if defined(MACOSX) // These functions are defined in launchchild_osx.mm @@ -72,10 +74,6 @@ void LaunchChild(int argc, char **argv); void LaunchMacPostProcess(const char* aAppBundle); #endif -#ifndef _O_BINARY -# define _O_BINARY 0 -#endif - #ifndef NULL # define NULL (0) #endif @@ -141,18 +139,12 @@ static bool sUseHardLinks = true; // This variable lives in libbz2. It's declared in bzlib_private.h, so we just // declare it here to avoid including that entire header file. -#define BZ2_CRC32TABLE_UNDECLARED - #if defined(HAVE_GCC_VISIBILITY_FEATURE) extern "C" __attribute__((visibility("default"))) unsigned int BZ2_crc32Table[256]; -#undef BZ2_CRC32TABLE_UNDECLARED #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) extern "C" __global unsigned int BZ2_crc32Table[256]; -#undef BZ2_CRC32TABLE_UNDECLARED -#endif -#if defined(BZ2_CRC32TABLE_UNDECLARED) +#else extern "C" unsigned int BZ2_crc32Table[256]; -#undef BZ2_CRC32TABLE_UNDECLARED #endif static unsigned int @@ -1825,8 +1817,10 @@ LaunchCallbackApp(const NS_tchar *workingDir, } #if defined(USE_EXECV) + (void) argc; (void) usingService; // avoid warnings execv(argv[0], argv); #elif defined(MACOSX) + (void) usingService; // avoid warnings LaunchChild(argc, argv); #elif defined(WNT) // Do not allow the callback to run when running an update through the @@ -1957,7 +1951,7 @@ CopyInstallDirToDestDir() // These files should not be copied over to the updated app #ifdef WNT #define SKIPLIST_COUNT 3 -#elif MACOSX +#elif defined(MACOSX) #define SKIPLIST_COUNT 0 #else #define SKIPLIST_COUNT 2 @@ -1992,7 +1986,7 @@ ProcessReplaceRequest() NS_tchar destDir[MAXPATHLEN]; NS_tsnprintf(destDir, sizeof(destDir)/sizeof(destDir[0]), NS_T("%s/Contents"), gInstallDirPath); -#elif WNT +#elif defined(WNT) // Windows preserves the case of the file/directory names. We use the // GetLongPathName API in order to get the correct case for the directory // name, so that if the user has used a different case when launching the @@ -2190,7 +2184,7 @@ GetUpdateFileName(NS_tchar *fileName, int maxChars) } static void -UpdateThreadFunc(void *param) +UpdateThreadFunc(void * /*param*/) { // open ZIP archive and process... int rv; |