From 272e57235cd60a2e65ac8258d96a02eb3939b687 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 25 Mar 2011 10:41:05 +0000 Subject: git update until 25 Mar 2011 xserver fontconfig glproto libXau libXft libXmu libfontenc libxcb mesa mkfontscale pixman randrproto xkeyboard-config xtrans xwininfo updated following packages: xproto-7.0.21 xineramaproto-1.2.1 libXt-1.1.1 libxkbfile-1.0.7 libXpm-3.5.9 libXfont-1.4.3 libXaw-1.0.9 bdftopcf-1.0.3 encodings-1.0.4 fixesproto-5.0 font-adobe-100dpi-1.0.3 font-adobe-75dpi-1.0.3 font-adobe-utopia-100dpi-1.0.4 font-adobe-utopia-75dpi-1.0.4 font-adobe-utopia-type1-1.0.4 font-alias-1.0.3 font-arabic-misc-1.0.3 font-bh-100dpi-1.0.3 font-bh-75dpi-1.0.3 font-bh-lucidatypewriter-100dpi-1.0.3 font-bh-lucidatypewriter-75dpi-1.0.3 font-bh-ttf-1.0.3 font-bh-type1-1.0.3 font-bitstream-100dpi-1.0.3 font-bitstream-75dpi-1.0.3 font-bitstream-speedo-1.0.2 font-bitstream-type1-1.0.3 font-cronyx-cyrillic-1.0.3 font-cursor-misc-1.0.3 font-daewoo-misc-1.0.3 font-dec-misc-1.0.3 font-ibm-type1-1.0.3 font-isas-misc-1.0.3 font-jis-misc-1.0.3 font-micro-misc-1.0.3 font-misc-cyrillic-1.0.3 font-misc-ethiopic-1.0.3 font-misc-meltho-1.0.3 font-misc-misc-1.1.2 font-mutt-misc-1.0.3 font-schumacher-misc-1.1.2 font-screen-cyrillic-1.0.4 font-sony-misc-1.0.3 font-sun-misc-1.0.3 font-util-1.2.0 font-winitzki-cyrillic-1.0.3 font-xfree86-type1-1.0.4 --- fontconfig/fc-lang/fc-lang.c | 47 +++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 16 deletions(-) (limited to 'fontconfig/fc-lang/fc-lang.c') diff --git a/fontconfig/fc-lang/fc-lang.c b/fontconfig/fc-lang/fc-lang.c index 21d568d7e..51717f952 100644 --- a/fontconfig/fc-lang/fc-lang.c +++ b/fontconfig/fc-lang/fc-lang.c @@ -7,9 +7,9 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in + * documentation, and that the name of the author(s) not be used in * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * specific, written prior permission. The authors make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * @@ -76,10 +76,14 @@ fatal (const char *file, int lineno, const char *msg) } static char * -get_line (FILE *f, char *line, int *lineno) +get_line (FILE *f, char *buf, int *lineno) { char *hash; + char *line; int end; + +next: + line = buf; if (!fgets (line, 1024, f)) return 0; ++(*lineno); @@ -87,12 +91,15 @@ get_line (FILE *f, char *line, int *lineno) if (hash) *hash = '\0'; + while (line[0] && isspace (line[0])) + line++; end = strlen (line); while (end > 0 && isspace (line[end-1])) line[--end] = '\0'; - if (line[0] == '\0' || line[0] == '\n' || line[0] == '\032' || line[0] == '\r') - return get_line (f, line, lineno); + if (line[0] == '\0' || line[0] == '\n' || line[0] == '\r') + goto next; + return line; } @@ -125,16 +132,18 @@ scanopen (char *file) * Comments begin with '#' */ -static const FcCharSet * +static FcCharSet * scan (FILE *f, char *file, FcCharSetFreezer *freezer) { FcCharSet *c = 0; FcCharSet *n; + FcBool del; int start, end, ucs4; - char line[1024]; + char buf[1024]; + char *line; int lineno = 0; - while (get_line (f, line, &lineno)) + while ((line = get_line (f, buf, &lineno))) { if (!strncmp (line, "include", 7)) { @@ -158,6 +167,12 @@ scan (FILE *f, char *file, FcCharSetFreezer *freezer) FcCharSetDestroy (n); continue; } + del = FcFalse; + if (line[0] == '-') + { + del = FcTrue; + line++; + } if (strchr (line, '-')) { if (sscanf (line, "%x-%x", &start, &end) != 2) @@ -173,11 +188,11 @@ scan (FILE *f, char *file, FcCharSetFreezer *freezer) c = FcCharSetCreate (); for (ucs4 = start; ucs4 <= end; ucs4++) { - if (!FcCharSetAddChar (c, ucs4)) + if (!((del ? FcCharSetDelChar : FcCharSetAddChar) (c, ucs4))) fatal (file, lineno, "out of memory"); } } - n = FcCharSetFreeze (freezer, c); + n = (FcCharSet *) FcCharSetFreeze (freezer, c); FcCharSetDestroy (c); return n; } @@ -231,8 +246,8 @@ typedef struct _Entry { static int compare (const void *a, const void *b) { - const Entry const *as = a, *bs = b; - return FcStrCmpIgnoreCase (as->file, bs->file); + const Entry *as = a, *bs = b; + return FcStrCmpIgnoreCase ((const FcChar8 *) as->file, (const FcChar8 *) bs->file); } #define MAX_LANG 1024 @@ -245,7 +260,7 @@ int main (int argc, char **argv) { static Entry entries[MAX_LANG]; - static const FcCharSet *sets[MAX_LANG]; + static FcCharSet *sets[MAX_LANG]; static int duplicate[MAX_LANG]; static int country[MAX_LANG]; static char *names[MAX_LANG]; @@ -363,9 +378,9 @@ main (int argc, char **argv) printf ("#define LEAF0 (%d * sizeof (FcLangCharSet))\n", nsets); printf ("#define OFF0 (LEAF0 + %d * sizeof (FcCharLeaf))\n", tl); - printf ("#define NUM0 (OFF0 + %d * sizeof (intptr_t))\n", tn); + printf ("#define NUM0 (OFF0 + %d * sizeof (uintptr_t))\n", tn); printf ("#define SET(n) (n * sizeof (FcLangCharSet) + offsetof (FcLangCharSet, charset))\n"); - printf ("#define OFF(s,o) (OFF0 + o * sizeof (intptr_t) - SET(s))\n"); + printf ("#define OFF(s,o) (OFF0 + o * sizeof (uintptr_t) - SET(s))\n"); printf ("#define NUM(s,n) (NUM0 + n * sizeof (FcChar16) - SET(s))\n"); printf ("#define LEAF(o,l) (LEAF0 + l * sizeof (FcCharLeaf) - (OFF0 + o * sizeof (intptr_t)))\n"); printf ("#define fcLangCharSets (fcLangData.langCharSets)\n"); @@ -376,7 +391,7 @@ main (int argc, char **argv) printf ("static const struct {\n" " FcLangCharSet langCharSets[%d];\n" " FcCharLeaf leaves[%d];\n" - " intptr_t leaf_offsets[%d];\n" + " uintptr_t leaf_offsets[%d];\n" " FcChar16 numbers[%d];\n" " FcChar%s langIndices[%d];\n" " FcChar%s langIndicesInv[%d];\n" -- cgit v1.2.3