summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-05-11 13:48:22 (GMT)
committer John Mark Bell <jmb@netsurf-browser.org>2009-05-11 13:48:22 (GMT)
commitacae6a226364604fe4692f118361af88c12977b0 (patch)
tree15c831d3701d6c8075c9decd15c1f55e861099a8
parent2038c15dc3b8c22155d88a6964c89a5eb0a277d9 (diff)
downloadttf2f-acae6a226364604fe4692f118361af88c12977b0.tar.gz
ttf2f-acae6a226364604fe4692f118361af88c12977b0.tar.bz2
Fix writing of font name to intmetrics file
svn path=/trunk/tools/ttf2f/; revision=7467
-rw-r--r--src/intmetrics.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/intmetrics.c b/src/intmetrics.c
index 51ed5fd..f79727d 100644
--- a/src/intmetrics.c
+++ b/src/intmetrics.c
@@ -116,7 +116,7 @@ ttf2f_result intmetrics_write(const char *savein, const char *name,
}
/* fill in header */
- name_len = max(39, strlen(name));
+ name_len = min(39, strlen(name));
snprintf(header.name, 40, "%s", name);
memset(header.name + name_len, 0xD, 40 - name_len);
header.a = header.b = 16;
@@ -130,13 +130,13 @@ ttf2f_result intmetrics_write(const char *savein, const char *name,
mapsize = 0;
snprintf(out, 1024, "%s" DIR_SEP "IntMetrics", savein);
- if ((output = fopen(out, "wb+")) == NULL) {
+ if ((output = fopen(out, "wb")) == NULL) {
free(xwidthtab);
return TTF2F_RESULT_OPEN;
}
- if (fwrite((void*) &header, sizeof(struct intmetrics_header),
- 1, output) != 1) goto error_write;
+ if (fwrite(&header, sizeof(struct intmetrics_header), 1, output) != 1)
+ goto error_write;
if (fputc(mapsize & 0xFF, output) == EOF) goto error_write;
if (fputc((mapsize & 0xFF00) >> 8, output) == EOF) goto error_write;