From: Paul Eggert Date: Mon, 7 Feb 2011 05:42:15 +0000 (-0800) Subject: * doprnt.c, indent.c, character.c: conform to C89 pointer rules X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~982 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7469ef5d1bf4a7d2297fce554dc0980d4787ffb4;p=emacs.git * doprnt.c, indent.c, character.c: conform to C89 pointer rules --- diff --git a/src/ChangeLog b/src/ChangeLog index eeaa5a24ae6..f646bd66981 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -24,6 +24,11 @@ * process.c (read_process_output, send_process, Fprocess_send_region): Likewise. * callproc.c (Fcall_process): Likewise. + * doprnt.c (doprnt): Likewise. + * indent.c (compute_motion): Likewise. + * character.c (strwidth): Make its argument const char *, not const + unsigned char *, since more callers prefer it that way. All callers + changed. 2011-02-06 Paul Eggert diff --git a/src/character.c b/src/character.c index 9936ac281cf..397481e5b39 100644 --- a/src/character.c +++ b/src/character.c @@ -395,9 +395,9 @@ c_string_width (const unsigned char *str, EMACS_INT len, int precision, occupies on the screen. */ EMACS_INT -strwidth (const unsigned char *str, EMACS_INT len) +strwidth (const char *str, EMACS_INT len) { - return c_string_width (str, len, -1, NULL, NULL); + return c_string_width ((const unsigned char *) str, len, -1, NULL, NULL); } /* Return width of Lisp string STRING when displayed in the current diff --git a/src/character.h b/src/character.h index 259aebbb8a8..f2ccb28bb37 100644 --- a/src/character.h +++ b/src/character.h @@ -612,7 +612,7 @@ extern EMACS_INT str_to_multibyte (unsigned char *, EMACS_INT, EMACS_INT); extern EMACS_INT str_as_unibyte (unsigned char *, EMACS_INT); extern EMACS_INT str_to_unibyte (const unsigned char *, unsigned char *, EMACS_INT, int); -extern EMACS_INT strwidth (const unsigned char *, EMACS_INT); +extern EMACS_INT strwidth (const char *, EMACS_INT); extern EMACS_INT c_string_width (const unsigned char *, EMACS_INT, int, EMACS_INT *, EMACS_INT *); extern EMACS_INT lisp_string_width (Lisp_Object, int, @@ -630,4 +630,3 @@ extern Lisp_Object string_escape_byte8 (Lisp_Object); do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (0) #endif /* EMACS_CHARACTER_H */ - diff --git a/src/doprnt.c b/src/doprnt.c index 979cce3c402..36eb272caae 100644 --- a/src/doprnt.c +++ b/src/doprnt.c @@ -71,11 +71,11 @@ doprnt (char *buffer, register int bufsize, const char *format, char *big_buffer = 0; register int tem; - unsigned char *string; + char *string; char fixed_buffer[20]; /* Default buffer for small formatting. */ char *fmtcpy; int minlen; - unsigned char charbuf[MAX_MULTIBYTE_LENGTH + 1]; /* Used for %c. */ + char charbuf[MAX_MULTIBYTE_LENGTH + 1]; /* Used for %c. */ if (format_end == 0) format_end = format + strlen (format); @@ -97,7 +97,7 @@ doprnt (char *buffer, register int bufsize, const char *format, fmt++; /* Copy this one %-spec into fmtcpy. */ - string = (unsigned char *) fmtcpy; + string = fmtcpy; *string++ = '%'; while (1) { @@ -166,7 +166,7 @@ doprnt (char *buffer, register int bufsize, const char *format, abort (); sprintf (sprintf_buffer, fmtcpy, va_arg(ap, char *)); /* Now copy into final output, truncating as nec. */ - string = (unsigned char *) sprintf_buffer; + string = sprintf_buffer; goto doit; case 'f': @@ -176,7 +176,7 @@ doprnt (char *buffer, register int bufsize, const char *format, double d = va_arg(ap, double); sprintf (sprintf_buffer, fmtcpy, d); /* Now copy into final output, truncating as nec. */ - string = (unsigned char *) sprintf_buffer; + string = sprintf_buffer; goto doit; } @@ -185,7 +185,7 @@ doprnt (char *buffer, register int bufsize, const char *format, case 's': if (fmtcpy[1] != 's') minlen = atoi (&fmtcpy[1]); - string = va_arg(ap, unsigned char *); + string = va_arg (ap, char *); tem = strlen (string); width = strwidth (string, tem); goto doit1; @@ -242,7 +242,7 @@ doprnt (char *buffer, register int bufsize, const char *format, both are passed the same way, otherwise we'll need to rewrite callers. */ EMACS_INT chr = va_arg(ap, EMACS_INT); - tem = CHAR_STRING ((int) chr, charbuf); + tem = CHAR_STRING ((int) chr, (unsigned char *) charbuf); string = charbuf; string[tem] = 0; width = strwidth (string, tem); @@ -277,4 +277,3 @@ doprnt (char *buffer, register int bufsize, const char *format, *bufptr = 0; /* Make sure our string end with a '\0' */ return bufptr - buffer; } - diff --git a/src/indent.c b/src/indent.c index b40cb9f50b6..84ce140c5ba 100644 --- a/src/indent.c +++ b/src/indent.c @@ -1250,7 +1250,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ unsigned char *ovstr; EMACS_INT ovlen = overlay_strings (pos, win, &ovstr); hpos += ((multibyte && ovlen > 0) - ? strwidth (ovstr, ovlen) : ovlen); + ? strwidth ((char *) ovstr, ovlen) : ovlen); } did_motion = 0;