Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/mono/cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#pragma warning(disable:4090) // const problem
#pragma warning(disable:4146) // unary minus operator applied to unsigned type, result still unsigned
#pragma warning(disable:4244) // integer conversion, possible loss of data
#pragma warning(disable:4267) // integer conversion, possible loss of data

// promote warnings to errors
#pragma warning( error:4013) // function undefined; assuming extern returning int
Expand Down
16 changes: 8 additions & 8 deletions src/mono/mono/component/debugger-agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ is_debugger_thread (void)
if (!internal)
return FALSE;

return internal->debugger_thread ? TRUE : FALSE;
return internal->debugger_thread;
}

static int
Expand Down Expand Up @@ -1398,13 +1398,13 @@ transport_handshake (void)
sprintf (handshake_msg, "DWP-Handshake");

do {
res = transport_send (handshake_msg, (int)strlen (handshake_msg));
res = transport_send (handshake_msg, strlen (handshake_msg));
} while (res == -1 && get_last_sock_error () == MONO_EINTR);

g_assert (res != -1);

/* Read answer */
res = transport_recv (buf, (int)strlen (handshake_msg));
res = transport_recv (buf, strlen (handshake_msg));
if ((res != strlen (handshake_msg)) || (memcmp (buf, handshake_msg, strlen (handshake_msg)) != 0)) {
PRINT_ERROR_MSG ("debugger-agent: DWP handshake failed.\n");
return FALSE;
Expand Down Expand Up @@ -1619,7 +1619,7 @@ mono_init_debugger_agent_for_wasm (int log_level_parm, MonoProfilerHandle *prof)
mono_profiler_set_jit_done_callback (*prof, jit_done);
}

void
void
mono_change_log_level (int new_log_level)
{
log_level = new_log_level;
Expand Down Expand Up @@ -6982,7 +6982,7 @@ vm_commands (int command, int id, guint8 *p, guint8 *end, Buffer *buf)
break;
}
case MDBGPROT_CMD_GET_ASSEMBLY_BY_NAME: {
size_t i;
int i;
char* assembly_name = decode_string (p, &p, end);
//we get 'foo.dll' but mono_assembly_load expects 'foo' so we strip the last dot
char *lookup_name = g_strdup (assembly_name);
Expand Down Expand Up @@ -8912,8 +8912,8 @@ thread_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
buffer_add_int (buf, 0);
} else {
const size_t len = strlen (s);
buffer_add_int (buf, (guint32)len);
buffer_add_data (buf, (guint8*)s, (uint32_t)len);
buffer_add_int (buf, len);
buffer_add_data (buf, (guint8*)s, len);
g_free (s);
}
break;
Expand Down Expand Up @@ -9717,7 +9717,7 @@ object_commands (int command, guint8 *p, guint8 *end, Buffer *buf)

/* TODO: metadata-update: implement support for added fields. */
g_assert (!m_field_is_from_update (f));

if (f->type->attrs & FIELD_ATTRIBUTE_STATIC) {
guint8 *val;
MonoVTable *vtable;
Expand Down
4 changes: 2 additions & 2 deletions src/mono/mono/component/hot_reload.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ table_info_find_in_base (const MonoTableInfo *table, MonoImage **base_out, int *

if (tbl_index) {
size_t s = ALIGN_TO (sizeof (MonoTableInfo), sizeof (gpointer));
*tbl_index = (int)(((intptr_t) table - (intptr_t) base->tables) / s);
*tbl_index = ((intptr_t) table - (intptr_t) base->tables) / s;
}
return TRUE;
}
Expand Down Expand Up @@ -2382,7 +2382,7 @@ hot_reload_metadata_linear_search (MonoImage *base_image, MonoTableInfo *base_ta
int tbl_index;
{
size_t s = ALIGN_TO (sizeof (MonoTableInfo), sizeof (gpointer));
tbl_index = (int)(((intptr_t) base_table - (intptr_t) base_image->tables) / s);
tbl_index = ((intptr_t) base_table - (intptr_t) base_image->tables) / s;
}

DeltaInfo *delta_info = NULL;
Expand Down
16 changes: 8 additions & 8 deletions src/mono/mono/eglib/giconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
return NULL;
}

len = (glong)strlen (str);
len = strlen (str);
}

inptr = (char *) str;
Expand Down Expand Up @@ -582,7 +582,7 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
*items_read = inptr - str;

if (items_written)
*items_written = (glong)outlen;
*items_written = outlen;

if (G_LIKELY (!custom_alloc_func))
outptr = outbuf = g_malloc ((outlen + 1) * sizeof (gunichar2));
Expand Down Expand Up @@ -680,7 +680,7 @@ g_utf8_to_ucs4 (const gchar *str, glong len, glong *items_read, glong *items_wri
g_return_val_if_fail (str != NULL, NULL);

if (len < 0)
len = (glong)strlen (str);
len = strlen (str);

inptr = (char *) str;
inleft = len;
Expand Down Expand Up @@ -714,7 +714,7 @@ g_utf8_to_ucs4 (const gchar *str, glong len, glong *items_read, glong *items_wri
}

if (items_written)
*items_written = (glong)(outlen / 4);
*items_written = outlen / 4;

if (items_read)
*items_read = inptr - str;
Expand Down Expand Up @@ -798,7 +798,7 @@ eg_utf16_to_utf8_general (const gunichar2 *str, glong len, glong *items_read, gl
*items_read = (inptr - (char *) str) / 2;

if (items_written)
*items_written = (glong)outlen;
*items_written = outlen;

if (G_LIKELY (!custom_alloc_func))
outptr = outbuf = g_malloc (outlen + 1);
Expand Down Expand Up @@ -902,7 +902,7 @@ g_utf16_to_ucs4 (const gunichar2 *str, glong len, glong *items_read, glong *item
*items_read = (inptr - (char *) str) / 2;

if (items_written)
*items_written = (glong)(outlen / 4);
*items_written = outlen / 4;

outptr = outbuf = g_malloc (outlen + 4);
inptr = (char *) str;
Expand Down Expand Up @@ -978,7 +978,7 @@ g_ucs4_to_utf8 (const gunichar *str, glong len, glong *items_read, glong *items_
*outptr = 0;

if (items_written)
*items_written = (glong)outlen;
*items_written = outlen;

if (items_read)
*items_read = i;
Expand Down Expand Up @@ -1040,7 +1040,7 @@ g_ucs4_to_utf16 (const gunichar *str, glong len, glong *items_read, glong *items
*outptr = 0;

if (items_written)
*items_written = (glong)outlen;
*items_written = outlen;

if (items_read)
*items_read = i;
Expand Down
4 changes: 2 additions & 2 deletions src/mono/mono/eglib/glib.h
Original file line number Diff line number Diff line change
Expand Up @@ -1076,9 +1076,9 @@ gboolean g_file_test (const gchar *filename, GFileTest test);
#define g_write write
#endif
#ifdef G_OS_WIN32
#define g_read(fd, buffer, buffer_size) _read(fd, buffer, (unsigned)buffer_size)
#define g_read _read
#else
#define g_read(fd, buffer, buffer_size) (int)read(fd, buffer, buffer_size)
#define g_read read
#endif

#define g_fopen fopen
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/eglib/gpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ g_ensure_directory_exists (const gchar *filename)
if (!dir_utf8 || !dir_utf8 [0])
return FALSE;

dir_utf16 = g_utf8_to_utf16 (dir_utf8, (glong)strlen (dir_utf8), NULL, NULL, NULL);
dir_utf16 = g_utf8_to_utf16 (dir_utf8, strlen (dir_utf8), NULL, NULL, NULL);
g_free (dir_utf8);

if (!dir_utf16)
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/eglib/gstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ g_str_from_file_region (int fd, guint64 offset, gsize size)
return NULL;
buffer [size] = 0;
do {
status = g_read (fd, buffer, size);
status = read (fd, buffer, size);
} while (status == -1 && errno == EINTR);
if (status == -1){
g_free (buffer);
Expand Down
16 changes: 8 additions & 8 deletions src/mono/mono/eventpipe/ep-rt-mono.c
Original file line number Diff line number Diff line change
Expand Up @@ -4332,16 +4332,16 @@ mono_profiler_fire_buffered_gc_event_root_register (
uint8_t root_source = (uint8_t)source;
uintptr_t root_key = (uintptr_t)key;
const char *root_name = (name ? name : "");
size_t root_name_len = strlen (root_name) + 1;
uint32_t root_name_len = strlen (root_name) + 1;

MonoProfilerBufferedGCEvent gc_event_data;
gc_event_data.type = MONO_PROFILER_BUFFERED_GC_EVENT_ROOT_REGISTER;
gc_event_data.payload_size = (uint32_t)
(sizeof (root_id) +
gc_event_data.payload_size =
sizeof (root_id) +
sizeof (root_size) +
sizeof (root_source) +
sizeof (root_key) +
root_name_len);
root_name_len;

uint8_t * buffer = mono_profiler_buffered_gc_event_alloc (gc_event_data.payload_size);
if (buffer) {
Expand Down Expand Up @@ -4545,8 +4545,8 @@ mono_profiler_fire_buffered_gc_event_moves (
MonoProfilerBufferedGCEvent gc_event_data;
gc_event_data.type = MONO_PROFILER_BUFFERED_GC_EVENT_MOVES;
gc_event_data.payload_size =
(uint32_t)(sizeof (count) +
(count * (sizeof (uintptr_t) + sizeof (uintptr_t))));
sizeof (count) +
(count * (sizeof (uintptr_t) + sizeof (uintptr_t)));

uint8_t * buffer = mono_profiler_buffered_gc_event_alloc (gc_event_data.payload_size);
if (buffer) {
Expand Down Expand Up @@ -4612,8 +4612,8 @@ mono_profiler_fire_buffered_gc_event_roots (
MonoProfilerBufferedGCEvent gc_event_data;
gc_event_data.type = MONO_PROFILER_BUFFERED_GC_EVENT_ROOTS;
gc_event_data.payload_size =
(uint32_t)(sizeof (count) +
(count * (sizeof (uintptr_t) + sizeof (uintptr_t))));
sizeof (count) +
(count * (sizeof (uintptr_t) + sizeof (uintptr_t)));

uint8_t * buffer = mono_profiler_buffered_gc_event_alloc (gc_event_data.payload_size);
if (buffer) {
Expand Down
14 changes: 7 additions & 7 deletions src/mono/mono/eventpipe/ep-rt-mono.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ prefix_name ## _rt_ ## type_name ## _ ## func_name
#define EP_RT_DEFINE_ARRAY_PREFIX(prefix_name, array_name, array_type, iterator_type, item_type) \
static inline void EP_RT_BUILD_TYPE_FUNC_NAME(prefix_name, array_name, alloc) (array_type *ep_array) { \
EP_ASSERT (ep_array != NULL); \
ep_array->array = g_array_new (FALSE, FALSE, (guint)sizeof (item_type)); \
ep_array->array = g_array_new (FALSE, FALSE, sizeof (item_type)); \
} \
static inline void EP_RT_BUILD_TYPE_FUNC_NAME(prefix_name, array_name, alloc_capacity) (array_type *ep_array, size_t capacity) { \
EP_ASSERT (ep_array != NULL); \
ep_array->array = g_array_sized_new (FALSE, FALSE, (guint)sizeof (item_type), (guint)capacity); \
ep_array->array = g_array_sized_new (FALSE, FALSE, sizeof (item_type), capacity); \
} \
static inline void EP_RT_BUILD_TYPE_FUNC_NAME(prefix_name, array_name, free) (array_type *ep_array) { \
EP_ASSERT (ep_array != NULL); \
Expand Down Expand Up @@ -188,11 +188,11 @@ prefix_name ## _rt_ ## type_name ## _ ## func_name
#define EP_RT_DEFINE_LOCAL_ARRAY_PREFIX(prefix_name, array_name, array_type, iterator_type, item_type) \
static inline void EP_RT_BUILD_TYPE_FUNC_NAME(prefix_name, array_name, init) (array_type *ep_array) { \
EP_ASSERT (ep_array != NULL); \
ep_array->array = g_array_new (FALSE, FALSE, (guint)sizeof (item_type)); \
ep_array->array = g_array_new (FALSE, FALSE, sizeof (item_type)); \
} \
static inline void EP_RT_BUILD_TYPE_FUNC_NAME(prefix_name, array_name, init_capacity) (array_type *ep_array, size_t capacity) { \
EP_ASSERT (ep_array != NULL); \
ep_array->array = g_array_sized_new (FALSE, FALSE, (guint)sizeof (item_type), (guint)capacity); \
ep_array->array = g_array_sized_new (FALSE, FALSE, sizeof (item_type), capacity); \
} \
static inline void EP_RT_BUILD_TYPE_FUNC_NAME(prefix_name, array_name, fini) (array_type *ep_array) { \
EP_ASSERT (ep_array != NULL); \
Expand Down Expand Up @@ -1308,7 +1308,7 @@ ep_rt_thread_sleep (uint64_t ns)
mono_thread_info_yield ();
} else {
MONO_ENTER_GC_SAFE;
g_usleep ((gulong)(ns / 1000));
g_usleep (ns / 1000);
MONO_EXIT_GC_SAFE;
}
}
Expand Down Expand Up @@ -1775,7 +1775,7 @@ ep_rt_utf8_to_utf16_string (
const ep_char8_t *str,
size_t len)
{
return (ep_char16_t *)(g_utf8_to_utf16 ((const gchar *)str, (glong)len, NULL, NULL, NULL));
return (ep_char16_t *)(g_utf8_to_utf16 ((const gchar *)str, len, NULL, NULL, NULL));
}

static
Expand Down Expand Up @@ -1813,7 +1813,7 @@ ep_rt_utf16_to_utf8_string (
const ep_char16_t *str,
size_t len)
{
return g_utf16_to_utf8 ((const gunichar2 *)str, (glong)len, NULL, NULL, NULL);
return g_utf16_to_utf8 ((const gunichar2 *)str, len, NULL, NULL, NULL);
}

static
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/metadata/appdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ real_load (gchar **search_path, const gchar *culture, const gchar *name, const M
gchar **path;
gchar *filename;
const gchar *local_culture;
size_t len;
gint len;

if (!culture || *culture == '\0') {
local_culture = "";
Expand Down
9 changes: 5 additions & 4 deletions src/mono/mono/metadata/assembly.c
Original file line number Diff line number Diff line change
Expand Up @@ -2137,9 +2137,10 @@ mono_assembly_request_load_from (MonoImage *image, const char *fname,
#if defined (HOST_WIN32)
{
gchar *tmp_fn;
int i;

tmp_fn = g_strdup (fname);
for (size_t i = strlen (tmp_fn) - 1; i >= 0; i--) {
for (i = strlen (tmp_fn) - 1; i >= 0; i--) {
if (tmp_fn [i] == '/')
tmp_fn [i] = '\\';
}
Expand Down Expand Up @@ -2334,7 +2335,7 @@ parse_public_key (const gchar *key, gchar** pubkey, gboolean *is_ecma)
//both pubkey and is_ecma are required arguments
g_assert (pubkey && is_ecma);

keylen = (gint)strlen (key) >> 1;
keylen = strlen (key) >> 1;
if (keylen < 1)
return FALSE;

Expand Down Expand Up @@ -2366,7 +2367,7 @@ parse_public_key (const gchar *key, gchar** pubkey, gboolean *is_ecma)

/* We need the first 16 bytes
* to check whether this key is valid or not */
pkeylen = (gint)strlen (pkey) >> 1;
pkeylen = strlen (pkey) >> 1;
if (pkeylen < 16)
return FALSE;

Expand Down Expand Up @@ -2725,7 +2726,7 @@ unquote (const char *str)
if (str == NULL)
return NULL;

slen = (gint)strlen (str);
slen = strlen (str);
if (slen < 2)
return NULL;

Expand Down
12 changes: 6 additions & 6 deletions src/mono/mono/metadata/class-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ mono_class_create_bounded_array (MonoClass *eclass, guint32 rank, gboolean bound
MonoClass *klass, *cached, *k;
MonoClass *parent = NULL;
GSList *list, *rootlist = NULL;
size_t nsize;
int nsize;
char *name;
MonoMemoryManager *mm;

Expand Down Expand Up @@ -1739,12 +1739,12 @@ mono_class_interface_match (const uint8_t *bitmap, int id)
static char*
concat_two_strings_with_zero (MonoImage *image, const char *s1, const char *s2)
{
size_t null_length = strlen ("(null)");
size_t len = (s1 ? strlen (s1) : null_length) + (s2 ? strlen (s2) : null_length) + 2;
char *s = (char *)mono_image_alloc (image, (int)len);
int null_length = strlen ("(null)");
int len = (s1 ? strlen (s1) : null_length) + (s2 ? strlen (s2) : null_length) + 2;
char *s = (char *)mono_image_alloc (image, len);
int result;

result = g_snprintf (s, (glong)len, "%s%c%s", s1 ? s1 : "(null)", '\0', s2 ? s2 : "(null)");
result = g_snprintf (s, len, "%s%c%s", s1 ? s1 : "(null)", '\0', s2 ? s2 : "(null)");
g_assert (result == len - 1);

return s;
Expand Down Expand Up @@ -2708,7 +2708,7 @@ generic_array_methods (MonoClass *klass)

generic_array_method_info [i].array_method = m;

name = (gchar *)mono_image_alloc (mono_defaults.corlib, (guint)(strlen (iname) + strlen (mname) + 1));
name = (gchar *)mono_image_alloc (mono_defaults.corlib, strlen (iname) + strlen (mname) + 1);
strcpy (name, iname);
strcpy (name + strlen (iname), mname);
generic_array_method_info [i].name = name;
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/metadata/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -3285,7 +3285,7 @@ mono_class_from_name_checked_aux (MonoImage *image, const char* name_space, cons

if ((nested = (char*)strchr (name, '/'))) {
int pos = nested - name;
size_t len = strlen (name);
int len = strlen (name);
if (len > 1023)
return NULL;
memcpy (buf, name, len + 1);
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/metadata/cominterop.c
Original file line number Diff line number Diff line change
Expand Up @@ -3110,7 +3110,7 @@ mono_ptr_to_ansibstr (const char *ptr, size_t slen)
char *s = (char *)mono_bstr_alloc ((slen + 1) * sizeof(char));
if (s == NULL)
return NULL;
*((guint32 *)s - 1) = (guint32)(slen * sizeof (char));
*((guint32 *)s - 1) = slen * sizeof (char);
if (ptr)
memcpy (s, ptr, slen * sizeof (char));
s [slen] = 0;
Expand Down
Loading