gfx/angle/src/compiler/preprocessor/64bit-tokenizer-safety.patch

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

     1 --- a/src/compiler/preprocessor/Tokenizer.cpp
     2 +++ b/src/compiler/preprocessor/Tokenizer.cpp
     3 @@ -56,6 +56,7 @@ typedef int16_t flex_int16_t;
     4  typedef uint16_t flex_uint16_t;
     5  typedef int32_t flex_int32_t;
     6  typedef uint32_t flex_uint32_t;
     7 +typedef uint64_t flex_uint64_t;
     8  #else
     9  typedef signed char flex_int8_t;
    10  typedef short int flex_int16_t;
    11 @@ -179,6 +180,11 @@ typedef void* yyscan_t;
    12  typedef struct yy_buffer_state *YY_BUFFER_STATE;
    13  #endif
    15 +#ifndef YY_TYPEDEF_YY_SIZE_T
    16 +#define YY_TYPEDEF_YY_SIZE_T
    17 +typedef size_t yy_size_t;
    18 +#endif
    19 +
    20  #define EOB_ACT_CONTINUE_SCAN 0
    21  #define EOB_ACT_END_OF_FILE 1
    22  #define EOB_ACT_LAST_MATCH 2
    23 @@ -201,11 +207,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
    25  #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
    27 -#ifndef YY_TYPEDEF_YY_SIZE_T
    28 -#define YY_TYPEDEF_YY_SIZE_T
    29 -typedef size_t yy_size_t;
    30 -#endif
    31 -
    32  #ifndef YY_STRUCT_YY_BUFFER_STATE
    33  #define YY_STRUCT_YY_BUFFER_STATE
    34  struct yy_buffer_state
    35 @@ -223,7 +224,7 @@ struct yy_buffer_state
    36  	/* Number of characters read into yy_ch_buf, not including EOB
    37  	 * characters.
    38  	 */
    39 -	int yy_n_chars;
    40 +	yy_size_t yy_n_chars;
    42  	/* Whether we "own" the buffer - i.e., we know we created it,
    43  	 * and can realloc() it to grow it, and should free() it to
    44 @@ -302,7 +303,7 @@ static void pp_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
    46  YY_BUFFER_STATE pp_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
    47  YY_BUFFER_STATE pp_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
    48 -YY_BUFFER_STATE pp_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
    49 +YY_BUFFER_STATE pp_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
    51  void *ppalloc (yy_size_t ,yyscan_t yyscanner );
    52  void *pprealloc (void *,yy_size_t ,yyscan_t yyscanner );
    53 @@ -353,7 +354,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
    54   */
    55  #define YY_DO_BEFORE_ACTION \
    56  	yyg->yytext_ptr = yy_bp; \
    57 -	yyleng = (size_t) (yy_cp - yy_bp); \
    58 +	yyleng = (yy_size_t) (yy_cp - yy_bp); \
    59  	yyg->yy_hold_char = *yy_cp; \
    60  	*yy_cp = '\0'; \
    61  	yyg->yy_c_buf_p = yy_cp;
    62 @@ -579,8 +580,8 @@ struct yyguts_t
    63      size_t yy_buffer_stack_max; /**< capacity of stack. */
    64      YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
    65      char yy_hold_char;
    66 -    int yy_n_chars;
    67 -    int yyleng_r;
    68 +    yy_size_t yy_n_chars;
    69 +    yy_size_t yyleng_r;
    70      char *yy_c_buf_p;
    71      int yy_init;
    72      int yy_start;
    73 @@ -637,7 +638,7 @@ FILE *ppget_out (yyscan_t yyscanner );
    75  void ppset_out  (FILE * out_str ,yyscan_t yyscanner );
    77 -int ppget_leng (yyscan_t yyscanner );
    78 +yy_size_t ppget_leng (yyscan_t yyscanner );
    80  char *ppget_text (yyscan_t yyscanner );
    82 @@ -704,7 +705,7 @@ static int input (yyscan_t yyscanner );
    83  	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
    84  		{ \
    85  		int c = '*'; \
    86 -		int n; \
    87 +		yy_size_t n; \
    88  		for ( n = 0; n < max_size && \
    89  			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
    90  			buf[n] = (char) c; \
    91 @@ -1338,7 +1339,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
    93  	else
    94  		{
    95 -			int num_to_read =
    96 +			yy_size_t num_to_read =
    97  			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
    99  		while ( num_to_read <= 0 )
   100 @@ -1352,7 +1353,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
   102  			if ( b->yy_is_our_buffer )
   103  				{
   104 -				int new_size = b->yy_buf_size * 2;
   105 +				yy_size_t new_size = b->yy_buf_size * 2;
   107  				if ( new_size <= 0 )
   108  					b->yy_buf_size += b->yy_buf_size / 8;
   109 @@ -1383,7 +1384,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
   111  		/* Read in more data. */
   112  		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
   113 -			yyg->yy_n_chars, (size_t) num_to_read );
   114 +			yyg->yy_n_chars, num_to_read );
   116  		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
   117  		}
   118 @@ -1508,7 +1509,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
   120  		else
   121  			{ /* need more input */
   122 -			int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
   123 +			yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
   124  			++yyg->yy_c_buf_p;
   126  			switch ( yy_get_next_buffer( yyscanner ) )
   127 @@ -1788,7 +1789,7 @@ void pppop_buffer_state (yyscan_t yyscanner)
   128   */
   129  static void ppensure_buffer_stack (yyscan_t yyscanner)
   130  {
   131 -	int num_to_alloc;
   132 +	yy_size_t num_to_alloc;
   133      struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   135  	if (!yyg->yy_buffer_stack) {
   136 @@ -1886,12 +1887,11 @@ YY_BUFFER_STATE pp_scan_string (yyconst char * yystr , yyscan_t yyscanner)
   137   * @param yyscanner The scanner object.
   138   * @return the newly allocated buffer state object.
   139   */
   140 -YY_BUFFER_STATE pp_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
   141 +YY_BUFFER_STATE pp_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len , yyscan_t yyscanner)
   142  {
   143  	YY_BUFFER_STATE b;
   144  	char *buf;
   145 -	yy_size_t n;
   146 -	int i;
   147 +	yy_size_t n, i;
   149  	/* Get memory for full buffer, including space for trailing EOB's. */
   150  	n = _yybytes_len + 2;
   151 @@ -2001,7 +2001,7 @@ FILE *ppget_out  (yyscan_t yyscanner)
   152  /** Get the length of the current token.
   153   * @param yyscanner The scanner object.
   154   */
   155 -int ppget_leng  (yyscan_t yyscanner)
   156 +yy_size_t ppget_leng  (yyscan_t yyscanner)
   157  {
   158      struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   159      return yyleng;

mercurial