Changeset 34052 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Nov 13, 2010 1:29:03 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 67734
- Location:
- trunk/src/VBox/Runtime/common/zip
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/zip/tarcmd.cpp
r34046 r34052 51 51 #define RTZIPTARCMD_OPT_OWNER 1001 52 52 #define RTZIPTARCMD_OPT_GROUP 1002 53 #define RTZIPTARCMD_OPT_PREFIX 1003 53 #define RTZIPTARCMD_OPT_UTC 1003 54 #define RTZIPTARCMD_OPT_PREFIX 1004 54 55 55 56 … … 86 87 /** The group ID to set when unpacking if pszGroup is not NULL. */ 87 88 RTGID gidGroup; 89 /** Display the modification times in UTC instead of local time. */ 90 bool fDisplayUtc; 88 91 89 92 /** What to prefix all names with when creating, adding, whatever. */ … … 229 232 * @param hVfsObj The tar object to display 230 233 * @param pszName The name. 234 * @param pOpts The tar options. 231 235 */ 232 static RTEXITCODE rtZipTarCmdDisplayEntryVerbose(RTEXITCODE rcExit, RTVFSOBJ hVfsObj, const char *pszName) 236 static RTEXITCODE rtZipTarCmdDisplayEntryVerbose(RTEXITCODE rcExit, RTVFSOBJ hVfsObj, const char *pszName, 237 PRTZIPTARCMDOPS pOpts) 233 238 { 234 239 /* … … 309 314 * Format the modification time. 310 315 */ 311 char szModTime[32]; 312 RTTIME ModTime; 313 if (RTTimeExplode(&ModTime, &UnixInfo.ModificationTime) == NULL) 316 char szModTime[32]; 317 RTTIME ModTime; 318 PRTTIME pTime; 319 if (!pOpts->fDisplayUtc) 320 pTime = RTTimeLocalExplode(&ModTime, &UnixInfo.ModificationTime); 321 else 322 pTime = RTTimeExplode(&ModTime, &UnixInfo.ModificationTime); 323 if (!pTime) 314 324 RT_ZERO(ModTime); 315 325 RTStrPrintf(szModTime, sizeof(szModTime), "%04d-%02u-%02u %02u:%02u", … … 326 336 + 1 327 337 + strlen(Group.Attr.u.UnixGroup.szName); 328 ssize_t cchPad = cchUserGroup + cchSize + 1 < 1 8329 ? 1 8- (cchUserGroup + cchSize + 1)338 ssize_t cchPad = cchUserGroup + cchSize + 1 < 19 339 ? 19 - (cchUserGroup + cchSize + 1) 330 340 : 0; 331 341 … … 403 413 RTPrintf("%s\n", pszName); 404 414 else 405 rcExit = rtZipTarCmdDisplayEntryVerbose(rcExit, hVfsObj, pszName );415 rcExit = rtZipTarCmdDisplayEntryVerbose(rcExit, hVfsObj, pszName, pOpts); 406 416 } 407 417 … … 466 476 { "--owner", RTZIPTARCMD_OPT_OWNER, RTGETOPT_REQ_STRING }, 467 477 { "--group", RTZIPTARCMD_OPT_GROUP, RTGETOPT_REQ_STRING }, 478 { "--utc", RTZIPTARCMD_OPT_UTC, RTGETOPT_REQ_NOTHING }, 468 479 469 480 /* IPRT extensions */ … … 516 527 517 528 case 'v': 518 Opts.fVerbose = false;529 Opts.fVerbose = true; 519 530 break; 520 531 … … 542 553 break; 543 554 555 case RTZIPTARCMD_OPT_UTC: 556 Opts.fDisplayUtc = true; 557 break; 544 558 545 559 /* iprt extensions */ -
trunk/src/VBox/Runtime/common/zip/tarvfs.cpp
r34050 r34052 289 289 i32Unsigned -= *(unsigned char *)pch; 290 290 i32Signed -= *(signed char *)pch; 291 pch++;292 291 } while (++pch != pchEnd); 293 292 … … 325 324 if (RT_FAILURE(rc)) 326 325 return VERR_TAR_BAD_CHKSUM_FIELD; 327 //if ( i32ChkSum != i64HdrChkSum328 //&& i32ChkSumSignedAlt != i64HdrChkSum) /** @todo check this */329 //return VERR_TAR_CHKSUM_MISMATCH;326 if ( i32ChkSum != i64HdrChkSum 327 && i32ChkSumSignedAlt != i64HdrChkSum) /** @todo check this */ 328 return VERR_TAR_CHKSUM_MISMATCH; 330 329 331 330 /* … … 977 976 /* 978 977 * Validate the header and convert to binary object info. 979 * We pick up the two zero headers in the failure path here.978 * We pick up the start of the zero headers here in the failure path. 980 979 */ 981 980 rc = rtZipTarHdrValidate(&Hdr); … … 992 991 if (RTVfsIoStrmIsAtEnd(pThis->hVfsIos)) 993 992 return VERR_EOF; 994 return VERR_TAR_EOS_MORE_INPUT; 993 994 /* Just drain the stream because blocksize may dictate that 995 there is a whole bunch of stuff comming up. */ 996 for (uint32_t i = 0; i < _32K / 512; i++) 997 { 998 rc = RTVfsIoStrmRead(pThis->hVfsIos, &Hdr, sizeof(Hdr), true /*fBlocking*/, &cbRead); 999 if (rc == VINF_EOF) 1000 return VERR_EOF; 1001 if (RT_FAILURE(rc)) 1002 break; 1003 Assert(cbRead == sizeof(Hdr)); 1004 } 995 1005 } 996 1006 } … … 1035 1045 pIosData->cbFile = Info.cbObject; 1036 1046 pIosData->offFile = 0; 1037 pIosData->cbPadding = 512 - (uint32_t)(Info.cbObject % 512);1047 pIosData->cbPadding = Info.cbAllocated - Info.cbObject; 1038 1048 pIosData->fEndOfStream = false; 1039 1049 pIosData->hVfsIos = pThis->hVfsIos;
Note:
See TracChangeset
for help on using the changeset viewer.