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-2020 by Christian Schoenebeck * |
* Copyright (C) 2003-2021 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 * |
28 |
#include <string> |
#include <string> |
29 |
#include <sstream> |
#include <sstream> |
30 |
#include <algorithm> |
#include <algorithm> |
31 |
|
#include <assert.h> |
32 |
|
|
33 |
#if defined(WIN32) && !HAVE_CONFIG_H && !defined(_MSC_VER) |
#if defined(WIN32) && !HAVE_CONFIG_H && !defined(_MSC_VER) |
34 |
# 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++ |
66 |
va_list args; |
va_list args; |
67 |
va_start(args, fmt); |
va_start(args, fmt); |
68 |
char* buf = NULL; |
char* buf = NULL; |
69 |
vasprintf(&buf, fmt, args); |
const int n = vasprintf(&buf, fmt, args); |
70 |
std::string res = buf; |
assert(n >= 0); |
71 |
|
std::string res = (buf && n > 0) ? buf : ""; |
72 |
if (buf) free(buf); |
if (buf) free(buf); |
73 |
va_end(args); |
va_end(args); |
74 |
return res; |
return res; |