Changeset 34952 in vbox
- Timestamp:
- Dec 10, 2010 2:15:46 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/zip/tar.cpp
r34951 r34952 195 195 DECLINLINE(void) rtTarSizeToRec(PRTTARRECORD pRecord, uint64_t cbSize) 196 196 { 197 /* Small enough for the standard octal string encoding? */ 198 if (cbSize <= 2 * _4G) 197 /* 198 * Small enough for the standard octal string encoding? 199 * 200 * Note! We could actually use the terminator character as well if we liked, 201 * but let not do that as it's easier to test this way. 202 */ 203 if (cbSize < _4G * 2U) 199 204 RTStrPrintf(pRecord->h.size, sizeof(pRecord->h.size), "%0.11llo", cbSize); 200 205 else … … 204 209 * We don't deal with negatives here, cause the size have to be greater 205 210 * than zero. 211 * 212 * Note! The base-256 extension are never used by gtar or libarchive 213 * with the "ustar \0" format version, only the later 214 * "ustar\000" version. However, this shouldn't cause much 215 * trouble as they are not picky about what they read. 206 216 */ 207 217 size_t cchField = sizeof(pRecord->h.size) - 1; … … 210 220 do 211 221 { 212 puchField[cchField--] = cbSize & ((1 << 8) - 1);213 cbSize = (cbSize >> 8);222 puchField[cchField--] = cbSize & 0xff; 223 cbSize >>= 8; 214 224 } while (cchField); 215 225 } … … 239 249 || cbSize < INT64_MIN / 256)) 240 250 { 241 cbSize = 0;251 cbSize = cbSize < 0 ? INT64_MIN : INT64_MAX; 242 252 break; 243 253 } … … 319 329 /** @todo check for field overflows. */ 320 330 /* Fill the header record */ 321 // RT_ZERO(pRecord); 331 // RT_ZERO(pRecord); - done by the caller. 322 332 RTStrPrintf(pRecord->h.name, sizeof(pRecord->h.name), "%s", pszSrcName); 323 333 RTStrPrintf(pRecord->h.mode, sizeof(pRecord->h.mode), "%0.7o", fmode);
Note:
See TracChangeset
for help on using the changeset viewer.