This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
As 2/3rds (or 3/4s) of the SV head structure is rewritten, it doesn't
[perl5.git] / ext / Encode / Encode.xs
index 1c0de8c..77d53af 100644 (file)
@@ -1,5 +1,5 @@
 /*
- $Id: Encode.xs,v 1.54 2003/02/20 14:42:34 dankogai Exp dankogai $
+ $Id: Encode.xs,v 2.0 2004/05/16 20:55:15 dankogai Exp $
  */
 
 #define PERL_NO_GET_CONTEXT
@@ -78,11 +78,15 @@ encode_method(pTHX_ encode_t * enc, encpage_t * dir, SV * src,
 
     if (offset) {
       s += *offset;
-      slen -= *offset;
+      if (slen > *offset){ /* safeguard against slen overflow */
+         slen -= *offset;
+      }else{
+         slen = 0;
+      }
       tlen = slen;
     }
 
-    if (slen <= 0){
+    if (slen == 0){
        SvCUR_set(dst, 0);
        SvPOK_only(dst);
        goto ENCODE_END;
@@ -254,6 +258,16 @@ encode_method(pTHX_ encode_t * enc, encpage_t * dir, SV * src,
 
 MODULE = Encode                PACKAGE = Encode::utf8  PREFIX = Method_
 
+PROTOTYPES: DISABLE
+
+void
+Method_renew(obj)
+SV *   obj
+CODE:
+{
+    XSRETURN(1);
+}
+
 void
 Method_decode_xs(obj,src,check = 0)
 SV *   obj
@@ -385,6 +399,14 @@ MODULE = Encode            PACKAGE = Encode::XS    PREFIX = Method_
 PROTOTYPES: ENABLE
 
 void
+Method_renew(obj)
+SV *   obj
+CODE:
+{
+    XSRETURN(1);
+}
+
+void
 Method_name(obj)
 SV *   obj
 CODE: