Fix exciting new gcc 11 compiler warnings.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3973 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-09-10 01:42:15 +00:00
parent 3b676d967e
commit 56db6a8e4d
4 changed files with 22 additions and 43 deletions

View File

@ -294,8 +294,8 @@ static const char* _task_loadFile(const char* fileName)
long fileSize = ftell(file);
fseek(file, 0, SEEK_SET);
result = tf_malloc(fileSize + 1);
fread(result, 1, fileSize, file);
result[fileSize] = '\0';
int bytes_read = fread(result, 1, fileSize, file);
result[bytes_read] = '\0';
fclose(file);
}
return result;
@ -703,11 +703,6 @@ static JSValue _tf_task_getStats(JSContext* context, JSValueConst this_val, int
JS_SetPropertyStr(context, result, "tls_malloc_percent", JS_NewFloat64(context, 100.0f * tf_mem_get_tls_malloc_size() / total_memory));
JS_SetPropertyStr(context, result, "tf_malloc_percent", JS_NewFloat64(context, 100.0f * tf_mem_get_tf_malloc_size() / total_memory));
#if !defined(_WIN32)
struct mallinfo mi = mallinfo();
JS_SetPropertyStr(context, result, "arena_percent", JS_NewFloat64(context, 100.0f * mi.arena / total_memory));
#endif
JS_SetPropertyStr(context, result, "socket_count", JS_NewInt32(context, tf_socket_get_count()));
JS_SetPropertyStr(context, result, "socket_open_count", JS_NewInt32(context, tf_socket_get_open_count()));