Print this page
10476 file(1) could be smatch clean

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/file/file.c
          +++ new/usr/src/cmd/file/file.c
↓ open down ↓ 845 lines elided ↑ open up ↑
 846  846          IS_ascii = 1;
 847  847          if (fbsz < FBSZ)
 848  848                  Max = fbsz;
 849  849          else
 850  850                  Max = FBSZ - MB_LEN_MAX; /* prevent cut of wchar read */
 851  851          /* end modification for multibyte env */
 852  852  
 853  853          for (i = 0; i < Max; /* null */)
 854  854                  if (fbuf[i] & 0200) {
 855  855                          IS_ascii = 0;
 856      -                        if (fbuf[0] == '\100' && fbuf[1] == '\357') {
      856 +                        if ((fbuf[0] == '\100') &&
      857 +                            ((uchar_t)fbuf[1] == (uchar_t)'\357')) {
 857  858                                  (void) printf(gettext("troff output\n"));
 858  859                                  return;
 859  860                          }
 860  861                  /* start modification for multibyte env */
 861  862                          if ((length = mbtowc(&wchar, &fbuf[i], MB_CUR_MAX))
 862  863                              <= 0 || !iswprint(wchar)) {
 863  864                                  (void) printf(gettext("data\n"));
 864  865                                  return;
 865  866                          }
 866  867                          i += length;
↓ open down ↓ 1039 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX