svn commit: r225436 - in user/gabor/grep/trunk: . regex
Gabor Kovesdan
gabor at FreeBSD.org
Wed Sep 7 13:26:20 UTC 2011
Author: gabor
Date: Wed Sep 7 13:26:20 2011
New Revision: 225436
URL: http://svn.freebsd.org/changeset/base/225436
Log:
- Fix some warnings
Modified:
user/gabor/grep/trunk/grep.c
user/gabor/grep/trunk/regex/fastmatch.c
Modified: user/gabor/grep/trunk/grep.c
==============================================================================
--- user/gabor/grep/trunk/grep.c Wed Sep 7 13:01:26 2011 (r225435)
+++ user/gabor/grep/trunk/grep.c Wed Sep 7 13:26:20 2011 (r225436)
@@ -234,7 +234,7 @@ add_pattern(char *pat, size_t len)
/* Check if we can do a shortcut */
if (len == 0) {
matchall = true;
- for (int i = 0; i < patterns; i++) {
+ for (unsigned int i = 0; i < patterns; i++) {
free(pattern[i].pat);
}
pattern = grep_realloc(pattern, sizeof(struct pat));
Modified: user/gabor/grep/trunk/regex/fastmatch.c
==============================================================================
--- user/gabor/grep/trunk/regex/fastmatch.c Wed Sep 7 13:01:26 2011 (r225435)
+++ user/gabor/grep/trunk/regex/fastmatch.c Wed Sep 7 13:26:20 2011 (r225436)
@@ -183,7 +183,9 @@ tre_fastfree(fastmatch_t *preg)
size_t offset = pmatch[0].rm_so; \
int ret; \
\
- if ((len != (unsigned)-1) && (pmatch[0].rm_eo > len)) \
+ if ((pmatch[0].rm_so < 0) || (pmatch[0].rm_eo < 0)) \
+ return REG_NOMATCH; \
+ if ((len != (unsigned)-1) && ((unsigned long)pmatch[0].rm_eo > len))\
return REG_NOMATCH; \
if ((long long)pmatch[0].rm_eo - pmatch[0].rm_so < 0) \
return REG_NOMATCH; \
More information about the svn-src-user
mailing list