diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2011-02-18 09:31:30 +0100 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2011-02-18 09:31:30 +0100 |
commit | ec9ba9c7939230974b09b7757adaf8b5a84b77b9 (patch) | |
tree | 62d4bd9556a8ae612951ba4e8b766251728b9027 | |
parent | d013790ca8d8ee2d9409749b963cacec357bd5f6 (diff) |
compiler fixes for clang 2.8libsynthesis_3.4.0.16+syncevolution-1-1-99-3
With these fixes, clang -Wall -Werror -Wno-unknown-pragmas compiles
cleanly.
Changes:
- short <-> int mismatches in printf formatting
- NULL format string causes a warning (okay in DebugOpenBlock(), but
cannot tell the compiler -> disable checking in that one place
where it happens)
- return NULL pointer instead of implicitly converting false to NULL
- use curly brackets to denote empty body because clang does not
accept a single colon
-rwxr-xr-x | src/DB_interfaces/api_db/pluginapids.cpp | 2 | ||||
-rwxr-xr-x | src/platform_adapters/binfile.cpp | 3 | ||||
-rwxr-xr-x | src/sysync/binfileimplds.cpp | 2 | ||||
-rwxr-xr-x | src/sysync/customimplds.cpp | 4 | ||||
-rwxr-xr-x | src/sysync/debuglogger.cpp | 3 | ||||
-rw-r--r-- | src/sysync/mimedirprofile.cpp | 2 | ||||
-rwxr-xr-x | src/sysync/rrules.cpp | 8 | ||||
-rwxr-xr-x | src/sysync/syncagent.cpp | 2 | ||||
-rwxr-xr-x | src/sysync/syncappbase.cpp | 3 | ||||
-rwxr-xr-x | src/sysync/timezones.cpp | 16 | ||||
-rw-r--r-- | src/sysync_SDK/Sources/dbitem.cpp | 3 |
11 files changed, 30 insertions, 18 deletions
diff --git a/src/DB_interfaces/api_db/pluginapids.cpp b/src/DB_interfaces/api_db/pluginapids.cpp index 56538b2..fe36cf4 100755 --- a/src/DB_interfaces/api_db/pluginapids.cpp +++ b/src/DB_interfaces/api_db/pluginapids.cpp @@ -1803,7 +1803,7 @@ localstatus TPluginApiDS::apiSaveAdminData(bool aDataCommitted, bool aSessionFin TPartialItemState pp= fPartialItemState; if (pp==pi_state_save_incoming) pp= pi_state_loaded_incoming; // adapt them before if (pp==pi_state_save_outgoing) pp= pi_state_loaded_outgoing; - adminData+="\r\npartialitemstate:"; StringObjAppendPrintf( adminData,"%hd",pp ); + adminData+="\r\npartialitemstate:"; StringObjAppendPrintf( adminData,"%d",pp ); // - fLastItemStatus = status code (TSyError) of last item adminData+="\r\nlastitemstatus:"; StringObjAppendPrintf( adminData,"%hd",fLastItemStatus ); // - fLastSourceURI = item ID (string, if limited in length should be long enough for large IDs, >=64 chars recommended) diff --git a/src/platform_adapters/binfile.cpp b/src/platform_adapters/binfile.cpp index 60c93d6..38cc24e 100755 --- a/src/platform_adapters/binfile.cpp +++ b/src/platform_adapters/binfile.cpp @@ -102,8 +102,9 @@ bool TBinFile::platformTruncateFile(uInt32 aNewSize) #if defined(LINUX) || defined(MACOSX) fflush(fCBinFile); // unbuffer everything int fd = fileno(fCBinFile); // get file descriptor - if (ftruncate(fd,aNewSize)) + if (ftruncate(fd,aNewSize)) { ; // error ignored + } #elif defined(WIN32) fflush(fCBinFile); // unbuffer everything HANDLE h = (HANDLE)fileno(fCBinFile); // get file descriptor diff --git a/src/sysync/binfileimplds.cpp b/src/sysync/binfileimplds.cpp index 1a0d5d9..7871eab 100755 --- a/src/sysync/binfileimplds.cpp +++ b/src/sysync/binfileimplds.cpp @@ -2418,7 +2418,7 @@ localstatus TBinfileImplDS::SaveAdminData(bool aSessionFinished, bool aSuccessfu (long)pendingItemHeader.storedSize )); PDEBUGPRINTFX(DBG_ADMIN+DBG_DBAPI+DBG_DETAILS,( - "SaveAdminData: saved pending item: src='%s', targ='%s', laststatus=%hd, pistate=%hd, total=%ld, unconfirmed=%ld, stored=%ld", + "SaveAdminData: saved pending item: src='%s', targ='%s', laststatus=%hd, pistate=%d, total=%ld, unconfirmed=%ld, stored=%ld", pendingItemHeader.lastSourceURI, pendingItemHeader.lastTargetURI, pendingItemHeader.lastItemStatus, diff --git a/src/sysync/customimplds.cpp b/src/sysync/customimplds.cpp index 57b5bfb..1f7e64e 100755 --- a/src/sysync/customimplds.cpp +++ b/src/sysync/customimplds.cpp @@ -3463,7 +3463,7 @@ cAppCharP paramScan(cAppCharP aParams,cAppCharP aParamName, string &aValue) cAppCharP q,r; int nl,vl; bool quotedvalue=false; - if (!p) return false; + if (!p) return NULL; while (*p && *p==';') { // skip param intro p++; @@ -3838,7 +3838,7 @@ sInt16 TDBItemKey::getFidFor(cAppCharP aName, stringSize aNameSz) TItemField *TDBItemKey::getBaseFieldFromFid(sInt16 aFid) { - if (!fItemP) return false; // no item, no field is accessible + if (!fItemP) return NULL; // no item, no field is accessible return fCustomImplDS->getMappedBaseFieldOrVar(*fItemP, aFid); } // TDBItemKey::getBaseFieldFromFid diff --git a/src/sysync/debuglogger.cpp b/src/sysync/debuglogger.cpp index fbb694a..a562fd8 100755 --- a/src/sysync/debuglogger.cpp +++ b/src/sysync/debuglogger.cpp @@ -577,7 +577,10 @@ void TDebugLoggerBase::DebugOpenBlock(TDBG_LOCATION_PROTO cAppCharP aBlockName, { // we need a format and debug not completely off if (getMask() && aBlockName) { + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wformat-security" DebugOpenBlock(TDBG_LOCATION_ARG aBlockName,aBlockTitle,aCollapsed,NULL); + #pragma clang diagnostic pop } } // TDebugLoggerBase::DebugOpenBlock diff --git a/src/sysync/mimedirprofile.cpp b/src/sysync/mimedirprofile.cpp index 617294d..2c92532 100644 --- a/src/sysync/mimedirprofile.cpp +++ b/src/sysync/mimedirprofile.cpp @@ -4666,7 +4666,7 @@ bool TMimeDirProfileHandler::parseLevels( if (foundmandatory<aProfileP->numMandatoryProperties) { // not all mandatory properties found POBJDEBUGPRINTFX(getSession(),DBG_ERROR,( - "parseMimeDir: missing %hd of %hd mandatory properies", + "parseMimeDir: missing %d of %hd mandatory properies", aProfileP->numMandatoryProperties-foundmandatory, aProfileP->numMandatoryProperties )); diff --git a/src/sysync/rrules.cpp b/src/sysync/rrules.cpp index 98b6b2c..74c1162 100755 --- a/src/sysync/rrules.cpp +++ b/src/sysync/rrules.cpp @@ -405,7 +405,7 @@ bool internalToRRULE1( // show repetion before first day item if (!repshown) { repshown=true; - StringObjAppendPrintf(aString," %hd",j+1); + StringObjAppendPrintf(aString," %d",j+1); // - show if relative to beginning or end of month if (i>0) aString+='-'; else aString+='+'; } @@ -434,7 +434,7 @@ bool internalToRRULE1( // - show day numbers for (k=0; k<32; k++) { if (m & ((uInt64)1<<k)) { - StringObjAppendPrintf(aString," %hd",k+1); + StringObjAppendPrintf(aString," %d",k+1); // show if relative to the end if (i>0) aString+='-'; } @@ -528,7 +528,7 @@ bool internalToRRULE2( if (!repshown) { repshown=true; if (i>0) aString+='-'; - StringObjAppendPrintf(aString,"%hd",j+1); + StringObjAppendPrintf(aString,"%d",j+1); // - show if relative to beginning or end of month } // show day @@ -2042,7 +2042,7 @@ void appendMaskAsNumbers( aString+=aPrefix; aPrefix=","; // prefix for further elements is now colon. if (i>0) aString+='-'; - StringObjAppendPrintf(aString,"%hd",k+1); + StringObjAppendPrintf(aString,"%d",k+1); } } // - switch to those that are relative to the end of the month / year diff --git a/src/sysync/syncagent.cpp b/src/sysync/syncagent.cpp index e5dd514..1a173ae 100755 --- a/src/sysync/syncagent.cpp +++ b/src/sysync/syncagent.cpp @@ -1919,7 +1919,7 @@ bool TSyncAgent::ServerMessageStarted(SmlSyncHdrPtr_t aContentP, TStatusCommand )); // - abort session after too many auth failures if (fAuthFailures>=MAX_AUTH_ATTEMPTS) { - PDEBUGPRINTFX(DBG_ERROR,("Too many (>=%hd) failures, aborting session",MAX_AUTH_ATTEMPTS)); + PDEBUGPRINTFX(DBG_ERROR,("Too many (>=%d) failures, aborting session",MAX_AUTH_ATTEMPTS)); AbortSession(400,true); } #endif diff --git a/src/sysync/syncappbase.cpp b/src/sysync/syncappbase.cpp index 73c770d..c8d50c4 100755 --- a/src/sysync/syncappbase.cpp +++ b/src/sysync/syncappbase.cpp @@ -1861,8 +1861,9 @@ localstatus TSyncAppBase::readXMLConfigFile(cAppCharP aFilePath) #endif CONSOLEPRINTF(("- Config file read from '%s'",aFilePath)); #ifdef SYDEBUG - if (getRootConfig()->fDebugConfig.fSessionDebugLogs || getRootConfig()->fDebugConfig.fGlobalDebugLogs) + if (getRootConfig()->fDebugConfig.fSessionDebugLogs || getRootConfig()->fDebugConfig.fGlobalDebugLogs) { CONSOLEPRINTF(("- Debug log path: %s",getRootConfig()->fDebugConfig.fDebugInfoPath.c_str())); + } // signal where config came from fConfigFilePath=aFilePath; #endif diff --git a/src/sysync/timezones.cpp b/src/sysync/timezones.cpp index f6f82df..91bf6f1 100755 --- a/src/sysync/timezones.cpp +++ b/src/sysync/timezones.cpp @@ -1053,8 +1053,10 @@ timecontext_t SelectTZ( TDaylightSavingZone zone, int bias, int biasDST, lineart default : ok= true; } // switch - if (isDbg) PNCDEBUGPRINTFX( DBG_SESSION,( " %d %d dst=%d cond=%d '%s'", - i, bias, dst, tCond, tz[ i ].name.c_str() )); + if (isDbg) { + PNCDEBUGPRINTFX( DBG_SESSION,( " %d %d dst=%d cond=%d '%s'", + i, bias, dst, tCond, tz[ i ].name.c_str() )); + } if (ok) { // check, if european time zone ok= (zone==EDstEuropean) == (tz[ i ].name.find("Europe") != string::npos || @@ -1067,8 +1069,10 @@ timecontext_t SelectTZ( TDaylightSavingZone zone, int bias, int biasDST, lineart } // if } // for - if (isDbg) PNCDEBUGPRINTFX( DBG_SESSION,( "SelectTZ: zone=%s bias=%d", - tz[ t ].name.c_str(), bias ) ); + if (isDbg) { + PNCDEBUGPRINTFX( DBG_SESSION,( "SelectTZ: zone=%s bias=%d", + tz[ t ].name.c_str(), bias ) ); + } return TCTX_SYMBOLIC_TZ+t; } // SelectTZ @@ -1107,7 +1111,9 @@ static bool MyContext( timecontext_t &aContext, GZones* g ) // - call platform specific routine bool ok = getSystemTimeZoneContext( aContext, g ); - if (isDbg) PNCDEBUGPRINTFX( DBG_SESSION, ( "MyContext: %08X ok=%d", aContext, ok )); + if (isDbg) { + PNCDEBUGPRINTFX( DBG_SESSION, ( "MyContext: %08X ok=%d", aContext, ok )); + } // update cached system context if (g && ok) g->sysTZ= aContext; // assign the system context diff --git a/src/sysync_SDK/Sources/dbitem.cpp b/src/sysync_SDK/Sources/dbitem.cpp index 644bd42..d9ea264 100644 --- a/src/sysync_SDK/Sources/dbitem.cpp +++ b/src/sysync_SDK/Sources/dbitem.cpp @@ -837,8 +837,9 @@ TSyError TDBItem::LoadDB( bool withKey, cAppCharP aPrefix, void* aCB ) q= &ch; s= ""; while (true) { - if (fread( q, 1,1, f ) != 1) + if (fread( q, 1,1, f ) != 1) { ; // error ignored + } if (feof( f )) break; |