diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2014-09-02 06:13:27 -0700 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2014-09-04 17:27:16 +0200 |
commit | 9279b2a9a89f116d8d110e7ea134d999d6640342 (patch) | |
tree | c620311741ec5efdc9f81198998a5c9d54d18b39 | |
parent | e8840880181024ccb77ba35f257def823885010e (diff) |
avoid assumptions about MemSize_t type
Some code only compiles cleanly when MemSize_t is signed. Otherwise there are
signed/unsigned comparison and printf format warnings. Avoid those by casting
the values which are known to be positive to MemSize_t or long in debug
output.
-rw-r--r-- | src/sysync/localengineds.cpp | 2 | ||||
-rwxr-xr-x | src/sysync/syncagent.cpp | 2 | ||||
-rwxr-xr-x | src/sysync/synccommand.cpp | 4 | ||||
-rwxr-xr-x | src/sysync/syncitemtype.cpp | 6 |
4 files changed, 7 insertions, 7 deletions
diff --git a/src/sysync/localengineds.cpp b/src/sysync/localengineds.cpp index 7e64388..ca9dc36 100644 --- a/src/sysync/localengineds.cpp +++ b/src/sysync/localengineds.cpp @@ -4794,7 +4794,7 @@ TSyncOpCommand *TLocalEngineDS::newSyncOpCommand( if (itemP && fSessionP->fMaxOutgoingObjSize) { if (itemP->data && itemP->data->content && itemP->data->length) { // there is data, check if size is ok - if (itemP->data->length > fSessionP->fMaxOutgoingObjSize) { + if (itemP->data->length > (MemSize_t)fSessionP->fMaxOutgoingObjSize) { // too large, suppress it PDEBUGPRINTFX(DBG_ERROR,( "WARNING: outgoing item is larger (%ld) than MaxObjSize (%ld) of remote -> suppress now/mark for resend", diff --git a/src/sysync/syncagent.cpp b/src/sysync/syncagent.cpp index 8e85bca..25441c5 100755 --- a/src/sysync/syncagent.cpp +++ b/src/sysync/syncagent.cpp @@ -2475,7 +2475,7 @@ void TSyncAgent::getBufferedAnswer(MemPtr_t &aAnswer, MemSize_t &aAnswerSize) aAnswerSize=fBufferedAnswerSize; PDEBUGPRINTFX(DBG_HOT,( "Buffered answer read from session: %ld bytes", - fBufferedAnswerSize + (long)fBufferedAnswerSize )); } // TSyncAgent::getBufferedAnswer diff --git a/src/sysync/synccommand.cpp b/src/sysync/synccommand.cpp index c37e9d3..8896037 100755 --- a/src/sysync/synccommand.cpp +++ b/src/sysync/synccommand.cpp @@ -1992,7 +1992,7 @@ TSmlCommand *TSyncOpCommand::splitCommand(sInt32 aReduceByBytes) canSplit() && // remote can handle large objects (that is: chunked transfers) dataP && // there is data dataP->contentType!=SML_PCDATA_EXTENSION && // it's not an extension - dataP->length > aReduceByBytes+MIN_SPLIT_DATA // remaining length of first part is large enough to make splitting worth doing now + dataP->length > (MemSize_t)aReduceByBytes+MIN_SPLIT_DATA // remaining length of first part is large enough to make splitting worth doing now ) { // split within this item // Prepare original item @@ -2244,7 +2244,7 @@ localstatus TSyncOpCommand::AddNextChunk(SmlItemPtr_t aNextChunkItem, TSyncOpCom return 424; // bad size string: size mismatch } // - check for size match - if (incompleteitem->data->length != expectedSize) { + if (incompleteitem->data->length != (MemSize_t)expectedSize) { // check if size mismatch could be due to duplicate transmit of unconfirmed data if (fUnconfirmedSize == uInt32(incompleteitem->data->length - expectedSize)) { // size mismatch is exactly what could be caused by duplicate transmit diff --git a/src/sysync/syncitemtype.cpp b/src/sysync/syncitemtype.cpp index 14e1fbc..755220e 100755 --- a/src/sysync/syncitemtype.cpp +++ b/src/sysync/syncitemtype.cpp @@ -830,9 +830,9 @@ SmlItemPtr_t TSyncItemType::newSmlItem( #ifdef SYDEBUG POBJDEBUGPRINTFX(fSessionP,DBG_DATA,( "zippedbindata item statistics: raw=%ld, compressed=%ld, compressed down to %ld%%", - expandedSize, - smlitemP->data->length, - smlitemP->data->length*100/expandedSize + (long)expandedSize, + (long)smlitemP->data->length, + (long)smlitemP->data->length*100/expandedSize )); fRawDataBytes+=expandedSize; fZippedDataBytes+=smlitemP->data->length; |