Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Unified Diff: webkit/fileapi/media/picasa/pmp_test_helper.cc

Issue 13529028: PicasaAlbumTableReader for Media Galleries API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0005-picasa-import-pmp-reader
Patch Set: Remove PmpTableReader::Init, fix up some tests Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/fileapi/media/picasa/pmp_test_helper.cc
diff --git a/webkit/fileapi/media/picasa/pmp_test_helper.cc b/webkit/fileapi/media/picasa/pmp_test_helper.cc
index 69f92ee3881644f941ac77841dcec48f1da8506d..4c09817cfd16ad13954a68d394a31f579518a857 100644
--- a/webkit/fileapi/media/picasa/pmp_test_helper.cc
+++ b/webkit/fileapi/media/picasa/pmp_test_helper.cc
@@ -59,7 +59,7 @@ std::vector<uint8> CombinedVectors(const std::vector<uint8>& a,
} // namespace
-PmpTestHelper::PmpTestHelper() { }
+PmpTestHelper::PmpTestHelper() {}
bool PmpTestHelper::Init() {
return temp_dir_.CreateUniqueTempDir();
@@ -106,7 +106,7 @@ template bool PmpTestHelper::WriteColumnFileFromVector<uint64>(
bool PmpTestHelper::InitColumnReaderFromBytes(
PmpColumnReader* const reader, const std::vector<uint8>& data,
- uint32* rows_read) {
+ const PmpFieldType expected_type, uint32* rows_read) {
DCHECK(temp_dir_.IsValid());
base::FilePath temp_path;
@@ -116,7 +116,7 @@ bool PmpTestHelper::InitColumnReaderFromBytes(
return false;
}
- bool success = reader->Init(temp_path, rows_read);
+ bool success = reader->Init(temp_path, expected_type, rows_read);
file_util::Delete(temp_path, true);
@@ -140,11 +140,14 @@ std::vector<uint8> PmpTestHelper::MakeHeader(const PmpFieldType field_type,
sizeof(picasaimport::kPmpMagic4));
// Copy in field type.
- memcpy(&header[picasaimport::kPmpFieldType1Offset], &field_type, 2);
- memcpy(&header[picasaimport::kPmpFieldType2Offset], &field_type, 2);
+ uint16 field_type_short = static_cast<uint16>(field_type);
+ memcpy(&header[picasaimport::kPmpFieldType1Offset], &field_type_short,
+ sizeof(uint16));
+ memcpy(&header[picasaimport::kPmpFieldType2Offset], &field_type_short,
+ sizeof(uint16));
// Copy in row count.
- memcpy(&header[picasaimport::kPmpRowCountOffset], &row_count, 4);
+ memcpy(&header[picasaimport::kPmpRowCountOffset], &row_count, sizeof(uint32));
return header;
}

Powered by Google App Engine
This is Rietveld 408576698