Skip to content
  • Rob Swindell's avatar
    Support user credits and transfer stats > 4GB in total · 1cac2c8a
    Rob Swindell authored
    Credits and daily free credits are accurate to the byte up to (a maximum) of 18446744073709551615 (that's 18 Exbibytes - 1).
    
    User's upload and download byte stats are now similarly extended in maximum range, but the accuracy is only "to the byte" for values less than 10,000,000,000. Beyond that value, the accuracy declines, but is generally pretty damn accurate (to 4 decimal places beyond the nearest multiple of a power of 1024), so I don't expect that to be an issue. This method of storing upload/download byte stats allowed me to use the same 10-character user record fields in the user.dat file.
    
    As a side-effect of this enhancements:
    * User and file credit values are now expressed in multiples of powers of 1024 (e.g. 4.0G rather than 4,294,967,296).
    * Free credits per day per security level has now been extended from 32 to 64-bits (to accommodate values >= 4GB).
    * adjustuserrec() now longer takes the record length since we can easily determine that automatically and don't need more "sources of truth" that can be out-of-sync (e.g. the U_CDT field length going from 10 to 20 chars with this change).
    * setting the stage for locale-dependent thousands-separators (e.g. space instead of comma) - currently still hard-coded to comma
    * more/better support for files > 4GB in size (e.g. in the batch download queue)
    * user_t ulong fields changed to either uint32_t or uint64_t - I didn't realize how many long/ulong's remained in the code (which are sometmies 32-bit, sometimes 64-bit) - ugh
    * Steve's ultoac() function renamed to u32toac() and created a C++ wrapper that still uses the old name, for homage
    1cac2c8a