Change 18381 by jhi@lyta on 2003/01/01 15:02:04

        Tweaks from Autrijus.

Affected files ...

... //depot/maint-5.8/perl/sv.c#14 edit

Differences ...

==== //depot/maint-5.8/perl/sv.c#14 (text) ====
Index: perl/sv.c
--- perl/sv.c#13~18353~ Wed Dec 25 18:07:06 2002
+++ perl/sv.c   Wed Jan  1 07:02:04 2003
@@ -5309,7 +5309,7 @@
  *
  */
 STATIC bool
-S_utf8_mg_pos_init(SV *sv, MAGIC **mgp, STRLEN **cachep, I32 i, I32 *offsetp, U8 *s, 
U8 *start)
+S_utf8_mg_pos_init(pTHX_ SV *sv, MAGIC **mgp, STRLEN **cachep, I32 i, I32 *offsetp, 
+U8 *s, U8 *start)
 {
     bool found = FALSE; 
 
@@ -5344,7 +5344,7 @@
  *
  */
 STATIC bool
-S_utf8_mg_pos(SV *sv, MAGIC **mgp, STRLEN **cachep, I32 i, I32 *offsetp, I32 uoff, U8 
**sp, U8 *start, U8 *send)
+S_utf8_mg_pos(pTHX_ SV *sv, MAGIC **mgp, STRLEN **cachep, I32 i, I32 *offsetp, I32 
+uoff, U8 **sp, U8 *start, U8 *send)
 {
     bool found = FALSE;
 
@@ -5353,7 +5353,7 @@
             *mgp = mg_find(sv, PERL_MAGIC_utf8);
         if (*mgp && (*mgp)->mg_ptr) {
             *cachep = (STRLEN *) (*mgp)->mg_ptr;
-            if ((*cachep)[i] == uoff)  /* An exact match. */
+            if ((*cachep)[i] == (STRLEN)uoff)  /* An exact match. */
                 found = TRUE;
            else {                      /* We will skip to the right spot. */
                 STRLEN forw  = 0;
@@ -5365,9 +5365,9 @@
                  * 2 * backw in the below comes from).  (The real
                  * figure of course depends on the UTF-8 data.) */
 
-                if ((*cachep)[i] > uoff) {
+                if ((*cachep)[i] > (STRLEN)uoff) {
                      forw  = uoff;
-                     backw = (*cachep)[i] - uoff;
+                     backw = (*cachep)[i] - (STRLEN)uoff;
 
                      if (forw < 2 * backw)
                           p = start;
@@ -5379,9 +5379,9 @@
                 else if (i == 0) { /* (*cachep)[i] < uoff */
                      STRLEN ulen = sv_len_utf8(sv);
 
-                     if (uoff < ulen) {
-                          forw  = uoff - (*cachep)[i];
-                          backw = ulen - uoff;
+                     if ((STRLEN)uoff < ulen) {
+                          forw  = (STRLEN)uoff - (*cachep)[i];
+                          backw = ulen - (STRLEN)uoff;
 
                           if (forw < 2 * backw)
                                p = start + (*cachep)[i+1];
@@ -5407,7 +5407,7 @@
                      }
 
                      /* Update the cache. */
-                     (*cachep)[i]   = uoff;
+                     (*cachep)[i]   = (STRLEN)uoff;
                      (*cachep)[i+1] = p - start;
 
                      found = TRUE;
@@ -5469,21 +5469,21 @@
         MAGIC *mg = 0;
         bool found = FALSE;
 
-         if (S_utf8_mg_pos(sv, &mg, &cache, 0, offsetp, *offsetp, &s, start, send))
+         if (S_utf8_mg_pos(aTHX_ sv, &mg, &cache, 0, offsetp, *offsetp, &s, start, 
+send))
              found = TRUE;
         if (!found && uoffset > 0) {
              while (s < send && uoffset--)
                   s += UTF8SKIP(s);
              if (s >= send)
                   s = send;
-              if (S_utf8_mg_pos_init(sv, &mg, &cache, 0, offsetp, s, start))
+              if (S_utf8_mg_pos_init(aTHX_ sv, &mg, &cache, 0, offsetp, s, start))
                   boffset = cache[1];
              *offsetp = s - start;
         }
         if (lenp) {
              found = FALSE;
              start = s;
-              if (S_utf8_mg_pos(sv, &mg, &cache, 2, lenp, *lenp + *offsetp, &s, 
start, send)) {
+              if (S_utf8_mg_pos(aTHX_ sv, &mg, &cache, 2, lenp, *lenp + *offsetp, &s, 
+start, send)) {
                   *lenp -= boffset;
                   found = TRUE;
               }
@@ -5494,7 +5494,7 @@
                             s += UTF8SKIP(s);
                   if (s >= send)
                        s = send;
-                   if (S_utf8_mg_pos_init(sv, &mg, &cache, 2, lenp, s, start))
+                   if (S_utf8_mg_pos_init(aTHX_ sv, &mg, &cache, 2, lenp, s, start))
                        cache[2] += *offsetp;
              }
              *lenp = s - start;
End of Patch.

Reply via email to