Fixed some formatting and a cast.

This commit is contained in:
gibbed 2014-01-17 18:57:56 -08:00
parent dbaa47a851
commit a6e1095cbc
1 changed files with 10 additions and 10 deletions

View File

@ -40,14 +40,14 @@ SHIM_CALL _vsnprintf_shim(
return; return;
} }
char *buffer = (char *)SHIM_MEM_ADDR(buffer_ptr); // TODO: ensure it never writes past the end of the buffer (count)... char* buffer = (char*)SHIM_MEM_ADDR(buffer_ptr); // TODO: ensure it never writes past the end of the buffer (count)...
const char *format = (const char *)SHIM_MEM_ADDR(format_ptr); const char* format = (const char*)SHIM_MEM_ADDR(format_ptr);
int arg_index = 0; int arg_index = 0;
char *b = buffer; char* b = buffer;
for (; *format != '\0'; ++format) { for (; *format != '\0'; ++format) {
const char *start = format; const char* start = format;
if (*format != '%') { if (*format != '%') {
*b++ = *format; *b++ = *format;
@ -64,7 +64,7 @@ SHIM_CALL _vsnprintf_shim(
continue; continue;
} }
const char *end; const char* end;
end = format; end = format;
// skip flags // skip flags
@ -208,7 +208,7 @@ SHIM_CALL _vsnprintf_shim(
XEASSERT(arg_size == 4); XEASSERT(arg_size == 4);
if (arg_extras == 0) { if (arg_extras == 0) {
uint32_t value = (uint32_t)SHIM_MEM_64(arg_ptr + (arg_index * 8)); // TODO: check if this is correct... uint32_t value = (uint32_t)SHIM_MEM_64(arg_ptr + (arg_index * 8)); // TODO: check if this is correct...
const char *pointer = (const char *)SHIM_MEM_ADDR(value); const char* pointer = (const char*)SHIM_MEM_ADDR(value);
int result = sprintf(b, local, pointer); int result = sprintf(b, local, pointer);
b += result; b += result;
arg_index++; arg_index++;
@ -248,7 +248,7 @@ SHIM_CALL _vswprintf_shim(
size_t format_length = wcslen(format); size_t format_length = wcslen(format);
// swap the format buffer // swap the format buffer
wchar_t *swapped_format = (wchar_t*)xe_malloc((format_length + 1) * sizeof(wchar_t)); wchar_t* swapped_format = (wchar_t*)xe_malloc((format_length + 1) * sizeof(wchar_t));
for (size_t i = 0; i < format_length; ++i) for (size_t i = 0; i < format_length; ++i)
{ {
swapped_format[i] = XESWAP16(format[i]); swapped_format[i] = XESWAP16(format[i]);
@ -260,7 +260,7 @@ SHIM_CALL _vswprintf_shim(
int arg_index = 0; int arg_index = 0;
wchar_t *b = buffer; wchar_t* b = buffer;
for (; *format != '\0'; ++format) { for (; *format != '\0'; ++format) {
const wchar_t *start = format; const wchar_t *start = format;
@ -279,7 +279,7 @@ SHIM_CALL _vswprintf_shim(
continue; continue;
} }
const wchar_t *end; const wchar_t* end;
end = format; end = format;
// skip flags // skip flags
@ -423,7 +423,7 @@ SHIM_CALL _vswprintf_shim(
XEASSERT(arg_size == 4); XEASSERT(arg_size == 4);
if (arg_extras == 0) { if (arg_extras == 0) {
uint32_t value = (uint32_t)SHIM_MEM_64(arg_ptr + (arg_index * 8)); // TODO: check if this is correct... uint32_t value = (uint32_t)SHIM_MEM_64(arg_ptr + (arg_index * 8)); // TODO: check if this is correct...
const char *pointer = (const char *)SHIM_MEM_ADDR(value); const wchar_t* pointer = (const wchar_t*)SHIM_MEM_ADDR(value);
int result = wsprintf(b, local, pointer); int result = wsprintf(b, local, pointer);
b += result; b += result;
arg_index++; arg_index++;