[BACK]Return to lex.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / usr.bin / xlint / lint1

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/usr.bin/xlint/lint1/lex.c between version 1.43 and 1.44

version 1.43, 2021/06/20 18:41:27 version 1.44, 2021/06/20 18:44:48
Line 862  int
Line 862  int
 lex_wide_character_constant(void)  lex_wide_character_constant(void)
 {  {
         static  char buf[MB_LEN_MAX + 1];          static  char buf[MB_LEN_MAX + 1];
         size_t  i, imax;          size_t  n, nmax;
         int c;          int c;
         wchar_t wc;          wchar_t wc;
   
         imax = MB_CUR_MAX;          nmax = MB_CUR_MAX;
   
         i = 0;          n = 0;
         while ((c = get_escaped_char('\'')) >= 0) {          while ((c = get_escaped_char('\'')) >= 0) {
                 if (i < imax)                  if (n < nmax)
                         buf[i] = (char)c;                          buf[n] = (char)c;
                 i++;                  n++;
         }          }
   
         wc = 0;          wc = 0;
Line 880  lex_wide_character_constant(void)
Line 880  lex_wide_character_constant(void)
         if (c == -2) {          if (c == -2) {
                 /* unterminated character constant */                  /* unterminated character constant */
                 error(253);                  error(253);
         } else if (i == 0) {          } else if (n == 0) {
                 /* empty character constant */                  /* empty character constant */
                 error(73);                  error(73);
         } else if (i > imax) {          } else if (n > nmax) {
                 i = imax;                  n = nmax;
                 /* too many characters in character constant */                  /* too many characters in character constant */
                 error(71);                  error(71);
         } else {          } else {
                 buf[i] = '\0';                  buf[n] = '\0';
                 (void)mbtowc(NULL, NULL, 0);                  (void)mbtowc(NULL, NULL, 0);
                 if (mbtowc(&wc, buf, imax) < 0)                  if (mbtowc(&wc, buf, nmax) < 0)
                         /* invalid multibyte character */                          /* invalid multibyte character */
                         error(291);                          error(291);
         }          }

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.44

CVSweb <webmaster@jp.NetBSD.org>