OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2009,2010 Red Hat, Inc. | 2 * Copyright © 2009,2010 Red Hat, Inc. |
3 * Copyright © 2011,2012 Google, Inc. | 3 * Copyright © 2011,2012 Google, Inc. |
4 * | 4 * |
5 * This is part of HarfBuzz, a text shaping library. | 5 * This is part of HarfBuzz, a text shaping library. |
6 * | 6 * |
7 * Permission is hereby granted, without written agreement and without | 7 * Permission is hereby granted, without written agreement and without |
8 * license or royalty fees, to use, copy, modify, and distribute this | 8 * license or royalty fees, to use, copy, modify, and distribute this |
9 * software and its documentation for any purpose, provided that the | 9 * software and its documentation for any purpose, provided that the |
10 * above copyright notice and the following two paragraphs appear in | 10 * above copyright notice and the following two paragraphs appear in |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 0, 0, 0, 0, 0 | 179 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 0, 0, 0, 0, 0 |
180 }; | 180 }; |
181 | 181 |
182 static bool | 182 static bool |
183 lang_equal (hb_language_t v1, | 183 lang_equal (hb_language_t v1, |
184 const void *v2) | 184 const void *v2) |
185 { | 185 { |
186 const unsigned char *p1 = (const unsigned char *) v1; | 186 const unsigned char *p1 = (const unsigned char *) v1; |
187 const unsigned char *p2 = (const unsigned char *) v2; | 187 const unsigned char *p2 = (const unsigned char *) v2; |
188 | 188 |
189 while (*p1 && *p1 == canon_map[*p2]) | 189 while (*p1 && *p1 == canon_map[*p2]) { |
190 p1++, p2++; | 190 p1++; |
| 191 p2++; |
| 192 } |
191 | 193 |
192 return *p1 == canon_map[*p2]; | 194 return *p1 == canon_map[*p2]; |
193 } | 195 } |
194 | 196 |
195 #if 0 | 197 #if 0 |
196 static unsigned int | 198 static unsigned int |
197 lang_hash (const void *key) | 199 lang_hash (const void *key) |
198 { | 200 { |
199 const unsigned char *p = key; | 201 const unsigned char *p = key; |
200 unsigned int h = 0; | 202 unsigned int h = 0; |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 char buf[32]; | 662 char buf[32]; |
661 unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp)); | 663 unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp)); |
662 strncpy (buf, *pp, len); | 664 strncpy (buf, *pp, len); |
663 buf[len] = '\0'; | 665 buf[len] = '\0'; |
664 | 666 |
665 char *p = buf; | 667 char *p = buf; |
666 char *pend = p; | 668 char *pend = p; |
667 float v; | 669 float v; |
668 | 670 |
669 errno = 0; | 671 errno = 0; |
670 v = strtof (p, &pend); | 672 v = strtod (p, &pend); |
671 if (errno || p == pend) | 673 if (errno || p == pend) |
672 return false; | 674 return false; |
673 | 675 |
674 *pv = v; | 676 *pv = v; |
675 *pp += pend - p; | 677 *pp += pend - p; |
676 return true; | 678 return true; |
677 } | 679 } |
678 | 680 |
679 static bool | 681 static bool |
680 parse_bool (const char **pp, const char *end, unsigned int *pv) | 682 parse_bool (const char **pp, const char *end, unsigned int *pv) |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 while (len && s[len - 1] == ' ') | 944 while (len && s[len - 1] == ' ') |
943 len--; | 945 len--; |
944 s[len++] = '='; | 946 s[len++] = '='; |
945 len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%g", variation->val
ue)); | 947 len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%g", variation->val
ue)); |
946 | 948 |
947 assert (len < ARRAY_LENGTH (s)); | 949 assert (len < ARRAY_LENGTH (s)); |
948 len = MIN (len, size - 1); | 950 len = MIN (len, size - 1); |
949 memcpy (buf, s, len); | 951 memcpy (buf, s, len); |
950 buf[len] = '\0'; | 952 buf[len] = '\0'; |
951 } | 953 } |
OLD | NEW |