summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@benzedrine.nwnk.net>2007-06-07 15:28:09 -0400
committerAdam Jackson <ajax@benzedrine.nwnk.net>2007-06-07 15:28:09 -0400
commit8c31fadabd706af63381007d666e685a66b58fd9 (patch)
tree034c274e87080c918408683e1e551f7552f128c5
parentfabf5458f1acbfc967bdaea3b89d707c22b97364 (diff)
Dead code cull from FreeType.
-rw-r--r--src/FreeType/ft.h1
-rw-r--r--src/FreeType/fttools.c47
-rw-r--r--src/FreeType/xttcap.c361
-rw-r--r--src/FreeType/xttcap.h5
4 files changed, 158 insertions, 256 deletions
diff --git a/src/FreeType/ft.h b/src/FreeType/ft.h
index 8ad8403..7560c8d 100644
--- a/src/FreeType/ft.h
+++ b/src/FreeType/ft.h
@@ -89,7 +89,6 @@ unsigned FTRemap(FT_Face face, FTMappingPtr, unsigned code);
int FTtoXReturnCode(int);
int FTGetEnglishName(FT_Face, int, char *, int);
-int FTcheckForTTCName(char*, char**, int*);
extern void ErrorF(const char*, ...);
diff --git a/src/FreeType/fttools.c b/src/FreeType/fttools.c
index 5393558..002b62c 100644
--- a/src/FreeType/fttools.c
+++ b/src/FreeType/fttools.c
@@ -153,50 +153,3 @@ FTGetEnglishName(FT_Face face, int nid, char *name_return, int name_len)
/* Must be some font that can only be named in Polish or something. */
return -1;
}
-
-int
-FTcheckForTTCName(char *fileName, char **realFileName, int *faceNumber)
-{
- int length;
- int fn;
- int i, j;
- char *start, *realName;
-
- length = strlen(fileName);
- if(length < 4)
- return 0;
-
- if(strcasecmp(fileName + (length-4), ".ttc") != 0 &&
- strcasecmp(fileName + (length-4), ".otc") != 0)
- return 0;
-
- realName = xalloc(length + 1);
- if(realName == NULL)
- return 0;
-
- strcpy(realName, fileName);
- *realFileName=realName;
- start = strchr(realName, ':');
- if(start) {
- fn=0;
- i=1;
- while(ft_isdigit(start[i])) {
- fn *= 10;
- fn += start[i]-'0';
- i++;
- }
- if(start[i]==':') {
- *faceNumber = fn;
- i++;
- j = 0;
- while(start[i]) {
- start[j++] = start[i++];
- }
- start[j] = '\0';
- return 1;
- }
- }
-
- *faceNumber = 0;
- return 1;
-}
diff --git a/src/FreeType/xttcap.c b/src/FreeType/xttcap.c
index 963d1ff..507da80 100644
--- a/src/FreeType/xttcap.c
+++ b/src/FreeType/xttcap.c
@@ -151,6 +151,164 @@ numOfCorrespondRelations
Functions
*/
+/* get property record type by record name */
+static Bool /* True == Found, False == Not Found */
+get_record_type_by_name(SPropertyRecord const ** const refRefRecord, /*result*/
+ char const *strName)
+{
+ Bool result = False;
+ int i;
+
+ *refRefRecord = NULL;
+ for (i=0; i<numOfValidRecords; i++) {
+ if (!strcasecmp(validRecords[i].strRecordName, strName)) {
+ result = True;
+ *refRefRecord = &validRecords[i];
+ break;
+ }
+ }
+
+ return result;
+}
+
+/* Add Property Record Value */
+static Bool /* True == Error, False == Success */
+SPropRecValList_add_record(SDynPropRecValList *pThisList,
+ char const * const recordName,
+ char const * const strValue)
+{
+ Bool result = False;
+ SPropRecValContainerEntityP tmpContainerE;
+
+ if (get_record_type_by_name(&tmpContainerE.refRecordType, recordName)) {
+ switch (tmpContainerE.refRecordType->recordType) {
+ case eRecTypeInteger:
+ {
+ int val;
+ char *endPtr;
+
+ val = strtol(strValue, &endPtr, 0);
+ if ('\0' != *endPtr) {
+ fprintf(stderr,
+ "truetype font property : "
+ "%s record needs integer value.\n",
+ recordName);
+ result = True;
+ goto quit;
+ }
+ SPropContainer_value_int(&tmpContainerE) = val;
+ }
+ break;
+ case eRecTypeDouble:
+ {
+ double val;
+ char *endPtr;
+
+ val = strtod(strValue, &endPtr);
+ if ('\0' != *endPtr) {
+ fprintf(stderr,
+ "truetype font property : "
+ "%s record needs floating point value.\n",
+ recordName);
+ result = True;
+ goto quit;
+ }
+ SPropContainer_value_dbl(&tmpContainerE) = val;
+ }
+ break;
+ case eRecTypeBool:
+ {
+ Bool val;
+
+ if (!strcasecmp(strValue, "yes"))
+ val = True;
+ else if (!strcasecmp(strValue, "y"))
+ val = True;
+ else if (!strcasecmp(strValue, "on"))
+ val = True;
+ else if (!strcasecmp(strValue, "true"))
+ val = True;
+ else if (!strcasecmp(strValue, "t"))
+ val = True;
+ else if (!strcasecmp(strValue, "ok"))
+ val = True;
+ else if (!strcasecmp(strValue, "no"))
+ val = False;
+ else if (!strcasecmp(strValue, "n"))
+ val = False;
+ else if (!strcasecmp(strValue, "off"))
+ val = False;
+ else if (!strcasecmp(strValue, "false"))
+ val = False;
+ else if (!strcasecmp(strValue, "f"))
+ val = False;
+ else if (!strcasecmp(strValue, "bad"))
+ val = False;
+ else {
+ fprintf(stderr,
+ "truetype font property : "
+ "%s record needs boolean value.\n",
+ recordName);
+ result = True;
+ goto quit;
+ }
+ SPropContainer_value_bool(&tmpContainerE) = val;
+ }
+ break;
+ case eRecTypeString:
+ {
+ char *p;
+
+ if (NULL == (p = (char *)xalloc(strlen(strValue)+1))) {
+ fprintf(stderr,
+ "truetype font property : "
+ "cannot allocate memory.\n");
+ result = True;
+ goto quit;
+ }
+ strcpy(p, strValue);
+ SPropContainer_value_str(&tmpContainerE) = p;
+ }
+ break;
+ case eRecTypeVoid:
+ if ('\0' != *strValue) {
+ fprintf(stderr,
+ "truetype font property : "
+ "%s record needs void.\n", recordName);
+ result = True;
+ }
+ break;
+ }
+ {
+ /* add to list */
+ SPropRecValListNodeP *newNode;
+
+ if (NULL == (newNode =
+ (SPropRecValListNodeP *)xalloc(sizeof(*newNode)))) {
+ fprintf(stderr,
+ "truetype font property : "
+ "cannot allocate memory.\n");
+ result = True;
+ goto quit;
+ }
+ newNode->nextNode = pThisList->headNode;
+ newNode->containerE = tmpContainerE;
+ tmpContainerE.refRecordType = NULL; /* invalidate --
+ disown value handle. */
+ pThisList->headNode = newNode;
+ }
+ } else {
+ /* invalid record name */
+ fprintf(stderr,
+ "truetype font : "
+ "invalid record name \"%s.\"\n", recordName);
+ result = True;
+ }
+
+ quit:
+ return result;
+}
+
#ifdef USE_TTP_FILE
#ifndef LEN_LINEBUF
@@ -393,26 +551,6 @@ SPropRecValList_read_prop_file(SDynPropRecValList *pThisList,
}
#endif /* USE_TTP_FILE */
-/* get property record type by record name */
-static Bool /* True == Found, False == Not Found */
-get_record_type_by_name(SPropertyRecord const ** const refRefRecord, /*result*/
- char const *strName)
-{
- Bool result = False;
- int i;
-
- *refRefRecord = NULL;
- for (i=0; i<numOfValidRecords; i++) {
- if (!strcasecmp(validRecords[i].strRecordName, strName)) {
- result = True;
- *refRefRecord = &validRecords[i];
- break;
- }
- }
-
- return result;
-}
-
/* Constructor for Container Node */
Bool /* True == Error, False == Success */
SPropRecValList_new(SDynPropRecValList *pThisList)
@@ -424,37 +562,6 @@ SPropRecValList_new(SDynPropRecValList *pThisList)
return result;
}
-/* Destructor for Container List */
-Bool /* True == Error, False == Success */
-SPropRecValList_delete(SDynPropRecValList *pThisList)
-{
- Bool result = False;
- SPropRecValListNodeP *p, *np;
-
- for (p=pThisList->headNode; NULL!=p; p=np) {
- np = p->nextNode;
- switch (p->containerE.refRecordType->recordType) {
- case eRecTypeInteger:
- break;
- case eRecTypeDouble:
- break;
- case eRecTypeBool:
- break;
- case eRecTypeString:
- if (SPropContainer_value_str(&p->containerE))
- xfree((void*)SPropContainer_value_str(&p->containerE));
- break;
- case eRecTypeVoid:
- break;
- }
- xfree(p);
- }
-
- pThisList->headNode = NULL;
-
- return result;
-}
-
#ifdef DUMP
void
SPropRecValList_dump(SRefPropRecValList *pThisList)
@@ -492,144 +599,6 @@ SPropRecValList_dump(SRefPropRecValList *pThisList)
}
#endif
-/* Add Property Record Value */
-extern Bool /* True == Error, False == Success */
-SPropRecValList_add_record(SDynPropRecValList *pThisList,
- char const * const recordName,
- char const * const strValue)
-{
- Bool result = False;
- SPropRecValContainerEntityP tmpContainerE;
-
- if (get_record_type_by_name(&tmpContainerE.refRecordType, recordName)) {
- switch (tmpContainerE.refRecordType->recordType) {
- case eRecTypeInteger:
- {
- int val;
- char *endPtr;
-
- val = strtol(strValue, &endPtr, 0);
- if ('\0' != *endPtr) {
- fprintf(stderr,
- "truetype font property : "
- "%s record needs integer value.\n",
- recordName);
- result = True;
- goto quit;
- }
- SPropContainer_value_int(&tmpContainerE) = val;
- }
- break;
- case eRecTypeDouble:
- {
- double val;
- char *endPtr;
-
- val = strtod(strValue, &endPtr);
- if ('\0' != *endPtr) {
- fprintf(stderr,
- "truetype font property : "
- "%s record needs floating point value.\n",
- recordName);
- result = True;
- goto quit;
- }
- SPropContainer_value_dbl(&tmpContainerE) = val;
- }
- break;
- case eRecTypeBool:
- {
- Bool val;
-
- if (!strcasecmp(strValue, "yes"))
- val = True;
- else if (!strcasecmp(strValue, "y"))
- val = True;
- else if (!strcasecmp(strValue, "on"))
- val = True;
- else if (!strcasecmp(strValue, "true"))
- val = True;
- else if (!strcasecmp(strValue, "t"))
- val = True;
- else if (!strcasecmp(strValue, "ok"))
- val = True;
- else if (!strcasecmp(strValue, "no"))
- val = False;
- else if (!strcasecmp(strValue, "n"))
- val = False;
- else if (!strcasecmp(strValue, "off"))
- val = False;
- else if (!strcasecmp(strValue, "false"))
- val = False;
- else if (!strcasecmp(strValue, "f"))
- val = False;
- else if (!strcasecmp(strValue, "bad"))
- val = False;
- else {
- fprintf(stderr,
- "truetype font property : "
- "%s record needs boolean value.\n",
- recordName);
- result = True;
- goto quit;
- }
- SPropContainer_value_bool(&tmpContainerE) = val;
- }
- break;
- case eRecTypeString:
- {
- char *p;
-
- if (NULL == (p = (char *)xalloc(strlen(strValue)+1))) {
- fprintf(stderr,
- "truetype font property : "
- "cannot allocate memory.\n");
- result = True;
- goto quit;
- }
- strcpy(p, strValue);
- SPropContainer_value_str(&tmpContainerE) = p;
- }
- break;
- case eRecTypeVoid:
- if ('\0' != *strValue) {
- fprintf(stderr,
- "truetype font property : "
- "%s record needs void.\n", recordName);
- result = True;
- }
- break;
- }
- {
- /* add to list */
- SPropRecValListNodeP *newNode;
-
- if (NULL == (newNode =
- (SPropRecValListNodeP *)xalloc(sizeof(*newNode)))) {
- fprintf(stderr,
- "truetype font property : "
- "cannot allocate memory.\n");
- result = True;
- goto quit;
- }
- newNode->nextNode = pThisList->headNode;
- newNode->containerE = tmpContainerE;
- tmpContainerE.refRecordType = NULL; /* invalidate --
- disown value handle. */
- pThisList->headNode = newNode;
- }
- } else {
- /* invalid record name */
- fprintf(stderr,
- "truetype font : "
- "invalid record name \"%s.\"\n", recordName);
- result = True;
- }
-
- quit:
- return result;
-}
-
/* Search Property Record */
Bool /* True == Hit, False == Miss */
@@ -759,18 +728,4 @@ XttXstrdup(char const *str)
}
-#if 0
-int main()
-{
- SDynPropRecValList list;
-
- SPropRecValList_new(&list);
- SPropRecValList_read_prop_file(&list, "-");
- SPropRecValList_dump(&list);
- SPropRecValList_delete(&list);
-
- return 0;
-}
-#endif
-
/* end of file */
diff --git a/src/FreeType/xttcap.h b/src/FreeType/xttcap.h
index 33c224f..9da3c96 100644
--- a/src/FreeType/xttcap.h
+++ b/src/FreeType/xttcap.h
@@ -93,11 +93,6 @@ SPropRecValList_delete(SDynPropRecValList *pThisList);
extern Bool /* True == Error, False == Success */
SPropRecValList_read_prop_file(SDynPropRecValList *pThisList,
char const * const strFileName);
-/* Add Property Record Value */
-extern Bool /* True == Error, False == Success */
-SPropRecValList_add_record(SDynPropRecValList *pThisList,
- char const * const recordName,
- char const * const strValue);
/* Search Property Record */
extern Bool /* True == Hit, False == Miss */
SPropRecValList_search_record(SRefPropRecValList *pThisList,