winemac: Rename some confusingly-named variables.

This commit is contained in:
Ken Thomases 2013-10-20 23:55:00 -05:00 committed by Alexandre Julliard
parent c7f8e71ab6
commit 49197e811b

View File

@ -918,25 +918,25 @@ static HANDLE import_utf8_to_text(CFDataRef data)
static HANDLE import_utf8_to_unicodetext(CFDataRef data) static HANDLE import_utf8_to_unicodetext(CFDataRef data)
{ {
const BYTE *src; const BYTE *src;
unsigned long data_len; unsigned long src_len;
unsigned long new_lines = 0; unsigned long new_lines = 0;
LPSTR dst; LPSTR dst;
unsigned long i, j; unsigned long i, j;
HANDLE unicode_handle = NULL; HANDLE unicode_handle = NULL;
src = CFDataGetBytePtr(data); src = CFDataGetBytePtr(data);
data_len = CFDataGetLength(data); src_len = CFDataGetLength(data);
for (i = 0; i < data_len; i++) for (i = 0; i < src_len; i++)
{ {
if (src[i] == '\n') if (src[i] == '\n')
new_lines++; new_lines++;
} }
if ((dst = HeapAlloc(GetProcessHeap(), 0, data_len + new_lines + 1))) if ((dst = HeapAlloc(GetProcessHeap(), 0, src_len + new_lines + 1)))
{ {
UINT count; UINT count;
for (i = 0, j = 0; i < data_len; i++) for (i = 0, j = 0; i < src_len; i++)
{ {
if (src[i] == '\n') if (src[i] == '\n')
dst[j++] = '\r'; dst[j++] = '\r';
@ -1000,25 +1000,25 @@ static HANDLE import_utf16_to_text(CFDataRef data)
static HANDLE import_utf16_to_unicodetext(CFDataRef data) static HANDLE import_utf16_to_unicodetext(CFDataRef data)
{ {
const WCHAR *src; const WCHAR *src;
unsigned long data_len; unsigned long src_len;
unsigned long new_lines = 0; unsigned long new_lines = 0;
LPWSTR dst; LPWSTR dst;
unsigned long i, j; unsigned long i, j;
HANDLE unicode_handle; HANDLE unicode_handle;
src = (const WCHAR *)CFDataGetBytePtr(data); src = (const WCHAR *)CFDataGetBytePtr(data);
data_len = CFDataGetLength(data) / sizeof(WCHAR); src_len = CFDataGetLength(data) / sizeof(WCHAR);
for (i = 0; i < data_len; i++) for (i = 0; i < src_len; i++)
{ {
if (src[i] == '\n') if (src[i] == '\n')
new_lines++; new_lines++;
} }
if ((unicode_handle = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, (data_len + new_lines + 1) * sizeof(WCHAR)))) if ((unicode_handle = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, (src_len + new_lines + 1) * sizeof(WCHAR))))
{ {
dst = GlobalLock(unicode_handle); dst = GlobalLock(unicode_handle);
for (i = 0, j = 0; i < data_len; i++) for (i = 0, j = 0; i < src_len; i++)
{ {
if (src[i] == '\n') if (src[i] == '\n')
dst[j++] = '\r'; dst[j++] = '\r';
@ -1351,27 +1351,27 @@ static CFDataRef export_unicodetext_to_utf16(HANDLE data)
{ {
CFMutableDataRef ret; CFMutableDataRef ret;
const WCHAR *src; const WCHAR *src;
INT dst_len; INT src_len;
src = GlobalLock(data); src = GlobalLock(data);
if (!src) return NULL; if (!src) return NULL;
dst_len = GlobalSize(data) / sizeof(WCHAR); src_len = GlobalSize(data) / sizeof(WCHAR);
if (dst_len) dst_len--; /* Leave off null terminator. */ if (src_len) src_len--; /* Leave off null terminator. */
ret = CFDataCreateMutable(NULL, dst_len * sizeof(WCHAR)); ret = CFDataCreateMutable(NULL, src_len * sizeof(WCHAR));
if (ret) if (ret)
{ {
LPWSTR dst; LPWSTR dst;
int i, j; int i, j;
CFDataSetLength(ret, dst_len * sizeof(WCHAR)); CFDataSetLength(ret, src_len * sizeof(WCHAR));
dst = (LPWSTR)CFDataGetMutableBytePtr(ret); dst = (LPWSTR)CFDataGetMutableBytePtr(ret);
/* Remove carriage returns */ /* Remove carriage returns */
for (i = 0, j = 0; i < dst_len; i++) for (i = 0, j = 0; i < src_len; i++)
{ {
if (src[i] == '\r' && if (src[i] == '\r' &&
(i + 1 >= dst_len || src[i + 1] == '\n' || src[i + 1] == '\0')) (i + 1 >= src_len || src[i + 1] == '\n' || src[i + 1] == '\0'))
continue; continue;
dst[j++] = src[i]; dst[j++] = src[i];
} }