Keith Packard
0d9e31c810
Eliminate ./ and ../ elements from font directory names when scanning.
...
FcStrCanonFilename eliminates ./ and ../ elements from pathnames through
simple string editing. Also, relative path names are fixed by prepending the
current working directory.
2006-08-27 23:40:51 -07:00
Keith Packard
af180c4037
Fix up fc-cache and fc-cat for no global cache changes.
...
fc-cache and fc-cat use internal (fcint.h) APIs that have
changed with the elimination of the global cache.
2006-08-27 22:24:39 -07:00
Keith Packard
00f059e930
Eliminate global cache. Eliminate multi-arch cache code.
...
With the removal of the in-directory cache files, and the addition of
per-user cache directories, there is no longer any reason to preserve the
giant global cache file. Eliminating of this unifies the cache structure
and simplifies the overall caching strategies greatly.
2006-08-27 21:53:48 -07:00
Keith Packard
cf65c0557e
Add architecture to cache filename.
...
Make cache filenames unique by inserting the architecture name into the
filename.
2006-08-27 18:29:51 -07:00
Keith Packard
db50cbdaf5
Eliminate NormalizeDir. Eliminate gratuitous stat/access calls per dir.
...
Normalized directory names offer protection against looped directory trees
but cost enormous numbers of system calls (stat per file in the hierarchy).
Also, cache file directory name contents are validated each time the
directory is modified, don't re-validate every time the cache file is loaded
with an access and stat call.
2006-08-27 18:19:39 -07:00
Keith Packard
d2f786849c
Write caches to first directory with permission. Valid cache in FcDirCacheOpen.
...
Previous policy was to attempt to update the cache in place and bail if that
didn't work. Now, search for the first writable directory and place the
cache file there instead. Furthermore, on startup, search directory list for
valid cache files instead of bailing if the first found cache file wasn't
valid.
2006-08-27 17:04:01 -07:00
Patrick Lam
7410e40bd9
2006-08-04 Keith Packard (keithp@keithp.com) reviewed by: plam
...
Make cache directories configurable. Simplify and correct some code which
deals with per-directory caches.
2006-08-04 16:13:00 +00:00
Patrick Lam
62a4a8459a
2006-07-19 Jon Burgess (jburgess@uklinux.net) reviewed by: plam
...
Fix file-descriptor leak in FcGlobalCacheDestroy.
2006-07-19 02:14:28 +00:00
Patrick Lam
1c14f2d963
2006-05-31 Yong Li (rigel863@gmail.com) reviewed by: plam, Bedhad Esfahbod
...
TrueType Collection table offsets are absolute, not relative.
2006-06-02 18:48:30 +00:00
Patrick Lam
31b7e6d7f5
2006-04-27 Paolo Borelli (pborelli@katamail.com) reviewed by: plam
...
Make FcStrCopy slightly more efficient.
2006-04-28 07:00:25 +00:00
Patrick Lam
0037aad501
Keith Packard <keithp@keithp.com>
...
Reduce transient memory usage during config file parsing by allocating
smaller buffers (64 seems to be a magic number).
2006-04-27 08:13:45 +00:00
Keith Packard
529291bef4
Eliminate pattern freezing
2006-04-27 07:54:07 +00:00
Keith Packard
c1c3ba06d5
Make path names in cache files absolute (NB, cache format change) Stop
...
permitting cache files to be stored in font dirs. Bump cache magic.
Don't include /fonts.cache-2 in cache hash construction.
reviewed by: Patrick Lam <plam@mit.edu>
2006-04-27 07:11:44 +00:00
Patrick Lam
73775d8f28
Fix the issues with GNU libiconv vs. libc iconv (which especially appear on
...
Solarii). Approach suggested by Tim Mooney.
reviewed by: plam
2006-04-25 15:33:07 +00:00
Patrick Lam
f045376c08
Include $(top_srcdir), $(top_srcdir)/src before anything else.
...
Shuffle order of includes for building out of srcdir on win32.
reviewed by: plam
2006-04-25 05:57:41 +00:00
Patrick Lam
55e145b025
Prevent terrible perf regression by getting the if-condition right
...
(reported by Wouter Bolsterlee).
2006-04-20 16:57:50 +00:00
Patrick Lam
93f67dfc73
Dominic Lachowicz <cinamod@hotmail.com>
...
Implement mmap-like code for Windows using MapViewOfFile.
2006-04-19 16:53:50 +00:00
Patrick Lam
c001a192af
Bail gracefully if the cache file does not contain enough data.
2006-04-19 16:17:19 +00:00
Patrick Lam
8cfa0bbc82
Fix Gecko-exposed segfault from my last hack to FcObjectToPtrLookup.
...
Simplify code and get things straight.
2006-04-14 18:35:16 +00:00
Patrick Lam
2f02e38361
Fix memory leak (Coverity defect #2089 ).
...
Ignore script if subtable is missing (Coverity defect #2088 ).
Fix possible null pointer dereference (Coverity defect #784 ) and memory
leak (Coverity defects #785 , #786 ).
Don't copy FcCharSet if we're going to throw it away anyway. (Reported by
Kenichi Handa).
reviewed by: plam
2006-04-12 14:36:36 +00:00
Patrick Lam
a56e89ab4f
Fix bad behaviour on realloc resulting in crash.
...
reviewed by: plam
2006-04-12 03:02:57 +00:00
Patrick Lam
5c90509c07
Don't crash if config is null (Coverity defect #984 ).
2006-04-12 02:38:28 +00:00
Patrick Lam
2de24638b2
Missing bits from previous patches.
...
Remove extra semi-colon.
Fix memory leak in error case (Coverity defects #776 , #985 ).
Fix memory leaks (Coverity defects #779 , #781 ) and memory use after free
(Coverity defect #780 ).
reviewed by: plam
2006-04-11 16:54:24 +00:00
Patrick Lam
04f7d3e7fd
Properly convert static charsets to dynamic charsets.
...
Fix memory leak in error case (Coverity defects #1820 , #1821 , #1822 ).
Fix memory leak (Coverity defect #1819 ).
prevent crash when invalid include line is parsed (Coverity defect #763 ).
Fix potential null pointer access (Coverity defect #1804 ).
Remove dead code (Coverity defect #1194 ).
Prevent potential null pointer access (Coverity defect #767 ), ensure error
value is read (Coverity defect #1195 ).
reviewed by: plam
2006-04-11 14:20:59 +00:00
Patrick Lam
ac0010940e
Swap typo in order of ALIGN and dereferencing, fixing bug 6529.
2006-04-10 21:04:54 +00:00
Patrick Lam
3ea92166a0
Fix string memory leak (Coverity defect #1823 ).
...
Fix memory leak with hash collision (Coverity defect #1824 ).
reviewed by: plam
2006-04-10 19:33:03 +00:00
Patrick Lam
c814c301ee
Don't leak header in non-error case (Coverity defect #1825 ).
...
reviewed by: plam
2006-04-10 16:12:55 +00:00
Patrick Lam
65448e8b2a
src/fcdir.c (FcDirScanConfig) Don't leak in error cases (Coverity defects
...
#777 , #1826 )
reviewed by: plam
2006-04-10 16:06:42 +00:00
Patrick Lam
ae2aafe602
Fix double free (spotted by Coverity, CID #1965 ).
...
Check if pattern is not null before using it (Coverity defect #1883 ).
Fix memory leak with hash collision (Coverity defect #1829 ).
Fix memory leak when bail cases (Coverity defect #1828 ).
Don't leak directory name (Coverity defect #1827 ).
reviewed by: plam
2006-04-10 15:46:34 +00:00
Patrick Lam
f23f5f388d
SGI compilation fixes (reported by Christoph Bauer):
...
1) reorder union definition of _FcChar;
2) omit .stats =.
2006-04-07 17:37:09 +00:00
Patrick Lam
44415a079a
Portability fixes for HP-UX (reported by Christoph Bauer). Replace
...
'__inline__' by AC_C_INLINE and 'inline'. Replace '__alignof__' by
'fc_alignof'.
reviewed by: plam
2006-04-07 17:27:39 +00:00
Patrick Lam
91fe51b4f8
Move up #include of config.h. Fail if neither inttypes.h nor stdint.h is
...
available. Fixes bug 6171.
reviewed by: plam
2006-04-07 17:06:55 +00:00
Patrick Lam
d6217cc6bc
Patrick Lam <plam@mit.edu>
...
Make fontconfig compile under MinGW:
1) remove unneeded #includes;
2) make use of mmap and sysconf conditional;
3) replace rand_r by srand/rand if needed;
4) use chsize instead of ftruncate; and
5) update libtool exports file
2006-04-07 04:42:32 +00:00
Patrick Lam
3a342c5a6c
Eliminate warning.
2006-04-07 04:19:49 +00:00
Patrick Lam
392fa276dc
Reduce amount of dirty rss by const'ing some data structures.
...
Don't fail if we can't create or remove $(pkgcachedir) i.e.
/var/cache/fontconfig. (reported by Quanah Gibson-Mount).
reviewed by: plam
2006-04-06 04:52:21 +00:00
Patrick Lam
0d745819a9
Fix intel compiler warnings: make many variables static, eliminate
...
duplicate names, reduce variable scopes, unsigned/signed printf
formatting.
reviewed by: plam
2006-04-06 04:33:11 +00:00
Patrick Lam
b17cf498be
Fix multiarch support (don't destroy multiarch files!)
...
Require pkg-config. (Thanks Behdad; better solution wanted for libxml2
detection!)
reviewed by: plam
2006-03-24 15:21:10 +00:00
Patrick Lam
c022182231
On Windows, unlink before rename. Reported by Tim Evans.
2006-03-23 04:21:10 +00:00
Patrick Lam
e3c6d3364c
Sort directory entries while scanning them from disk; prevents Heisenbugs
...
due to file ordering in a directory.
reviewed by: plam
2006-03-08 19:10:57 +00:00
Patrick Lam
d8951c0cc2
Remove stuff we don't use, make get_{char,short,long} functions of ftglue
...
macros to be inlined.
Code cleanups (excess prototype, old-style function definition).
reviewed by: plam
2006-03-08 02:30:43 +00:00
Patrick Lam
9226e04c69
Because we hacked FcPatternGet, we don't really need to expand the filename
...
again in FcPatternGetString.
2006-03-05 15:33:46 +00:00
Patrick Lam
618adbaf7b
Ok, so some people (wine!) use FcPatternGet to fetch FC_FILE. Make that
...
work. Reported by Bernhard Rosenkraenzer.
2006-03-05 06:05:50 +00:00
Patrick Lam
dc70c15aba
Include inttypes.h instead of stdint.h if appropriate.
2006-03-03 18:35:42 +00:00
Patrick Lam
bb6b19938e
Get rid of C++-style comments.
2006-03-03 06:35:53 +00:00
Patrick Lam
b36f2a39d0
Fix suspicious return expression which causes junk to be returned.
...
reviewed by: plam
2006-03-03 06:11:31 +00:00
Patrick Lam
0cfaf27e33
Takashi Iwai <tiwai@suse.de> reviewed by: plam
...
Fix double-free on error case.
2006-02-24 16:41:34 +00:00
Patrick Lam
656b47f698
Pass the buck; make fontconfig not crash on pango badness.
2006-02-21 15:56:41 +00:00
Patrick Lam
f2fb985c7a
Eliminate redundancies.
...
reviewed by: plam
2006-02-21 15:50:19 +00:00
Patrick Lam
b023dbd384
Eliminate unused vars reported by Intel's compiler.
...
reviewed by: plam
2006-02-21 15:40:18 +00:00
Patrick Lam
dacf81ed4c
Freeze patterns created by configuration file for tiny memory savings
...
(every little bit helps).
reviewed by: plam, keithp
2006-02-21 15:24:28 +00:00
Patrick Lam
530e66b008
Fix the underlying cause of the below segfault (must usually call
...
FcDirCacheHasCurrentArch after FcDirCacheValid).
2006-02-18 18:18:07 +00:00
Patrick Lam
a68ce9525d
Fix segfault (reported by fcrozat) caused by incorrect input on cache
...
files.
2006-02-18 17:56:25 +00:00
Patrick Lam
310817371c
Bump up magic version; we changed the binary format.
2006-02-17 14:44:42 +00:00
Patrick Lam
8c0d692125
Deal correctly with changing FC_CACHE_MAGIC.
2006-02-16 17:50:04 +00:00
Patrick Lam
719f4b841f
Don't bail if fontconfig can't remove a dir cache file. Skip the ID of a
...
cache file when copying. Eliminate 'source file too small' bug in
FcDirCacheWrite.
2006-02-16 07:12:04 +00:00
Patrick Lam
f8a17f3298
Fix memory leak in error condition code.
2006-02-13 22:19:30 +00:00
Patrick Lam
5657098e29
Skip bitmap fonts which can't even get it together enough to declare a
...
family name; this appears to reproduce previous fontconfig behaviour.
reviewed by: plam
2006-02-13 21:51:11 +00:00
Patrick Lam
d00c3cb5e0
Try to open /var/cache/fontconfig/[hashed name] before fonts.cache-2 in a
...
directory, because /var/cache/fontconfig failures ought to be fixable,
unlike fonts.cache-2 failures, which may leave you screwed.
reviewed by: plam
2006-02-11 05:01:32 +00:00
Patrick Lam
9e07e0a77b
Use a tri-state to mark the fonts which didn't get blocked but were just
...
missing an element, to distinguish them from the fonts that do match
the element.
reviewed by: plam
2006-02-11 04:50:46 +00:00
Patrick Lam
f11a184104
Don't kill fonts because they don't declare an element that's being matched
...
on.
reviewed by: plam
2006-02-10 19:40:11 +00:00
Patrick Lam
879af7060b
Define and pass O_BINARY to open if appropriate, for those platforms that
...
need it. Reported by Doodle.
2006-02-09 18:44:14 +00:00
Patrick Lam
c7490074c5
Fix attempt to close -1. Don't unboundedly grow bad caches (reported by
...
fcrozat).
2006-02-09 16:19:42 +00:00
Patrick Lam
a8c425301a
Fix problem with missing 'en' due to euro.patch: change cache file format
...
slightly to coincide with that generated by fc-lang.
2006-02-09 15:25:57 +00:00
Patrick Lam
b10e77628c
Fix warning.
2006-02-08 03:34:17 +00:00
Patrick Lam
5c3deb2985
Don't reject dirs that can't be normalized (fixes lilypond, and is correct
...
in the context of application font directories.)
Use normalized directory name exclusively in FcCacheReadDirs.
reviewed by: plam
2006-02-07 22:09:01 +00:00
Patrick Lam
efb11b36c4
Perf optimizations. Inline FcValueCanonicalize, reduce FcValueListPtrU
...
usage, remove redundant cast.
reviewed by: plam
2006-02-07 21:15:33 +00:00
Patrick Lam
6cc02fe6b9
src/fccharset.c (FcLangCharSetPopulate, FcCharSetInsertLeaf)
...
Fix missing FcCacheBankToIndex in FcCharSetInsertLeaf. Declare extern for
static arrays as arrays, not pointers. (Part of the fix for 'fonts
don't have en' issue after Euro patch.)
(I forgot to commit the ChangeLog last time.)
reviewed by: plam
2006-02-07 20:56:48 +00:00
Patrick Lam
a81f23c0ce
Fix hidden variable warning.
2006-02-07 03:53:32 +00:00
Patrick Lam
799157dbbf
Remove de-escaping logic because FcCacheWriteString doesn't escape anyway.
...
Do blockwise reading instead of byte-wise for performance.
2006-02-07 02:33:57 +00:00
Patrick Lam
8b413bb62c
Takashi Iwai <tiwai@suse.de>
...
Don't loop infinitely on recursive symlinks (client-side).
2006-02-07 02:22:50 +00:00
Patrick Lam
fff5a5af30
Skip subdirs when skipping over stale bits of global cache. Introduce state
...
machine into FcGlobalCacheDir to avoid doing inappropriate operations
on global dir entries, e.g. writing out an out-of-date cache entry.
reviewed by: plam
2006-02-06 22:44:02 +00:00
Patrick Lam
98592bbb1d
Hoist FcFileIsDir check out of FcFileScanConfig loop.
...
reviewed by: plam
2006-02-06 21:52:15 +00:00
Patrick Lam
a0aa54f6ee
Don't rescan when trying to normalize a non-declared font dir. Don't add
...
font dirs multiple times (even if they're aliased).
reviewed by: plam
2006-02-06 19:25:45 +00:00
Patrick Lam
86e75dfb5d
Explain apples/oranges comparison and fix compilation error.
...
reviewed by: plam
2006-02-06 14:44:46 +00:00
Patrick Lam
f076169d19
Insert check for integer overflow in # of fonts.
...
reviewed by: plam
2006-02-06 14:14:21 +00:00
Patrick Lam
68355f3877
src/fccache.c (FcGlobalCacheLoad, FcGlobalCacheSave, FcDirCacheConsume,
...
FcDirCacheWrite)
Check I/O call return values and eliminate unused variable warnings.
reviewed by: plam
2006-02-05 02:57:21 +00:00
Patrick Lam
c4c47a7654
src/fccfg.c (FcConfigAppFontAddFile, FcConfigAppFontAddDir)
...
Fix memory leak.
reviewed by: plam
2006-02-04 00:09:42 +00:00
Patrick Lam
a8e4d9eb39
Gracefully handle the case where a cache asserts that it has a negative
...
number of fonts, causing overflow.
reviewed by: plam
2006-02-04 00:04:00 +00:00
Patrick Lam
1af0f5741a
Fix double free in error case.
2006-02-03 23:47:37 +00:00
Patrick Lam
28aefd013d
Toast broken global cache files.
...
reviewed by: plam
2006-01-31 07:16:22 +00:00
Patrick Lam
3616cbe251
Actually use the directories that I added to the global cache. Fixes 'make
...
check'.
2006-01-31 04:42:20 +00:00
Patrick Lam
81d97094cf
Make global cache work again after putting dir names into global cache (I
...
misplaced the recording of a file offset).
2006-01-30 16:31:56 +00:00
Patrick Lam
2c4e012497
Update fc-cat to handle subdir lists in global cache file.
...
Another FcCacheReadString return value check.
2006-01-30 15:59:17 +00:00
Patrick Lam
c5411c4cae
Make fccache more resilient to broken cache files by checking return value
...
of FcCacheReadString all the time.
reviewed by: plam
2006-01-30 15:44:13 +00:00
Patrick Lam
30c4189deb
Fix global cache reads of subdirectories.
...
reviewed by: plam
2006-01-30 04:47:17 +00:00
Patrick Lam
971cf18018
Add documentation for FcConfigNormalizeFontDir.
...
Write directory information to global caches to fix make check (reported by
Ronny V. Vindenes). This changes the global cache format again.
2006-01-30 04:27:53 +00:00
Patrick Lam
97293e07dd
Move FcConfigNormalizeFontDir call so that it doesn't result in infinite
...
recursion (reported by Ronny V. Vindenes).
2006-01-27 05:47:59 +00:00
Patrick Lam
3cf9f5cec3
Add a couple of missing normalizations to make fc-cache work right; only
...
scan subdirectories once.
2006-01-27 00:27:37 +00:00
Patrick Lam
4073203deb
Don't crash on non-existant directories in global cache.
...
reviewed by: plam
2006-01-26 16:11:41 +00:00
Patrick Lam
f468f568b4
Stop trampling the directory name when writing out caches. (with Mike
...
Fabian:) Beef up FcConfigNormalizeFontDir to scan subdirs when
necessary. Don't scan directories that can't be normalized.
2006-01-26 16:09:12 +00:00
Patrick Lam
575a37b797
Fix additional memory leaks reported by Ronny V. Vindenes: don't invoke
...
FcValueSave on hashed static strings in FcPatternAddWithBinding.
Add another st_dev check in FcDirCacheOpen.
2006-01-25 14:52:49 +00:00
Patrick Lam
16a71eff3e
Treat zh-hk fonts differently from zh-tw fonts. This patch may cause
...
fontconfig to treat A-X fonts differently from A-Y fonts; please mail
the fontconfig list if this causes any problems.
reviewed by: plam
2006-01-25 02:54:37 +00:00
Patrick Lam
6f9fcb5186
Fix memory leaks reported by Ronny V. Vindenes.
2006-01-25 02:33:46 +00:00
Patrick Lam
986e35979e
Fix for unaligned memory accesses.
...
reviewed by: plam
2006-01-19 19:20:30 +00:00
Patrick Lam
58bdd29619
Properly order the FcConfigAddFontDir and FcConfigNormalizeFontDir calls to
...
avoid crashes.
reviewed by: plam
2006-01-18 15:41:15 +00:00
Patrick Lam
eadadf489a
Fix segfault when consuming zero-length caches in fc-cat (which has no
...
config, so FcConfigAddFontDir shouldn't be called.)
2006-01-15 05:31:58 +00:00
Patrick Lam
8a0b0ed6d0
Compare device numbers as well as inodes. Always normalize directory names
...
before comparing them.
Allocate extra space for appended '/' in directory name.
reviewed by: plam
2006-01-14 21:23:03 +00:00
Patrick Lam
df3efc11a9
Explicitly add font dirs to config.fontDirs even if they're empty. Set
...
current config in fc-cache.c. Fix treatment of cache directory as read
from cache file; don't use string equality to determine if we have the
right file, use inode equality.
2006-01-10 13:15:05 +00:00
Patrick Lam
cd9bca6970
Normalize font dirs by using the form, as given in fonts.conf, and recorded
...
in FcConfig's fontDirs string set, as canonical.
Actually update config.fontDirs as font directories are scanned.
2006-01-09 13:58:04 +00:00
Patrick Lam
5576a5873d
Fix matching bug when multiple elements match; don't use the sum of all
...
scores, but the best score.
Also more perf opts, e.g. evaluate best over all font sets rather than on a
per-set basis (and other changes).
2006-01-08 10:58:30 +00:00