Ensures, when we cannot demangle the string, to return the mangled

name instead of a NULL pointer.
This commit is contained in:
Eric Pouech 2005-11-18 12:06:00 +00:00 committed by Alexandre Julliard
parent 73b0e94bb3
commit ced7436fe9
1 changed files with 10 additions and 12 deletions

View File

@ -1152,6 +1152,7 @@ char* __unDNameEx(char* buffer, const char* mangled, int buflen,
void* unknown, unsigned short int flags) void* unknown, unsigned short int flags)
{ {
struct parsed_symbol sym; struct parsed_symbol sym;
const char* result;
TRACE("(%p,%s,%d,%p,%p,%p,%x) stub!\n", TRACE("(%p,%s,%d,%p,%p,%p,%x) stub!\n",
buffer, mangled, buflen, memget, memfree, unknown, flags); buffer, mangled, buflen, memget, memfree, unknown, flags);
@ -1171,20 +1172,17 @@ char* __unDNameEx(char* buffer, const char* mangled, int buflen,
sym.mem_free_ptr = memfree; sym.mem_free_ptr = memfree;
sym.current = mangled; sym.current = mangled;
if (symbol_demangle(&sym)) result = symbol_demangle(&sym) ? sym.result : mangled;
if (buffer && buflen)
{ {
if (buffer && buflen) memcpy(buffer, result, buflen - 1);
{ buffer[buflen - 1] = '\0';
memcpy(buffer, sym.result, buflen - 1); }
buffer[buflen - 1] = '\0'; else
} {
else buffer = memget(strlen(result) + 1);
{ if (buffer) strcpy(buffer, result);
buffer = memget(strlen(sym.result) + 1);
if (buffer) strcpy(buffer, sym.result);
}
} }
else buffer = NULL;
und_free_all(&sym); und_free_all(&sym);