Crash fix 1.4.12
Bjorn
bahl@privat.utfors.se
Sat, 26 May 2001 18:22:35 +0200
I finally found & fixed the annoying problem which used to crash GnuCash
when I used Swedish characters. This turned out to be a problem with
CHAR_TO_INDEX() [in QuickFill.c] taking a SIGNED argument, thus making all
characters >= 128 NEGATIVE. (In Sweden, people like to use åäöÅÄÖ.)
I don't know if this is already corrected in 1.5.x. The patch applies to
1.4.12. (I know, the patch is not clean, but it's such a small change
loading up the editor is just as easy - and I don't want to figure out how
to set up a development environment just for this.)
=== gdb trace ===
Breakpoint 1, qfInsertTextRec (qf=0x83ea800,
text=0x8456240 "Överföring aktiedepå", depth=0, sort=QUICKFILL_LIFO)
at QuickFill.c:191
191 {
(gdb) step
192 if (NULL == qf) return;
(gdb)
194 if( text )
(gdb)
196 if( text[depth] != '\0' )
(gdb)
198 int index = CHAR_TO_INDEX( text[depth] );
(gdb) next
200 if( qf->qf[index] == NULL )
(gdb) print index
$14 = -41
(gdb) whatis index
type = int
=== CHAR_TO_INDEX ===
static int
CHAR_TO_INDEX( char c )
{
int index = toupper(c); ! (char)c => (int)parameter
if (index >= (QFNUM - 1))
return 0;
return index + 1;
}
=== PATCH ===
--- QuickFill_old.c Sat May 26 17:24:45 2001
+++ QuickFill.c Sat May 26 17:24:50 2001
@@ -45,7 +45,7 @@
\********************************************************************/
static int
-CHAR_TO_INDEX( char c )
+CHAR_TO_INDEX( unsigned char c )
{
int index = toupper(c);
Cheers,
Björn Ahlqvist
(I'm REALLY happy I found this one...)