From 35e8792efa2cb11d857216ee75d665858c96d45d Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Fri, 9 Jun 2017 06:39:48 +0000 Subject: [PATCH] libxmp-lite: Changes to build (in C mode). git-svn-id: https://svn.eduke32.com/eduke32@6160 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/libxmp-lite/include/libxmp-lite/xmp.h | 2 +- source/libxmp-lite/src/common.h | 5 ++++- source/libxmp-lite/src/control.c | 2 +- source/libxmp-lite/src/format.c | 4 ++-- source/libxmp-lite/src/format.h | 2 +- source/libxmp-lite/src/load_helpers.c | 2 +- source/libxmp-lite/src/memio.c | 2 +- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/source/libxmp-lite/include/libxmp-lite/xmp.h b/source/libxmp-lite/include/libxmp-lite/xmp.h index 52a8257e4..101f8912a 100644 --- a/source/libxmp-lite/include/libxmp-lite/xmp.h +++ b/source/libxmp-lite/include/libxmp-lite/xmp.h @@ -329,7 +329,7 @@ EXPORT void xmp_get_frame_info (xmp_context, struct xmp_frame_info *); EXPORT void xmp_end_player (xmp_context); EXPORT void xmp_inject_event (xmp_context, int, struct xmp_event *); EXPORT void xmp_get_module_info (xmp_context, struct xmp_module_info *); -EXPORT char **xmp_get_format_list (void); +EXPORT const char**xmp_get_format_list (void); EXPORT int xmp_next_position (xmp_context); EXPORT int xmp_prev_position (xmp_context); EXPORT int xmp_set_position (xmp_context, int); diff --git a/source/libxmp-lite/src/common.h b/source/libxmp-lite/src/common.h index 65a9f57f0..de5f11e85 100644 --- a/source/libxmp-lite/src/common.h +++ b/source/libxmp-lite/src/common.h @@ -145,7 +145,10 @@ void __inline CLIB_DECL D_(const char *text, ...) { do {} while (0); } #define close _close #define unlink _unlink #endif -#if defined(_WIN32) || defined(__WATCOMC__) /* in win32.c */ +#if defined(_MSC_VER) +#define snprintf _snprintf +#define vsnprintf _vsnprintf +#elif defined(__WATCOMC__) /* in win32.c */ int libxmp_vsnprintf(char *, size_t, const char *, va_list); int libxmp_snprintf (char *, size_t, const char *, ...); #define snprintf libxmp_snprintf diff --git a/source/libxmp-lite/src/control.c b/source/libxmp-lite/src/control.c index 30a26482c..1e8028981 100644 --- a/source/libxmp-lite/src/control.c +++ b/source/libxmp-lite/src/control.c @@ -495,7 +495,7 @@ int xmp_get_player__(xmp_context opaque, int parm) return ret; } -char **xmp_get_format_list() +const char **xmp_get_format_list() { return format_list(); } diff --git a/source/libxmp-lite/src/format.c b/source/libxmp-lite/src/format.c index e19f070e7..cc3aa2d6c 100644 --- a/source/libxmp-lite/src/format.c +++ b/source/libxmp-lite/src/format.c @@ -46,7 +46,7 @@ const struct format_loader *const format_loader[5] = { static const char *_farray[5] = { NULL }; -char **format_list() +const char **format_list() { int count, i; @@ -58,5 +58,5 @@ char **format_list() _farray[count] = NULL; } - return (char **)_farray; + return _farray; } diff --git a/source/libxmp-lite/src/format.h b/source/libxmp-lite/src/format.h index 4d90458bb..b5a1013a8 100644 --- a/source/libxmp-lite/src/format.h +++ b/source/libxmp-lite/src/format.h @@ -11,7 +11,7 @@ struct format_loader { int (*const loader)(struct module_data *, HIO_HANDLE *, const int); }; -char **format_list(void); +const char **format_list(void); #ifndef LIBXMP_CORE_PLAYER diff --git a/source/libxmp-lite/src/load_helpers.c b/source/libxmp-lite/src/load_helpers.c index 4f442857f..af17b4fc5 100644 --- a/source/libxmp-lite/src/load_helpers.c +++ b/source/libxmp-lite/src/load_helpers.c @@ -25,7 +25,7 @@ #include #include #include "common.h" -#include "loaders/loader.h" +#include "loader.h" #ifndef LIBXMP_CORE_PLAYER diff --git a/source/libxmp-lite/src/memio.c b/source/libxmp-lite/src/memio.c index 8439bdb8a..a117d345c 100644 --- a/source/libxmp-lite/src/memio.c +++ b/source/libxmp-lite/src/memio.c @@ -42,7 +42,7 @@ static inline ptrdiff_t CAN_READ(MFILE *m) int mgetc(MFILE *m) { if (CAN_READ(m) >= 1) - return *(uint8 *)(m->start + m->pos++); + return *(const uint8 *)(m->start + m->pos++); else return EOF; }