Kaydet (Commit) d866c3af authored tarafından Jochen Nitschke's avatar Jochen Nitschke

cppcheck invalidPrintfArgType

signedness and long vs int corrections

Change-Id: I67c6b9e05b16f5d8d4693879f1656db50dc7ec48
Reviewed-on: https://gerrit.libreoffice.org/29355Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJochen Nitschke <j.nitschke+logerrit@ok.de>
üst a9483f71
...@@ -545,7 +545,7 @@ void CBasic::printArray( LPSAFEARRAY val, BSTR message, VARTYPE type) ...@@ -545,7 +545,7 @@ void CBasic::printArray( LPSAFEARRAY val, BSTR message, VARTYPE type)
case VT_I4: case VT_I4:
case VT_ERROR: case VT_ERROR:
hr= SafeArrayGetElement( val, &i, (void*)&data); hr= SafeArrayGetElement( val, &i, (void*)&data);
sprintf( tmp, "%d \n", *(long*)&data); sprintf( tmp, "%ld \n", *(long*)&data);
break; break;
case VT_BSTR: case VT_BSTR:
hr= SafeArrayGetElement( val, &i, (void*)&data); hr= SafeArrayGetElement( val, &i, (void*)&data);
...@@ -803,15 +803,15 @@ void CBasic::printMulArray( SAFEARRAY* val, VARTYPE type) ...@@ -803,15 +803,15 @@ void CBasic::printMulArray( SAFEARRAY* val, VARTYPE type)
{ {
case VT_I4: case VT_I4:
hr= SafeArrayGetElement( val, index, &longVal); hr= SafeArrayGetElement( val, index, &longVal);
sprintf( tmpBuf, "(%d,%d): %d\n", index[1], index[0], longVal); sprintf( tmpBuf, "(%ld,%ld): %ld\n", index[1], index[0], longVal);
break; break;
case VT_UI1: case VT_UI1:
hr= SafeArrayGetElement( val, index, &longVal); hr= SafeArrayGetElement( val, index, &longVal);
sprintf( tmpBuf, "(%d,%d): %d\n", index[1], index[0], (unsigned char)longVal); sprintf( tmpBuf, "(%ld,%ld): %d\n", index[1], index[0], (unsigned char)longVal);
break; break;
case VT_VARIANT: case VT_VARIANT:
hr= SafeArrayGetElement( val, index, &var ); hr= SafeArrayGetElement( val, index, &var );
sprintf( tmpBuf, "(%d,%d): %d (vartype %d)\n", index[1], index[0], var.byref, var.vt); sprintf( tmpBuf, "(%ld,%ld): %d (vartype %d)\n", index[1], index[0], var.byref, var.vt);
break; break;
} }
strcat( buff,tmpBuf); strcat( buff,tmpBuf);
...@@ -852,16 +852,16 @@ void CBasic::printMulArray( SAFEARRAY* val, VARTYPE type) ...@@ -852,16 +852,16 @@ void CBasic::printMulArray( SAFEARRAY* val, VARTYPE type)
{ {
case VT_I4: case VT_I4:
hr= SafeArrayGetElement( val, index, &longVal); hr= SafeArrayGetElement( val, index, &longVal);
sprintf( tmpBuf, "(%d,%d,%d): %d\n", index[2], index[1], index[0], longVal); sprintf( tmpBuf, "(%ld,%ld,%ld): %ld\n", index[2], index[1], index[0], longVal);
break; break;
case VT_UI1: case VT_UI1:
hr= SafeArrayGetElement( val, index, &longVal); hr= SafeArrayGetElement( val, index, &longVal);
sprintf( tmpBuf, "(%d,%d,%d): %d\n", index[2], index[1], index[0], (unsigned char)longVal); sprintf( tmpBuf, "(%ld,%ld,%ld): %d\n", index[2], index[1], index[0], (unsigned char)longVal);
break; break;
case VT_VARIANT: case VT_VARIANT:
hr= SafeArrayGetElement( val, index, &var ); hr= SafeArrayGetElement( val, index, &var );
sprintf( tmpBuf, "(%d,%d,%d): %d (vartype %d)\n", index[2], index[1], index[0], var.byref, var.vt); sprintf( tmpBuf, "(%ld,%ld,%ld): %d (vartype %d)\n", index[2], index[1], index[0], var.byref, var.vt);
break; break;
} }
strcat( buff,tmpBuf); strcat( buff,tmpBuf);
......
...@@ -47,8 +47,8 @@ void trim(char * str) ...@@ -47,8 +47,8 @@ void trim(char * str)
void ddfLogProgress(DDFLOGLEVEL lvl, char * desc, unsigned int progress) void ddfLogProgress(DDFLOGLEVEL lvl, char * desc, unsigned int progress)
{ {
if (DdfVerb < lvl) return; if (DdfVerb < lvl) return;
if (progress == 0) printf(" %s: %3d%%", desc, progress); if (progress == 0) printf(" %s: %3u%%", desc, progress);
else if (progress > 0 && progress < 100) printf("\r %s: %3d%%", desc, progress); else if (progress > 0 && progress < 100) printf("\r %s: %3u%%", desc, progress);
else if (progress == 100) printf("\r %s: 100%%\n", desc); else if (progress == 100) printf("\r %s: 100%%\n", desc);
fflush(stdout); fflush(stdout);
} }
......
...@@ -481,7 +481,7 @@ unsigned int i; ...@@ -481,7 +481,7 @@ unsigned int i;
hash->size = (old_size << 1) + 1; hash->size = (old_size << 1) + 1;
/* we really should avoid to get there... so print a message to alert of the condition */ /* we really should avoid to get there... so print a message to alert of the condition */
fprintf(stderr, "resize hash %d -> %d\n", old_size, hash->size); fprintf(stderr, "resize hash %u -> %u\n", old_size, hash->size);
if(hash->size == old_size) if(hash->size == old_size)
{ {
hash->flags |= HASH_F_NO_RESIZE; hash->flags |= HASH_F_NO_RESIZE;
......
...@@ -2338,7 +2338,7 @@ int CreateT42FromTTGlyphs(TrueTypeFont *ttf, ...@@ -2338,7 +2338,7 @@ int CreateT42FromTTGlyphs(TrueTypeFont *ttf,
for (i = 1; i<nGlyphs; i++) { for (i = 1; i<nGlyphs; i++) {
fprintf(outf, "Encoding %d /glyph%u put\n", encoding[i], gID[i]); fprintf(outf, "Encoding %d /glyph%u put\n", encoding[i], gID[i]);
} }
fprintf(outf, "/XUID [103 0 1 16#%08X %d 16#%08X 16#%08X] def\n", (unsigned int)rtl_crc32(0, ttf->ptr, ttf->fsize), (unsigned int)nGlyphs, (unsigned int)rtl_crc32(0, glyphArray, nGlyphs * 2), (unsigned int)rtl_crc32(0, encoding, nGlyphs)); fprintf(outf, "/XUID [103 0 1 16#%08X %u 16#%08X 16#%08X] def\n", (unsigned int)rtl_crc32(0, ttf->ptr, ttf->fsize), (unsigned int)nGlyphs, (unsigned int)rtl_crc32(0, glyphArray, nGlyphs * 2), (unsigned int)rtl_crc32(0, encoding, nGlyphs));
DumpSfnts(outf, sfntP, sfntLen); DumpSfnts(outf, sfntP, sfntLen);
......
...@@ -175,7 +175,7 @@ STDMETHODIMP CAccTextBase::get_attributes(long offset, long * startOffset, long ...@@ -175,7 +175,7 @@ STDMETHODIMP CAccTextBase::get_attributes(long offset, long * startOffset, long
unsigned long nColor; unsigned long nColor;
pValue.Value >>= nColor; pValue.Value >>= nColor;
OLECHAR pBuf[64]; OLECHAR pBuf[64];
swprintf( pBuf, L"%08X", nColor ); swprintf( pBuf, L"%08lX", nColor );
pTemp[0]=L'#'; pTemp[0]=L'#';
wcscat( pTemp, pBuf ); wcscat( pTemp, pBuf );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment