From 0c99641a25a20f00996eecedbafd132ea073f486 Mon Sep 17 00:00:00 2001 From: Just van Rossum Date: Tue, 1 Aug 2000 20:47:48 +0000 Subject: [PATCH] fixed t1_tofixed() to handle floats of the form .001 and -.001 correctly. --- src/type1z/z1parse.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/type1z/z1parse.c b/src/type1z/z1parse.c index dcd039c34..794339dd2 100644 --- a/src/type1z/z1parse.c +++ b/src/type1z/z1parse.c @@ -504,17 +504,22 @@ if ( cur >= limit ) return 0; - /* first of all, read the integer part */ - result = t1_toint( &cur, limit ) << 16; + /* first of all, check the sign */ + if ( *cur == '-' ) + { + sign = 1; + cur++; + } + + /* then, read the integer part, if any */ + if ( *cur != '.' ) + result = t1_toint( &cur, limit ) << 16; + else + result = 0; + num = 0; divider = 1; - if ( result < 0 ) - { - sign = 1; - result = -result; - } - if ( cur >= limit ) goto Exit;