Skip to content

Commit

Permalink
Increase range of allowed integers to the full 32-bit range.
Browse files Browse the repository at this point in the history
Narrowing to 999999999 made the range too small for time_t values
(e.g. the return from on(), which is what started all of this anyway)
that represent roughly the present time.  So expand the range as far
as we sensibly can, to the max ranges for signed 32-bit integers
(values are stored in int variables, even the CF_VALRANGE ones that
clearly think they're unsigned).
  • Loading branch information
Edward Welbourne committed Aug 28, 2014
1 parent c402152 commit 51b564c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions contrib/cfengine.el
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ bundle agent rcfiles
"Cache for `cfengine-mode' syntax trees obtained from 'cf-promises -s json'.")

; Be sure to keep these two in sync with libpromises/cf3.defs.h
(defconst cfengine3-uint-range "0,999999999")
(defconst cfengine3-sint-range "-999999999,999999999")
(defconst cfengine3-uint-range "0,2147483647")
(defconst cfengine3-sint-range "-2147483648,2147483647")

(defconst cfengine3-fallback-syntax
'((functions
Expand Down
11 changes: 6 additions & 5 deletions libpromises/cf3.defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -536,11 +536,12 @@ typedef enum
#define CF_BOOL "true,false,yes,no,on,off"
#define CF_LINKRANGE "symlink,hardlink,relative,absolute"
#define CF_TIMERANGE "0,2147483647" /* i.e. "0,0x7fffffff" */
/* Be careful not to make these too big for the valid 32-bit range, or
* they get wrapped, potentially to quite small (and mysterious, until
* you work out where they came from) values: */
#define CF_VALRANGE "0,999999999"
#define CF_INTRANGE "-999999999,999999999"
/* Be careful not to make these too big for the (signed - values are
* stored in int, even when controlled by CF_VALRANGE) valid 32-bit
* range, or they get wrapped, potentially to quite small (and
* mysterious, until you work out where they came from) values: */
#define CF_VALRANGE "0,2147483647"
#define CF_INTRANGE "-2147483648,2147483647"
#define CF_INTLISTRANGE "[-0-9_$(){}\\[\\].]+"
#define CF_REALRANGE "-9.99999E100,9.99999E100"
#define CF_CHARRANGE "^.$"
Expand Down

0 comments on commit 51b564c

Please sign in to comment.