Index: net/disk_cache/simple/simple_util.cc |
diff --git a/net/disk_cache/simple/simple_util.cc b/net/disk_cache/simple/simple_util.cc |
index e9ec067635ada57f24956ca1f501a893e6db2fb5..ca09b182db829404ba879d6fbfabdd1480a3dc52 100644 |
--- a/net/disk_cache/simple/simple_util.cc |
+++ b/net/disk_cache/simple/simple_util.cc |
@@ -79,10 +79,24 @@ int64 GetFileSizeFromKeyAndDataSize(const std::string& key, int32 data_size) { |
sizeof(SimpleFileEOF); |
} |
-int64 GetFileOffsetFromKeyAndDataOffset(const std::string& key, |
- int data_offset) { |
+int GetFileIndexFromStreamIndex(int stream_index) { |
+ return (stream_index == 2) ? 1 : 0; |
+} |
+ |
+int GetMaximumDataOffset(int file_index, const int data_size[]) { |
+ if (file_index == 0) |
+ return data_size[0] + data_size[1] + sizeof(SimpleFileEOF); |
+ return data_size[2]; |
+} |
+ |
+int64 GetFileOffsetFromDataOffset(const std::string& key, |
+ int data_offset, |
+ int index, |
+ int stream_1_size) { |
const int64 headers_size = sizeof(disk_cache::SimpleFileHeader) + key.size(); |
- return headers_size + data_offset; |
+ const int64 additional_offset = |
+ index == 0 ? stream_1_size + sizeof(SimpleFileEOF) : 0; |
+ return headers_size + data_offset + additional_offset; |
} |
// TODO(clamy, gavinp): this should go in base |