Fixes for signedness warnings noticed by VMSperlers.
Jarkko Hietaniemi [Wed, 22 Nov 2000 23:59:15 +0000 (23:59 +0000)]
p4raw-id: //depot/perl@7824

ext/Storable/Storable.xs
regcomp.c
sv.c

index f7c810a..a574c33 100644 (file)
@@ -670,7 +670,7 @@ static char magicstr[] = "pst0";                    /* Used as a magic number */
 #define GETMARK(x) do {                                                        \
        if (!cxt->fio)                                                          \
                MBUF_GETC(x);                                                   \
-       else if ((x = PerlIO_getc(cxt->fio)) == EOF)    \
+       else if ((int)(x = PerlIO_getc(cxt->fio)) == EOF)       \
                return (SV *) 0;                                                \
 } while (0)
 
index 3b474b2..c906790 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -3007,8 +3007,12 @@ tryagain:
        loopdone:
            RExC_parse = p - 1;
            nextchar(pRExC_state);
-           if (len < 0)
-               vFAIL("Internal disaster");
+           {
+               /* len is STRLEN which is unsigned, need to copy to signed */
+               IV iv = len;
+               if (iv < 0)
+                   vFAIL("Internal disaster");
+           }
            if (len > 0)
                *flagp |= HASWIDTH;
            if (len == 1)
diff --git a/sv.c b/sv.c
index 2cc3c43..acb0b82 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -2961,8 +2961,11 @@ void
 Perl_sv_setpvn(pTHX_ register SV *sv, register const char *ptr, register STRLEN len)
 {
     register char *dptr;
-    assert(len >= 0);  /* STRLEN is probably unsigned, so this may
-                         elicit a warning, but it won't hurt. */
+    {
+        /* len is STRLEN which is unsigned, need to copy to signed */
+       IV iv = len;
+       assert(iv >= 0);
+    }
     SV_CHECK_THINKFIRST(sv);
     if (!ptr) {
        (void)SvOK_off(sv);