From ac74e6951703282f444de956afecf379243e31bd Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Mon, 8 Dec 2025 18:01:56 -0600 Subject: [PATCH] reduce compiler warnings --- .../System.Globalization.Native/pal_icushim_static.c | 9 +++++---- src/native/libs/System.Native/pal_networking.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/native/libs/System.Globalization.Native/pal_icushim_static.c b/src/native/libs/System.Globalization.Native/pal_icushim_static.c index 54560d29049981..011f7adb7e97c2 100644 --- a/src/native/libs/System.Globalization.Native/pal_icushim_static.c +++ b/src/native/libs/System.Globalization.Native/pal_icushim_static.c @@ -83,7 +83,7 @@ int32_t mono_wasi_load_icu_data(const void* pData) static int32_t load_icu_data(const void* pData) { - UErrorCode status = 0; + UErrorCode status = U_ZERO_ERROR; udata_setCommonData(pData, &status); if (U_FAILURE(status)) @@ -108,6 +108,7 @@ static const char * cstdlib_load_icu_data(const char *path) { char *file_buf = NULL; + long file_buf_size = 0; FILE *fp = fopen(path, "rb"); if (fp == NULL) @@ -122,7 +123,7 @@ cstdlib_load_icu_data(const char *path) goto error; } - long file_buf_size = ftell(fp); + file_buf_size = ftell(fp); if (file_buf_size == -1) { @@ -130,7 +131,7 @@ cstdlib_load_icu_data(const char *path) goto error; } - file_buf = malloc(sizeof(char) * (unsigned long)(file_buf_size + 1)); + file_buf = (char*)malloc(sizeof(char) * (unsigned long)(file_buf_size + 1)); if (file_buf == NULL) { @@ -223,7 +224,7 @@ int32_t GlobalizationNative_LoadICU(void) } #endif - UErrorCode status = 0; + UErrorCode status = U_ZERO_ERROR; UVersionInfo version; // Request the CLDR version to perform basic ICU initialization and find out // whether it worked. diff --git a/src/native/libs/System.Native/pal_networking.c b/src/native/libs/System.Native/pal_networking.c index 3b460d4c4e8296..14dd8569c17284 100644 --- a/src/native/libs/System.Native/pal_networking.c +++ b/src/native/libs/System.Native/pal_networking.c @@ -3635,6 +3635,7 @@ int32_t SystemNative_SendFile(intptr_t out_fd, intptr_t in_fd, int64_t offset, i // Emulate sendfile using a simple read/send loop. *sent = 0; char* buffer = NULL; + size_t bufferLength = Min((size_t)count, 80 * 1024 * sizeof(char)); // Save the original input file position and seek to the offset position off_t inputFileOrigOffset = lseek(infd, 0, SEEK_CUR); @@ -3644,7 +3645,6 @@ int32_t SystemNative_SendFile(intptr_t out_fd, intptr_t in_fd, int64_t offset, i } // Allocate a buffer - size_t bufferLength = Min((size_t)count, 80 * 1024 * sizeof(char)); buffer = (char*)malloc(bufferLength); if (buffer == NULL) {