win_opengl: Fix MSVC build errors and warnings

This commit is contained in:
ts-korhonen
2021-04-17 00:12:49 +03:00
parent 7a83b463c2
commit b7be825ba7
3 changed files with 24 additions and 13 deletions

View File

@@ -34,6 +34,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <86box/86box.h>
#include <86box/plat.h>
@@ -80,13 +81,21 @@ static char* read_file_to_string(const char* path)
{
/* get file size */
fseek(file_handle, 0, SEEK_END);
long file_size = ftell(file_handle);
size_t file_size = (size_t)ftell(file_handle);
fseek(file_handle, 0, SEEK_SET);
/* read to buffer and close */
char* content = (char*)malloc(sizeof(char) * (file_size + 1));
if (!content)
return NULL;
size_t length = fread(content, sizeof(char), file_size, file_handle);
fclose(file_handle);
content[length] = 0;
return content;