From: Shaun J. <sja...@ho...> - 2001-07-13 08:39:26
|
From the looks of the code it assumes off_t is 64 bit. On my Linux system it's a mere 32 bit which creates problems with get_disk_usage (6GB hard disk space > max 32 bit 4GB). I've attached a patch that changes any off_t referring to the NJB *only* (eg not a local file, which I left as off_t) to u_int64_t. Shaun Index: libnjb.h =================================================================== RCS file: /var/cvs/libnjb/src/libnjb.h,v retrieving revision 1.1.1.3 diff -c -u -r1.1.1.3 libnjb.h --- libnjb.h 11 Jul 2001 07:27:00 -0000 1.1.1.3 +++ libnjb.h 13 Jul 2001 08:32:00 -0000 @@ -200,7 +200,7 @@ songid_t *NJB_Get_Track_Tag (njb_t *njb); void NJB_Reset_Get_Playlist (njb_t *njb); playlist_t *NJB_Get_Playlist (njb_t *njb); -int NJB_Get_Disk_Usage (njb_t *njb, off_t *btotal, off_t *bfree); +int NJB_Get_Disk_Usage (njb_t *njb, u_int64_t *btotal, u_int64_t *bfree); char *NJB_Get_Owner_String (njb_t *njb); int NJB_Set_Owner_String (njb_t *njb, char *name); void NJB_Reset_Get_Datafile_Tag (njb_t *njb); Index: procedure.c =================================================================== RCS file: /var/cvs/libnjb/src/procedure.c,v retrieving revision 1.1.1.2 diff -c -u -r1.1.1.2 procedure.c --- procedure.c 7 Jul 2001 20:44:39 -0000 1.1.1.2 +++ procedure.c 13 Jul 2001 08:36:06 -0000 @@ -212,7 +212,7 @@ return njb_get_playlist(njb, &plh); } -int NJB_Get_Disk_Usage (njb_t *njb, off_t *btotal, off_t *bfree) +int NJB_Get_Disk_Usage (njb_t *njb, u_int64_t *btotal, u_int64_t *bfree) { __dsub= "NJB_Get_Disk_Usage"; @@ -485,7 +485,8 @@ XferCallback *callback, u_int32_t *trackid) { __dsub= "NJB_Send_Track"; - off_t btotal, bfree, size; + u_int64_t btotal, bfree; + off_t size; songid_t song; songid_frame_t *frame; unsigned char *ptag; @@ -590,7 +591,8 @@ XferCallback *callback, u_int32_t *fileid) { __dsub= "NJB_Send_File"; - off_t btotal, bfree, size; + u_int64_t btotal, bfree; + off_t size; datafile_t df; int status; Index: protocol.c =================================================================== RCS file: /var/cvs/libnjb/src/protocol.c,v retrieving revision 1.1.1.3 diff -c -u -r1.1.1.3 protocol.c --- protocol.c 11 Jul 2001 07:27:00 -0000 1.1.1.3 +++ protocol.c 13 Jul 2001 08:37:31 -0000 @@ -296,7 +296,7 @@ return pl; } -int njb_get_disk_usage (njb_t *njb, off_t *total, off_t *free) +int njb_get_disk_usage (njb_t *njb, u_int64_t *total, u_int64_t *free) { __dsub= "njb_get_disk_usage"; unsigned char data[17]; @@ -318,13 +318,13 @@ memcpy(&lsdw, &data[5], 4); msdw= utoh32(msdw); lsdw= utoh32(lsdw); - *total= (off_t) make64(msdw, lsdw); + *total= make64(msdw, lsdw); memcpy(&msdw, &data[9], 4); memcpy(&lsdw, &data[13], 4); msdw= utoh32(msdw); lsdw= utoh32(lsdw); - *free= (off_t) make64(msdw, lsdw); + *free= make64(msdw, lsdw); return 0; } Index: protocol.h =================================================================== RCS file: /var/cvs/libnjb/src/protocol.h,v retrieving revision 1.1.1.2 diff -c -u -r1.1.1.2 protocol.h --- protocol.h 7 Jul 2001 20:44:39 -0000 1.1.1.2 +++ protocol.h 13 Jul 2001 08:33:16 -0000 @@ -73,7 +73,7 @@ int njb_verify_last_command (njb_t *njb); int njb_capture (njb_t *njb, int which); int njb_reset_get_songlist (njb_t *njb); -int njb_get_disk_usage (njb_t *njb, off_t *total, off_t *free); +int njb_get_disk_usage (njb_t *njb, u_int64_t *total, u_int64_t *free); int njb_get_owner_string (njb_t *njb, owner_string name); int njb_set_owner_string (njb_t *njb, owner_string name); int njb_request_file (njb_t *njb, u_int32_t fileid); |