stuff
[vg.git] / src / vg / vg_io.h
index 56e6219e33f6782c40706e353d796d48766d08cd..2650b3fd9f7e5ac6faa2f33cf4a70a888b7a0f5e 100644 (file)
@@ -1,5 +1,15 @@
 /* Copyright (C) 2021-2022 Harry Godden (hgn) - All Rights Reserved */
 
+#ifndef VG_IO_H
+#define VG_IO_H
+
+#include "vg_stdint.h"
+#include "vg_platform.h"
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <malloc.h>
+
 #define KNRM  "\x1B[0m"
 #define KRED  "\x1B[31m"
 #define KGRN  "\x1B[32m"
@@ -25,7 +35,7 @@ static void vg_log_write( FILE *file, const char *prefix,
                        break;
        }
        
-       j = i + vsnprintf( buffer + i, vg_list_size( buffer ) - i -2, fmt, args );
+       j = i + vsnprintf( buffer + i, vg_list_size( buffer ) - i -12, fmt, args );
        strcpy( buffer + j, KNRM );
        
        fputs( buffer, file );
@@ -95,7 +105,7 @@ static char *vg_disk_load_text( const char *path, i64 *size )
        char *buf;
        i64 fsize;
        
-       if( (buf = vg_disk_open_read( path, 1, &fsize )) )
+       if( (buf = (char *)vg_disk_open_read( path, 1, &fsize )) )
        {
                buf[ fsize ] = 0x00;
                *size = fsize +1;
@@ -142,3 +152,5 @@ static int vg_asset_write( const char *path, void *data, i64 size )
                return 0;
        }
 }
+
+#endif /* VG_IO_H */