[BACK]Return to chars.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/chars.c between version 1.38 and 1.39

version 1.38, 2011/04/30 22:14:42 version 1.39, 2011/04/30 22:24:31
Line 137  mchars_res2cp(struct mchars *arg, const char *p, size_
Line 137  mchars_res2cp(struct mchars *arg, const char *p, size_
   
   
 /*  /*
  * Numbered character to literal character,   * Numbered character to literal character.
  * represented as a null-terminated string for additional safety.  
  */   */
 const char *  char
 mchars_num2char(const char *p, size_t sz)  mchars_num2char(const char *p, size_t sz)
 {  {
         int               i;          int               i;
         static char       c[2];  
   
         if (sz > 3)          if (sz > 3)
                 return(NULL);                  return('\0');
   
         i = atoi(p);          i = atoi(p);
         if (i < 0 || i > 255)          /*
                 return(NULL);           * FIXME:
         c[0] = (char)i;           * This is wrong.  Anything could be written here!
         c[1] = '\0';           * This should be carefully screened for possible characters.
         return(c);           */
           return(i <= 0 || i > 255 ? '\0' : (char)i);
 }  }
   
   

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.39

CVSweb