Commit 5de10794 authored by David Reid's avatar David Reid

Get jar_mod and jar_xm compiling with MSVC.

parent 7649aa53
...@@ -1524,7 +1524,12 @@ mulong jar_mod_load_file(jar_mod_context_t * modctx, const char* filename) ...@@ -1524,7 +1524,12 @@ mulong jar_mod_load_file(jar_mod_context_t * modctx, const char* filename)
modctx->modfile = 0; modctx->modfile = 0;
} }
FILE *f = fopen(filename, "rb"); FILE *f = NULL;
#if defined(_MSC_VER) && _MSC_VER >= 1500
fopen_s(&f, filename, "rb");
#else
f = fopen(filename, "rb");
#endif
if(f) if(f)
{ {
fseek(f,0,SEEK_END); fseek(f,0,SEEK_END);
......
...@@ -1439,7 +1439,7 @@ static void jar_xm_volume_slide(jar_xm_channel_context_t* ch, uint8_t rawval) { ...@@ -1439,7 +1439,7 @@ static void jar_xm_volume_slide(jar_xm_channel_context_t* ch, uint8_t rawval) {
} }
} }
static float jar_xm_envelope_lerp(jar_xm_envelope_point_t* restrict a, jar_xm_envelope_point_t* restrict b, uint16_t pos) { static float jar_xm_envelope_lerp(jar_xm_envelope_point_t* a, jar_xm_envelope_point_t* b, uint16_t pos) {
/* Linear interpolation between two envelope points */ /* Linear interpolation between two envelope points */
if(pos <= a->frame) return a->value; if(pos <= a->frame) return a->value;
else if(pos >= b->frame) return b->value; else if(pos >= b->frame) return b->value;
...@@ -2606,7 +2606,12 @@ int jar_xm_create_context_from_file(jar_xm_context_t** ctx, uint32_t rate, const ...@@ -2606,7 +2606,12 @@ int jar_xm_create_context_from_file(jar_xm_context_t** ctx, uint32_t rate, const
FILE* xmf; FILE* xmf;
int size; int size;
#if defined(_MSC_VER) && _MSC_VER >= 1500
xmf = NULL;
fopen_s(&xmf, filename, "rb");
#else
xmf = fopen(filename, "rb"); xmf = fopen(filename, "rb");
#endif
if(xmf == NULL) { if(xmf == NULL) {
DEBUG_ERR("Could not open input file"); DEBUG_ERR("Could not open input file");
*ctx = NULL; *ctx = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment