mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-23 19:31:44 +00:00
Hopefully fixed compilation with MSC which doesn't know va_copy but which allows using a va_list with a consumer function more than once.
This commit is contained in:
parent
ed3a1f4a53
commit
c1d2c53d58
@ -1397,11 +1397,15 @@ get_varg_len(const char *fmt,
|
||||
size = 1024;
|
||||
dst = (char *)safemalloc(size);
|
||||
while (1) {
|
||||
#if defined(COMP_MSC)
|
||||
result = vsnprintf(dst, size - 1, fmt, ap);
|
||||
#else
|
||||
va_list ap2;
|
||||
|
||||
va_copy(ap2, ap);
|
||||
result = vsnprintf(dst, size - 1, fmt, ap2);
|
||||
va_end(ap2);
|
||||
#endif // defined(COMP_MSC)
|
||||
if (result >= 0) {
|
||||
safefree(dst);
|
||||
return result;
|
||||
@ -1420,14 +1424,20 @@ mxvsprintf(const char *fmt,
|
||||
string new_fmt, dst;
|
||||
char *new_string;
|
||||
int len;
|
||||
#if !defined(COMP_MSC)
|
||||
va_list ap2;
|
||||
#endif
|
||||
|
||||
fix_format(fmt, new_fmt);
|
||||
len = get_varg_len(new_fmt.c_str(), ap);
|
||||
new_string = (char *)safemalloc(len + 1);
|
||||
#if defined(COMP_MSC)
|
||||
vsprintf(new_string, new_fmt.c_str(), ap);
|
||||
#else
|
||||
va_copy(ap2, ap);
|
||||
vsprintf(new_string, new_fmt.c_str(), ap2);
|
||||
va_end(ap2);
|
||||
#endif // defined(COMP_MSC)
|
||||
dst = new_string;
|
||||
safefree(new_string);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user