[BACK]Return to strfmon.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / stdlib

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

Diff for /src/lib/libc/stdlib/strfmon.c between version 1.4.16.1 and 1.6

version 1.4.16.1, 2008/03/24 07:14:45 version 1.6, 2008/03/27 21:50:30
Line 50  __RCSID("$NetBSD$");
Line 50  __RCSID("$NetBSD$");
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
   #include <stddef.h>
   
 /* internal flags */  /* internal flags */
 #define NEED_GROUPING           0x01    /* print digits grouped (default) */  #define NEED_GROUPING           0x01    /* print digits grouped (default) */
Line 75  __RCSID("$NetBSD$");
Line 76  __RCSID("$NetBSD$");
 } while (/* CONSTCOND */ 0)  } while (/* CONSTCOND */ 0)
   
 #define GET_NUMBER(VAR) do {                                    \  #define GET_NUMBER(VAR) do {                                    \
         int ovar;                                               \          VAR = 0;                                                \
         ovar = VAR = 0;                                         \  
         while (isdigit((unsigned char)*fmt)) {                  \          while (isdigit((unsigned char)*fmt)) {                  \
                 VAR *= 10;                                      \                  VAR *= 10;                                      \
                 VAR += *fmt - '0';                              \                  VAR += *fmt - '0';                              \
                 if (ovar > VAR)                                 \                  if (VAR > 0x00ffffff)                           \
                         goto e2big_error;                       \                          goto e2big_error;                       \
                 else                                            \  
                         ovar = VAR;                             \  
                 fmt++;                                          \                  fmt++;                                          \
         }                                                       \          }                                                       \
 } while (/* CONSTCOND */ 0)  } while (/* CONSTCOND */ 0)
Line 200  strfmon(char * __restrict s, size_t maxs
Line 198  strfmon(char * __restrict s, size_t maxs
   
                 /* field Width */                  /* field Width */
                 if (isdigit((unsigned char)*fmt)) {                  if (isdigit((unsigned char)*fmt)) {
                           ptrdiff_t d = dst - s;
                         GET_NUMBER(width);                          GET_NUMBER(width);
                         /* Do we have enough space to put number with                          /* Do we have enough space to put number with
                          * required width ?                           * required width ?
                          */                           */
                         if (dst + width >= s + maxsize)  
                           if (d + width >= maxsize)
                                 goto e2big_error;                                  goto e2big_error;
                 }                  }
   

Legend:
Removed from v.1.4.16.1  
changed lines
  Added in v.1.6

CVSweb <webmaster@jp.NetBSD.org>