mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 11:54:01 +00:00
A va_list is undefined after a call to a consumer function like vsprintf. Therefore it has to be copied if it will be used multiple times. This was working on most 32bit systems but not on AMD64 anymore. Fixes Anthill bug 120.
This commit is contained in:
parent
608b681baa
commit
78f13d2bc1
@ -1,3 +1,8 @@
|
|||||||
|
2005-04-09 Moritz Bunkus <moritz@bunkus.org>
|
||||||
|
|
||||||
|
* all: bug fix: My output functions did not work on AMD64
|
||||||
|
systems. Fixes Anthill bug 120.
|
||||||
|
|
||||||
2005-04-07 Moritz Bunkus <moritz@bunkus.org>
|
2005-04-07 Moritz Bunkus <moritz@bunkus.org>
|
||||||
|
|
||||||
* mkvextract: new feature: Added the extraction of the raw
|
* mkvextract: new feature: Added the extraction of the raw
|
||||||
|
@ -1266,7 +1266,7 @@ mxprints(char *dst,
|
|||||||
static void
|
static void
|
||||||
mxmsg(int level,
|
mxmsg(int level,
|
||||||
const char *fmt,
|
const char *fmt,
|
||||||
va_list &ap) {
|
va_list ap) {
|
||||||
string new_fmt, output;
|
string new_fmt, output;
|
||||||
bool nl;
|
bool nl;
|
||||||
FILE *stream;
|
FILE *stream;
|
||||||
@ -1397,7 +1397,11 @@ get_varg_len(const char *fmt,
|
|||||||
size = 1024;
|
size = 1024;
|
||||||
dst = (char *)safemalloc(size);
|
dst = (char *)safemalloc(size);
|
||||||
while (1) {
|
while (1) {
|
||||||
result = vsnprintf(dst, size - 1, fmt, ap);
|
va_list ap2;
|
||||||
|
|
||||||
|
va_copy(ap2, ap);
|
||||||
|
result = vsnprintf(dst, size - 1, fmt, ap2);
|
||||||
|
va_end(ap2);
|
||||||
if (result >= 0) {
|
if (result >= 0) {
|
||||||
safefree(dst);
|
safefree(dst);
|
||||||
return result;
|
return result;
|
||||||
@ -1412,16 +1416,18 @@ get_varg_len(const char *fmt,
|
|||||||
|
|
||||||
string
|
string
|
||||||
mxvsprintf(const char *fmt,
|
mxvsprintf(const char *fmt,
|
||||||
va_list &ap) {
|
va_list ap) {
|
||||||
string new_fmt, dst;
|
string new_fmt, dst;
|
||||||
char *new_string;
|
char *new_string;
|
||||||
int len;
|
int len;
|
||||||
|
va_list ap2;
|
||||||
|
|
||||||
fix_format(fmt, new_fmt);
|
fix_format(fmt, new_fmt);
|
||||||
len = get_varg_len(new_fmt.c_str(), ap);
|
len = get_varg_len(new_fmt.c_str(), ap);
|
||||||
new_string = (char *)safemalloc(len + 1);
|
new_string = (char *)safemalloc(len + 1);
|
||||||
vsprintf(new_string, new_fmt.c_str(), ap);
|
va_copy(ap2, ap);
|
||||||
va_end(ap);
|
vsprintf(new_string, new_fmt.c_str(), ap2);
|
||||||
|
va_end(ap2);
|
||||||
dst = new_string;
|
dst = new_string;
|
||||||
safefree(new_string);
|
safefree(new_string);
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ void MTX_DLL_API mxverb(int level, const char *fmt, ...);
|
|||||||
void MTX_DLL_API mxdebug(const char *fmt, ...);
|
void MTX_DLL_API mxdebug(const char *fmt, ...);
|
||||||
int MTX_DLL_API mxsscanf(const string &str, const char *fmt, ...);
|
int MTX_DLL_API mxsscanf(const string &str, const char *fmt, ...);
|
||||||
#endif
|
#endif
|
||||||
string MTX_DLL_API mxvsprintf(const char *fmt, va_list &ap);
|
string MTX_DLL_API mxvsprintf(const char *fmt, va_list ap);
|
||||||
void MTX_DLL_API mxexit(int code = -1);
|
void MTX_DLL_API mxexit(int code = -1);
|
||||||
|
|
||||||
#define trace() _trace(__func__, __FILE__, __LINE__)
|
#define trace() _trace(__func__, __FILE__, __LINE__)
|
||||||
|
Loading…
Reference in New Issue
Block a user