~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

Viewing changes to src/lib/str-find.c

  • Committer: Package Import Robot
  • Author(s): Jaldhar H. Vyas
  • Date: 2013-09-09 00:57:32 UTC
  • mfrom: (1.13.11)
  • mto: (4.8.5 experimental) (1.16.1)
  • mto: This revision was merged to the branch mainline in revision 97.
  • Revision ID: package-import@ubuntu.com-20130909005732-dn1eell8srqbhh0e
Tags: upstream-2.2.5
ImportĀ upstreamĀ versionĀ 2.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2007-2012 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2007-2013 Dovecot authors, see the included COPYING file */
2
2
 
3
3
/* @UNSAFE: whole file */
4
4
 
37
37
 
38
38
        suffixes[len_1] = ctx->key_len;
39
39
        g = len_1;
40
 
        for (i = ctx->key_len - 2; i >= 0; i--) {
 
40
        for (i = (int)ctx->key_len - 2; i >= 0; i--) {
41
41
                if (i > g && (int)suffixes[i + len_1 - f] < i - g)
42
42
                        suffixes[i] = suffixes[i + len_1 - f];
43
43
                else {
53
53
 
54
54
static void init_goodtab(struct str_find_context *ctx)
55
55
{
56
 
        unsigned int len_1 = ctx->key_len - 1;
57
 
        unsigned int j, *suffixes;
58
 
        int i;
 
56
        unsigned int *suffixes;
 
57
        int j, i, len_1 = ctx->key_len - 1;
59
58
 
60
59
        suffixes = t_buffer_get(sizeof(*suffixes) * ctx->key_len);
61
60
        init_suffixes(ctx, suffixes);
153
152
                                i--;
154
153
                        }
155
154
 
156
 
                        bad_value = ctx->badtab[data[i + j]] + i + 1 - key_len;
 
155
                        bad_value = (int)(ctx->badtab[data[i + j]] + i + 1) -
 
156
                                (int)key_len;
157
157
                        j += I_MAX(ctx->goodtab[i], bad_value);
158
158
                }
159
159
                i_assert(j <= size);