X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=pcrs.c;h=a748a3b956ad5d4f118421a9edf5d91cf2071cb1;hp=1a000253d76ed16a35a6de9d388c6fd20932cd89;hb=c31dff24961d15a9cf13b81ec3d19ad68074107a;hpb=f121f0983e47d77ebac01da9bb308ac5c1ea113b diff --git a/pcrs.c b/pcrs.c index 1a000253..a748a3b9 100644 --- a/pcrs.c +++ b/pcrs.c @@ -1,4 +1,4 @@ -const char pcrs_rcs[] = "$Id: pcrs.c,v 1.12 2001/08/18 11:35:00 oes Exp $"; +const char pcrs_rcs[] = "$Id: pcrs.c,v 1.15 2001/09/20 16:11:06 steudten Exp $"; /********************************************************************* * @@ -33,6 +33,16 @@ const char pcrs_rcs[] = "$Id: pcrs.c,v 1.12 2001/08/18 11:35:00 oes Exp $"; * * Revisions : * $Log: pcrs.c,v $ + * Revision 1.15 2001/09/20 16:11:06 steudten + * + * Add casting for some string functions. + * + * Revision 1.14 2001/09/09 21:41:57 oes + * Fixing yet another silly bug + * + * Revision 1.13 2001/09/06 14:05:59 oes + * Fixed silly bug + * * Revision 1.12 2001/08/18 11:35:00 oes * - Introduced pcrs_strerror() * - made some NULL arguments non-fatal @@ -201,7 +211,7 @@ int pcrs_parse_perl_options(const char *optstring, int *flags) case 's': rc |= PCRE_DOTALL; break; case 'x': rc |= PCRE_EXTENDED; break; case 'U': rc |= PCRE_UNGREEDY; break; - case 'T': *flags |= PCRS_TRIVIAL; break; + case 'T': *flags |= PCRS_TRIVIAL; break; default: break; } } @@ -268,7 +278,7 @@ pcrs_substitute *pcrs_compile_replacement(const char *replacement, int trivialfl *errptr = PCRS_ERR_NOMEM; return NULL; } - memset(r, '\0', length + 1); + memset(text, '\0', length + 1); /* @@ -341,9 +351,9 @@ pcrs_substitute *pcrs_compile_replacement(const char *replacement, int trivialfl r->block_length[l] = k - r->block_offset[l]; /* Numerical backreferences */ - if (isdigit(replacement[i + 1])) + if (isdigit((int) replacement[i + 1])) { - while (i < length && isdigit(replacement[++i])) + while (i < length && isdigit((int) replacement[++i])) { r->backref[l] = r->backref[l] * 10 + replacement[i] - 48; } @@ -747,7 +757,8 @@ int pcrs_execute_list(pcrs_job *joblist, char *subject, size_t subject_length, c int pcrs_execute(pcrs_job *job, char *subject, size_t subject_length, char **result, size_t *result_length) { int offsets[3 * PCRS_MAX_SUBMATCHES], - offset, i, k, + offset, + i, k, matches_found, newsize, submatches, @@ -811,7 +822,7 @@ int pcrs_execute(pcrs_job *job, char *subject, size_t subject_length, char **res /* Storage for matches exhausted? -> Extend! */ if (++i >= max_matches) { - max_matches *= PCRS_MAX_MATCH_GROW; + max_matches = (int) (max_matches * PCRS_MAX_MATCH_GROW); if (NULL == (dummy = (pcrs_match *)realloc(matches, max_matches * sizeof(pcrs_match)))) { free(matches); @@ -826,7 +837,10 @@ int pcrs_execute(pcrs_job *job, char *subject, size_t subject_length, char **res /* Don't loop on empty matches */ if (offsets[1] == offset) - if (offset < subject_length) + /* FIXME: is offset an int or a size_t? Previous line compares + * against int, the next one compares against size_t. + */ + if ((size_t)offset < subject_length) offset++; else break;