summaryrefslogtreecommitdiff
path: root/mkfontscale.c
AgeCommit message (Collapse)Author
2019-01-06Clear some -Wshorten-64-to-32 warnings from clang 6Alan Coopersmith
ident.c:84:13: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] int n = strlen(filename); ~ ^~~~~~~~~~~~~~~~ ident.c:130:9: warning: implicit conversion loses integer precision: 'off64_t' (aka 'long') to 'int' [-Wshorten-64-to-32] return gzseek(ff->f.gz, offset, whence); ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ident.c:140:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] n = offset - ff->pos; ~ ~~~~~~~^~~~~~~~~ ident.c:143:10: warning: implicit conversion loses integer precision: 'off_t' (aka 'long') to 'int' [-Wshorten-64-to-32] n = offset; ~ ^~~~~~ ident.c:156:12: warning: implicit conversion loses integer precision: 'off_t' (aka 'long') to 'unsigned int' [-Wshorten-64-to-32] ff->pos = offset; ~ ^~~~~~ ident.c:157:9: warning: implicit conversion loses integer precision: 'off_t' (aka 'long') to 'int' [-Wshorten-64-to-32] return offset; ~~~~~~ ^~~~~~ mkfontscale.c:704:13: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] int n = strlen(dirname); ~ ^~~~~~~~~~~~~~~ mkfontscale.c:748:13: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] int n = strlen(filename); ~ ^~~~~~~~~~~~~~~~ mkfontscale.c:794:14: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] xl = strlen (exclusionSuffix); ~ ^~~~~~~~~~~~~~~~~~~~~~~~ mkfontscale.c:796:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] i = strlen(dirname_given); ~ ^~~~~~~~~~~~~~~~~~~~~ mkfontscale.c:858:15: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] int dl = strlen (entry->d_name); ~~ ^~~~~~~~~~~~~~~~~~~~~~ mkfontscale.c:930:21: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] int l = strlen(xlfd_name); ~ ^~~~~~~~~~~~~~~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-01-06Clear some -Wsign-compare warnings from gcc 7Alan Coopersmith
mkfontscale.c: In function ‘getName’: mkfontscale.c:336:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(i = 0; i < name.string_len / 2; i++) { ^ mkfontscale.c: In function ‘nameWidth’: mkfontscale.c:427:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(i = 0; i < NUMWIDTHS; i++) ^ mkfontscale.c: In function ‘notice_foundry’: mkfontscale.c:1261:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(i = 0; i < countof(notice_foundries); i++) ^ mkfontscale.c: In function ‘vendor_foundry’: mkfontscale.c:1285:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(i = 0; i < countof(vendor_foundries); i++) ^ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-01-06Add new ConstList functions and use them.Thomas Klausner
Gets rid of lots of const warnings. Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
2018-10-01Stop shadowing 'found' in checkExtraEncoding()Alan Coopersmith
mkfontscale.c: In function ‘checkExtraEncoding’: mkfontscale.c:1220:17: warning: declaration of ‘found’ shadows a parameter [-Wshadow] int found = 0; ^~~~~ mkfontscale.c:1214:59: note: shadowed declaration is here checkExtraEncoding(FT_Face face, char *encoding_name, int found) ^~~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-10-01Rename variable 'n' to avoid shadowing another 'n' in doDirectoryAlan Coopersmith
mkfontscale.c: In function ‘doDirectory’: mkfontscale.c:928:17: warning: declaration of ‘n’ shadows a previous local [-Wshadow] int n = strlen(xlfd_name); ^ mkfontscale.c:788:12: note: shadowed declaration is here int i, n, dirn, diri, found, rc; ^ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-10-01Replace dsprintf("%s", s) with strdup(s)Alan Coopersmith
dsprintf is an allocating sprintf. With a format string of "%s", it reduces to just being a more complicated version of strdup, so lets just use strdup instead to save time and reduce complexity. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-10-01Remove last use of strcatAlan Coopersmith
If getcwd returned a string that exactly filled the prefix buffer, it could write the null terminator byte out of bounds. Instead, since the prefix is copied to a newly allocated string and never used again, just let the dsprintf() call take care of it. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-09-10Sort input file listBernhard M. Wiedemann
so that openSUSE's installation-images builds in a reproducible way in spite of indeterministic filesystem readdir order See https://reproducible-builds.org/ for why this is good. Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
2016-05-10fix handling of Type1 fonts without /FamilyName and/or /FullNameStefan Dirsch
https://bugzilla.opensuse.org/show_bug.cgi?id=918466 Signed-off-by: Stefan Dirsch <sndirsch@suse.de> Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-07-06Remove extraneous duplicate checks for -r & -n optionsAlan Coopersmith
Flagged by cppcheck 1.65: [mkfontscale.c:247]: (style) Expression is always false because 'else if' condition matches previous condition at line 224. [mkfontscale.c:245]: (style) Expression is always false because 'else if' condition matches previous condition at line 227. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-03-19Only include config.h if it exists.Thomas Klausner
Reviewed-by: Gaetan Nadon <memsize@videotron.ca> Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
2014-01-02Plug a memory leak found by clang static analysisJeremy Huddleston Sequoia
mkfontscale.c:635:25: warning: Potential leak of memory pointed to by 'notice' foundry = notice_foundry(notice); ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ mkfontscale.c:640:8: warning: Potential leak of memory pointed to by 'notice' if(strcmp(slant, "i") == 0) { ^~~~~~ Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2013-11-22Print which option was in error along with usage messageAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
2013-11-22Make usage() always exit(1)Alan Coopersmith
Avoid duplicating exit(1) calls after every single call to usage() Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
2013-11-22Add -v flag to print program versionAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
2013-11-22Add missing newline to usage outputAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
2013-01-19Replace malloc(strlen);strcpy() calls with strdupAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-01-11Fix compilation for MinGWEgbert Eich
Fix compilation for MinGW since 9cbe3256bc932b82f2435b23cda0931f4f5f5ba2 Unfortunately, MinGW doesn't define S_ISLNK, so check for that as well. Signed-off-by: Egbert Eich <eich@freedesktop.org> Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
2013-01-10Prefer original file over symlink (v2)Egbert Eich
If a symlink to a fontfile in the same directory exists the file that got picked depends on the order in which readdir() picked entries. This patch gives the file a higher preference than the symlink to it so it will be preferred if the xlfd entries match. v2: Followed a suggestion by Julien Cristau <jcristau@debian.org> to check for DT_LNK being defined instead of _BSD_SOURCE and fall back to lstat() if d_type is DT_UNKNOWN. Signed-off-by: Egbert Eich <eich@freedesktop.org>
2011-10-04Strip trailing whitespaceAlan Coopersmith
Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}' git diff -w & git diff -b show no diffs from this change Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-10-04Add const attributes to fix gcc -Wwrite-strings warningsAlan Coopersmith
Does not fix all of them since some lists contain constant strings and some contain dynamically allocated strings that need to be freed later. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-10-04mkfontscale: Support FontForge weight designations.Maxim Iorsh
Fontforge uses 'ExtraLight' and 'Heavy' weights in Type 1 fonts, which should be understood by mkfontscale. Other FontForge designations are already addressed. Signed-off-by: Maxim Iorsh <iorsh@users.sourceforge.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-05-08Dead code removalJeremy Huddleston
have_face is initialized to 0 at the beginning of the loop, so no need to set it to 0 just before it goes out of scope at the end of the loop. mkfontscale.c:945:13: warning: Value stored to 'have_face' is never read have_face = 0; ^ ~ Found-by: clang static analyzer Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-03-01Leave room for null terminator in file & font name arraysAlan Coopersmith
fscanf %s arguments don't include the trailing \0 byte in their counts. Error: Buffer overrun Buffer overflow (CWE 120): Use of fscanf(%1024[), with buffer 'font' Array size is 1024 bytes at line 707 of mkfontscale.c in function 'readFontScale'. Buffer overflow (CWE 120): Use of fscanf(%1024s), with buffer 'file' Array size is 1024 bytes at line 707 of mkfontscale.c in function 'readFontScale'. [ This bug was found by the Parfait 0.3.6 bug checking tool. For more information see http://labs.oracle.com/projects/parfait/ ] Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Julien Cristau <jcristau@debian.org>
2011-02-14Sort contents of encodings.dirAlan Coopersmith
Allows easier comparison between builds to detect changes. Helps reduce deltas in packaging systems that compare old & new versions. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-01-13Remove unused NEED_SNPRINTF code to #include non-existent snprintf.cAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-01-13Make fscanf format string constant so it can be checked at compile timeAlan Coopersmith
Clears gcc warning of: mkfontscale.c:714: warning: format not a string literal, argument types not checked Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-10-06Purge cvs tags.Jesse Adkins
Signed-off-by: Jesse Adkins <jesserayadkins@gmail.com>
2009-01-16Silence sparse warnings and update .gitignore.Paulo Cesar Pereira de Andrade
2008-11-05Add support for bzip2 compressed fonts if configured --with-bzip2Alan Coopersmith
2008-05-10Fix handling of OpenType/CFF fonts with embedded bitmaps.Juliusz Chroboczek
The old workaround would trigger with CFF fonts with embedded bitmaps. We now explicitly check for the font format being TrueType. Reported by Andrey V. Panov.
2008-05-10Remove doubly included header.Juliusz Chroboczek
2008-04-28Add bdf and pcf to font priority table.Juliusz Chroboczek
This mirrors the behaviour of the old mkfontdir, which prefers pcf to bdf fonts.
2008-04-28Fix typo in mkfontscale.c.Juliusz Chroboczek
This spurious break statement disabled checking for Apple and ISO Unicode CMaps in SFNT fonts. Thanks to Alan Coopersmith and Stefan Dirsch.
2008-04-24Compile warning fixes.Paulo Cesar Pereira de Andrade
Include headers for proper prototypes and "ansify" makeHashTable. Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2006-10-31Allow SemiBold weight for Type 1 fonts.Juliusz Chroboczek
Thanks to Andrey Panov.
2006-07-19open files in binary mode. fixes cygwin issues.Alan Hourihane
2004-11-05xc/fonts/encodings/Imakefilesco_port_update-baseXORG-6_8_99_903XORG-6_8_99_902XORG-6_8_99_901XORG-6_8_99_900XORG-6_8_99_9XORG-6_8_99_8XORG-6_8_99_7XORG-6_8_99_6XORG-6_8_99_5XORG-6_8_99_4XORG-6_8_99_3XORG-6_8_99_2XORG-6_8_99_16XORG-6_8_99_15XORG-6_8_99_14XORG-6_8_99_13XORG-6_8_99_12XORG-6_8_99_11XORG-6_8_99_10XORG-6_8_99_1Roland Mainz
xc/fonts/encodings/ascii-0.enc Adding ascii-0 font encoding which helps in cases where a font has all ASCII chars populated but not enougth glyphs to match the requirements for ISO8859-1 (and to add backwards compatibility to ttmkfdir).
2004-04-23Merging XORG-CURRENT into trunkrel-0-6-1lg3d-rel-0-7-0lg3d-baseXORG-6_8_1XORG-6_8_0XORG-6_7_99_904XORG-6_7_99_903XORG-6_7_99_902XORG-6_7_99_901XORG-6_7_99_2XORG-6_7_99_1XACE-SELINUX-MERGEEgbert Eich
2004-03-14Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004xf86-4_4_99_1Egbert Eich
2004-03-03Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004xf86-4_4_0Egbert Eich
2004-02-26readding XFree86's cvs IDsxf86-4_3_99_903Egbert Eich
2004-02-26Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004Egbert Eich
2003-12-19XFree86 4.3.99.902 (RC 2)xf86-4_3_99_903_specialxf86-4_3_99_902xf86-012804-2330Kaleb Keithley
2003-12-04XFree86 4.3.99.901 (RC 1)xf86-4_3_99_901Kaleb Keithley
2003-11-25XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folksxf86-4_3_99_16Kaleb Keithley
2003-11-14Initial revisionKaleb Keithley