diff options
author | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-21 20:41:15 +0000 |
---|---|---|
committer | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-21 20:41:15 +0000 |
commit | 41052c98c01f6575b436a478b49612722478db70 (patch) | |
tree | b69490176459e84859bfc4780113b6861c69b529 /o3d/import/cross/tar_processor_test.cc | |
parent | d1868637ceb9def78abc10b10c55f1642c6c6971 (diff) | |
download | chromium_src-41052c98c01f6575b436a478b49612722478db70.zip chromium_src-41052c98c01f6575b436a478b49612722478db70.tar.gz chromium_src-41052c98c01f6575b436a478b49612722478db70.tar.bz2 |
Refactor tar code to support long names.
The previous code only support names up to 99 chars.
This one supports up to 1024. The code actually
supports 32bit length but given that Linux, OSX and
other only support 255 I set it 1024. Why 1024?
Because Windows actually supports 255 wchar characters
which when converted to utf-8 could be up to 1024 bytes.
I'm not 100% sure the format is correct. I could not
find any docs on the format, Just reverse engineered it.
Looking at hex dumps by both 7zip and gnu tar it was
pretty clear what it does including zeroing many
of the standard fields.
Review URL: http://codereview.chromium.org/159129
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21210 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/import/cross/tar_processor_test.cc')
-rw-r--r-- | o3d/import/cross/tar_processor_test.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/o3d/import/cross/tar_processor_test.cc b/o3d/import/cross/tar_processor_test.cc index 3e7afaa..1317042 100644 --- a/o3d/import/cross/tar_processor_test.cc +++ b/o3d/import/cross/tar_processor_test.cc @@ -42,17 +42,22 @@ class TarProcessorTest : public testing::Test { // We verify that the tar file contains exactly these filenames static const char *kFilename1 = "test/file1"; -static const char *kFilename2 = "test/file2"; -static const char *kFilename3 = "test/file3"; +static const char *kFilename2 = + "test/file1ThisIsAFilenameLongerThen100Chars" + "ThisIsAFilenameLongerThen100Chars" + "ThisIsAFilenameLongerThen100CharsThisIsAFilenameLongerThen100Chars"; +static const char *kFilename3 = "test/file2"; +static const char *kFilename4 = "test/file3"; // With each file having these exact contents -#define kFileContents1 "the cat in the hat\n" -#define kFileContents2 "abracadabra\n" -#define kFileContents3 "I think therefore I am\n" // we should receive these (and exactly these bytes in this order) static const char *kConcatenatedContents = - kFileContents1 kFileContents2 kFileContents3; + "the cat in the hat\n" // file 1 contents. + "this file has a long name" // file 2 contents. + "abracadabra\n" // file 3 contents. + "I think therefore I am\n" // file 4 contents. + ""; // end // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class TarTestClient : public ArchiveCallbackClient { @@ -85,6 +90,9 @@ void TarTestClient::ReceiveFileHeader(const ArchiveFileInfo &file_info) { case 2: EXPECT_TRUE(!strcmp(kFilename3, file_info.GetFileName().c_str())); break; + case 3: + EXPECT_TRUE(!strcmp(kFilename4, file_info.GetFileName().c_str())); + break; } file_count_++; |