Silence VC warnings about possible operator precedence problems
Steve Hay [Tue, 12 Dec 2006 17:49:51 +0000 (17:49 +0000)]
and signed/unsigned mismatches

p4raw-id: //depot/perl@29532

regexec.c
sv.h
util.c

index 746d915..9ded511 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -514,7 +514,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos,
 
        if (PL_screamfirst[BmRARE(check)] >= 0
            || ( BmRARE(check) == '\n'
-                && (BmPREVIOUS(check) == SvCUR(check) - 1)
+                && (BmPREVIOUS(check) == (U8)SvCUR(check) - 1)
                 && SvTAIL(check) ))
            s = screaminstr(sv, check,
                            srch_start_shift + (s - strbeg), srch_end_shift, pp, 0);
diff --git a/sv.h b/sv.h
index 8849a3e..5417759 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -1353,10 +1353,10 @@ the scalar's value cannot change unless written to.
 
 #  define BmUSEFUL(sv) ((XPVBM*)  SvANY(sv))->xiv_u.xivu_i32
 #  define BmPREVIOUS(sv)                                               \
-    (*(U8*)(SvEND(sv) + PERL_FBM_TABLE_OFFSET                          \
+    ((*(U8*)(SvEND(sv) + PERL_FBM_TABLE_OFFSET                         \
           + PERL_FBM_PREVIOUS_H_OFFSET_FROM_TABLE) << 8)               \
-    | (*(U8*)(SvEND(sv) + PERL_FBM_TABLE_OFFSET                                \
-            + PERL_FBM_PREVIOUS_L_OFFSET_FROM_TABLE))                  \
+       | (*(U8*)(SvEND(sv) + PERL_FBM_TABLE_OFFSET                     \
+          + PERL_FBM_PREVIOUS_L_OFFSET_FROM_TABLE)))                   \
 
 #endif
 #define BmPREVIOUS_set(sv, val)                                                \
diff --git a/util.c b/util.c
index 9718c54..3cd98c0 100644 (file)
--- a/util.c
+++ b/util.c
@@ -767,7 +767,7 @@ Perl_screaminstr(pTHX_ SV *bigstr, SV *littlestr, I32 start_shift, I32 end_shift
        : (((pos = *old_posp), pos += PL_screamnext[pos]) == 0)) {
       cant_find:
        if ( BmRARE(littlestr) == '\n'
-            && BmPREVIOUS(littlestr) == SvCUR(littlestr) - 1) {
+            && BmPREVIOUS(littlestr) == (U8)SvCUR(littlestr) - 1) {
            little = (const unsigned char *)(SvPVX_const(littlestr));
            littleend = little + SvCUR(littlestr);
            first = *little++;