Fixed various const warnings

This commit is contained in:
Armin Novak 2022-02-01 11:06:22 +01:00 committed by akallabeth
parent a40467b3b0
commit 10e40147fb
9 changed files with 19 additions and 19 deletions

View File

@ -53,7 +53,7 @@ extern "C"
typedef struct crypto_cert_struct* CryptoCert;
FREERDP_API CryptoCert crypto_cert_read(BYTE* data, UINT32 length);
FREERDP_API CryptoCert crypto_cert_read(const BYTE* data, UINT32 length);
FREERDP_API BYTE* crypto_cert_hash(X509* xcert, const char* hash, UINT32* length);
FREERDP_API char* crypto_cert_fingerprint_by_hash(X509* xcert, const char* hash);
FREERDP_API char* crypto_cert_fingerprint_by_hash_ex(X509* xcert, const char* hash,

View File

@ -368,7 +368,8 @@ int zgfx_decompress(ZGFX_CONTEXT* zgfx, const BYTE* pSrcData, UINT32 SrcSize, BY
{
int status = -1;
BYTE descriptor;
wStream* stream = Stream_New((BYTE*)pSrcData, SrcSize);
wStream sbuffer = { 0 };
wStream* stream = Stream_StaticConstInit(&sbuffer, pSrcData, SrcSize);
if (!stream)
return -1;
@ -448,7 +449,6 @@ int zgfx_decompress(ZGFX_CONTEXT* zgfx, const BYTE* pSrcData, UINT32 SrcSize, BY
status = 1;
fail:
Stream_Free(stream, FALSE);
return status;
}

View File

@ -1439,7 +1439,7 @@ int rdp_server_transition_to_state(rdpRdp* rdp, CONNECTION_STATE state)
{
int status = 0;
freerdp_peer* client = NULL;
const int cstate = rdp_get_state(rdp);
const CONNECTION_STATE cstate = rdp_get_state(rdp);
if (cstate >= CONNECTION_STATE_RDP_SECURITY_COMMENCEMENT)
client = rdp->context->peer;

View File

@ -29,7 +29,7 @@
#define TAG FREERDP_TAG("crypto")
CryptoCert crypto_cert_read(BYTE* data, UINT32 length)
CryptoCert crypto_cert_read(const BYTE* data, UINT32 length)
{
CryptoCert cert = malloc(sizeof(*cert));

View File

@ -37,8 +37,8 @@ extern "C"
WINPR_API void winpr_HexDump(const char* tag, UINT32 lvl, const BYTE* data, size_t length);
WINPR_API void winpr_HexLogDump(wLog* log, UINT32 lvl, const BYTE* data, size_t length);
WINPR_API void winpr_CArrayDump(const char* tag, UINT32 lvl, const BYTE* data, int length,
int width);
WINPR_API void winpr_CArrayDump(const char* tag, UINT32 lvl, const BYTE* data, size_t length,
size_t width);
WINPR_API char* winpr_BinToHexString(const BYTE* data, size_t length, BOOL space);
WINPR_API size_t winpr_BinToHexStringBuffer(const BYTE* data, size_t length, char* dstStr,

View File

@ -61,8 +61,8 @@ extern "C"
WINPR_API size_t _wcslen(const WCHAR* str);
WINPR_API size_t _wcsnlen(const WCHAR* str, size_t maxNumberOfElements);
WINPR_API WCHAR* _wcschr(const WCHAR* str, WCHAR c);
WINPR_API WCHAR* _wcsrchr(const WCHAR* str, WCHAR c);
WINPR_API const WCHAR* _wcschr(const WCHAR* str, WCHAR c);
WINPR_API const WCHAR* _wcsrchr(const WCHAR* str, WCHAR c);
WINPR_API char* strtok_s(char* strToken, const char* strDelimit, char** context);
WINPR_API WCHAR* wcstok_s(WCHAR* strToken, const WCHAR* strDelimit, WCHAR** context);

View File

@ -130,7 +130,7 @@ size_t _wcsnlen(const WCHAR* str, size_t max)
/* _wcschr -> wcschr */
WCHAR* _wcschr(const WCHAR* str, WCHAR c)
const WCHAR* _wcschr(const WCHAR* str, WCHAR c)
{
const WCHAR* p = (const WCHAR*)str;
WCHAR value;
@ -139,12 +139,12 @@ WCHAR* _wcschr(const WCHAR* str, WCHAR c)
while (*p && (*p != value))
p++;
return ((*p == value) ? (WCHAR*)p : NULL);
return ((*p == value) ? p : NULL);
}
/* _wcsrchr -> wcsrchr */
WCHAR* _wcsrchr(const WCHAR* str, WCHAR c)
const WCHAR* _wcsrchr(const WCHAR* str, WCHAR c)
{
const WCHAR* p;
WCHAR ch;
@ -156,7 +156,7 @@ WCHAR* _wcsrchr(const WCHAR* str, WCHAR c)
if (ch == c)
p = (const WCHAR*)str;
return (WCHAR*)p;
return p;
}
char* strtok_s(char* strToken, const char* strDelimit, char** context)

View File

@ -353,7 +353,8 @@ static int winpr_image_bitmap_read_buffer(wImage* image, const BYTE* buffer, siz
BYTE* pDstData;
WINPR_BITMAP_FILE_HEADER bf;
WINPR_BITMAP_INFO_HEADER bi;
wStream* s = Stream_New((BYTE*)buffer, size);
wStream sbuffer = { 0 };
wStream* s = Stream_StaticConstInit(&sbuffer, buffer, size);
if (!s)
return -1;
@ -419,7 +420,6 @@ fail:
image->data = NULL;
}
Stream_Free(s, FALSE);
return rc;
}

View File

@ -131,11 +131,11 @@ fail:
free(buffer);
}
void winpr_CArrayDump(const char* tag, UINT32 level, const BYTE* data, int length, int width)
void winpr_CArrayDump(const char* tag, UINT32 level, const BYTE* data, size_t length, size_t width)
{
const BYTE* p = data;
int i, line, offset = 0;
const size_t llen = ((length > width) ? width : length) * 4 + 1;
size_t i, offset = 0;
const size_t llen = ((length > width) ? width : length) * 4ull + 1ull;
size_t pos;
char* buffer = malloc(llen);
@ -147,7 +147,7 @@ void winpr_CArrayDump(const char* tag, UINT32 level, const BYTE* data, int lengt
while (offset < length)
{
line = length - offset;
size_t line = length - offset;
if (line > width)
line = width;