Update to latest MiniVHD.

This commit is contained in:
Stephen McKinney
2020-11-19 01:23:27 -06:00
parent 84df433c6a
commit 21e555b63f
8 changed files with 29 additions and 7 deletions

View File

@@ -1,3 +1,6 @@
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <stdarg.h> #include <stdarg.h>

View File

@@ -1,3 +1,6 @@
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>

View File

@@ -1,3 +1,6 @@
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>

View File

@@ -3,6 +3,9 @@
* \brief Sector reading and writing implementations * \brief Sector reading and writing implementations
*/ */
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "minivhd_internal.h" #include "minivhd_internal.h"

View File

@@ -2,7 +2,9 @@
* \file * \file
* \brief VHD management functions (open, close, read write etc) * \brief VHD management functions (open, close, read write etc)
*/ */
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>

View File

@@ -2,7 +2,9 @@
* \file * \file
* \brief Header and footer serialize/deserialize functions * \brief Header and footer serialize/deserialize functions
*/ */
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>

View File

@@ -1,5 +1,5 @@
#ifndef MINIVHD_STRUCT_RW_H #ifndef MINIVHD_STRUCT_RW_H
#define minivhd_struct_rw #define MINIVHD_STRUCT_RW_H
#include "minivhd_internal.h" #include "minivhd_internal.h"

View File

@@ -2,7 +2,9 @@
* \file * \file
* \brief Utility functions * \brief Utility functions
*/ */
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
@@ -152,7 +154,7 @@ FILE* mvhd_fopen(const char* path, const char* mode, int* err) {
} }
} }
#else #else
f = fopen64(path, mode); f = fopen(path, mode);
if (f == NULL) { if (f == NULL) {
mvhd_errno = errno; mvhd_errno = errno;
*err = MVHD_ERR_FILE; *err = MVHD_ERR_FILE;
@@ -253,8 +255,10 @@ int64_t mvhd_ftello64(FILE* stream)
{ {
#ifdef _MSC_VER #ifdef _MSC_VER
return _ftelli64(stream); return _ftelli64(stream);
#else #elif defined(__MINGW32__)
return ftello64(stream); return ftello64(stream);
#else /* This should work with linux (with _FILE_OFFSET_BITS), and hopefully OS X and BSD */
return ftello(stream);
#endif #endif
} }
@@ -262,8 +266,10 @@ int mvhd_fseeko64(FILE* stream, int64_t offset, int origin)
{ {
#ifdef _MSC_VER #ifdef _MSC_VER
return _fseeki64(stream, offset, origin); return _fseeki64(stream, offset, origin);
#else #elif defined(__MINGW32__)
return fseeko64(stream, offset, origin); return fseeko64(stream, offset, origin);
#else /* This should work with linux (with _FILE_OFFSET_BITS), and hopefully OS X and BSD */
return fseeko(stream, offset, origin);
#endif #endif
} }