From 01569b8f5f2394c534c3aba7276caf22493fce82 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Tue, 5 Mar 2019 15:57:50 -0800 Subject: Fixing some warnings by adding cast from 'int' to 'size_t' in memset, memcpy, etc. --- src/misc/bbl/bblif.c | 8 ++++---- src/misc/espresso/cofactor.c | 2 +- src/misc/espresso/compl.c | 4 ++-- src/misc/espresso/contain.c | 2 +- src/misc/espresso/cvrm.c | 4 ++-- src/misc/extra/extraUtilFile.c | 2 +- src/misc/extra/extraUtilMisc.c | 4 ++-- src/misc/extra/extraUtilReader.c | 2 +- src/misc/util/abc_global.h | 10 +++++----- src/misc/util/utilMem.c | 2 +- src/misc/util/utilSort.c | 6 +++--- src/misc/vec/vecFlt.h | 4 ++-- src/misc/vec/vecInt.h | 10 +++++----- src/misc/vec/vecPtr.h | 8 ++++---- src/misc/vec/vecStr.h | 8 ++++---- src/misc/vec/vecVec.h | 8 ++++---- src/misc/vec/vecWec.h | 12 ++++++------ src/misc/vec/vecWrd.h | 6 +++--- src/misc/zlib/deflate.c | 2 +- src/misc/zlib/gzwrite.c | 2 +- src/misc/zlib/zutil.h | 4 ++-- 21 files changed, 55 insertions(+), 55 deletions(-) (limited to 'src/misc') diff --git a/src/misc/bbl/bblif.c b/src/misc/bbl/bblif.c index 1f0dbaeb..8b315210 100644 --- a/src/misc/bbl/bblif.c +++ b/src/misc/bbl/bblif.c @@ -844,7 +844,7 @@ void Bbl_ManSortCubes( char ** pCubes, int nCubes, int nVars ) { best_i = i; for (j = i+1; j < nCubes; j++) - if ( memcmp( pCubes[j], pCubes[best_i], nVars ) < 0 ) + if ( memcmp( pCubes[j], pCubes[best_i], (size_t)nVars ) < 0 ) best_i = j; pTemp = pCubes[i]; pCubes[i] = pCubes[best_i]; pCubes[best_i] = pTemp; } @@ -871,7 +871,7 @@ char * Bbl_ManSortSop( char * pSop, int nVars ) if ( nCubes < 2 ) { pSopNew = BBLIF_ALLOC( char, Length + 1 ); - memcpy( pSopNew, pSop, Length + 1 ); + memcpy( pSopNew, pSop, (size_t)(Length + 1) ); return pSopNew; } pCubes = BBLIF_ALLOC( char *, nCubes ); @@ -881,7 +881,7 @@ char * Bbl_ManSortSop( char * pSop, int nVars ) Bbl_ManSortCubes( pCubes, nCubes, nVars ); pSopNew = BBLIF_ALLOC( char, Length + 1 ); for ( c = 0; c < nCubes; c++ ) - memcpy( pSopNew + c * (nVars + 3), pCubes[c], nVars + 3 ); + memcpy( pSopNew + c * (nVars + 3), pCubes[c], (size_t)(nVars + 3) ); BBLIF_FREE( pCubes ); pSopNew[nCubes * (nVars + 3)] = 0; return pSopNew; @@ -933,7 +933,7 @@ int Bbl_ManSopCheckUnique( Bbl_Man_t * p, char * pSop, int nVars, int nCubes, in pEnt = Bbl_VecEnt( p->pEnts, h ); pFnc = Bbl_VecFnc( p->pFncs, pEnt->iFunc ); assert( nVars == 16 || nCubes == 16 || pFnc->nWords == nWords ); - if ( pFnc->nWords == nWords && memcmp( pFnc->pWords, pSop, Length ) == 0 ) + if ( pFnc->nWords == nWords && memcmp( pFnc->pWords, pSop, (size_t)Length ) == 0 ) return pEnt->iFunc; } p->SopMap[nVars][nCubes] = Bbl_ManCreateEntry( p, iFunc, p->SopMap[nVars][nCubes] ); diff --git a/src/misc/espresso/cofactor.c b/src/misc/espresso/cofactor.c index fec36afd..04b211dd 100644 --- a/src/misc/espresso/cofactor.c +++ b/src/misc/espresso/cofactor.c @@ -372,7 +372,7 @@ pcube *T; (void) set_copy(cube.temp[0], T[0]); /* retrieve cofactor */ ncubes = CUBELISTSIZE(T); - qsort((char *) (T+2), ncubes, sizeof(pset), (int (*)()) d1_order); + qsort((char *) (T+2), (size_t)ncubes, sizeof(pset), (int (*)()) d1_order); Tdest = T+2; /* *Tdest++ = T[2]; */ diff --git a/src/misc/espresso/compl.c b/src/misc/espresso/compl.c index a17eb278..1f49577a 100644 --- a/src/misc/espresso/compl.c +++ b/src/misc/espresso/compl.c @@ -200,8 +200,8 @@ int lifting; /* whether to perform lifting or not */ /* Sort the arrays for a distance-1 merge */ (void) set_copy(cube.temp[0], cube.var_mask[var]); - qsort((char *) (L1 = sf_list(L)), L->count, sizeof(pset), (int (*)()) d1_order); - qsort((char *) (R1 = sf_list(R)), R->count, sizeof(pset), (int (*)()) d1_order); + qsort((char *) (L1 = sf_list(L)), (size_t)L->count, sizeof(pset), (int (*)()) d1_order); + qsort((char *) (R1 = sf_list(R)), (size_t)R->count, sizeof(pset), (int (*)()) d1_order); /* Perform distance-1 merge */ compl_d1merge(L1, R1); diff --git a/src/misc/espresso/contain.c b/src/misc/espresso/contain.c index e6073076..63eba8b2 100644 --- a/src/misc/espresso/contain.c +++ b/src/misc/espresso/contain.c @@ -342,7 +342,7 @@ IN int (*compare)(); *pdest = NULL; /* Sentinel -- never seen by sort */ /* Sort cubes by size */ - qsort((char *) A1, A->count, sizeof(pset), compare); + qsort((char *) A1, (size_t)A->count, sizeof(pset), compare); return A1; } diff --git a/src/misc/espresso/cvrm.c b/src/misc/espresso/cvrm.c index 2a573ae0..8fe4837d 100644 --- a/src/misc/espresso/cvrm.c +++ b/src/misc/espresso/cvrm.c @@ -161,7 +161,7 @@ int (*compare)(); FREE(count); /* use qsort to sort the array */ - qsort((char *) (F1 = sf_list(F)), F->count, sizeof(pcube), compare); + qsort((char *) (F1 = sf_list(F)), (size_t)F->count, sizeof(pcube), compare); F_sorted = sf_unlist(F1, F->count, F->sf_size); free_cover(F); @@ -189,7 +189,7 @@ IN pcover T; foreach_set(T, last, p) PUTSIZE(p, ((n - cdist(largest,p)) << 7) + MIN(set_ord(p),127)); - qsort((char *) (T1 = sf_list(T)), T->count, sizeof(pcube), (int (*)()) descend); + qsort((char *) (T1 = sf_list(T)), (size_t)T->count, sizeof(pcube), (int (*)()) descend); T_sorted = sf_unlist(T1, T->count, T->sf_size); free_cover(T); diff --git a/src/misc/extra/extraUtilFile.c b/src/misc/extra/extraUtilFile.c index 8f60f421..0af78ac4 100644 --- a/src/misc/extra/extraUtilFile.c +++ b/src/misc/extra/extraUtilFile.c @@ -808,7 +808,7 @@ void Extra_FileSort( char * pFileName, char * pFileNameOut ) Begin = i + 1; } // sort the lines - qsort( pLines, nLines, sizeof(char *), (int(*)(const void *,const void *))Extra_StringCompare ); + qsort( pLines, (size_t)nLines, sizeof(char *), (int(*)(const void *,const void *))Extra_StringCompare ); // write a new file pFile = fopen( pFileNameOut, "wb" ); for ( i = 0; i < nLines; i++ ) diff --git a/src/misc/extra/extraUtilMisc.c b/src/misc/extra/extraUtilMisc.c index 1b14e07f..db24a418 100644 --- a/src/misc/extra/extraUtilMisc.c +++ b/src/misc/extra/extraUtilMisc.c @@ -2493,7 +2493,7 @@ void Extra_NpnTest() // read functions pFuncs = Extra_NpnRead( "C:\\_projects\\abc\\_TEST\\allan\\lib6var5M.txt", nFuncs ); // pFuncs = Extra_NpnRead( "C:\\_projects\\abc\\_TEST\\allan\\lib6var5M_out_Total_minimal.txt", nFuncs ); - qsort( (void *)pFuncs, nFuncs, sizeof(word), (int(*)(const void *,const void *))CompareWords ); + qsort( (void *)pFuncs, (size_t)nFuncs, sizeof(word), (int(*)(const void *,const void *))CompareWords ); // count unique k = 1; @@ -2517,7 +2517,7 @@ void Extra_NpnTest() printf( "Finished deriving minimum form\n" ); /* // sort them by value - qsort( (void *)pFuncs, nFuncs, sizeof(word), (int(*)(const void *,const void *))CompareWords ); + qsort( (void *)pFuncs, (size_t)nFuncs, sizeof(word), (int(*)(const void *,const void *))CompareWords ); // count unique nUnique = nFuncs; for ( i = 1; i < nFuncs; i++ ) diff --git a/src/misc/extra/extraUtilReader.c b/src/misc/extra/extraUtilReader.c index 732402d4..db604396 100644 --- a/src/misc/extra/extraUtilReader.c +++ b/src/misc/extra/extraUtilReader.c @@ -369,7 +369,7 @@ void Extra_FileReaderReload( Extra_FileReader_t * p ) // figure out how many chars are still not processed nCharsUsed = p->pBufferEnd - p->pBufferCur; // move the remaining data to the beginning of the buffer - memmove( p->pBuffer, p->pBufferCur, nCharsUsed ); + memmove( p->pBuffer, p->pBufferCur, (size_t)nCharsUsed ); p->pBufferCur = p->pBuffer; // determine how many chars we will read nCharsToRead = EXTRA_MINIMUM( p->nBufferSize - nCharsUsed, p->nFileSize - p->nFileRead ); diff --git a/src/misc/util/abc_global.h b/src/misc/util/abc_global.h index c27b907e..28f0dd57 100644 --- a/src/misc/util/abc_global.h +++ b/src/misc/util/abc_global.h @@ -256,13 +256,13 @@ typedef ABC_INT64_T iword; #define ABC_PRMn(a,f) (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%10.3f MB ", 1.0*(f)/(1<<20))) #define ABC_PRMP(a,f,F) (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%10.3f MB (%6.2f %%)\n", (1.0*(f)/(1<<20)), ((F)? 100.0*(f)/(F) : 0.0) ) ) -#define ABC_ALLOC(type, num) ((type *) malloc(sizeof(type) * (num))) -#define ABC_CALLOC(type, num) ((type *) calloc((num), sizeof(type))) -#define ABC_FALLOC(type, num) ((type *) memset(malloc(sizeof(type) * (num)), 0xff, sizeof(type) * (num))) +#define ABC_ALLOC(type, num) ((type *) malloc(sizeof(type) * (size_t)(num))) +#define ABC_CALLOC(type, num) ((type *) calloc((size_t)(num), sizeof(type))) +#define ABC_FALLOC(type, num) ((type *) memset(malloc(sizeof(type) * (size_t)(num)), 0xff, sizeof(type) * (size_t)(num))) #define ABC_FREE(obj) ((obj) ? (free((char *) (obj)), (obj) = 0) : 0) #define ABC_REALLOC(type, obj, num) \ - ((obj) ? ((type *) realloc((char *)(obj), sizeof(type) * (num))) : \ - ((type *) malloc(sizeof(type) * (num)))) + ((obj) ? ((type *) realloc((char *)(obj), sizeof(type) * (size_t)(num))) : \ + ((type *) malloc(sizeof(type) * (size_t)(num)))) static inline int Abc_AbsInt( int a ) { return a < 0 ? -a : a; } static inline int Abc_MaxInt( int a, int b ) { return a > b ? a : b; } diff --git a/src/misc/util/utilMem.c b/src/misc/util/utilMem.c index 0bce119b..302d9008 100644 --- a/src/misc/util/utilMem.c +++ b/src/misc/util/utilMem.c @@ -153,7 +153,7 @@ static void Vec_MemSort( Vec_Mem_t * p, int (*Vec_MemSortCompare)() ) { if ( p->nSize < 2 ) return; - qsort( (void *)p->pArray, p->nSize, sizeof(void *), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(void *), (int (*)(const void *, const void *)) Vec_MemSortCompare ); } diff --git a/src/misc/util/utilSort.c b/src/misc/util/utilSort.c index 4dca700c..32154a7d 100644 --- a/src/misc/util/utilSort.c +++ b/src/misc/util/utilSort.c @@ -434,7 +434,7 @@ void Abc_SortTest() else { clk = Abc_Clock(); - qsort( (void *)pArray, nSize, sizeof(int), (int (*)(const void *, const void *)) Abc_SortNumCompare ); + qsort( (void *)pArray, (size_t)nSize, sizeof(int), (int (*)(const void *, const void *)) Abc_SortNumCompare ); Abc_PrintTime( 1, "Old sort", Abc_Clock() - clk ); // check for ( i = 1; i < nSize; i++ ) @@ -479,14 +479,14 @@ void Abc_QuickSort1( word * pData, int nSize, int fDecrease ) int i, fVerify = 0; if ( fDecrease ) { - qsort( (void *)pData, nSize, sizeof(word), (int (*)(const void *, const void *))Abc_QuickSort1CompareDec ); + qsort( (void *)pData, (size_t)nSize, sizeof(word), (int (*)(const void *, const void *))Abc_QuickSort1CompareDec ); if ( fVerify ) for ( i = 1; i < nSize; i++ ) assert( (unsigned)pData[i-1] >= (unsigned)pData[i] ); } else { - qsort( (void *)pData, nSize, sizeof(word), (int (*)(const void *, const void *))Abc_QuickSort1CompareInc ); + qsort( (void *)pData, (size_t)nSize, sizeof(word), (int (*)(const void *, const void *))Abc_QuickSort1CompareInc ); if ( fVerify ) for ( i = 1; i < nSize; i++ ) assert( (unsigned)pData[i-1] <= (unsigned)pData[i] ); diff --git a/src/misc/vec/vecFlt.h b/src/misc/vec/vecFlt.h index 9988deae..b5c5e498 100644 --- a/src/misc/vec/vecFlt.h +++ b/src/misc/vec/vecFlt.h @@ -807,10 +807,10 @@ static int Vec_FltSortCompare2( float * pp1, float * pp2 ) static inline void Vec_FltSort( Vec_Flt_t * p, int fReverse ) { if ( fReverse ) - qsort( (void *)p->pArray, p->nSize, sizeof(float), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(float), (int (*)(const void *, const void *)) Vec_FltSortCompare2 ); else - qsort( (void *)p->pArray, p->nSize, sizeof(float), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(float), (int (*)(const void *, const void *)) Vec_FltSortCompare1 ); } diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h index dd478a1c..76c0aca2 100644 --- a/src/misc/vec/vecInt.h +++ b/src/misc/vec/vecInt.h @@ -1381,20 +1381,20 @@ static int Vec_IntSortCompare2( int * pp1, int * pp2 ) static inline void Vec_IntSort( Vec_Int_t * p, int fReverse ) { if ( fReverse ) - qsort( (void *)p->pArray, p->nSize, sizeof(int), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(int), (int (*)(const void *, const void *)) Vec_IntSortCompare2 ); else - qsort( (void *)p->pArray, p->nSize, sizeof(int), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(int), (int (*)(const void *, const void *)) Vec_IntSortCompare1 ); } static inline void Vec_IntSortMulti( Vec_Int_t * p, int nMulti, int fReverse ) { assert( Vec_IntSize(p) % nMulti == 0 ); if ( fReverse ) - qsort( (void *)p->pArray, p->nSize/nMulti, nMulti*sizeof(int), + qsort( (void *)p->pArray, (size_t)(p->nSize/nMulti), nMulti*sizeof(int), (int (*)(const void *, const void *)) Vec_IntSortCompare2 ); else - qsort( (void *)p->pArray, p->nSize/nMulti, nMulti*sizeof(int), + qsort( (void *)p->pArray, (size_t)(p->nSize/nMulti), nMulti*sizeof(int), (int (*)(const void *, const void *)) Vec_IntSortCompare1 ); } @@ -1638,7 +1638,7 @@ static inline int Vec_IntSortCompareUnsigned( unsigned * pp1, unsigned * pp2 ) ***********************************************************************/ static inline void Vec_IntSortUnsigned( Vec_Int_t * p ) { - qsort( (void *)p->pArray, p->nSize, sizeof(int), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(int), (int (*)(const void *, const void *)) Vec_IntSortCompareUnsigned ); } diff --git a/src/misc/vec/vecPtr.h b/src/misc/vec/vecPtr.h index 015aa1be..3cdd25d6 100644 --- a/src/misc/vec/vecPtr.h +++ b/src/misc/vec/vecPtr.h @@ -910,10 +910,10 @@ static void Vec_PtrSort( Vec_Ptr_t * p, int (*Vec_PtrSortCompare)() ) if ( p->nSize < 2 ) return; if ( Vec_PtrSortCompare == NULL ) - qsort( (void *)p->pArray, p->nSize, sizeof(void *), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(void *), (int (*)(const void *, const void *)) Vec_PtrSortComparePtr ); else - qsort( (void *)p->pArray, p->nSize, sizeof(void *), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(void *), (int (*)(const void *, const void *)) Vec_PtrSortCompare ); } @@ -1067,7 +1067,7 @@ static inline void Vec_PtrDoubleSimInfo( Vec_Ptr_t * vInfo ) nWords = (unsigned *)Vec_PtrEntry(vInfo,1) - (unsigned *)Vec_PtrEntry(vInfo,0); vInfoNew = Vec_PtrAllocSimInfo( 2*Vec_PtrSize(vInfo), nWords ); // copy the simulation info - memcpy( Vec_PtrEntry(vInfoNew,0), Vec_PtrEntry(vInfo,0), Vec_PtrSize(vInfo) * nWords * 4 ); + memcpy( Vec_PtrEntry(vInfoNew,0), Vec_PtrEntry(vInfo,0), (size_t)(Vec_PtrSize(vInfo) * nWords * 4) ); // replace the array ABC_FREE( vInfo->pArray ); vInfo->pArray = vInfoNew->pArray; @@ -1099,7 +1099,7 @@ static inline void Vec_PtrReallocSimInfo( Vec_Ptr_t * vInfo ) vInfoNew = Vec_PtrAllocSimInfo( Vec_PtrSize(vInfo), 2*nWords ); // copy the simulation info for ( i = 0; i < vInfo->nSize; i++ ) - memcpy( Vec_PtrEntry(vInfoNew,i), Vec_PtrEntry(vInfo,i), nWords * 4 ); + memcpy( Vec_PtrEntry(vInfoNew,i), Vec_PtrEntry(vInfo,i), (size_t)(nWords * 4) ); // replace the array ABC_FREE( vInfo->pArray ); vInfo->pArray = vInfoNew->pArray; diff --git a/src/misc/vec/vecStr.h b/src/misc/vec/vecStr.h index ef5e9a41..8c8f7e6e 100644 --- a/src/misc/vec/vecStr.h +++ b/src/misc/vec/vecStr.h @@ -565,7 +565,7 @@ static inline void Vec_StrPushBuffer( Vec_Str_t * p, char * pBuffer, int nSize ) { if ( p->nSize + nSize > p->nCap ) Vec_StrGrow( p, 2 * (p->nSize + nSize) ); - memcpy( p->pArray + p->nSize, pBuffer, nSize ); + memcpy( p->pArray + p->nSize, pBuffer, (size_t)nSize ); p->nSize += nSize; } @@ -916,10 +916,10 @@ static int Vec_StrSortCompare2( char * pp1, char * pp2 ) static inline void Vec_StrSort( Vec_Str_t * p, int fReverse ) { if ( fReverse ) - qsort( (void *)p->pArray, p->nSize, sizeof(char), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(char), (int (*)(const void *, const void *)) Vec_StrSortCompare2 ); else - qsort( (void *)p->pArray, p->nSize, sizeof(char), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(char), (int (*)(const void *, const void *)) Vec_StrSortCompare1 ); } @@ -940,7 +940,7 @@ static inline int Vec_StrCompareVec( Vec_Str_t * p1, Vec_Str_t * p2 ) return (p1 != NULL) - (p2 != NULL); if ( Vec_StrSize(p1) != Vec_StrSize(p2) ) return Vec_StrSize(p1) - Vec_StrSize(p2); - return memcmp( Vec_StrArray(p1), Vec_StrArray(p2), Vec_StrSize(p1) ); + return memcmp( Vec_StrArray(p1), Vec_StrArray(p2), (size_t)Vec_StrSize(p1) ); } diff --git a/src/misc/vec/vecVec.h b/src/misc/vec/vecVec.h index 157b887c..1d90d11c 100644 --- a/src/misc/vec/vecVec.h +++ b/src/misc/vec/vecVec.h @@ -554,10 +554,10 @@ static int Vec_VecSortCompare2( Vec_Ptr_t ** pp1, Vec_Ptr_t ** pp2 ) static inline void Vec_VecSort( Vec_Vec_t * p, int fReverse ) { if ( fReverse ) - qsort( (void *)p->pArray, p->nSize, sizeof(void *), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(void *), (int (*)(const void *, const void *)) Vec_VecSortCompare2 ); else - qsort( (void *)p->pArray, p->nSize, sizeof(void *), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(void *), (int (*)(const void *, const void *)) Vec_VecSortCompare1 ); } @@ -603,10 +603,10 @@ static int Vec_VecSortCompare4( Vec_Int_t ** pp1, Vec_Int_t ** pp2 ) static inline void Vec_VecSortByFirstInt( Vec_Vec_t * p, int fReverse ) { if ( fReverse ) - qsort( (void *)p->pArray, p->nSize, sizeof(void *), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(void *), (int (*)(const void *, const void *)) Vec_VecSortCompare4 ); else - qsort( (void *)p->pArray, p->nSize, sizeof(void *), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(void *), (int (*)(const void *, const void *)) Vec_VecSortCompare3 ); } diff --git a/src/misc/vec/vecWec.h b/src/misc/vec/vecWec.h index c8c89701..e4c3d292 100644 --- a/src/misc/vec/vecWec.h +++ b/src/misc/vec/vecWec.h @@ -454,10 +454,10 @@ static int Vec_WecSortCompare2( Vec_Int_t * p1, Vec_Int_t * p2 ) static inline void Vec_WecSort( Vec_Wec_t * p, int fReverse ) { if ( fReverse ) - qsort( (void *)p->pArray, p->nSize, sizeof(Vec_Int_t), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(Vec_Int_t), (int (*)(const void *, const void *)) Vec_WecSortCompare2 ); else - qsort( (void *)p->pArray, p->nSize, sizeof(Vec_Int_t), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(Vec_Int_t), (int (*)(const void *, const void *)) Vec_WecSortCompare1 ); } @@ -492,10 +492,10 @@ static int Vec_WecSortCompare4( Vec_Int_t * p1, Vec_Int_t * p2 ) static inline void Vec_WecSortByFirstInt( Vec_Wec_t * p, int fReverse ) { if ( fReverse ) - qsort( (void *)p->pArray, p->nSize, sizeof(Vec_Int_t), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(Vec_Int_t), (int (*)(const void *, const void *)) Vec_WecSortCompare4 ); else - qsort( (void *)p->pArray, p->nSize, sizeof(Vec_Int_t), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(Vec_Int_t), (int (*)(const void *, const void *)) Vec_WecSortCompare3 ); } @@ -529,10 +529,10 @@ static int Vec_WecSortCompare6( Vec_Int_t * p1, Vec_Int_t * p2 ) static inline void Vec_WecSortByLastInt( Vec_Wec_t * p, int fReverse ) { if ( fReverse ) - qsort( (void *)p->pArray, p->nSize, sizeof(Vec_Int_t), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(Vec_Int_t), (int (*)(const void *, const void *)) Vec_WecSortCompare6 ); else - qsort( (void *)p->pArray, p->nSize, sizeof(Vec_Int_t), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(Vec_Int_t), (int (*)(const void *, const void *)) Vec_WecSortCompare5 ); } diff --git a/src/misc/vec/vecWrd.h b/src/misc/vec/vecWrd.h index d286baf3..eb0c137c 100644 --- a/src/misc/vec/vecWrd.h +++ b/src/misc/vec/vecWrd.h @@ -1084,10 +1084,10 @@ static int Vec_WrdSortCompare2( word * pp1, word * pp2 ) static inline void Vec_WrdSort( Vec_Wrd_t * p, int fReverse ) { if ( fReverse ) - qsort( (void *)p->pArray, p->nSize, sizeof(word), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(word), (int (*)(const void *, const void *)) Vec_WrdSortCompare2 ); else - qsort( (void *)p->pArray, p->nSize, sizeof(word), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(word), (int (*)(const void *, const void *)) Vec_WrdSortCompare1 ); } @@ -1171,7 +1171,7 @@ static int Vec_WrdSortCompareUnsigned( word * pp1, word * pp2 ) ***********************************************************************/ static inline void Vec_WrdSortUnsigned( Vec_Wrd_t * p ) { - qsort( (void *)p->pArray, p->nSize, sizeof(word), + qsort( (void *)p->pArray, (size_t)p->nSize, sizeof(word), (int (*)(const void *, const void *)) Vec_WrdSortCompareUnsigned ); } diff --git a/src/misc/zlib/deflate.c b/src/misc/zlib/deflate.c index 04dcbf09..934196c8 100644 --- a/src/misc/zlib/deflate.c +++ b/src/misc/zlib/deflate.c @@ -1232,7 +1232,7 @@ local void check_match(deflate_state *s, IPos start, IPos match, int length) { /* check that the match is indeed a match */ if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { + s->window + start, (size_t)length) != EQUAL) { fprintf(stderr, " start %u, match %u, length %d\n", start, match, length); do { diff --git a/src/misc/zlib/gzwrite.c b/src/misc/zlib/gzwrite.c index 44e116de..19015b44 100644 --- a/src/misc/zlib/gzwrite.c +++ b/src/misc/zlib/gzwrite.c @@ -128,7 +128,7 @@ local int gz_zero(gz_statep state, z_off64_t len) n = GT_OFF(state->size) || (z_off64_t)state->size > len ? (unsigned)len : state->size; if (first) { - memset(state->in, 0, n); + memset(state->in, 0, (size_t)n); first = 0; } strm->avail_in = n; diff --git a/src/misc/zlib/zutil.h b/src/misc/zlib/zutil.h index ad5dc411..26e37f31 100644 --- a/src/misc/zlib/zutil.h +++ b/src/misc/zlib/zutil.h @@ -239,11 +239,11 @@ ABC_NAMESPACE_HEADER_START # ifdef SMALL_MEDIUM /* MSDOS small or medium model */ # define zmemcpy _fmemcpy # define zmemcmp _fmemcmp -# define zmemzero(dest, len) _fmemset(dest, 0, len) +# define zmemzero(dest, len) _fmemset(dest, 0, (size_t)len) # else # define zmemcpy memcpy # define zmemcmp memcmp -# define zmemzero(dest, len) memset(dest, 0, len) +# define zmemzero(dest, len) memset(dest, 0, (size_t)len) # endif #else void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); -- cgit v1.2.3