Fix many problems with 8bit chars (sign extend in ctype macros)
Fix main problem with 8-bit chars in directories names: because signed_sum left uninitialized, wrong checksum occurse
This commit is contained in:
parent
b25aa8a037
commit
109de6c0ab
@ -95,9 +95,9 @@ read_dir_file ()
|
||||
{
|
||||
int dev;
|
||||
int ino;
|
||||
char *strp;
|
||||
unsigned char *strp;
|
||||
FILE *fp;
|
||||
char buf[512];
|
||||
unsigned char buf[512];
|
||||
static char *path = 0;
|
||||
|
||||
if (path == 0)
|
||||
|
@ -323,7 +323,7 @@ read_header ()
|
||||
|
||||
recsum = from_oct (8, header->header.chksum);
|
||||
|
||||
sum = 0;
|
||||
signed_sum = sum = 0;
|
||||
p = header->charptr;
|
||||
for (i = sizeof (*header); --i >= 0;)
|
||||
{
|
||||
@ -504,7 +504,7 @@ decode_header (header, st, stdp, wantug)
|
||||
long
|
||||
from_oct (digs, where)
|
||||
register int digs;
|
||||
register char *where;
|
||||
register unsigned char *where;
|
||||
{
|
||||
register long value;
|
||||
|
||||
|
@ -837,7 +837,7 @@ quote_copy_string (string)
|
||||
from_here = string;
|
||||
while (*from_here)
|
||||
{
|
||||
c = *from_here++;
|
||||
c = *from_here++ & 0xff;
|
||||
if (c == '\\')
|
||||
{
|
||||
if (!copying)
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
/* We need this for `regex.h', and perhaps for the Emacs include files. */
|
||||
#include <sys/types.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
@ -101,13 +102,8 @@ init_syntax_once ()
|
||||
|
||||
bzero (re_syntax_table, sizeof re_syntax_table);
|
||||
|
||||
for (c = 'a'; c <= 'z'; c++)
|
||||
re_syntax_table[c] = Sword;
|
||||
|
||||
for (c = 'A'; c <= 'Z'; c++)
|
||||
re_syntax_table[c] = Sword;
|
||||
|
||||
for (c = '0'; c <= '9'; c++)
|
||||
for (c = 0; c < CHAR_SET_SIZE; c++)
|
||||
if (isalnum(c))
|
||||
re_syntax_table[c] = Sword;
|
||||
|
||||
re_syntax_table['_'] = Sword;
|
||||
@ -125,33 +121,28 @@ init_syntax_once ()
|
||||
#include "regex.h"
|
||||
|
||||
/* isalpha etc. are used for the character classes. */
|
||||
#include <ctype.h>
|
||||
|
||||
#ifndef isascii
|
||||
#define isascii(c) 1
|
||||
#endif
|
||||
|
||||
#ifdef isblank
|
||||
#define ISBLANK(c) (isascii (c) && isblank (c))
|
||||
#define ISBLANK(c) isblank (c)
|
||||
#else
|
||||
#define ISBLANK(c) ((c) == ' ' || (c) == '\t')
|
||||
#endif
|
||||
#ifdef isgraph
|
||||
#define ISGRAPH(c) (isascii (c) && isgraph (c))
|
||||
#define ISGRAPH(c) isgraph (c)
|
||||
#else
|
||||
#define ISGRAPH(c) (isascii (c) && isprint (c) && !isspace (c))
|
||||
#define ISGRAPH(c) (isprint (c) && !isspace (c))
|
||||
#endif
|
||||
|
||||
#define ISPRINT(c) (isascii (c) && isprint (c))
|
||||
#define ISDIGIT(c) (isascii (c) && isdigit (c))
|
||||
#define ISALNUM(c) (isascii (c) && isalnum (c))
|
||||
#define ISALPHA(c) (isascii (c) && isalpha (c))
|
||||
#define ISCNTRL(c) (isascii (c) && iscntrl (c))
|
||||
#define ISLOWER(c) (isascii (c) && islower (c))
|
||||
#define ISPUNCT(c) (isascii (c) && ispunct (c))
|
||||
#define ISSPACE(c) (isascii (c) && isspace (c))
|
||||
#define ISUPPER(c) (isascii (c) && isupper (c))
|
||||
#define ISXDIGIT(c) (isascii (c) && isxdigit (c))
|
||||
#define ISPRINT(c) isprint (c)
|
||||
#define ISDIGIT(c) isdigit (c)
|
||||
#define ISALNUM(c) isalnum (c)
|
||||
#define ISALPHA(c) isalpha (c)
|
||||
#define ISCNTRL(c) iscntrl (c)
|
||||
#define ISLOWER(c) islower (c)
|
||||
#define ISPUNCT(c) ispunct (c)
|
||||
#define ISSPACE(c) isspace (c)
|
||||
#define ISUPPER(c) isupper (c)
|
||||
#define ISXDIGIT(c) isxdigit (c)
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
|
Loading…
Reference in New Issue
Block a user