summaryrefslogtreecommitdiff
path: root/vcl/source/fontsubset
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/fontsubset')
-rw-r--r--vcl/source/fontsubset/ttcr.cxx21
1 files changed, 12 insertions, 9 deletions
diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx
index 7a785b9bf99f..4356636e90a2 100644
--- a/vcl/source/fontsubset/ttcr.cxx
+++ b/vcl/source/fontsubset/ttcr.cxx
@@ -399,16 +399,19 @@ int StreamToFile(TrueTypeCreator *_this, const char* fname)
FILE* fd;
if ((r = StreamToMemory(_this, &ptr, &length)) != SF_OK) return r;
- if (!fname) return SF_BADFILE;
- if ((fd = fopen(fname, "wb")) == NULL) return SF_BADFILE;
-
- if (fwrite(ptr, 1, length, fd) != length) {
- r = SF_FILEIO;
- } else {
- r = SF_OK;
+ if (fname && (fd = fopen(fname, "wb")) != NULL)
+ {
+ if (fwrite(ptr, 1, length, fd) != length) {
+ r = SF_FILEIO;
+ } else {
+ r = SF_OK;
+ }
+ fclose(fd);
+ }
+ else
+ {
+ r = SF_BADFILE;
}
-
- fclose(fd);
free(ptr);
return r;
}