Author: timbo
Date: Thu Jan 31 12:38:55 2008
New Revision: 10677

Modified:
   dbi/trunk/Changes
   dbi/trunk/DBI.xs

Log:
Fixed take_imp_data for some platforms thanks to Jeffrey Klein.
Fixed DBD::DBM bug in push_names thanks to J M Davitt.


Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes   (original)
+++ dbi/trunk/Changes   Thu Jan 31 12:38:55 2008
@@ -46,6 +46,8 @@
     into perl from XS code. Thanks to John Gardiner Myers.
   Fixed DBI::Util::CacheMemory->new to not clear the cache.
   Fixed avg in DBI::Profile as_text() thanks to Abe Ingersoll.
+  Fixed DBD::DBM bug in push_names thanks to J M Davitt.
+  Fixed take_imp_data for some platforms thanks to Jeffrey Klein.
   Expanded DBI::DBD docs for driver authors thanks to Martin Evans.
   Enhanced t/80proxy.t test script.
   Enhanced t/85gofer.t test script thanks to Stig.

Modified: dbi/trunk/DBI.xs
==============================================================================
--- dbi/trunk/DBI.xs    (original)
+++ dbi/trunk/DBI.xs    Thu Jan 31 12:38:55 2008
@@ -982,9 +982,12 @@
        DBIc_FLAGS(imp) = imp_templ_flags & (DBIcf_IMPSET|DBIcf_ACTIVE);
     }
     else {
-       dbih_imp_sv = newSV(imp_size); /* is grown to imp_size+1 */
+       dbih_imp_sv = newSV(imp_size); /* is grown to at least imp_size+1 */
        imp = (imp_xxh_t*)(void*)SvPVX(dbih_imp_sv);
        memzero((char*)imp, imp_size);
+        /* set up SV with SvCUR set ready for take_imp_data */
+        SvCUR_set(dbih_imp_sv, imp_size);
+        *SvEND(dbih_imp_sv) = '\0';
     }
 
     DBIc_DBISTATE(imp)  = DBIS;
@@ -4415,9 +4418,7 @@
     /* (don't use magical DBIc_ACTIVE_on here)                         */
     DBIc_FLAGS(imp_xxh) |=  DBIcf_IMPSET | DBIcf_ACTIVE;
     /* --- tidy up the raw PV for life as a more normal string */
-    SvPOK_on(imp_xxh_sv);
-    SvCUR_set(imp_xxh_sv, SvLEN(imp_xxh_sv)-1); /* SvLEN(imp_xxh_sv)-1 == 
imp_size */
-    *SvEND(imp_xxh_sv) = '\0';
+    SvPOK_on(imp_xxh_sv);       /* SvCUR & SvEND were set at creation   */
     /* --- return the actual imp_xxh_sv on the stack */
     ST(0) = imp_xxh_sv;
 

Reply via email to