applied patch #1180886 - fix halibut segfaults on powerpc (and maybe other platforms)

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3959 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2005-04-12 17:27:42 +00:00
parent 9fdd4fbfc0
commit b62da6fe46

View file

@ -73,21 +73,21 @@ static void dospace(word *** wret)
static void donumber(word *** wret, int num) static void donumber(word *** wret, int num)
{ {
wchar_t text[20]; wchar_t text[20];
wchar_t *p = text + sizeof(text); int i = 19;
*--p = L'\0'; text[i] = L'\0';
while (num != 0) while (num != 0)
{ {
assert(p > text); assert(i >= 0);
*--p = L"0123456789"[num % 10]; i--; text[i] = L"0123456789"[num % 10];
num /= 10; num /= 10;
} }
dotext(wret, p); dotext(wret, &text[i]);
} }
static void doanumber(word *** wret, int num) static void doanumber(word *** wret, int num)
{ {
wchar_t text[20]; wchar_t text[20];
wchar_t *p; int i = 19;
int nletters, aton; int nletters, aton;
nletters = 1; nletters = 1;
aton = 25; aton = 25;
@ -100,15 +100,14 @@ static void doanumber(word *** wret, int num)
else else
aton = INT_MAX; aton = INT_MAX;
} }
p = text + sizeof(text); text[i] = L'\0';
*--p = L'\0';
while (nletters--) while (nletters--)
{ {
assert(p > text); assert(i >= 0);
*--p = L"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[num % 26]; i--; text[i] = L"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[num % 26];
num /= 26; num /= 26;
} }
dotext(wret, p); dotext(wret, &text[i]);
} }
void number_cfg(numberstate * state, paragraph * source) void number_cfg(numberstate * state, paragraph * source)