Thanks Kurt, I've been working through your patch and correcting the code in dev... If you're willing, I would like to send you my results when I'm done to test again.
I really need to get myself a 64-bit box... Thanks, Tyler Kurt Roeckx <[EMAIL PROTECTED]> wrote: > On Mon, Jul 10, 2006 at 02:30:21PM -0700, Tyler MacDonald wrote: > > Kurt, > > Any chance I can get access to a box to play around with? This (and > > other problems) could pop up all over the place in the code, it'd be nice to > > be able to tackle them all at once instead of just uploading a new version > > to find a new problem... > > I've started changing things and I've attached the patch > from as far as I got. When using printing a size_t, you > need the z modifier in printf(). For u_int64_t's you have > things in <inttypes.h> like PRIu64 that should give you > the right string. > > The only problem I've had was with off_t. It works for me > if I use the z modifier, as used for size_t, but I have a > feeling this isn't very portable, and I haven't tried this > on a 32 bit system. Not that if you have large file > support, an off_t might be 64 bit with a size_t only 32 > bit. I don't know how to portably print those. > > Then I got: > Tracker.xs: In function 'XS_Net__BitTorrent__LibBT__Tracker_Infohash': > Tracker.xs:576: warning: passing argument 3 of 'Perl_sv_2pv_flags' from > incompatible pointer type > Tracker.xs: In function 'XS_Net__BitTorrent__LibBT__Tracker__Infohash_Peer': > Tracker.xs:1047: warning: passing argument 3 of 'Perl_sv_2pv_flags' from > incompatible pointer type > > And I'm not sure how to deal with this, but didn't look > very hard at it. > > If I don't forgot, I'll try looking at it again tomorrow. > > > Kurt > > --- src/libbtutil/util/bt_nice_size.c.old 2006-07-10 23:40:58.000000000 > +0200 > +++ src/libbtutil/util/bt_nice_size.c 2006-07-10 23:44:04.000000000 +0200 > @@ -7,6 +7,7 @@ > #include <stdio.h> > #include <stdlib.h> > #include <sys/types.h> > +#include <inttypes.h> > > #define SZSTR 64 > > @@ -31,7 +32,7 @@ > } > else > { > - snprintf(szstr, SZSTR, "%llub", size); > + snprintf(szstr, SZSTR, "%" PRIu64 "b", size); > } > > rv = apr_pstrdup(p, szstr); > --- src/libbtutil/types/bt_metainfo.c.old 2006-07-10 23:45:09.000000000 > +0200 > +++ src/libbtutil/types/bt_metainfo.c 2006-07-10 23:53:42.000000000 +0200 > @@ -40,7 +40,7 @@ > > if(sinfo.st_size > BT_MAX_METAINFO_SIZE) { > fprintf( > - stderr, "%s: file to large (%llu bytes > %u bytes)", > + stderr, "%s: file to large (%zu bytes > %u bytes)", > path, sinfo.st_size, BT_MAX_METAINFO_SIZE > ); > return NULL; > @@ -60,7 +60,7 @@ > > if((rv = apr_file_read(file, buf, &len)) != APR_SUCCESS) { > fprintf( > - stderr, "Failed to read %llu bytes from %s: %s\n", > + stderr, "Failed to read %zu bytes from %s: %s\n", > sinfo.st_size, path, > apr_strerror(rv, errorstr, BT_SHORT_STRING) > ); > @@ -70,7 +70,7 @@ > if(len != sinfo.st_size) { > fprintf( > stderr, > - "%s: expected %llu bytes, but got %"SF"!\n", path, > sinfo.st_size, len > + "%s: expected %zu bytes, but got %"SF"!\n", path, sinfo.st_size, > len > ); > return NULL; > } > --- src/libbttracker/tracker/btt_tracker_alloc.c.old 2006-07-10 > 23:54:53.000000000 +0200 > +++ src/libbttracker/tracker/btt_tracker_alloc.c 2006-07-10 > 23:55:52.000000000 +0200 > @@ -122,13 +122,13 @@ > rv = NULL; > } else { > if((ret = apr_shm_create(&rv, size, shfile, p)) != APR_SUCCESS) { > - fprintf(stderr, "apr_shm_create(&rv, %d, \"%s\", pool) failed: %s\n", > size, shfile, apr_strerror(ret, btt_error_msg, sizeof(btt_error_msg))); > + fprintf(stderr, "apr_shm_create(&rv, %zd, \"%s\", pool) failed: > %s\n", size, shfile, apr_strerror(ret, btt_error_msg, sizeof(btt_error_msg))); > fflush(stderr); > rv = NULL; > } > } > } else { > - fprintf(stderr, "apr_shm_create(&rv, %d, \"%s\", pool) failed: %s\n", > size, shfile, apr_strerror(ret, btt_error_msg, sizeof(btt_error_msg))); > + fprintf(stderr, "apr_shm_create(&rv, %zd, \"%s\", pool) failed: %s\n", > size, shfile, apr_strerror(ret, btt_error_msg, sizeof(btt_error_msg))); > fflush(stderr); > rv = NULL; > } > @@ -189,7 +189,7 @@ > return NULL; > } > } else { > - fprintf(stderr, "bt_tracker_alloc(): Failed to allocate %d > bytes!\n", sizeof(btt_tracker)); > + fprintf(stderr, "bt_tracker_alloc(): Failed to allocate %zd > bytes!\n", sizeof(btt_tracker)); > fflush(stderr); > return NULL; > } > --- src/libbttracker/types/btt_infohash.c.old 2006-07-10 23:56:48.000000000 > +0200 > +++ src/libbttracker/types/btt_infohash.c 2006-07-11 00:02:16.000000000 > +0200 > @@ -18,6 +18,7 @@ > /* libc */ > #include <time.h> > #include <stdio.h> > +#include <inttypes.h> > /* other libs */ > #include <apr.h> > #include <apr_pools.h> > @@ -79,7 +80,7 @@ > "<TR><TH>Infohash:</TH><TD>%s</TH></TR>\n" > "<TR><TH>Filename:</TH><TD>%s</TD></TR>\n" > "<TR><TH>File Size:</TH><TD>%s</TD></TR>\n" > - "<TR><TH>Announce Hits:</TH><TD>%llu</TD></TR>\n" > + "<TR><TH>Announce Hits:</TH><TD>%" PRIu64 "</TD></TR>\n" > "<TR><TH>Max Uploaded/Downloaded:</TH><TD>%s/%s</TD></TR>\n" > "<TR><TH>Min/Max Left:</TH><TD>%s/%s</TD></TR>\n" > "<TR><TH>Peers/Seeds/Shields:</TH><TD>%u/%u/%u</TD></TR>\n" > @@ -121,7 +122,7 @@ > "Infohash: %s\n" > "Filename: %s\n" > "File Size: %s\n" > - "Announce Hits: %llu\n" > + "Announce Hits: %" PRIu64 "\n" > "Max Uploaded: %s\n" > "Mac Downloaded: %s\n" > "Min/Max Left: %s/%s\n" > @@ -171,7 +172,7 @@ > char* rv = apr_psprintf > ( > p, > - > "20:....................d8:completei%ue10:downloadedi%ue10:incompletei%ue4:name%u:%s4:sizei%lluee", > + > "20:....................d8:completei%ue10:downloadedi%ue10:incompletei%ue4:name%zu:%s4:sizei%" > PRIu64 "ee", > complete, infohash->completes, infohash->peers - infohash->seeds, > strlen(infohash->filename), > infohash->filename, infohash->filesize > ); > --- src/libbttracker/types/btt_peer.c.old 2006-07-11 00:03:22.000000000 > +0200 > +++ src/libbttracker/types/btt_peer.c 2006-07-11 00:04:54.000000000 +0200 > @@ -122,7 +122,7 @@ > fprintf( > stderr, > "bt_peer_req2struct(): got an invalid infohash " > - "of length %i\n", fp.value_len > + "of length %zi\n", fp.value_len > ); > fflush(stderr); > return 0; > @@ -135,7 +135,7 @@ > fprintf( > stderr, > "bt_peer_req2struct(): got an invalid peerid " > - "of length %i\n", fp.value_len > + "of length %zi\n", fp.value_len > ); > fflush(stderr); > return 0; > @@ -175,7 +175,7 @@ > fprintf( > stderr, > "bt_peer_req2struct(): Got an invalid event " > - "of length %i\n", fp.value_len > + "of length %zi\n", fp.value_len > ); > fflush(stderr); > return 0; > @@ -256,7 +256,7 @@ > int len = 0; > > rv = apr_psprintf( > - p, "d2:ip%u:%s4:porti%uee", strlen(ip), ip, > + p, "d2:ip%zu:%s4:porti%uee", strlen(ip), ip, > ntohs(peer->address.sin_port) > ); > len = strlen(rv); > @@ -268,11 +268,11 @@ > int btt_peer2bencode(apr_pool_t* p, btt_peer* peer, char **result) { > char *rv = NULL; > char *ip = apr_pstrdup(p, inet_ntoa(peer->address.sin_addr)); > - int iplen = strlen(apr_psprintf(p, "%u%s", strlen(ip), ip)); > + int iplen = strlen(apr_psprintf(p, "%zu%s", strlen(ip), ip)); > int len = 0; > > rv = apr_psprintf( > - p, "d2:ip%u:%s7:peer id20:xxxxxxxxxxxxxxxxxxxx4:porti%uee", > + p, "d2:ip%zu:%s7:peer id20:xxxxxxxxxxxxxxxxxxxx4:porti%uee", > strlen(ip), ip, ntohs(peer->address.sin_port) > ); > > --- src/libbttracker/types/btt_tracker.c.old 2006-07-11 00:05:53.000000000 > +0200 > +++ src/libbttracker/types/btt_tracker.c 2006-07-11 00:08:38.000000000 > +0200 > @@ -15,6 +15,7 @@ > * limitations under the License. > */ > > +#include <inttypes.h> > /* other libs */ > #include <apr.h> > #include <apr_pools.h> > @@ -136,8 +137,8 @@ > " <TR><TH>Startup Time:</TH><TD>%s</TD></TR>\n" > " <TR><TH>Hashes:</TH><TD>%u</TD></TR>\n" > " <TR><TH>Peers:</TH><TD>%u</TD></TR>\n" > - " <TR><TH>Announces:</TH><TD>%llu (%.02f/s)</TD></TR>\n" > - " <TR><TH>Faulty Announces:</TH><TD>%llu</TD></TR>\n" > + " <TR><TH>Announces:</TH><TD>%" PRIu64 " (%.02f/s)</TD></TR>\n" > + " <TR><TH>Faulty Announces:</TH><TD>%" PRIu64 "</TD></TR>\n" > " <TR><TH>Peers Returned:</TH><TD>0 < %u < %u</TD></TR>\n" > " <TR><TH>Return Interval:</TH><TD>%s</TD></TR>\n" > " <TR><TH>Hash Expiry:</TH><TD>%lus - %lus (Watermark %u)</TD></TR>\n" > @@ -206,8 +207,8 @@ > " <NumRequests>%u</NumRequests>\n" > " <NumHashes>%u</NumHashes>\n" > " <NumPeers>%u</NumPeers>\n" > - " <Announces>%llu</Announces>\n" > - " <BadAnnounces>%llu</BadAnnounces>\n" > + " <Announces>%" PRIu64 "</Announces>\n" > + " <BadAnnounces>%" PRIu64 "</BadAnnounces>\n" > " <StartT>%lu</StartT>\n" > " <MasterPID>%u</MasterPID>\n" > " <ServerTime>%lu</ServerTime>\n" > @@ -215,7 +216,7 @@ > " <DB>\n" > " <Open>%u</Open>\n" > " <Dir>%s</Dir>\n" > - " <Cache>%u</Cache>\n" > + " <Cache>%zu</Cache>\n" > " </DB>\n" > "</Tracker>\n", > tracker->c->random_retry, -- Tank will proactively strategize distributed CEOs. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]