diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2011-12-26 23:39:43 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2011-12-26 23:39:43 +0000 |
commit | 565b869438b16eb074a054e770e71c684dbfb2d2 (patch) | |
tree | 1334dd8cb5251009cb57767c21c63ecdd8247073 | |
parent | 0b885f26282637bd9a7289aaae690e8931106c22 (diff) | |
download | rockbox-565b869438b16eb074a054e770e71c684dbfb2d2.tar.gz rockbox-565b869438b16eb074a054e770e71c684dbfb2d2.zip |
file properties: display correctly file/folder sizes > 2GB
Use unsigned type for file sizes (some directory/file structures should be changed too)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31449 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/plugins/properties.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c index c38c6d5ec5..de80e2ad70 100644 --- a/apps/plugins/properties.c +++ b/apps/plugins/properties.c | |||
@@ -40,7 +40,7 @@ char str_duration[32]; | |||
40 | int num_properties; | 40 | int num_properties; |
41 | 41 | ||
42 | static const char human_size_prefix[4] = { '\0', 'K', 'M', 'G' }; | 42 | static const char human_size_prefix[4] = { '\0', 'K', 'M', 'G' }; |
43 | static unsigned human_size_log(long long size) | 43 | static unsigned human_size_log(unsigned long long size) |
44 | { | 44 | { |
45 | const size_t n = sizeof(human_size_prefix)/sizeof(human_size_prefix[0]); | 45 | const size_t n = sizeof(human_size_prefix)/sizeof(human_size_prefix[0]); |
46 | 46 | ||
@@ -76,9 +76,9 @@ static bool file_properties(char* selected_file) | |||
76 | rb->snprintf(str_dirname, sizeof str_dirname, "Path: %s", tstr); | 76 | rb->snprintf(str_dirname, sizeof str_dirname, "Path: %s", tstr); |
77 | rb->snprintf(str_filename, sizeof str_filename, "Name: %s", | 77 | rb->snprintf(str_filename, sizeof str_filename, "Name: %s", |
78 | selected_file+dirlen); | 78 | selected_file+dirlen); |
79 | log = human_size_log(info.size); | 79 | log = human_size_log((unsigned long)info.size); |
80 | rb->snprintf(str_size, sizeof str_size, "Size: %ld %cB", | 80 | rb->snprintf(str_size, sizeof str_size, "Size: %lu %cB", |
81 | info.size >> (log*10), human_size_prefix[log]); | 81 | ((unsigned long)info.size) >> (log*10), human_size_prefix[log]); |
82 | rb->snprintf(str_date, sizeof str_date, "Date: %04d/%02d/%02d", | 82 | rb->snprintf(str_date, sizeof str_date, "Date: %04d/%02d/%02d", |
83 | ((info.wrtdate >> 9 ) & 0x7F) + 1980, /* year */ | 83 | ((info.wrtdate >> 9 ) & 0x7F) + 1980, /* year */ |
84 | ((info.wrtdate >> 5 ) & 0x0F), /* month */ | 84 | ((info.wrtdate >> 5 ) & 0x0F), /* month */ |
@@ -138,7 +138,7 @@ typedef struct { | |||
138 | int len; | 138 | int len; |
139 | unsigned int dc; | 139 | unsigned int dc; |
140 | unsigned int fc; | 140 | unsigned int fc; |
141 | long long bc; | 141 | unsigned long long bc; |
142 | } DPS; | 142 | } DPS; |
143 | 143 | ||
144 | static bool _dir_properties(DPS* dps) | 144 | static bool _dir_properties(DPS* dps) |
@@ -184,7 +184,7 @@ static bool _dir_properties(DPS* dps) | |||
184 | rb->lcd_putsf(0,3,"Directories: %d", dps->dc); | 184 | rb->lcd_putsf(0,3,"Directories: %d", dps->dc); |
185 | rb->lcd_putsf(0,4,"Files: %d", dps->fc); | 185 | rb->lcd_putsf(0,4,"Files: %d", dps->fc); |
186 | log = human_size_log(dps->bc); | 186 | log = human_size_log(dps->bc); |
187 | rb->lcd_putsf(0,5,"Size: %ld %cB", (long) (dps->bc >> (10*log)), | 187 | rb->lcd_putsf(0,5,"Size: %lu %cB", (unsigned long)(dps->bc >> (10*log)), |
188 | human_size_prefix[log]); | 188 | human_size_prefix[log]); |
189 | rb->lcd_update(); | 189 | rb->lcd_update(); |
190 | } | 190 | } |