... |
... |
@@ -378,7 +378,7 @@ |
378
|
378
|
*alen = 0;
|
379
|
379
|
|
380
|
380
|
if ( list == NULL || list->used == 0 )
|
381
|
|
- return 0;
|
|
381
|
+ return NULL;
|
382
|
382
|
|
383
|
383
|
dp = list->field[0];
|
384
|
384
|
for ( i = j = 0; i < list->used; i++ )
|
... |
... |
@@ -887,18 +887,18 @@ |
887
|
887
|
}
|
888
|
888
|
|
889
|
889
|
|
890
|
|
- FT_LOCAL_DEF( bdf_property_t* )
|
891
|
|
- bdf_get_property( char* name,
|
|
890
|
+ static bdf_property_t*
|
|
891
|
+ bdf_get_property( const char* name,
|
892
|
892
|
bdf_font_t* font )
|
893
|
893
|
{
|
894
|
894
|
size_t* propid;
|
895
|
895
|
|
896
|
896
|
|
897
|
897
|
if ( name == NULL || *name == 0 )
|
898
|
|
- return 0;
|
|
898
|
+ return NULL;
|
899
|
899
|
|
900
|
900
|
if ( ( propid = ft_hash_str_lookup( name, &(font->proptbl) ) ) == NULL )
|
901
|
|
- return 0;
|
|
901
|
+ return NULL;
|
902
|
902
|
|
903
|
903
|
if ( *propid >= num_bdf_properties_ )
|
904
|
904
|
return font->user_props + ( *propid - num_bdf_properties_ );
|
... |
... |
@@ -944,7 +944,7 @@ |
944
|
944
|
|
945
|
945
|
static FT_Error
|
946
|
946
|
bdf_add_comment_( bdf_font_t* font,
|
947
|
|
- char* comment,
|
|
947
|
+ const char* comment,
|
948
|
948
|
unsigned long len )
|
949
|
949
|
{
|
950
|
950
|
char* cp;
|
... |
... |
@@ -1053,27 +1053,24 @@ |
1053
|
1053
|
bdf_property_t* p;
|
1054
|
1054
|
|
1055
|
1055
|
|
1056
|
|
- *name = sp = ep = line;
|
|
1056
|
+ sp = ep = line;
|
1057
|
1057
|
|
1058
|
1058
|
while ( *ep && *ep != ' ' && *ep != '\t' )
|
1059
|
1059
|
ep++;
|
1060
|
1060
|
|
1061
|
|
- hold = -1;
|
1062
|
|
- if ( *ep )
|
1063
|
|
- {
|
1064
|
|
- hold = *ep;
|
1065
|
|
- *ep = 0;
|
1066
|
|
- }
|
|
1061
|
+ hold = *ep;
|
|
1062
|
+ *ep = '\0';
|
1067
|
1063
|
|
1068
|
1064
|
p = bdf_get_property( sp, font );
|
1069
|
1065
|
|
1070
|
|
- /* Restore the character that was saved before any return can happen. */
|
1071
|
|
- if ( hold != -1 )
|
1072
|
|
- *ep = (char)hold;
|
1073
|
|
-
|
1074
|
1066
|
/* If the property exists and is not an atom, just return here. */
|
1075
|
1067
|
if ( p && p->format != BDF_ATOM )
|
|
1068
|
+ {
|
|
1069
|
+ *ep = (char)hold; /* Undo NUL-termination. */
|
1076
|
1070
|
return 0;
|
|
1071
|
+ }
|
|
1072
|
+
|
|
1073
|
+ *name = sp;
|
1077
|
1074
|
|
1078
|
1075
|
/* The property is an atom. Trim all leading and trailing whitespace */
|
1079
|
1076
|
/* and double quotes for the atom value. */
|
... |
... |
@@ -1081,25 +1078,26 @@ |
1081
|
1078
|
ep = line + linelen;
|
1082
|
1079
|
|
1083
|
1080
|
/* Trim the leading whitespace if it exists. */
|
1084
|
|
- if ( *sp )
|
1085
|
|
- *sp++ = 0;
|
1086
|
|
- while ( *sp &&
|
1087
|
|
- ( *sp == ' ' || *sp == '\t' ) )
|
1088
|
|
- sp++;
|
|
1081
|
+ if ( sp < ep )
|
|
1082
|
+ do
|
|
1083
|
+ sp++;
|
|
1084
|
+ while ( *sp == ' ' || *sp == '\t' );
|
1089
|
1085
|
|
1090
|
1086
|
/* Trim the leading double quote if it exists. */
|
1091
|
1087
|
if ( *sp == '"' )
|
1092
|
1088
|
sp++;
|
|
1089
|
+
|
1093
|
1090
|
*value = sp;
|
1094
|
1091
|
|
1095
|
1092
|
/* Trim the trailing whitespace if it exists. */
|
1096
|
|
- while ( ep > sp &&
|
1097
|
|
- ( *( ep - 1 ) == ' ' || *( ep - 1 ) == '\t' ) )
|
1098
|
|
- *--ep = 0;
|
|
1093
|
+ if ( sp < ep )
|
|
1094
|
+ do
|
|
1095
|
+ *ep-- = '\0';
|
|
1096
|
+ while ( *ep == ' ' || *ep == '\t' );
|
1099
|
1097
|
|
1100
|
1098
|
/* Trim the trailing double quote if it exists. */
|
1101
|
|
- if ( ep > sp && *( ep - 1 ) == '"' )
|
1102
|
|
- *--ep = 0;
|
|
1099
|
+ if ( *ep == '"' )
|
|
1100
|
+ *ep = '\0';
|
1103
|
1101
|
|
1104
|
1102
|
return 1;
|
1105
|
1103
|
}
|