Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / src / surf / xml / simgrid_dtd.c
index b830e14..f95cef5 100644 (file)
@@ -25,7 +25,7 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 0
+#define YY_FLEX_SUBMINOR_VERSION 1
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -104,25 +104,13 @@ typedef unsigned int flex_uint32_t;
 
 #endif /* ! FLEXINT_H */
 
-#ifdef __cplusplus
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else  /* ! __cplusplus */
-
-/* C99 requires __STDC__ to be defined as 1. */
-#if defined (__STDC__)
-
-#define YY_USE_CONST
-
-#endif /* defined (__STDC__) */
-#endif /* ! __cplusplus */
-
-#ifdef YY_USE_CONST
+/* TODO: this is always defined, so inline it */
 #define yyconst const
+
+#if defined(__GNUC__) && __GNUC__ >= 3
+#define yynoreturn __attribute__((__noreturn__))
 #else
-#define yyconst
+#define yynoreturn
 #endif
 
 /* Returned upon end-of-file. */
@@ -183,7 +171,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
 typedef size_t yy_size_t;
 #endif
 
-extern yy_size_t surf_parse_leng;
+extern int surf_parse_leng;
 
 extern FILE *surf_parse_in, *surf_parse_out;
 
@@ -193,14 +181,14 @@ extern FILE *surf_parse_in, *surf_parse_out;
 
     /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
      *       access to the local variable yy_act. Since yyless() is a macro, it would break
-     *       existing scanners that call yyless() from OUTSIDE surf_parse_lex. 
+     *       existing scanners that call yyless() from OUTSIDE surf_parse_lex.
      *       One obvious solution it to make yy_act a global. I tried that, and saw
      *       a 5% performance hit in a non-surf_parse_lineno scanner, because yy_act is
      *       normally declared as a variable-- so it is not worth it.
      */
     #define  YY_LESS_LINENO(n) \
             do { \
-                unsigned int yyl;\
+                int yyl;\
                 for ( yyl = n; yyl < surf_parse_leng; ++yyl )\
                     if ( surf_parse_text[yyl] == '\n' )\
                         --surf_parse_lineno;\
@@ -241,7 +229,7 @@ struct yy_buffer_state
        /* Size of input buffer in bytes, not including room for EOB
         * characters.
         */
-       yy_size_t yy_buf_size;
+       int yy_buf_size;
 
        /* Number of characters read into yy_ch_buf, not including EOB
         * characters.
@@ -269,7 +257,7 @@ struct yy_buffer_state
 
     int yy_bs_lineno; /**< The line count. */
     int yy_bs_column; /**< The column count. */
-    
+
        /* Whether to try to fill the input buffer when we reach the
         * end of it.
         */
@@ -297,7 +285,7 @@ struct yy_buffer_state
 /* Stack of input buffers. */
 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
-static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
+static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
 
 /* We provide macros for accessing buffer states in case in the
  * future we want to put the buffer states in a more general
@@ -317,10 +305,10 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
 /* yy_hold_char holds the character lost when surf_parse_text is formed. */
 static char yy_hold_char;
 static int yy_n_chars;         /* number of characters read into yy_ch_buf */
-yy_size_t surf_parse_leng;
+int surf_parse_leng;
 
 /* Points to current character in buffer. */
-static char *yy_c_buf_p = (char *) 0;
+static char *yy_c_buf_p = NULL;
 static int yy_init = 0;                /* whether we need to initialize */
 static int yy_start = 0;       /* start state number */
 
@@ -345,7 +333,7 @@ static void surf_parse__init_buffer (YY_BUFFER_STATE b,FILE *file  );
 
 YY_BUFFER_STATE surf_parse__scan_buffer (char *base,yy_size_t size  );
 YY_BUFFER_STATE surf_parse__scan_string (yyconst char *yy_str  );
-YY_BUFFER_STATE surf_parse__scan_bytes (yyconst char *bytes,yy_size_t len  );
+YY_BUFFER_STATE surf_parse__scan_bytes (yyconst char *bytes,int len  );
 
 void *surf_parse_alloc (yy_size_t  );
 void *surf_parse_realloc (void *,yy_size_t  );
@@ -382,7 +370,7 @@ void surf_parse_free (void *  );
 
 typedef unsigned char YY_CHAR;
 
-FILE *surf_parse_in = (FILE *) 0, *surf_parse_out = (FILE *) 0;
+FILE *surf_parse_in = NULL, *surf_parse_out = NULL;
 
 typedef int yy_state_type;
 
@@ -399,17 +387,14 @@ extern char *surf_parse_text;
 static yy_state_type yy_get_previous_state (void );
 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
 static int yy_get_next_buffer (void );
-#if defined(__GNUC__) && __GNUC__ >= 3
-__attribute__((__noreturn__))
-#endif
-static void yy_fatal_error (yyconst char msg[]  );
+static void yynoreturn yy_fatal_error (yyconst char* msg  );
 
 /* Done after the current pattern has been matched and before the
  * corresponding action - sets up surf_parse_text.
  */
 #define YY_DO_BEFORE_ACTION \
        (yytext_ptr) = yy_bp; \
-       surf_parse_leng = (size_t) (yy_cp - yy_bp); \
+       surf_parse_leng = (int) (yy_cp - yy_bp); \
        (yy_hold_char) = *yy_cp; \
        *yy_cp = '\0'; \
        (yy_c_buf_p) = yy_cp;
@@ -5104,7 +5089,7 @@ FILE *surf_parse_get_out (void );
 
 void surf_parse_set_out  (FILE * _out_str  );
 
-yy_size_t surf_parse_get_leng (void );
+                       int surf_parse_get_leng (void );
 
 char *surf_parse_get_text (void );
 
@@ -5169,7 +5154,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO do { if (fwrite( surf_parse_text, surf_parse_leng, 1, surf_parse_out )) {} } while (0)
+#define ECHO do { if (fwrite( surf_parse_text, (size_t) surf_parse_leng, 1, surf_parse_out )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -5181,7 +5166,7 @@ static int input (void );
                { \
                int c = '*'; \
                size_t n; \
-               for ( n = 0; n < max_size && \
+               for ( n = 0; n < (size_t) max_size && \
                             (c = getc( surf_parse_in )) != EOF && c != '\n'; ++n ) \
                        buf[n] = (char) c; \
                if ( c == '\n' ) \
@@ -5193,7 +5178,7 @@ static int input (void );
        else \
                { \
                errno=0; \
-               while ( (result = fread(buf, 1, max_size, surf_parse_in))==0 && ferror(surf_parse_in)) \
+               while ( (result = (int) fread(buf, 1, max_size, surf_parse_in))==0 && ferror(surf_parse_in)) \
                        { \
                        if( errno != EINTR) \
                                { \
@@ -5470,7 +5455,7 @@ yy_match:
                                if ( yy_current_state >= 3334 )
                                        yy_c = yy_meta[(unsigned int) yy_c];
                                }
-                       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+                       yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
                        ++yy_cp;
                        }
                while ( yy_base[yy_current_state] != 11902 );
@@ -5488,10 +5473,10 @@ yy_find_action:
 
                if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
                        {
-                       yy_size_t yyl;
+                       int yyl;
                        for ( yyl = 0; yyl < surf_parse_leng; ++yyl )
                                if ( surf_parse_text[yyl] == '\n' )
-                                          
+                                       
     surf_parse_lineno++;
 ;
                        }
@@ -5843,8 +5828,8 @@ YY_RULE_SETUP
   if (!AX_surfxml_ASroute_src) FAIL("Required attribute `src' not set for `ASroute' element.");
   LEAVE; STag_surfxml_ASroute(); surfxml_pcdata_ix = 0; ETag_surfxml_ASroute(); popbuffer(); /* attribute */
   switch (YY_START) {
-   case S_surfxml_AS: case S_surfxml_AS_5: SET(S_surfxml_AS_6); break;
-   case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_4: case S_surfxml_AS_6: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
+   case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_5: SET(S_surfxml_AS_6); break;
+   case S_surfxml_AS_4: case S_surfxml_AS_6: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
   }
  }
        YY_BREAK
@@ -5868,8 +5853,8 @@ YY_RULE_SETUP
   ETag_surfxml_ASroute();
   popbuffer(); /* attribute */
   switch (YY_START) {
-   case S_surfxml_AS: case S_surfxml_AS_5: SET(S_surfxml_AS_6); break;
-   case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_4: case S_surfxml_AS_6: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
+   case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_5: SET(S_surfxml_AS_6); break;
+   case S_surfxml_AS_4: case S_surfxml_AS_6: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
   }
  }
        YY_BREAK
@@ -7796,7 +7781,6 @@ YY_RULE_SETUP
   if (!AX_surfxml_peer_bw___in) FAIL("Required attribute `bw_in' not set for `peer' element.");
   if (!AX_surfxml_peer_bw___out) FAIL("Required attribute `bw_out' not set for `peer' element.");
   if (!AX_surfxml_peer_id) FAIL("Required attribute `id' not set for `peer' element.");
-  if (!AX_surfxml_peer_lat) FAIL("Required attribute `lat' not set for `peer' element.");
   if (!AX_surfxml_peer_speed) FAIL("Required attribute `speed' not set for `peer' element.");
   LEAVE; STag_surfxml_peer();surfxml_pcdata_ix = 0; ENTER(E_surfxml_peer);
  }
@@ -7807,7 +7791,6 @@ YY_RULE_SETUP
   if (!AX_surfxml_peer_bw___in) FAIL("Required attribute `bw_in' not set for `peer' element.");
   if (!AX_surfxml_peer_bw___out) FAIL("Required attribute `bw_out' not set for `peer' element.");
   if (!AX_surfxml_peer_id) FAIL("Required attribute `id' not set for `peer' element.");
-  if (!AX_surfxml_peer_lat) FAIL("Required attribute `lat' not set for `peer' element.");
   if (!AX_surfxml_peer_speed) FAIL("Required attribute `speed' not set for `peer' element.");
   LEAVE; STag_surfxml_peer(); surfxml_pcdata_ix = 0; ETag_surfxml_peer(); popbuffer(); /* attribute */
   switch (YY_START) {
@@ -7878,9 +7861,12 @@ if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</peer>' expected.");
   *      - speed. Default: 'f' or 'flops'. Also defined:
   *         'Yf',         'Zf',         'Ef',       'Pf',        'Tf',        'Gf',        'Mf',        'kf'
   *         'yottaflops', 'zettaflops', 'exaflops', 'petaflops', 'teraflops', 'gigaflops', 'megaflops', 'kiloflops'
-  *      - bandwidth. Default: 'Bps' bytes per second (or 'bps' for bits but 1 Bps = 8 bps)
-  *        Also defined in bytes: 'TiBps', 'GiBps', 'MiBps', 'KiBps', 'TBps', 'GBps', 'MBps', 'kBps', 'Bps'
-  *        And the same in bits:  'Tibps', 'Gibps', 'Mibps', 'Kibps', 'Tbps', 'Gbps', 'Mbps', 'kbps', 'bps'
+  *      - bandwidth. Default: 'Bps' bytes per second
+  *        In bytes and powers of 2  (1 KiBps = 1024 Bps): 'EiBps', 'PiBps', 'TiBps', 'GiBps', 'MiBps', 'KiBps'
+  *        In bits  and powers of 2  (1 Bps = 8 bps)     : 'Eibps', 'Pibps', 'Tibps', 'Gibps', 'Mibps', 'Kibps'
+  *        In bytes and powers of 10 (1 KBps = 1000 Bps) : 'EBps', 'PBps', 'TBps', 'GBps', 'MBps', 'kBps', 'Bps'
+  *        In bits  and powers of 10                     : 'Ebps', 'Pbps', 'Tbps', 'Gbps', 'Mbps', 'kbps', 'bps'
+  *        (Exa and Peta notations were introduced in SimGrid v3.14)
   *      - latency. Default: 's' second. Also defined:
   *        'w' week, 'd' day, 'h' hour, 'm' minute, 'ms' millisecond, 'us' microsecond, 'ns' nanosecond, 'ps' picosecond
   * * New in DTD version 3 (in SimGrid 3.5):
@@ -9450,7 +9436,7 @@ static int yy_get_next_buffer (void)
 
        else
                {
-                       yy_size_t num_to_read =
+                       int num_to_read =
                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 
                while ( num_to_read <= 0 )
@@ -9464,7 +9450,7 @@ static int yy_get_next_buffer (void)
 
                        if ( b->yy_is_our_buffer )
                                {
-                               yy_size_t new_size = b->yy_buf_size * 2;
+                               int new_size = b->yy_buf_size * 2;
 
                                if ( new_size <= 0 )
                                        b->yy_buf_size += b->yy_buf_size / 8;
@@ -9477,7 +9463,7 @@ static int yy_get_next_buffer (void)
                                }
                        else
                                /* Can't grow it, we don't own it. */
-                               b->yy_ch_buf = 0;
+                               b->yy_ch_buf = NULL;
 
                        if ( ! b->yy_ch_buf )
                                YY_FATAL_ERROR(
@@ -9519,7 +9505,7 @@ static int yy_get_next_buffer (void)
        else
                ret_val = EOB_ACT_CONTINUE_SCAN;
 
-       if ((unsigned int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+       if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
                /* Extend the array by 50%, plus the number we really need. */
                int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
                YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) surf_parse_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
@@ -9559,7 +9545,7 @@ static int yy_get_next_buffer (void)
                        if ( yy_current_state >= 3334 )
                                yy_c = yy_meta[(unsigned int) yy_c];
                        }
-               yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+               yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
                }
 
        return yy_current_state;
@@ -9587,7 +9573,7 @@ static int yy_get_next_buffer (void)
                if ( yy_current_state >= 3334 )
                        yy_c = yy_meta[(unsigned int) yy_c];
                }
-       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+       yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
        yy_is_jam = (yy_current_state == 3333);
 
                return yy_is_jam ? 0 : yy_current_state;
@@ -9621,7 +9607,7 @@ static int yy_get_next_buffer (void)
 
                else
                        { /* need more input */
-                       yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
+                       int offset = (yy_c_buf_p) - (yytext_ptr);
                        ++(yy_c_buf_p);
 
                        switch ( yy_get_next_buffer(  ) )
@@ -9645,7 +9631,7 @@ static int yy_get_next_buffer (void)
                                case EOB_ACT_END_OF_FILE:
                                        {
                                        if ( surf_parse_wrap( ) )
-                                               return EOF;
+                                               return 0;
 
                                        if ( ! (yy_did_buffer_switch_on_eof) )
                                                YY_NEW_FILE;
@@ -9668,7 +9654,7 @@ static int yy_get_next_buffer (void)
        (yy_hold_char) = *++(yy_c_buf_p);
 
        if ( c == '\n' )
-                  
+               
     surf_parse_lineno++;
 ;
 
@@ -9898,7 +9884,7 @@ void surf_parse_pop_buffer_state (void)
  */
 static void surf_parse_ensure_buffer_stack (void)
 {
-       yy_size_t num_to_alloc;
+       int num_to_alloc;
     
        if (!(yy_buffer_stack)) {
 
@@ -9906,15 +9892,15 @@ static void surf_parse_ensure_buffer_stack (void)
                 * scanner will even need a stack. We use 2 instead of 1 to avoid an
                 * immediate realloc on the next call.
          */
-               num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
+      num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
                (yy_buffer_stack) = (struct yy_buffer_state**)surf_parse_alloc
                                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
                                                                );
                if ( ! (yy_buffer_stack) )
                        YY_FATAL_ERROR( "out of dynamic memory in surf_parse_ensure_buffer_stack()" );
-                                                                 
+
                memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-                               
+
                (yy_buffer_stack_max) = num_to_alloc;
                (yy_buffer_stack_top) = 0;
                return;
@@ -9943,7 +9929,7 @@ static void surf_parse_ensure_buffer_stack (void)
  * @param base the character buffer
  * @param size the size in bytes of the character buffer
  * 
- * @return the newly allocated buffer state object. 
+ * @return the newly allocated buffer state object.
  */
 YY_BUFFER_STATE surf_parse__scan_buffer  (char * base, yy_size_t  size )
 {
@@ -9953,7 +9939,7 @@ YY_BUFFER_STATE surf_parse__scan_buffer  (char * base, yy_size_t  size )
             base[size-2] != YY_END_OF_BUFFER_CHAR ||
             base[size-1] != YY_END_OF_BUFFER_CHAR )
                /* They forgot to leave room for the EOB's. */
-               return 0;
+               return NULL;
 
        b = (YY_BUFFER_STATE) surf_parse_alloc(sizeof( struct yy_buffer_state )  );
        if ( ! b )
@@ -9962,7 +9948,7 @@ YY_BUFFER_STATE surf_parse__scan_buffer  (char * base, yy_size_t  size )
        b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
        b->yy_buf_pos = b->yy_ch_buf = base;
        b->yy_is_our_buffer = 0;
-       b->yy_input_file = 0;
+       b->yy_input_file = NULL;
        b->yy_n_chars = b->yy_buf_size;
        b->yy_is_interactive = 0;
        b->yy_at_bol = 1;
@@ -9985,7 +9971,7 @@ YY_BUFFER_STATE surf_parse__scan_buffer  (char * base, yy_size_t  size )
 YY_BUFFER_STATE surf_parse__scan_string (yyconst char * yystr )
 {
     
-       return surf_parse__scan_bytes(yystr,strlen(yystr) );
+       return surf_parse__scan_bytes(yystr,(int) strlen(yystr) );
 }
 
 /** Setup the input buffer state to scan the given bytes. The next call to surf_parse_lex() will
@@ -9995,7 +9981,7 @@ YY_BUFFER_STATE surf_parse__scan_string (yyconst char * yystr )
  * 
  * @return the newly allocated buffer state object.
  */
-YY_BUFFER_STATE surf_parse__scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )
+YY_BUFFER_STATE surf_parse__scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
 {
        YY_BUFFER_STATE b;
        char *buf;
@@ -10003,12 +9989,12 @@ YY_BUFFER_STATE surf_parse__scan_bytes  (yyconst char * yybytes, yy_size_t  _yyb
        yy_size_t i;
     
        /* Get memory for full buffer, including space for trailing EOB's. */
-       n = _yybytes_len + 2;
+       n = (yy_size_t) _yybytes_len + 2;
        buf = (char *) surf_parse_alloc(n  );
        if ( ! buf )
                YY_FATAL_ERROR( "out of dynamic memory in surf_parse__scan_bytes()" );
 
-       for ( i = 0; i < _yybytes_len; ++i )
+       for ( i = 0; i < (yy_size_t) _yybytes_len; ++i )
                buf[i] = yybytes[i];
 
        buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
@@ -10032,7 +10018,7 @@ YY_BUFFER_STATE surf_parse__scan_bytes  (yyconst char * yybytes, yy_size_t  _yyb
                yy_size_t new_size;
 
                (yy_start_stack_depth) += YY_START_STACK_INCR;
-               new_size = (yy_start_stack_depth) * sizeof( int );
+               new_size = (yy_size_t) (yy_start_stack_depth) * sizeof( int );
 
                if ( ! (yy_start_stack) )
                        (yy_start_stack) = (int *) surf_parse_alloc(new_size  );
@@ -10061,7 +10047,7 @@ YY_BUFFER_STATE surf_parse__scan_bytes  (yyconst char * yybytes, yy_size_t  _yyb
 #define YY_EXIT_FAILURE 2
 #endif
 
-static void yy_fatal_error (yyconst char* msg )
+static void yynoreturn yy_fatal_error (yyconst char* msg )
 {
                        (void) fprintf( stderr, "%s\n", msg );
        exit( YY_EXIT_FAILURE );
@@ -10091,7 +10077,7 @@ static void yy_fatal_error (yyconst char* msg )
  */
 int surf_parse_get_lineno  (void)
 {
-        
+    
     return surf_parse_lineno;
 }
 
@@ -10114,7 +10100,7 @@ FILE *surf_parse_get_out  (void)
 /** Get the length of the current token.
  * 
  */
-yy_size_t surf_parse_get_leng  (void)
+int surf_parse_get_leng  (void)
 {
         return surf_parse_leng;
 }
@@ -10173,10 +10159,10 @@ static int yy_init_globals (void)
     /* We do not touch surf_parse_lineno unless the option is enabled. */
     surf_parse_lineno =  1;
     
-    (yy_buffer_stack) = 0;
+    (yy_buffer_stack) = NULL;
     (yy_buffer_stack_top) = 0;
     (yy_buffer_stack_max) = 0;
-    (yy_c_buf_p) = (char *) 0;
+    (yy_c_buf_p) = NULL;
     (yy_init) = 0;
     (yy_start) = 0;
 
@@ -10189,8 +10175,8 @@ static int yy_init_globals (void)
     surf_parse_in = stdin;
     surf_parse_out = stdout;
 #else
-    surf_parse_in = (FILE *) 0;
-    surf_parse_out = (FILE *) 0;
+    surf_parse_in = NULL;
+    surf_parse_out = NULL;
 #endif
 
     /* For future reference: Set errno on error, since we are called by
@@ -10252,7 +10238,7 @@ static int yy_flex_strlen (yyconst char * s )
 
 void *surf_parse_alloc (yy_size_t  size )
 {
-                       return (void *) malloc( size );
+                       return malloc(size);
 }
 
 void *surf_parse_realloc  (void * ptr, yy_size_t  size )
@@ -10265,7 +10251,7 @@ void *surf_parse_realloc  (void * ptr, yy_size_t  size )
         * any pointer type to void*, and deal with argument conversions
         * as though doing an assignment.
         */
-       return (void *) realloc( (char *) ptr, size );
+       return realloc(ptr, size);
 }
 
 void surf_parse_free (void * ptr )
@@ -10348,11 +10334,11 @@ static int fail(const char* fmt, ...)
     int chars_left, used;
     va_list ap; va_start(ap, fmt);
 #ifdef FLEXML_yylineno
-    used = sprintf(flexml_err_msg,
+    used = snprintf(flexml_err_msg,flexml_max_err_msg_size,
                   "Invalid XML (XML input line %d, state %d): ",
                   surf_parse_lineno, YY_START);
 #else
-    used = sprintf(flexml_err_msg,
+    used = snprintf(flexml_err_msg,flexml_max_err_msg_size,
                   "Invalid XML (state %d): ",
                   YY_START);
 #endif