diff options
author | Wohlstand <admin@wohlnet.ru> | 2017-11-20 04:06:31 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2017-11-20 04:06:31 +0300 |
commit | 93078915431d1fcd8ece793201cbeda0d32d8722 (patch) | |
tree | 158d42c54eda421a849e05847543427f069fb616 | |
parent | 549bcaa5dcd460a6aa5143776eeea6c4bde1cf5f (diff) | |
download | libADLMIDI-93078915431d1fcd8ece793201cbeda0d32d8722.tar.gz libADLMIDI-93078915431d1fcd8ece793201cbeda0d32d8722.tar.bz2 libADLMIDI-93078915431d1fcd8ece793201cbeda0d32d8722.zip |
Use const char* and const void* as input data types
-rw-r--r-- | include/adlmidi.h | 8 | ||||
-rw-r--r-- | src/adlmidi.cpp | 8 | ||||
-rw-r--r-- | src/adlmidi_load.cpp | 8 | ||||
-rw-r--r-- | src/adlmidi_private.hpp | 12 |
4 files changed, 18 insertions, 18 deletions
diff --git a/include/adlmidi.h b/include/adlmidi.h index 6dc930c..c67952f 100644 --- a/include/adlmidi.h +++ b/include/adlmidi.h @@ -108,10 +108,10 @@ extern void adl_setLogarithmicVolumes(struct ADL_MIDIPlayer *device, int logvol) extern void adl_setVolumeRangeModel(struct ADL_MIDIPlayer *device, int volumeModel); /*Load WOPL bank file from File System*/ -extern int adl_openBankFile(struct ADL_MIDIPlayer *device, char *filePath); +extern int adl_openBankFile(struct ADL_MIDIPlayer *device, const char *filePath); /*Load WOPL bank file from memory data*/ -extern int adl_openBankData(struct ADL_MIDIPlayer *device, void *mem, long size); +extern int adl_openBankData(struct ADL_MIDIPlayer *device, const void *mem, unsigned long size); /*Returns name of currently used OPL3 emulator*/ @@ -130,10 +130,10 @@ extern const char *adl_errorInfo(struct ADL_MIDIPlayer *device); extern struct ADL_MIDIPlayer *adl_init(long sample_rate); /*Load MIDI file from File System*/ -extern int adl_openFile(struct ADL_MIDIPlayer *device, char *filePath); +extern int adl_openFile(struct ADL_MIDIPlayer *device, const char *filePath); /*Load MIDI file from memory data*/ -extern int adl_openData(struct ADL_MIDIPlayer *device, void *mem, long size); +extern int adl_openData(struct ADL_MIDIPlayer *device, const void *mem, unsigned long size); /*Resets MIDI player*/ extern void adl_reset(struct ADL_MIDIPlayer *device); diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp index 18e5243..e96c757 100644 --- a/src/adlmidi.cpp +++ b/src/adlmidi.cpp @@ -222,7 +222,7 @@ ADLMIDI_EXPORT void adl_setVolumeRangeModel(struct ADL_MIDIPlayer *device, int v play->opl.ChangeVolumeRangesModel(static_cast<ADLMIDI_VolumeModels>(volumeModel)); } -ADLMIDI_EXPORT int adl_openBankFile(struct ADL_MIDIPlayer *device, char *filePath) +ADLMIDI_EXPORT int adl_openBankFile(struct ADL_MIDIPlayer *device, const char *filePath) { if(device && device->adl_midiPlayer) { @@ -243,7 +243,7 @@ ADLMIDI_EXPORT int adl_openBankFile(struct ADL_MIDIPlayer *device, char *filePat return -1; } -ADLMIDI_EXPORT int adl_openBankData(struct ADL_MIDIPlayer *device, void *mem, long size) +ADLMIDI_EXPORT int adl_openBankData(struct ADL_MIDIPlayer *device, const void *mem, unsigned long size) { if(device && device->adl_midiPlayer) { @@ -264,7 +264,7 @@ ADLMIDI_EXPORT int adl_openBankData(struct ADL_MIDIPlayer *device, void *mem, lo return -1; } -ADLMIDI_EXPORT int adl_openFile(ADL_MIDIPlayer *device, char *filePath) +ADLMIDI_EXPORT int adl_openFile(ADL_MIDIPlayer *device, const char *filePath) { if(device && device->adl_midiPlayer) { @@ -285,7 +285,7 @@ ADLMIDI_EXPORT int adl_openFile(ADL_MIDIPlayer *device, char *filePath) return -1; } -ADLMIDI_EXPORT int adl_openData(ADL_MIDIPlayer *device, void *mem, long size) +ADLMIDI_EXPORT int adl_openData(ADL_MIDIPlayer *device, const void *mem, unsigned long size) { if(device && device->adl_midiPlayer) { diff --git a/src/adlmidi_load.cpp b/src/adlmidi_load.cpp index 60c4151..1d4a193 100644 --- a/src/adlmidi_load.cpp +++ b/src/adlmidi_load.cpp @@ -55,10 +55,10 @@ bool MIDIplay::LoadBank(const std::string &filename) return LoadBank(file); } -bool MIDIplay::LoadBank(void *data, unsigned long size) +bool MIDIplay::LoadBank(const void *data, size_t size) { fileReader file; - file.openData(data, (size_t)size); + file.openData(data, size); return LoadBank(file); } @@ -346,10 +346,10 @@ bool MIDIplay::LoadMIDI(const std::string &filename) return true; } -bool MIDIplay::LoadMIDI(void *data, unsigned long size) +bool MIDIplay::LoadMIDI(const void *data, size_t size) { fileReader file; - file.openData(data, (size_t)size); + file.openData(data, size); return LoadMIDI(file); } diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp index 39ec298..4d7251b 100644 --- a/src/adlmidi_private.hpp +++ b/src/adlmidi_private.hpp @@ -342,7 +342,7 @@ public: mp_tell = 0; } - void openData(void *mem, size_t lenght) + void openData(const void *mem, size_t lenght) { fp = NULL; mp = mem; @@ -392,7 +392,7 @@ public: while((pos < maxSize) && (mp_tell < mp_size)) { - reinterpret_cast<unsigned char *>(buf)[pos] = reinterpret_cast<unsigned char *>(mp)[mp_tell]; + reinterpret_cast<unsigned char *>(buf)[pos] = reinterpret_cast<unsigned const char *>(mp)[mp_tell]; mp_tell++; pos++; } @@ -408,7 +408,7 @@ public: else { if(mp_tell >= mp_size) return -1; - int x = reinterpret_cast<unsigned char *>(mp)[mp_tell]; + int x = reinterpret_cast<unsigned const char *>(mp)[mp_tell]; mp_tell++; return x; } @@ -446,7 +446,7 @@ public: } std::string _fileName; std::FILE *fp; - void *mp; + const void *mp; size_t mp_size; size_t mp_tell; }; @@ -812,11 +812,11 @@ public: uint64_t ReadVarLenEx(uint8_t **ptr, uint8_t *end, bool &ok); bool LoadBank(const std::string &filename); - bool LoadBank(void *data, unsigned long size); + bool LoadBank(const void *data, size_t size); bool LoadBank(fileReader &fr); bool LoadMIDI(const std::string &filename); - bool LoadMIDI(void *data, unsigned long size); + bool LoadMIDI(const void *data, size_t size); bool LoadMIDI(fileReader &fr); /** |