progressmeter.c (149749) | progressmeter.c (157016) |
---|---|
1/* 2 * Copyright (c) 2003 Nils Nordman. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 71 unchanged lines hidden (view full) --- 80 bytes *= 100; 81 for (i = 0; bytes >= 100*1000 && unit[i] != 'T'; i++) 82 bytes = (bytes + 512) / 1024; 83 if (i == 0) { 84 i++; 85 bytes = (bytes + 512) / 1024; 86 } 87 snprintf(buf, size, "%3lld.%1lld%c%s", | 1/* 2 * Copyright (c) 2003 Nils Nordman. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 71 unchanged lines hidden (view full) --- 80 bytes *= 100; 81 for (i = 0; bytes >= 100*1000 && unit[i] != 'T'; i++) 82 bytes = (bytes + 512) / 1024; 83 if (i == 0) { 84 i++; 85 bytes = (bytes + 512) / 1024; 86 } 87 snprintf(buf, size, "%3lld.%1lld%c%s", |
88 (int64_t) (bytes + 5) / 100, 89 (int64_t) (bytes + 5) / 10 % 10, | 88 (long long) (bytes + 5) / 100, 89 (long long) (bytes + 5) / 10 % 10, |
90 unit[i], 91 i ? "B" : " "); 92} 93 94static void 95format_size(char *buf, int size, off_t bytes) 96{ 97 int i; 98 99 for (i = 0; bytes >= 10000 && unit[i] != 'T'; i++) 100 bytes = (bytes + 512) / 1024; 101 snprintf(buf, size, "%4lld%c%s", | 90 unit[i], 91 i ? "B" : " "); 92} 93 94static void 95format_size(char *buf, int size, off_t bytes) 96{ 97 int i; 98 99 for (i = 0; bytes >= 10000 && unit[i] != 'T'; i++) 100 bytes = (bytes + 512) / 1024; 101 snprintf(buf, size, "%4lld%c%s", |
102 (int64_t) bytes, | 102 (long long) bytes, |
103 unit[i], 104 i ? "B" : " "); 105} 106 107void 108refresh_progress_meter(void) 109{ 110 char buf[MAX_WINSIZE + 1]; --- 182 unchanged lines hidden --- | 103 unit[i], 104 i ? "B" : " "); 105} 106 107void 108refresh_progress_meter(void) 109{ 110 char buf[MAX_WINSIZE + 1]; --- 182 unchanged lines hidden --- |