VC fix: mustn't use filename/parent_path instead of leaf/branch_path because those aren't yet available in the version of boost we're currently using.
remove needless restriction on wdbg_printf buffer size update description of wdbg_printf to match wvsprintfW's real behavior This was SVN commit r7199.
This commit is contained in:
parent
a444e6febc
commit
78bc63d92c
@ -165,18 +165,14 @@ bool debug_filter_allows(const wchar_t* text)
|
||||
return false;
|
||||
}
|
||||
|
||||
// max # characters (including \0) output by debug_printf in one call.
|
||||
const size_t DEBUG_PRINTF_MAX_CHARS = 1024; // refer to wdbg.cpp!debug_vsprintf before changing this
|
||||
|
||||
#undef debug_printf // allowing #defining it out
|
||||
|
||||
void debug_printf(const wchar_t* fmt, ...)
|
||||
{
|
||||
wchar_t buf[DEBUG_PRINTF_MAX_CHARS]; buf[ARRAY_SIZE(buf)-1] = '\0';
|
||||
wchar_t buf[4096];
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
const int numChars = vswprintf_s(buf, DEBUG_PRINTF_MAX_CHARS, fmt, ap);
|
||||
const int numChars = vswprintf_s(buf, ARRAY_SIZE(buf), fmt, ap);
|
||||
debug_assert(numChars >= 0);
|
||||
va_end(ap);
|
||||
|
||||
|
@ -117,11 +117,11 @@ LibError CreateDirectories(const fs::wpath& path, mode_t mode)
|
||||
}
|
||||
|
||||
// If we were passed a path ending with '/', strip the '/' now so that
|
||||
// we can consistently use parent_path to find parent directory names
|
||||
if (path.filename() == L".")
|
||||
return CreateDirectories(path.parent_path(), mode);
|
||||
// we can consistently use branch_path to find parent directory names
|
||||
if (path.leaf() == L".")
|
||||
return CreateDirectories(path.branch_path(), mode);
|
||||
|
||||
RETURN_ERR(CreateDirectories(path.parent_path(), mode));
|
||||
RETURN_ERR(CreateDirectories(path.branch_path(), mode));
|
||||
|
||||
const fs::path path_c = path_from_wpath(path);
|
||||
errno = 0;
|
||||
|
@ -95,10 +95,10 @@ void debug_puts(const wchar_t* text)
|
||||
|
||||
void wdbg_printf(const wchar_t* fmt, ...)
|
||||
{
|
||||
wchar_t buf[1024/sizeof(wchar_t)]; // as required by wvsprintf
|
||||
wchar_t buf[1024+1]; // wvsprintfW will truncate to this size
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
wvsprintfW(buf, fmt, ap);
|
||||
wvsprintfW(buf, fmt, ap); // (return value doesn't indicate whether truncation occurred)
|
||||
va_end(ap);
|
||||
|
||||
debug_puts(buf);
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
/**
|
||||
* same as debug_printf except that some type conversions aren't supported
|
||||
* (in particular, no floating point).
|
||||
* (in particular, no floating point) and output is limited to 1024+1 characters.
|
||||
*
|
||||
* this function does not allocate memory from the CRT heap, which makes it
|
||||
* safe to use from an allocation hook.
|
||||
|
Loading…
Reference in New Issue
Block a user