[0.4.9][MSWSOCK] Fix 3 MSVC2010SP1 x86 dbg warnings C4146 CORE-18104

can be observed with MSVC 2010SP1 (16.0.40219.1) x86 target in dbg configuation:
C:\047rls\reactos\dll\win32\mswsock\mswhelper.c(264) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\047rls\reactos\dll\win32\mswsock\mswhelper.c(280) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
C:\047rls\reactos\dll\win32\mswsock\mswhelper.c(326) : warning C4146: unary minus operator applied to unsigned type, result still unsigned

Fix is a partial pick of 0.4.10-dev-409-g 0f8439aa71

No warnings left in this module.
This commit is contained in:
Joachim Henze 2022-03-27 17:12:05 +02:00
parent f2df2af002
commit ca4c076210

View file

@ -108,7 +108,7 @@ mswBufferAppendLst(_Inout_ PMSW_BUFFER mswBuf,
{ {
DWORD lstItemCount; DWORD lstItemCount;
DWORD lstByteSize; DWORD lstByteSize;
DWORD lstDataPos; DWORD_PTR lstDataPos;
DWORD i1; DWORD i1;
UINT_PTR *ptrSrcLstPos; UINT_PTR *ptrSrcLstPos;
@ -129,7 +129,7 @@ mswBufferAppendLst(_Inout_ PMSW_BUFFER mswBuf,
/* calculate position for the data of the first item */ /* calculate position for the data of the first item */
lstDataPos = ((lstItemCount + 1) * sizeof(UINT_PTR)) + lstDataPos = ((lstItemCount + 1) * sizeof(UINT_PTR)) +
(DWORD)mswBufferEndPtr(mswBuf); (DWORD_PTR)mswBufferEndPtr(mswBuf);
/* add ptrofs */ /* add ptrofs */
lstDataPos += ptrofs; lstDataPos += ptrofs;
@ -164,7 +164,7 @@ mswBufferAppendStrLstA(_Inout_ PMSW_BUFFER mswBuf,
DWORD lstItemLen[MAX_ARRAY_SIZE]; DWORD lstItemLen[MAX_ARRAY_SIZE];
DWORD lstItemCount; DWORD lstItemCount;
DWORD lstByteSize; DWORD lstByteSize;
DWORD lstDataPos; DWORD_PTR lstDataPos;
DWORD lstDataSize; DWORD lstDataSize;
DWORD i1; DWORD i1;
UINT_PTR *ptrSrcLstPos; UINT_PTR *ptrSrcLstPos;
@ -194,7 +194,7 @@ mswBufferAppendStrLstA(_Inout_ PMSW_BUFFER mswBuf,
/* calculate position for the data of the first item */ /* calculate position for the data of the first item */
lstDataPos = ((lstItemCount + 1) * sizeof(UINT_PTR)) + lstDataPos = ((lstItemCount + 1) * sizeof(UINT_PTR)) +
(DWORD)mswBufferEndPtr(mswBuf); (DWORD_PTR)mswBufferEndPtr(mswBuf);
/* add ptrofs */ /* add ptrofs */
lstDataPos += ptrofs; lstDataPos += ptrofs;
@ -261,7 +261,7 @@ mswBufferAppendBlob_Hostent(_Inout_ PMSW_BUFFER mswBuf,
{ {
if (!mswBufferAppendStrLstA(mswBuf, if (!mswBufferAppendStrLstA(mswBuf,
(void**)hostAliasesA, (void**)hostAliasesA,
-(DWORD)bytesOfs)) -(LONG_PTR)bytesOfs))
return FALSE; return FALSE;
} }
else else
@ -277,7 +277,7 @@ mswBufferAppendBlob_Hostent(_Inout_ PMSW_BUFFER mswBuf,
phe->h_addr_list = (char**)(mswBufferEndPtr(mswBuf) - bytesOfs); phe->h_addr_list = (char**)(mswBufferEndPtr(mswBuf) - bytesOfs);
if (!mswBufferAppendLst(mswBuf, lst, 4, -(DWORD)bytesOfs)) if (!mswBufferAppendLst(mswBuf, lst, 4, -(LONG_PTR)bytesOfs))
return FALSE; return FALSE;
/* name */ /* name */
@ -323,7 +323,7 @@ mswBufferAppendBlob_Servent(_Inout_ PMSW_BUFFER mswBuf,
{ {
if (!mswBufferAppendStrLstA(mswBuf, if (!mswBufferAppendStrLstA(mswBuf,
(void**)serviceAliasesA, (void**)serviceAliasesA,
-(DWORD)bytesOfs)) -(LONG_PTR)bytesOfs))
return FALSE; return FALSE;
} }
else else
@ -484,8 +484,8 @@ WCHAR*
StrCpyHeapAllocW(_In_opt_ HANDLE hHeap, StrCpyHeapAllocW(_In_opt_ HANDLE hHeap,
_In_ WCHAR* wStr) _In_ WCHAR* wStr)
{ {
int chLen; size_t chLen;
int bLen; size_t bLen;
WCHAR* resW; WCHAR* resW;
if (wStr == NULL) if (wStr == NULL)
@ -507,8 +507,8 @@ char*
StrCpyHeapAllocA(_In_opt_ HANDLE hHeap, StrCpyHeapAllocA(_In_opt_ HANDLE hHeap,
_In_ char* aStr) _In_ char* aStr)
{ {
int chLen; size_t chLen;
int bLen; size_t bLen;
char* resA; char* resA;
if (aStr == NULL) if (aStr == NULL)
@ -534,8 +534,8 @@ StrAryCpyHeapAllocA(_In_opt_ HANDLE hHeap,
char** aDstPtr; char** aDstPtr;
char* aDstNextStr; char* aDstNextStr;
DWORD aStrByteLen[MAX_ARRAY_SIZE]; DWORD aStrByteLen[MAX_ARRAY_SIZE];
int bLen; size_t bLen;
int bItmLen; size_t bItmLen;
int aCount; int aCount;
int i1; int i1;
char** resA; char** resA;
@ -581,7 +581,7 @@ StrAryCpyHeapAllocA(_In_opt_ HANDLE hHeap,
*aDstPtr = aDstNextStr; *aDstPtr = aDstNextStr;
RtlCopyMemory(*aDstPtr, *aSrcPtr, bItmLen); RtlCopyMemory(*aDstPtr, *aSrcPtr, bItmLen);
aDstNextStr = (char*)((DWORD)aDstNextStr + (DWORD)bItmLen); aDstNextStr = (char*)((DWORD_PTR)aDstNextStr + (DWORD)bItmLen);
aDstPtr++; aDstPtr++;
aSrcPtr++; aSrcPtr++;
} }
@ -671,7 +671,7 @@ StrAryCpyHeapAllocWToA(_In_opt_ HANDLE hHeap,
RtlCopyMemory(*aDstPtr, aStr, bItmLen); RtlCopyMemory(*aDstPtr, aStr, bItmLen);
HeapFree(hHeap, 0, aStr); HeapFree(hHeap, 0, aStr);
aDstNextStr = (char*)((DWORD)aDstNextStr + (DWORD)bItmLen); aDstNextStr = (char*)((DWORD_PTR)aDstNextStr + (DWORD)bItmLen);
aDstPtr++; aDstPtr++;
wSrcPtr++; wSrcPtr++;
} }