diff options
author | Wohlstand <admin@wohlnet.ru> | 2019-12-02 20:47:10 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2019-12-02 20:47:10 +0300 |
commit | c83fff6de633403c6c216bd1abf83e6915aa9913 (patch) | |
tree | a6902e82bcf3c3383ffeac9ac841063f5ced8f07 /src/adlmidi.cpp | |
parent | 45190534246f6c5186aa1708187d5010363db03d (diff) | |
parent | 84af1cde8d624100b4396173688743368db64b58 (diff) | |
download | libADLMIDI-c83fff6de633403c6c216bd1abf83e6915aa9913.tar.gz libADLMIDI-c83fff6de633403c6c216bd1abf83e6915aa9913.tar.bz2 libADLMIDI-c83fff6de633403c6c216bd1abf83e6915aa9913.zip |
Merge branch 'master' into wip-new-embedded-banks
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 dee99d2..3274716 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; |