Commits

Anteru  committed fd1a8b7

Disable warnings and fix the int<->size_t conversion.

  • Participants
  • Parent commits e25e04b

Comments (0)

Files changed (2)

  *
  * New I/O routines added by Matthaeus G. Chajdas <dev@anteru.net>
  * ---------------------------------------------------------------------- */
+#if defined(_MSC_VER) && (_MSC_VER >= 1500)
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <stdio.h>
 #include <ctype.h>
 #include <assert.h>
     FILE* file;
 } ply_stdio_context;
 
-static int ply_stdio_read (void* context, int size, void* buffer)
+static size_t ply_stdio_read (void* context, size_t size, void* buffer)
 {
     return fread (buffer, 1, size, ((ply_stdio_context*)context)->file);
 }
 
-static int ply_stdio_write (void* context, int size, void* buffer)
+static size_t ply_stdio_write (void* context, size_t size, const void* buffer)
 {
     return fwrite (buffer, 1, size, ((ply_stdio_context*)context)->file);
 }
  * ---------------------------------------------------------------------- */
 int ply_get_ply_user_data(p_ply ply, void **pdata, long *idata);
 
-typedef int (*p_ply_io_read)(void* context, int length, void* output);
-typedef int (*p_ply_io_write)(void* context, int length, void* input);
+typedef size_t (*p_ply_io_read)(void* context, size_t length, void* output);
+typedef size_t (*p_ply_io_write)(void* context, size_t length, const void* input);
 typedef int (*p_ply_io_close)(void* context);
 
 /* ----------------------------------------------------------------------