} else {
do {
char m4_path[PATH_MAX];
- int length = strlen(path);
+ size_t length = strlen(path);
struct stat sbuf;
const char *endOfDir = strchr(path, ':');
if (!endOfDir)
endOfDir = path+length;
- if ((endOfDir-path+2) >= sizeof(m4_path)) {
+ if (endOfDir + 2 >= path + sizeof(m4_path)) {
path = endOfDir+1;
continue;
}
FILE *tablesout;
struct yytbl_hdr hdr;
char *pname = 0;
- int nbytes = 0;
+ size_t nbytes = 0;
buf_m4_define (&m4defs_buf, "M4_YY_TABLES_EXTERNAL", NULL);
break;
case OPT_PREPROC_LEVEL:
- preproc_level = strtol(arg,NULL,0);
+ preproc_level = (int) strtol(arg,NULL,0);
break;
case OPT_MAIN:
}
else {
buf_strnappend (&userdef_buf, arg,
- def - arg);
+ (int) (def - arg));
buf_strappend (&userdef_buf, " ");
buf_strappend (&userdef_buf,
def + 1);
void *allocate_array (int size, size_t element_size)
{
void *mem;
- size_t num_bytes = element_size * size;
+ size_t num_bytes = element_size * (size_t) size;
mem = malloc(num_bytes);
if (!mem)
return "' '";
else {
- rform[0] = c;
+ rform[0] = (char) c;
rform[1] = '\0';
return rform;
void *reallocate_array (void *array, int size, size_t element_size)
{
void *new_array;
- size_t num_bytes = element_size * size;
+ size_t num_bytes = element_size * (size_t) size;
new_array = realloc(array, num_bytes);
if (!new_array)
memset (preg, 0, sizeof (regex_t));
if ((err = regcomp (preg, regex, cflags)) != 0) {
- const int errbuf_sz = 200;
+ const size_t errbuf_sz = 200;
char *errbuf, *rxerr;
errbuf = malloc(errbuf_sz * sizeof(char));
char *regmatch_dup (regmatch_t * m, const char *src)
{
char *str;
- int len;
+ size_t len;
if (m == NULL || m->rm_so < 0)
return NULL;
- len = m->rm_eo - m->rm_so;
+ len = (size_t) (m->rm_eo - m->rm_so);
str = malloc((len + 1) * sizeof(char));
if (!str)
flexfatal(_("Unable to allocate a copy of the match"));
return dest;
}
- snprintf (dest, regmatch_len(m), "%s", src + m->rm_so);
+ snprintf (dest, (size_t) regmatch_len(m), "%s", src + m->rm_so);
return dest;
}
else
s = regmatch_dup (m, src);
- n = strtol (s, endptr, base);
+ n = (int) strtol (s, endptr, base);
if (s != buf)
free (s);
else
{ /* push back name surrounded by ()'s */
- int len = strlen( nmdefptr );
+ size_t len = strlen( nmdefptr );
if (end_is_ws)
unput(end_ch);
if (*p == '=' || isspace ((unsigned char)*p)
|| !(aux->flags & IS_LONG)) {
if (aux->namelen == 0)
- aux->namelen = p - pname;
+ aux->namelen = (int) (p - pname);
aux->flags |= ARG_REQ;
aux->flags &= ~ARG_NONE;
}
/* detect optional arg. This overrides required arg. */
if (*p == '[') {
if (aux->namelen == 0)
- aux->namelen = p - pname;
+ aux->namelen = (int) (p - pname);
aux->flags &= ~(ARG_REQ | ARG_NONE);
aux->flags |= ARG_OPT;
break;
}
}
if (aux->namelen == 0)
- aux->namelen = p - pname;
+ aux->namelen = (int) (p - pname);
}
return (scanopt_t *) s;
}
while (*p && *p != '=')
++p;
- *optlen = p - *optname;
+ *optlen = (int) (p - *optname);
if (!*p)
/* an option with no '=...' part. */
*arg = p;
while (*p)
++p;
- *arglen = p - *arg;
+ *arglen = (int) (p - *arg);
return 1;
}
if (len > s->aux[i].namelen)
continue;
- if (strncmp (optname, optstart, len) == 0) {
+ if (strncmp (optname, optstart, (size_t) len) == 0) {
nmatch++;
*opt_offset = i;
*/
yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl)
{
- flex_int32_t n;
+ flex_uint32_t n;
/* total number of ints */
n = tbl->td_lolen;
if (tbl->td_id == YYTD_ID_TRANSITION)
n *= 2;
- return n;
+ return (flex_int32_t) n;
}