From: oes Date: Fri, 8 Mar 2002 14:18:23 +0000 (+0000) Subject: Fixing -Wconversion warnings X-Git-Tag: v_2_9_12~109 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=7cc6d7ec42703a7fa6501b53447acf9fbef48db9 Fixing -Wconversion warnings --- diff --git a/pcrs.c b/pcrs.c index 8b233221..93c2e26d 100644 --- a/pcrs.c +++ b/pcrs.c @@ -1,4 +1,4 @@ -const char pcrs_rcs[] = "$Id: pcrs.c,v 1.16 2001/11/30 21:32:14 jongfoster Exp $"; +const char pcrs_rcs[] = "$Id: pcrs.c,v 1.17 2002/03/08 13:45:48 oes Exp $"; /********************************************************************* * @@ -33,6 +33,9 @@ const char pcrs_rcs[] = "$Id: pcrs.c,v 1.16 2001/11/30 21:32:14 jongfoster Exp $ * * Revisions : * $Log: pcrs.c,v $ + * Revision 1.17 2002/03/08 13:45:48 oes + * Hiding internal functions + * * Revision 1.16 2001/11/30 21:32:14 jongfoster * Fixing signed/unsigned comparison (Andreas please check this!) * One tab->space @@ -258,7 +261,8 @@ static int pcrs_parse_perl_options(const char *optstring, int *flags) *********************************************************************/ static pcrs_substitute *pcrs_compile_replacement(const char *replacement, int trivialflag, int capturecount, int *errptr) { - int length, i, k, l, quoted; + int i, k, l, quoted; + size_t length; char *text; pcrs_substitute *r; @@ -515,7 +519,8 @@ void pcrs_free_joblist(pcrs_job *joblist) *********************************************************************/ pcrs_job *pcrs_compile_command(const char *command, int *errptr) { - int i, k, l, limit, quoted = FALSE; + int i, k, l, quoted = FALSE; + size_t limit; char delimiter; char *tokens[4]; pcrs_job *newjob; @@ -772,9 +777,9 @@ int pcrs_execute(pcrs_job *job, char *subject, size_t subject_length, char **res offset, i, k, matches_found, - newsize, submatches, max_matches = PCRS_MAX_MATCH_INIT; + size_t newsize; pcrs_match *matches, *dummy; char *result_offset; @@ -801,9 +806,9 @@ int pcrs_execute(pcrs_job *job, char *subject, size_t subject_length, char **res * Find the pattern and calculate the space * requirements for the result */ - newsize=subject_length; + newsize = subject_length; - while ((submatches = pcre_exec(job->pattern, job->hints, subject, subject_length, offset, 0, offsets, 3 * PCRS_MAX_SUBMATCHES)) > 0) + while ((submatches = pcre_exec(job->pattern, job->hints, subject, (int) subject_length, offset, 0, offsets, 3 * PCRS_MAX_SUBMATCHES)) > 0) { job->flags |= PCRS_SUCCESS; matches[i].submatches = submatches; @@ -888,7 +893,7 @@ int pcrs_execute(pcrs_job *job, char *subject, size_t subject_length, char **res for (i=0; i < matches_found; i++) { /* copy the chunk preceding the match */ - memcpy(result_offset, subject + offset, matches[i].submatch_offset[0] - offset); + memcpy(result_offset, subject + offset, (size_t) matches[i].submatch_offset[0] - offset); result_offset += matches[i].submatch_offset[0] - offset; /* For every segment of the substitute.. */ diff --git a/pcrs.h b/pcrs.h index e6ab0e3e..a14b8165 100644 --- a/pcrs.h +++ b/pcrs.h @@ -11,6 +11,9 @@ * * Revisions : * $Log: pcrs.h,v $ + * Revision 1.10 2002/03/08 13:44:48 oes + * Hiding internal functions, preventing double inclusion of pcre.h + * * Revision 1.9 2001/08/18 11:35:29 oes * - Introduced pcrs_strerror() * - added pcrs_execute_list() @@ -56,7 +59,7 @@ * *********************************************************************/ -#define PCRS_H_VERSION "$Id: pcrs.h,v 1.9 2001/08/18 11:35:29 oes Exp $" +#define PCRS_H_VERSION "$Id: pcrs.h,v 1.10 2002/03/08 13:44:48 oes Exp $" #ifndef _PCRE_H @@ -99,12 +102,12 @@ extern "C" { /* A compiled substitute */ typedef struct { - char *text; /* The plaintext part of the substitute, with all backreferences stripped */ - int backrefs; /* The number of backreferences */ - int block_offset[PCRS_MAX_SUBMATCHES]; /* Array with the offsets of all plaintext blocks in text */ - int block_length[PCRS_MAX_SUBMATCHES]; /* Array with the lengths of all plaintext blocks in text */ - int backref[PCRS_MAX_SUBMATCHES]; /* Array with the backref number for all plaintext block borders */ - int backref_count[PCRS_MAX_SUBMATCHES + 2]; /* Array with the number of references to each backref index */ + char *text; /* The plaintext part of the substitute, with all backreferences stripped */ + int backrefs; /* The number of backreferences */ + int block_offset[PCRS_MAX_SUBMATCHES]; /* Array with the offsets of all plaintext blocks in text */ + size_t block_length[PCRS_MAX_SUBMATCHES]; /* Array with the lengths of all plaintext blocks in text */ + int backref[PCRS_MAX_SUBMATCHES]; /* Array with the backref number for all plaintext block borders */ + int backref_count[PCRS_MAX_SUBMATCHES + 2]; /* Array with the number of references to each backref index */ } pcrs_substitute; @@ -116,9 +119,9 @@ typedef struct { */ typedef struct { - int submatches; /* Number of captured subpatterns */ - int submatch_offset[PCRS_MAX_SUBMATCHES + 2]; /* Offset for each submatch in the subject */ - int submatch_length[PCRS_MAX_SUBMATCHES + 2]; /* Length of each submatch in the subject */ + int submatches; /* Number of captured subpatterns */ + int submatch_offset[PCRS_MAX_SUBMATCHES + 2]; /* Offset for each submatch in the subject */ + size_t submatch_length[PCRS_MAX_SUBMATCHES + 2]; /* Length of each submatch in the subject */ } pcrs_match;