Update of /cvsroot/radmind/radmind-assistant/rte
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26020
Modified Files:
NSString(RXAdditions).m
Log Message:
Support for displaying human-readable sizes in GB.
Index: NSString(RXAdditions).m
===================================================================
RCS file: /cvsroot/radmind/radmind-assistant/rte/NSString(RXAdditions).m,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** NSString(RXAdditions).m 24 Feb 2006 21:45:47 -0000 1.13
--- NSString(RXAdditions).m 7 Apr 2006 14:32:44 -0000 1.14
***************
*** 163,167 ****
const char *s = [ self UTF8String ];
off_t size, m, n;
! float fraction, mbytes;
if (( size = strtoll( s, NULL, 10 )) == 0 ) {
--- 163,167 ----
const char *s = [ self UTF8String ];
off_t size, m, n;
! float fraction, mbytes, gbytes;
if (( size = strtoll( s, NULL, 10 )) == 0 ) {
***************
*** 184,194 ****
}
! /* otherwise, return in MB */
! m = ( m % 1024 );
! fraction = ( float )( m / 1024.0 );
! mbytes = ( float )n;
! mbytes += fraction;
! return( [ NSString stringWithFormat: @"%.2f MB ", mbytes ] );
}
--- 184,203 ----
}
! /* if size is less than 1GB, return mbytes */
! if (( n / 1024 ) == 0 ) {
! m = ( m % 1024 );
! fraction = ( float )( m / 1024.0 );
! mbytes = ( float )n;
! mbytes += fraction;
! return( [ NSString stringWithFormat: @"%.2f MB ", mbytes ] );
! }
! /* otherwise, return gbytes */
! m = ( n / 1024 );
! n = ( n % 1024 );
! fraction = ( float )( n / 1024.0 );
! gbytes = ( float )m;
! gbytes += fraction;
! return( [ NSString stringWithFormat: @"%.2f GB ", gbytes ] );
}
|