From 81bb4ad937f21e5fe64b2bdfef98250984e37eff Mon Sep 17 00:00:00 2001 From: David Turner Date: Wed, 28 Jun 2000 04:19:49 +0000 Subject: [PATCH] latest clean-ups.. The code compiles with NO WARNINGS with GCC and Visual C++ (also with LCC minus debugging options) --- BUILD | 4 ++-- CHANGES | 3 +++ config/win32/w32-lcc.mk | 4 ++-- demos/src/ftmulti.c | 8 +++++--- demos/src/ftview.c | 2 +- demos/src/memtest.c | 8 +++----- include/freetype/internal/t1types.h | 1 + src/base/ftobjs.c | 3 +-- src/base/ftstream.c | 19 +++++++++++++++++-- src/cff/t2gload.c | 4 ++++ src/cff/t2parse.c | 27 +++++++++++++++++++-------- src/cid/cidafm.c | 6 +++--- src/cid/cidafm.h | 8 ++++---- src/cid/cidgload.c | 6 +++--- src/cid/cidload.c | 2 +- src/cid/cidobjs.c | 1 - src/cid/cidriver.c | 10 ++-------- src/cid/rules.mk | 1 - src/cid/type1cid.c | 2 +- src/truetype/ttgload.c | 2 +- src/type1/t1driver.c | 6 +++--- 21 files changed, 76 insertions(+), 51 deletions(-) diff --git a/BUILD b/BUILD index 9a03572f8..6cfd39c94 100644 --- a/BUILD +++ b/BUILD @@ -222,9 +222,9 @@ II. DETAILED COMPILATION PROCEDURE: src/base/ftinit.c - initialisation layer src/base/ftdebug.c - debugging component (empty in release build) src/base/ftbase.c - the "base layer" component - src/base/ftraster.c - the standard raster (scan-converter) - src/base/ftgrays.c - the smooth raster (anti-aliased only) src/base/ftglyph.c - optional convenience functions + src/raster1/raster1.c - the monochrome bitmap renderer + src/smooth/smooth.c - the anti-aliased bitmap renderer src/sfnt/sfnt.c - the "sfnt" module src/psnames/psnames.c - the "psnames" module src/truetype/truetype.c - the TrueType font driver diff --git a/CHANGES b/CHANGES index 659f0b451..42e3a0abf 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,9 @@ LATEST CHANGES "make multi" now works well :-) + Also removed the use of "cidafm" for now, even if the source files + are still there. This functionality will certainly go into a specific + module.. - CHANGES TO THE RENDERER MODULES diff --git a/config/win32/w32-lcc.mk b/config/win32/w32-lcc.mk index 1ac7b8250..172ead1cf 100644 --- a/config/win32/w32-lcc.mk +++ b/config/win32/w32-lcc.mk @@ -119,8 +119,8 @@ ifdef BUILD_FREETYPE # librarian library_file {list of object files} # $(FT_LIBRARY): $(OBJECTS_LIST) - lcclib /out:$(subst $(SEP),$(HOSTSEP),$@) \ - $(subst $(SEP),$(HOSTSEP),$(OBJECTS_LIST)) + lcclib /out:$(subst $(SEP),\\,$@) \ + $(subst $(SEP),\\,$(OBJECTS_LIST)) endif diff --git a/demos/src/ftmulti.c b/demos/src/ftmulti.c index 34fce60fd..ebc19dcfb 100644 --- a/demos/src/ftmulti.c +++ b/demos/src/ftmulti.c @@ -343,6 +343,8 @@ const unsigned char* p; + ptsize=ptsize; + start_x = 4; start_y = 32 + size->metrics.y_ppem; @@ -586,7 +588,7 @@ return 1; Do_Axis: - if ( axis < multimaster.num_axis ) + if ( axis < (int)multimaster.num_axis ) { FT_MM_Axis* a = multimaster.axis + axis; FT_Long pos = design_pos[axis]; @@ -711,7 +713,7 @@ int n; - for ( n = 0; n < multimaster.num_axis; n++ ) + for ( n = 0; n < (int)multimaster.num_axis; n++ ) design_pos[n] = ( multimaster.axis[n].minimum + multimaster.axis[n].maximum ) / 2; } @@ -790,7 +792,7 @@ int n; - for ( n = 0; n < multimaster.num_axis; n++ ) + for ( n = 0; n < (int)multimaster.num_axis; n++ ) { char temp[32]; diff --git a/demos/src/ftview.c b/demos/src/ftview.c index 8b1e8bfce..e1e2690a5 100644 --- a/demos/src/ftview.c +++ b/demos/src/ftview.c @@ -601,7 +601,7 @@ if ( debug ) { #ifdef FT_DEBUG_LEVEL_TRACE - FT_SetTraceLevel( trace_any, trace_level ); + FT_SetTraceLevel( trace_any, (FT_Byte)trace_level ); #else trace_level = 0; #endif diff --git a/demos/src/memtest.c b/demos/src/memtest.c index 3717b9dc6..b78010164 100644 --- a/demos/src/memtest.c +++ b/demos/src/memtest.c @@ -18,6 +18,7 @@ int Fail; int Num; + extern void FT_Add_Default_Modules( FT_Library library ); @@ -42,11 +43,6 @@ typedef struct MyBlock static MyBlock my_blocks[ MAX_RECORDED_BLOCKS ]; static int num_my_blocks = 0; -static -void rewind_memory( void ) -{ - num_my_blocks = 0; -} /* record a new block in the table, check for duplicates too */ static @@ -125,12 +121,14 @@ void* my_alloc( FT_Memory memory, if (p) record_my_block(p,size); + memory=memory; return p; } static void my_free( FT_Memory memory, void* block ) { + memory=memory; forget_my_block(block); /* free(block); WE DO NOT REALLY FREE THE BLOCK */ } diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h index 067e2da11..974d9764a 100644 --- a/include/freetype/internal/t1types.h +++ b/include/freetype/internal/t1types.h @@ -184,6 +184,7 @@ FT_FaceRec root; void* psnames; CID_Info cid; + void* afm_data; CID_Subrs* subrs; } CID_FaceRec; diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 7a5650751..aa129938a 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -2257,7 +2257,7 @@ if ( !result || result->glyph_format != slot->format ) - result = ft_lookup_renderer( library, slot->format, 0 ); + result = FT_Lookup_Renderer( library, slot->format, 0 ); return result; } @@ -2439,7 +2439,6 @@ } -<<<<<<< ftobjs.c /************************************************************************* * * diff --git a/src/base/ftstream.c b/src/base/ftstream.c index 739536716..f2fc2ee23 100644 --- a/src/base/ftstream.c +++ b/src/base/ftstream.c @@ -645,12 +645,27 @@ *(FT_UShort*)p = (FT_UShort)value; break; + /* A slight note regarding the following: */ + /* */ + /* SIZEOF_INT is defined in */ + /* and gives the size in bytes of the "int" type on the */ + /* current platform.. */ + /* */ + /* Only on 16-bit systems can the value of SIZEOF_INT be */ + /* less than 4. In this case SIZEOF_LONG is always 4 */ + /* */ + /* On a 64-bit system, SIZEOF_LONG can be 8, which is */ + /* handled by the default case.. */ + /* */ + +#if SIZEOF_INT == 4 case 4: - *(FT_ULong*)p = (FT_ULong)value; + *(FT_UInt*)p = (FT_UInt)value; break; +#endif default: - ; /* ignore! */ + *(FT_ULong*)p = (FT_ULong)value; } /* go to next field */ diff --git a/src/cff/t2gload.c b/src/cff/t2gload.c index 8a719519f..6eeec2de4 100644 --- a/src/cff/t2gload.c +++ b/src/cff/t2gload.c @@ -363,6 +363,10 @@ if (cff->num_subfonts >= 1) { FT_Byte fd_index = CFF_Get_FD( &cff->fd_select, glyph_index ); + if (fd_index >= cff->num_subfonts) + { + FT_ERROR(( "INVALID FD INDEX = %d >= %d\n", fd_index, cff->num_subfonts )); + } sub = cff->subfonts[fd_index]; } diff --git a/src/cff/t2parse.c b/src/cff/t2parse.c index 1b9207fbc..7692e115a 100644 --- a/src/cff/t2parse.c +++ b/src/cff/t2parse.c @@ -516,17 +516,28 @@ case t2_kind_fixed: val = t2_parse_fixed( parser->stack ); + /* A slight note regarding the following: */ + /* */ + /* SIZEOF_INT is defined in */ + /* and gives the size in bytes of the "int" type on the */ + /* current platform.. */ + /* */ + /* Only on 16-bit systems can the value of SIZEOF_INT be */ + /* less than 4. In this case SIZEOF_LONG is always 4 */ + /* */ + /* On a 64-bit system, SIZEOF_LONG can be 8, which is */ + /* handled by the default case.. */ + /* */ + Store_Number: switch ( field->size ) { - case 1: - *(FT_Byte*)q = (FT_Byte)val; - break; - case 2: - *(FT_Short*)q = (FT_Short)val; - break; - default: - *(FT_Long*)q = val; + case 1: *(FT_Byte*)q = (FT_Byte)val; break; + case 2: *(FT_Short*)q = (FT_Short)val; break; +#if SIZEOF_INT == 4 + case 4: *(FT_Int*)q = (FT_Int)val; break; +#endif + default: *(FT_Long*)q = val; } break; diff --git a/src/cid/cidafm.c b/src/cid/cidafm.c index a98c3fc91..86b2bce05 100644 --- a/src/cid/cidafm.c +++ b/src/cid/cidafm.c @@ -159,7 +159,7 @@ /* parse an AFM file - for now, only read the kerning pairs */ LOCAL_FUNC - FT_Error CID_Read_AFM( FT_Face t1_face, + FT_Error CID_Read_AFM( FT_Face cid_face, FT_Stream stream ) { FT_Error error; @@ -168,9 +168,9 @@ FT_Byte* limit; FT_Byte* p; FT_Int count = 0; - CID_Kern_Pair* pair; + CID_Kern_Pair* pair; T1_Font* type1 = &((T1_Face)t1_face)->type1; - CID_AFM* afm = 0; + CID_AFM* afm = 0; if ( ACCESS_Frame( stream->size ) ) diff --git a/src/cid/cidafm.h b/src/cid/cidafm.h index bb1741a5a..61c5ad721 100644 --- a/src/cid/cidafm.h +++ b/src/cid/cidafm.h @@ -32,7 +32,7 @@ typedef struct CID_AFM_ { - FT_Int num_pairs; + FT_UInt num_pairs; CID_Kern_Pair* kern_pairs; } CID_AFM; @@ -41,15 +41,15 @@ #if 1 LOCAL_DEF - FT_Error CID_Read_AFM( FT_Face t1_face, + FT_Error CID_Read_AFM( FT_Face cid_face, FT_Stream stream ); LOCAL_DEF void CID_Done_AFM( FT_Memory memory, - CID_AFM* afm ); + CID_AFM* afm ); LOCAL_DEF - void CID_Get_Kerning( CID_AFM* afm, + void CID_Get_Kerning( CID_AFM* afm, FT_UInt glyph1, FT_UInt glyph2, FT_Vector* kerning ); diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index 96d0b5323..96519306f 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -1324,10 +1324,10 @@ goto Exit; p = (FT_Byte*)stream->cursor; - fd_select = (FT_UInt) cid_get_offset( &p, cid->fd_bytes ); - off1 = (FT_ULong)cid_get_offset( &p, cid->gd_bytes ); + fd_select = (FT_UInt) cid_get_offset( &p, (FT_Byte)cid->fd_bytes ); + off1 = (FT_ULong)cid_get_offset( &p, (FT_Byte)cid->gd_bytes ); p += cid->fd_bytes; - glyph_len = cid_get_offset( &p, cid->gd_bytes ) - off1; + glyph_len = cid_get_offset( &p, (FT_Byte)cid->gd_bytes ) - off1; FORGET_Frame(); diff --git a/src/cid/cidload.c b/src/cid/cidload.c index 61c55257f..41b823da3 100644 --- a/src/cid/cidload.c +++ b/src/cid/cidload.c @@ -400,7 +400,7 @@ p = (FT_Byte*)stream->cursor; for ( count = 0; count <= num_subrs; count++ ) - offsets[count] = cid_get_offset( &p, dict->sd_bytes ); + offsets[count] = cid_get_offset( &p, (FT_Byte)dict->sd_bytes ); FORGET_Frame(); diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index ffa9172c6..21490b42a 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -22,7 +22,6 @@ #include #include #include -#include /*************************************************************************/ diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index 8e3a759b8..11be5c761 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -18,7 +18,6 @@ #include #include -#include #include #include @@ -48,7 +47,7 @@ } -#ifndef T1_CONFIG_OPTION_NO_AFM +#if 0 /* unimplemented for now.. */ static FT_Error cid_Get_Kerning( T1_Face face, @@ -70,7 +69,7 @@ } -#endif /* !T1_CONFIG_OPTION_NO_AFM */ +#endif /* 0 */ /*************************************************************************/ @@ -209,13 +208,8 @@ (FTDriver_loadGlyph) CID_Load_Glyph, (FTDriver_getCharIndex) CID_Get_Char_Index, -#ifdef T1_CONFIG_OPTION_NO_AFM (FTDriver_getKerning) 0, (FTDriver_attachFile) 0, -#else - (FTDriver_getKerning) cid_Get_Kerning, - (FTDriver_attachFile) CID_Read_AFM, -#endif (FTDriver_getAdvances) 0 }; diff --git a/src/cid/rules.mk b/src/cid/rules.mk index 5999a739b..8e9758612 100644 --- a/src/cid/rules.mk +++ b/src/cid/rules.mk @@ -35,7 +35,6 @@ CID_DRV_SRC := $(CID_DIR_)cidparse.c \ $(CID_DIR_)cidload.c \ $(CID_DIR_)cidriver.c \ $(CID_DIR_)cidgload.c \ - $(CID_DIR_)cidafm.c \ $(CID_DIR_)cidobjs.c # CID driver headers diff --git a/src/cid/type1cid.c b/src/cid/type1cid.c index dca723cb9..855f564d2 100644 --- a/src/cid/type1cid.c +++ b/src/cid/type1cid.c @@ -24,7 +24,7 @@ #include #include -#if 1 +#if 0 #include #endif diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 01686b4e4..e2cbbad86 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1417,7 +1417,7 @@ #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ /* clear all outline flags, except the `owner' one */ - glyph->outline.flags &= ft_outline_owner; + glyph->outline.flags = 0; if ( size && size->root.metrics.y_ppem < 24 ) glyph->outline.flags |= ft_outline_high_precision; diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index d5da36a6b..64b606dee 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -308,12 +308,12 @@ #ifdef T1_CONFIG_OPTION_NO_AFM (FTDriver_getKerning) 0, - (FTDriver_getAdvances) 0 + (FTDriver_getAdvances) 0, #else (FTDriver_getKerning) Get_Kerning, - (FTDriver_attachFile) T1_Read_AFM + (FTDriver_attachFile) T1_Read_AFM, #endif - (FTDriver_getAdvances) 0 + (FTDriver_getAdvances) 0 };