Excellent, many thanks! Tim. On Mon, Sep 10, 2001 at 01:12:46PM +0100, Robin Barker wrote: > Tim > > The attached patch corrects various pointer cast, printf format and > "computed value not used" warning from DBI; which I found following > up the following messages. > > I was using perl-5.7.2@11938, configured with -Duse64bitint. > My solution to the setlinebuf warning was to delete all the PerlIO > definitions, perhaps not the best solution. > > Robin > > > From [EMAIL PROTECTED] Sat Sep 8 09:50:45 >2001 > > Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm > > Precedence: bulk > > list-help: <mailto:[EMAIL PROTECTED]> > > list-unsubscribe: <mailto:[EMAIL PROTECTED]> > > list-post: <mailto:[EMAIL PROTECTED]> > > Delivered-To: mailing list [EMAIL PROTECTED] > > From: "Richard Soderberg" <[EMAIL PROTECTED]> > > To: "Michael G Schwern" <[EMAIL PROTECTED]> > > Cc: <[EMAIL PROTECTED]> > > Subject: RE: [BUG] DBI 1.20, bleadperl and 64 bit ints not mixing too well > > Date: Sat, 8 Sep 2001 04:50:34 -0400 > > MIME-Version: 1.0 > > Content-Transfer-Encoding: 7bit > > Importance: Normal > > X-Spam-Rating: onion.valueclick.com 1.6.2 0/1000/N > > > > From: Michael G Schwern [mailto:[EMAIL PROTECTED]] > > > On Fri, Sep 07, 2001 at 04:27:10PM -0400, Michael G Schwern wrote: > > > > DBI 1.20 & bleadperl seems to have some trouble with 64bit integers, > > > > at least on Linux. > > > > > > DBI 1.19 is having similar problems, but passing all tests. I've > > > attached the differences between the generated DBI.c file in 1.19 and > > > 1.20 for bleadperl w/64 bit ints. > > > > > DBI.xs: In function `dbi_bootinit': > > > DBI.xs:221: warning: cast from pointer to integer of different size > > > DBI.xs:223: warning: cast to pointer from integer of different size > > > > Aren't these the same kind of warnings that PM_GETRE is spitting out > > when you compile with 64bit ints? I remember Arthur mentioning > > something about this to me a couple days ago, and saying it was > > harmless. > > > > R. > > > --- DBIXS.h.orig Fri Aug 24 23:11:03 2001 > +++ DBIXS.h > @@ -266,7 +266,7 @@ > if (!DBIc_ACTIVE(imp) && ph_com && !dirty \ > && ++DBIc_ACTIVE_KIDS(ph_com) > DBIc_KIDS(ph_com)) \ > croak("panic: DBI active kids (%d) > kids (%d)", \ > - DBIc_ACTIVE_KIDS(ph_com), DBIc_KIDS(ph_com)); \ > + (int)DBIc_ACTIVE_KIDS(ph_com), (int)DBIc_KIDS(ph_com)); \ > DBIc_FLAGS(imp) |= DBIcf_ACTIVE; \ > } while(0) > #define DBIc_ACTIVE_off(imp) /* adjust parent's active kid count */ \ > @@ -276,7 +276,7 @@ > && (--DBIc_ACTIVE_KIDS(ph_com) > DBIc_KIDS(ph_com) \ > || DBIc_ACTIVE_KIDS(ph_com) < 0) ) \ > croak("panic: DBI active kids (%d) < 0 or > kids (%d)", \ > - DBIc_ACTIVE_KIDS(ph_com), DBIc_KIDS(ph_com)); \ > + (int)DBIc_ACTIVE_KIDS(ph_com), (int)DBIc_KIDS(ph_com)); \ > DBIc_FLAGS(imp) &= ~DBIcf_ACTIVE; \ > } while(0) > > @@ -406,7 +406,7 @@ > # define DBISTATE_ASSIGN(st) > # define DBISTATE_INIT > static dbistate_t **get_dbistate() { > - return ((dbistate_t**)&SvIVX(DBISTATE_ADDRSV)); > + return (INT2PTR(dbistate_t**,&SvIVX(DBISTATE_ADDRSV))); > } > # undef DBIS > # define DBIS (*get_dbistate()) > @@ -416,7 +416,7 @@ > > # define DBISTATE_DECLARE static dbistate_t *DBIS > # define DBISTATE_ASSIGN(st) (DBIS = (st)) > -# define DBISTATE_INIT_DBIS DBISTATE_ASSIGN((dbistate_t*)SvIV(DBISTATE_ADDRSV)) > +# define DBISTATE_INIT_DBIS >DBISTATE_ASSIGN(INT2PTR(dbistate_t*,SvIV(DBISTATE_ADDRSV))) > # define DBISTATE_INIT { /* typically use in BOOT: of XS file */ \ > DBISTATE_INIT_DBIS; \ > if (DBIS == NULL) \ > --- DBI.xs.orig Fri Aug 24 23:10:48 2001 > +++ DBI.xs > @@ -24,18 +24,6 @@ > /* not a problem since we created the pointers anyway. */ > #define DBIh_FROM_MG(mg) ((imp_xxh_t*)(void*)SvPVX((mg)->mg_obj)) > > -/* If the tests fail with errors about 'setlinebuf' then try */ > -/* deleting the lines in the block below except the setvbuf one */ > -#ifndef PerlIO_setlinebuf > -#ifdef HAS_SETLINEBUF > -#define PerlIO_setlinebuf(f) setlinebuf(f) > -#else > -#ifndef USE_PERLIO > -#define PerlIO_setlinebuf(f) setvbuf(f, Nullch, _IOLBF, 0) > -#endif > -#endif > -#endif > - > #ifndef PerlIO > # define PerlIO FILE > # define PerlIO_printf fprintf > @@ -219,7 +207,7 @@ > sv_setiv(DBIS->neatsvpvlen, 400); > > /* publish address of dbistate so dynaloaded DBD's can find it */ > - sv_setiv(get_sv(DBISTATE_PERLNAME,1), (IV)DBIS); > + sv_setiv(get_sv(DBISTATE_PERLNAME,1), PTR2IV(DBIS)); > > DBISTATE_INIT; /* check DBD code to set DBIS from DBISTATE_PERLNAME */ > > @@ -817,8 +805,8 @@ > char *pad = " "; > if (!msg) > msg = "dbih_dumpcom"; > - PerlIO_printf(DBILOGFP," %s (h 0x%lx, com 0x%lx):\n", > - msg, (IV)DBIc_MY_H(imp_xxh), (IV)imp_xxh); > + PerlIO_printf(DBILOGFP," %s (h 0x%"UVxf", com 0x%"UVxf"):\n", > + msg, PTR2UV(DBIc_MY_H(imp_xxh)), PTR2UV(imp_xxh)); > if (DBIc_COMSET(imp_xxh)) sv_catpv(flags,"COMSET "); > if (DBIc_IMPSET(imp_xxh)) sv_catpv(flags,"IMPSET "); > if (DBIc_ACTIVE(imp_xxh)) sv_catpv(flags,"Active "); > @@ -898,7 +886,7 @@ > if (DBIc_TYPE(imp_xxh) <= DBIt_DB) { > imp_dbh_t *imp_dbh = (imp_dbh_t*)imp_xxh; /* works for DRH also */ > if (DBIc_CACHED_KIDS(imp_dbh)) { > - warn("DBI handle cleared whilst still holding %d cached kids", > + warn("DBI handle cleared whilst still holding %"IVdf" cached kids", > HvKEYS(DBIc_CACHED_KIDS(imp_dbh)) ); > SvREFCNT_dec(DBIc_CACHED_KIDS(imp_dbh)); /* may recurse */ > DBIc_CACHED_KIDS(imp_dbh) = Nullhv; > @@ -963,8 +951,8 @@ > DBIc_COMSET_off(imp_xxh); > > if (DBIS->debug >= 4) > - PerlIO_printf(DBILOGFP," dbih_clearcom 0x%lx (com 0x%lx, type %d) >done.\n\n", > - (IV)DBIc_MY_H(imp_xxh), (IV)imp_xxh, DBIc_TYPE(imp_xxh)); > + PerlIO_printf(DBILOGFP," dbih_clearcom 0x%"UVxf" (com 0x%"UVxf", type %d) >done.\n\n", > + PTR2UV(DBIc_MY_H(imp_xxh)), PTR2UV(imp_xxh), DBIc_TYPE(imp_xxh)); > } > > > @@ -1965,7 +1953,7 @@ > else { > PerlIO_printf(logfp, " %s", neatsvpv(s,0)); > if ( SvROK(s) && SvTYPE(SvRV(s))==SVt_PVHV && !SvOBJECT(SvRV(s)) ) > - PerlIO_printf(logfp, "%ldkeys", HvKEYS(SvRV(s))); > + PerlIO_printf(logfp, "%"IVdf"keys", HvKEYS(SvRV(s))); > } > } > if (gimme & G_ARRAY) { > @@ -2244,7 +2232,7 @@ > warn("\tPlaceholder :%d out of sequence, must be in sequential >order (:a1, :a2 ..)\n", idx); > return(0); > } > - while(isDIGIT(*src)) *src++; > + while(isDIGIT(*src)) src++; > idx++; > break; > case 4: /* ':1' -> '%s' */ > @@ -2254,7 +2242,7 @@ > warn("\tPlaceholder :%d out of sequence, must be in sequential >order (:a1, :a2 ..)\n", idx); > return(0); > } > - while(isDIGIT(*src)) *src++; > + while(isDIGIT(*src)) src++; > idx++; > break; > } > @@ -2271,12 +2259,12 @@ > case 2: > *start = '?'; > *dst = *start; > - while (isALNUM(*src)) *src++; /* includes '_' */ > + while (isALNUM(*src)) src++; /* includes '_' */ > break; > case 4: /* ':foo' -> '%s' */ > sprintf(start,"%%s"); > dst = start+strlen(start); > - while (isALNUM(*src)) *src++; /* includes '_' */ > + while (isALNUM(*src)) src++; /* includes '_' */ > break; > } > } > @@ -2678,7 +2666,7 @@ > /* default to method call via stash of implementor of DBI_LAST_HANDLE */ > imp_stash = DBIc_IMP_STASH(imp_xxh); > if (DBIS->debug >= 2) > - fprintf(DBILOGFP," >> %s::%s\n", HvNAME(imp_stash), meth); > + PerlIO_printf(DBILOGFP," >> %s::%s\n", HvNAME(imp_stash), meth); > ST(0) = DBI_LAST_HANDLE; > if ((imp_gv = gv_fetchmethod(imp_stash,meth)) == NULL) { > croak("Can't locate $DBI::%s object method \"%s\" via package \"%s\"", > @@ -2713,7 +2701,7 @@ > croak("_set_fbav(%s): not an array ref", neatsvpv(src_rv,0)); > src_av = (AV*)SvRV(src_rv); > if (AvFILL(src_av)+1 != num_fields) > - croak("_set_fbav(%s): array has %d fields, should have %d%s", > + croak("_set_fbav(%s): array has %ld fields, should have %d", > neatsvpv(src_rv,0), AvFILL(src_av)+1, num_fields); > for(i=0; i < num_fields; ++i) { /* copy over the row */ > sv_setsv(AvARRAY(dst_av)[i], AvARRAY(src_av)[i]); > @@ -2888,7 +2876,7 @@ > D_imp_sth(sth); > AV *av = dbih_get_fbav(imp_sth); > if (num_fields != AvFILL(av)+1) > - croak("fetchrow returned %d fields, expected %d", > + croak("fetchrow returned %d fields, expected %ld", > num_fields, AvFILL(av)+1); > SPAGAIN; > while(--num_fields >= 0) > End of patch > > -- > Robin Barker | Email: [EMAIL PROTECTED] > CMSC, Building 10, | Phone: +44 (0) 20 8943 7090 > National Physical Laboratory, | Fax: +44 (0) 20 8977 7091 > Teddington, Middlesex, UK. TW11 OLW | WWW: http://www.npl.co.uk
