diff options
author | Wohlstand <admin@wohlnet.ru> | 2019-09-26 15:21:36 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2019-09-26 15:21:36 +0300 |
commit | e721728ef11dd97395853514c6ae44b05bd6e71c (patch) | |
tree | 31045f309b70d82ec86f5e43d46040878ce599c4 /src/adlmidi.cpp | |
parent | 6896738560200e7245904c34bfd57f578ebb99d2 (diff) | |
download | libADLMIDI-e721728ef11dd97395853514c6ae44b05bd6e71c.tar.gz libADLMIDI-e721728ef11dd97395853514c6ae44b05bd6e71c.tar.bz2 libADLMIDI-e721728ef11dd97395853514c6ae44b05bd6e71c.zip |
Fixed build for MSVC2013
Diffstat (limited to 'src/adlmidi.cpp')
-rw-r--r-- | src/adlmidi.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp index 72cf601..d0ce7e5 100644 --- a/src/adlmidi.cpp +++ b/src/adlmidi.cpp @@ -31,6 +31,36 @@ #include "midi_sequencer.hpp" #endif +#if defined(_MSC_VER) && _MSC_VER < 1900 + +#define snprintf c99_snprintf +#define vsnprintf c99_vsnprintf + +__inline int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap) +{ + int count = -1; + + if (size != 0) + count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap); + if (count == -1) + count = _vscprintf(format, ap); + + return count; +} + +__inline int c99_snprintf(char *outBuf, size_t size, const char *format, ...) +{ + int count; + va_list ap; + + va_start(ap, format); + count = c99_vsnprintf(outBuf, size, format, ap); + va_end(ap); + + return count; +} +#endif + /* Unify MIDI player casting and interface between ADLMIDI and OPNMIDI */ #define GET_MIDI_PLAYER(device) reinterpret_cast<MIDIplay *>((device)->adl_midiPlayer) typedef MIDIplay MidiPlayer; |