2 |
* * |
* * |
3 |
* libgig - C++ cross-platform Gigasampler format file access library * |
* libgig - C++ cross-platform Gigasampler format file access library * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003-2014 by Christian Schoenebeck * |
* Copyright (C) 2003-2017 by Christian Schoenebeck * |
6 |
* <cuse@users.sourceforge.net> * |
* <cuse@users.sourceforge.net> * |
7 |
* * |
* * |
8 |
* This library is free software; you can redistribute it and/or modify * |
* This library is free software; you can redistribute it and/or modify * |
27 |
#include <string.h> |
#include <string.h> |
28 |
#include <string> |
#include <string> |
29 |
#include <sstream> |
#include <sstream> |
30 |
|
#include <algorithm> |
31 |
|
|
32 |
#if defined(WIN32) && !HAVE_CONFIG_H |
#if defined(WIN32) && !HAVE_CONFIG_H |
33 |
# include "../win32/libgig_private.h" // like config.h, automatically generated by Dev-C++ |
# include "../win32/libgig_private.h" // like config.h, automatically generated by Dev-C++ |
35 |
# define VERSION VER_STRING // VER_STRING defined in libgig_private.h |
# define VERSION VER_STRING // VER_STRING defined in libgig_private.h |
36 |
#endif // WIN32 |
#endif // WIN32 |
37 |
|
|
38 |
|
#if HAVE_CONFIG_H /*&& !HAVE_VASPRINTF*/ && defined(WIN32) |
39 |
|
# include <stdarg.h> |
40 |
|
int vasprintf(char** ret, const char* format, va_list arg); |
41 |
|
#endif |
42 |
|
|
43 |
#include "RIFF.h" |
#include "RIFF.h" |
44 |
|
|
45 |
// *************** Helper Functions ************** |
// *************** Helper Functions ************** |
51 |
return ss.str(); |
return ss.str(); |
52 |
} |
} |
53 |
|
|
54 |
|
inline std::string toLowerCase(std::string s) { |
55 |
|
std::transform(s.begin(), s.end(), s.begin(), ::tolower); |
56 |
|
return s; |
57 |
|
} |
58 |
|
|
59 |
inline long Min(long A, long B) { |
inline long Min(long A, long B) { |
60 |
return (A > B) ? B : A; |
return (A > B) ? B : A; |
61 |
} |
} |
206 |
inline void LoadString(RIFF::Chunk* ck, std::string& s) { |
inline void LoadString(RIFF::Chunk* ck, std::string& s) { |
207 |
if (ck) { |
if (ck) { |
208 |
const char* str = (char*)ck->LoadChunkData(); |
const char* str = (char*)ck->LoadChunkData(); |
209 |
|
if (!str) { |
210 |
|
ck->ReleaseChunkData(); |
211 |
|
s = ""; |
212 |
|
return; |
213 |
|
} |
214 |
int size = (int) ck->GetSize(); |
int size = (int) ck->GetSize(); |
215 |
int len; |
int len; |
216 |
for (len = 0 ; len < size ; len++) |
for (len = 0 ; len < size ; len++) |