Overview
| Comment: | utils/ofhttp: Make old Apple GCC happy |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
a3f24bdd18a8010580b8a2deeac09956 |
| User & Date: | js on 2015-06-17 22:19:50 |
| Other Links: | manifest | tags |
Context
|
2015-06-28
| ||
| 16:16 | Extremely minor API inconsistency fix (check-in: 1b1db13483 user: js tags: trunk) | |
|
2015-06-17
| ||
| 22:19 | utils/ofhttp: Make old Apple GCC happy (check-in: a3f24bdd18 user: js tags: trunk) | |
| 22:11 | Add OF_NULLABLE_PROPERTY (check-in: 80e1a9655b user: js tags: trunk) | |
Changes
Modified utils/ofhttp/ProgressBar.m from [541aee4c03] to [e84b0f1e4e].
| ︙ | ︙ | |||
98 99 100 101 102 103 104 | else barWidth = 0; #else barWidth = 43; #endif bars = (float)(_resumedFrom + _received) / | | | | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
else
barWidth = 0;
#else
barWidth = 43;
#endif
bars = (float)(_resumedFrom + _received) /
(float)(_resumedFrom + _length) * barWidth;
percent = (float)(_resumedFrom + _received) /
(float)(_resumedFrom + _length) * 100;
[of_stdout writeString: @"\r ▕"];
for (i = 0; i < (size_t)bars; i++)
[of_stdout writeString: @"█"];
if (bars < barWidth) {
float remainder = bars - floorf(bars);
|
| ︙ | ︙ | |||
135 136 137 138 139 140 141 |
}
[of_stdout writeFormat: @"▏ %6.2f%% ", percent];
if (percent == 100) {
double timeInterval = -[_startDate timeIntervalSinceNow];
| | | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
}
[of_stdout writeFormat: @"▏ %6.2f%% ", percent];
if (percent == 100) {
double timeInterval = -[_startDate timeIntervalSinceNow];
_BPS = (float)_received / (float)timeInterval;
_ETA = timeInterval;
}
if (isinf(_ETA))
[of_stdout writeString: @"--:--:-- "];
else if (_ETA >= 99 * 3600)
[of_stdout writeFormat: @"%4.2f d ", _ETA / (24 * 3600)];
|
| ︙ | ︙ | |||
177 178 179 180 181 182 183 | @"\r %7.2f KiB ", (float)(_resumedFrom + _received) / KIBIBYTE]; else [of_stdout writeFormat: @"\r %jd bytes ", _resumedFrom + _received]; if (_stopped) | | > | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | @"\r %7.2f KiB ", (float)(_resumedFrom + _received) / KIBIBYTE]; else [of_stdout writeFormat: @"\r %jd bytes ", _resumedFrom + _received]; if (_stopped) _BPS = (float)_received / -(float)[_startDate timeIntervalSinceNow]; if (_BPS >= GIBIBYTE) [of_stdout writeFormat: @"%7.2f GiB/s", _BPS / GIBIBYTE]; else if (_BPS >= MEBIBYTE) [of_stdout writeFormat: @"%7.2f MiB/s", _BPS / MEBIBYTE]; else if (_BPS >= KIBIBYTE) [of_stdout writeFormat: @"%7.2f KiB/s", _BPS / KIBIBYTE]; |
| ︙ | ︙ | |||
200 201 202 203 204 205 206 |
else
[self _drawReceived];
}
- (void)calculateBPSAndETA
{
_BPS = (float)(_received - _lastReceived) /
| | | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
else
[self _drawReceived];
}
- (void)calculateBPSAndETA
{
_BPS = (float)(_received - _lastReceived) /
-(float)[_lastReceivedDate timeIntervalSinceNow];
_ETA = (double)(_length - _resumedFrom - _received) / _BPS;
_lastReceived = _received;
[_lastReceivedDate release];
_lastReceivedDate = [[OFDate alloc] init];
}
|
| ︙ | ︙ |