From b62da6fe46c8c3134e6bc9406c3d18f435d9c722 Mon Sep 17 00:00:00 2001 From: kichik Date: Tue, 12 Apr 2005 17:27:42 +0000 Subject: [PATCH] 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 --- Docs/src/bin/halibut/contents.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Docs/src/bin/halibut/contents.c b/Docs/src/bin/halibut/contents.c index 6be53fa2..27215fe6 100644 --- a/Docs/src/bin/halibut/contents.c +++ b/Docs/src/bin/halibut/contents.c @@ -73,21 +73,21 @@ static void dospace(word *** wret) static void donumber(word *** wret, int num) { wchar_t text[20]; - wchar_t *p = text + sizeof(text); - *--p = L'\0'; + int i = 19; + text[i] = L'\0'; while (num != 0) { - assert(p > text); - *--p = L"0123456789"[num % 10]; + assert(i >= 0); + i--; text[i] = L"0123456789"[num % 10]; num /= 10; } - dotext(wret, p); + dotext(wret, &text[i]); } static void doanumber(word *** wret, int num) { wchar_t text[20]; - wchar_t *p; + int i = 19; int nletters, aton; nletters = 1; aton = 25; @@ -100,15 +100,14 @@ static void doanumber(word *** wret, int num) else aton = INT_MAX; } - p = text + sizeof(text); - *--p = L'\0'; + text[i] = L'\0'; while (nletters--) { - assert(p > text); - *--p = L"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[num % 26]; + assert(i >= 0); + i--; text[i] = L"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[num % 26]; num /= 26; } - dotext(wret, p); + dotext(wret, &text[i]); } void number_cfg(numberstate * state, paragraph * source)