Make sure that parse_t2_real correctly parses a CFF real number. Added more comments
to the function.
This commit is contained in:
parent
ef0af208a0
commit
a51b45c607
|
@ -153,7 +153,7 @@
|
||||||
FT_Byte* limit,
|
FT_Byte* limit,
|
||||||
FT_Int power_ten )
|
FT_Int power_ten )
|
||||||
{
|
{
|
||||||
FT_Byte* p = ++start;
|
FT_Byte* p = start;
|
||||||
FT_Long num, divider, result, exp;
|
FT_Long num, divider, result, exp;
|
||||||
FT_Int sign = 0, exp_sign = 0;
|
FT_Int sign = 0, exp_sign = 0;
|
||||||
FT_Byte nib;
|
FT_Byte nib;
|
||||||
|
@ -166,14 +166,20 @@
|
||||||
|
|
||||||
/* first of all, read the integer part */
|
/* first of all, read the integer part */
|
||||||
phase = 4;
|
phase = 4;
|
||||||
p--;
|
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
/* read one nibble at a time */
|
|
||||||
if ( phase && ++p >= limit )
|
/* If we entered this iteration with phase == 4, we need to */
|
||||||
|
/* read a new byte. This also skips past the intial 0x1E. */
|
||||||
|
if ( phase )
|
||||||
|
p++;
|
||||||
|
|
||||||
|
/* Make sure we don't read past the end. */
|
||||||
|
if ( p >= limit )
|
||||||
goto Bad;
|
goto Bad;
|
||||||
|
|
||||||
|
/* Get the nibble. */
|
||||||
nib = ( p[0] >> phase ) & 0xF;
|
nib = ( p[0] >> phase ) & 0xF;
|
||||||
phase = 4 - phase;
|
phase = 4 - phase;
|
||||||
|
|
||||||
|
@ -189,13 +195,19 @@
|
||||||
if ( nib == 0xa )
|
if ( nib == 0xa )
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
/* read one nibble at a time */
|
|
||||||
if ( !phase && ++p >= limit )
|
/* If we entered this iteration with phase == 4, we need */
|
||||||
|
/* to read a new byte. */
|
||||||
|
if ( phase )
|
||||||
|
p++;
|
||||||
|
|
||||||
|
/* Make sure we don't read past the end. */
|
||||||
|
if ( p >= limit )
|
||||||
goto Bad;
|
goto Bad;
|
||||||
|
|
||||||
phase = 4 - phase;
|
/* Get the nibble. */
|
||||||
nib = ( p[0] >> phase ) & 0xF;
|
nib = ( p[0] >> phase ) & 0xF;
|
||||||
|
phase = 4 - phase;
|
||||||
if ( nib >= 10 )
|
if ( nib >= 10 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -219,13 +231,18 @@
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
/* read one nibble at a time */
|
/* If we entered this iteration with phase == 4, we need */
|
||||||
if ( !phase && ++p >= limit )
|
/* to read a new byte. */
|
||||||
|
if ( phase )
|
||||||
|
p++;
|
||||||
|
|
||||||
|
/* Make sure we don't read past the end. */
|
||||||
|
if ( p >= limit )
|
||||||
goto Bad;
|
goto Bad;
|
||||||
|
|
||||||
phase = 4 - phase;
|
/* Get the nibble. */
|
||||||
nib = ( p[0] >> phase ) & 0xF;
|
nib = ( p[0] >> phase ) & 0xF;
|
||||||
|
phase = 4 - phase;
|
||||||
if ( nib >= 10 )
|
if ( nib >= 10 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue