aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorPaul Eggert2012-08-16 14:58:44 -0700
committerPaul Eggert2012-08-16 14:58:44 -0700
commit620f13b0612810324592ab2d2b4e5a5dab27f981 (patch)
tree844d21f0c90ede1887eb699058398f5f9a81f069 /src/image.c
parent85c2386bbe5d7957cf5750b6f96b2868f83eedf4 (diff)
downloademacs-620f13b0612810324592ab2d2b4e5a5dab27f981.tar.gz
emacs-620f13b0612810324592ab2d2b4e5a5dab27f981.zip
Use ASCII tests for character types.
* admin/merge-gnulib (GNULIB_MODULES): Add c-ctype. * lwlib/lwlib-Xaw.c, lwlib/lwlib.c, lwlib/xlwmenu.c: Don't include <ctype.h>; no longer needed. * lwlib/lwlib-Xaw.c (openFont): * lwlib/xlwmenu.c (openXftFont): Test just for ASCII digits. * src/category.c, src/dispnew.c, src/doprnt.c, src/editfns.c, src/syntax.c * src/term.c, src/xfns.c, src/xterm.c: Don't include <ctype.h>; was not needed. * src/charset.c, src/doc.c, src/fileio.c, src/font.c, src/frame.c: * src/gtkutil.c, src/image.c, src/sysdep.c, src/xfaces.c: Include <c-ctype.h> instead of <ctype.h>. * src/nsterm.m: Include <c-ctype.h>. * src/charset.c (read_hex): * src/doc.c (Fsnarf_documentation): * src/fileio.c (IS_DRIVE) [WINDOWSNT]: (DRIVE_LETTER) [DOS_NT]: (Ffile_name_directory, Fexpand_file_name) (Fsubstitute_in_file_name): * src/font.c (font_parse_xlfd, font_parse_fcname): * src/frame.c (x_set_font_backend): * src/gtkutil.c (xg_get_font): * src/image.c (xbm_scan, xpm_scan, pbm_scan_number): * src/nsimage.m (hexchar): * src/nsterm.m (ns_xlfd_to_fontname): * src/sysdep.c (system_process_attributes): * src/xfaces.c (hash_string_case_insensitive): Use C-locale tests instead of locale-specific tests for character types, since we want the ASCII interpretation here, not the interpretation suitable for whatever happens to be the current locale.
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/image.c b/src/image.c
index 8a318c2f6ec..f2778165ece 100644
--- a/src/image.c
+++ b/src/image.c
@@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20#include <config.h> 20#include <config.h>
21#include <stdio.h> 21#include <stdio.h>
22#include <math.h> 22#include <math.h>
23#include <ctype.h>
24#include <unistd.h> 23#include <unistd.h>
25 24
26#ifdef HAVE_PNG 25#ifdef HAVE_PNG
@@ -33,6 +32,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
33 32
34#include <setjmp.h> 33#include <setjmp.h>
35 34
35#include <c-ctype.h>
36
36/* This makes the fields of a Display accessible, in Xlib header files. */ 37/* This makes the fields of a Display accessible, in Xlib header files. */
37 38
38#define XLIB_ILLEGAL_ACCESS 39#define XLIB_ILLEGAL_ACCESS
@@ -2405,12 +2406,12 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
2405 loop: 2406 loop:
2406 2407
2407 /* Skip white space. */ 2408 /* Skip white space. */
2408 while (*s < end && (c = *(*s)++, isspace (c))) 2409 while (*s < end && (c = *(*s)++, c_isspace (c)))
2409 ; 2410 ;
2410 2411
2411 if (*s >= end) 2412 if (*s >= end)
2412 c = 0; 2413 c = 0;
2413 else if (isdigit (c)) 2414 else if (c_isdigit (c))
2414 { 2415 {
2415 int value = 0, digit; 2416 int value = 0, digit;
2416 2417
@@ -2422,7 +2423,7 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
2422 while (*s < end) 2423 while (*s < end)
2423 { 2424 {
2424 c = *(*s)++; 2425 c = *(*s)++;
2425 if (isdigit (c)) 2426 if (c_isdigit (c))
2426 digit = c - '0'; 2427 digit = c - '0';
2427 else if (c >= 'a' && c <= 'f') 2428 else if (c >= 'a' && c <= 'f')
2428 digit = c - 'a' + 10; 2429 digit = c - 'a' + 10;
@@ -2433,11 +2434,11 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
2433 value = 16 * value + digit; 2434 value = 16 * value + digit;
2434 } 2435 }
2435 } 2436 }
2436 else if (isdigit (c)) 2437 else if (c_isdigit (c))
2437 { 2438 {
2438 value = c - '0'; 2439 value = c - '0';
2439 while (*s < end 2440 while (*s < end
2440 && (c = *(*s)++, isdigit (c))) 2441 && (c = *(*s)++, c_isdigit (c)))
2441 value = 8 * value + c - '0'; 2442 value = 8 * value + c - '0';
2442 } 2443 }
2443 } 2444 }
@@ -2445,7 +2446,7 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
2445 { 2446 {
2446 value = c - '0'; 2447 value = c - '0';
2447 while (*s < end 2448 while (*s < end
2448 && (c = *(*s)++, isdigit (c))) 2449 && (c = *(*s)++, c_isdigit (c)))
2449 value = 10 * value + c - '0'; 2450 value = 10 * value + c - '0';
2450 } 2451 }
2451 2452
@@ -2454,11 +2455,11 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
2454 *ival = value; 2455 *ival = value;
2455 c = XBM_TK_NUMBER; 2456 c = XBM_TK_NUMBER;
2456 } 2457 }
2457 else if (isalpha (c) || c == '_') 2458 else if (c_isalpha (c) || c == '_')
2458 { 2459 {
2459 *sval++ = c; 2460 *sval++ = c;
2460 while (*s < end 2461 while (*s < end
2461 && (c = *(*s)++, (isalnum (c) || c == '_'))) 2462 && (c = *(*s)++, (c_isalnum (c) || c == '_')))
2462 *sval++ = c; 2463 *sval++ = c;
2463 *sval = 0; 2464 *sval = 0;
2464 if (*s < end) 2465 if (*s < end)
@@ -3661,16 +3662,17 @@ xpm_scan (const unsigned char **s,
3661 while (*s < end) 3662 while (*s < end)
3662 { 3663 {
3663 /* Skip white-space. */ 3664 /* Skip white-space. */
3664 while (*s < end && (c = *(*s)++, isspace (c))) 3665 while (*s < end && (c = *(*s)++, c_isspace (c)))
3665 ; 3666 ;
3666 3667
3667 /* gnus-pointer.xpm uses '-' in its identifier. 3668 /* gnus-pointer.xpm uses '-' in its identifier.
3668 sb-dir-plus.xpm uses '+' in its identifier. */ 3669 sb-dir-plus.xpm uses '+' in its identifier. */
3669 if (isalpha (c) || c == '_' || c == '-' || c == '+') 3670 if (c_isalpha (c) || c == '_' || c == '-' || c == '+')
3670 { 3671 {
3671 *beg = *s - 1; 3672 *beg = *s - 1;
3672 while (*s < end 3673 while (*s < end
3673 && (c = **s, isalnum (c) || c == '_' || c == '-' || c == '+')) 3674 && (c = **s, c_isalnum (c)
3675 || c == '_' || c == '-' || c == '+'))
3674 ++*s; 3676 ++*s;
3675 *len = *s - *beg; 3677 *len = *s - *beg;
3676 return XPM_TK_IDENT; 3678 return XPM_TK_IDENT;
@@ -5014,7 +5016,7 @@ pbm_scan_number (unsigned char **s, unsigned char *end)
5014 while (*s < end) 5016 while (*s < end)
5015 { 5017 {
5016 /* Skip white-space. */ 5018 /* Skip white-space. */
5017 while (*s < end && (c = *(*s)++, isspace (c))) 5019 while (*s < end && (c = *(*s)++, c_isspace (c)))
5018 ; 5020 ;
5019 5021
5020 if (c == '#') 5022 if (c == '#')
@@ -5023,11 +5025,11 @@ pbm_scan_number (unsigned char **s, unsigned char *end)
5023 while (*s < end && (c = *(*s)++, c != '\n')) 5025 while (*s < end && (c = *(*s)++, c != '\n'))
5024 ; 5026 ;
5025 } 5027 }
5026 else if (isdigit (c)) 5028 else if (c_isdigit (c))
5027 { 5029 {
5028 /* Read decimal number. */ 5030 /* Read decimal number. */
5029 val = c - '0'; 5031 val = c - '0';
5030 while (*s < end && (c = *(*s)++, isdigit (c))) 5032 while (*s < end && (c = *(*s)++, c_isdigit (c)))
5031 val = 10 * val + c - '0'; 5033 val = 10 * val + c - '0';
5032 break; 5034 break;
5033 } 5035 }
@@ -8554,7 +8556,7 @@ gs_load (struct frame *f, struct image *img)
8554 don't either. Let the Lisp loader use `unwind-protect' instead. */ 8556 don't either. Let the Lisp loader use `unwind-protect' instead. */
8555 printnum1 = FRAME_X_WINDOW (f); 8557 printnum1 = FRAME_X_WINDOW (f);
8556 printnum2 = img->pixmap; 8558 printnum2 = img->pixmap;
8557 window_and_pixmap_id 8559 window_and_pixmap_id
8558 = make_formatted_string (buffer, "%"pMu" %"pMu, printnum1, printnum2); 8560 = make_formatted_string (buffer, "%"pMu" %"pMu, printnum1, printnum2);
8559 8561
8560 printnum1 = FRAME_FOREGROUND_PIXEL (f); 8562 printnum1 = FRAME_FOREGROUND_PIXEL (f);