Fix several bugs.
1. Incorrect string pool offset calculation.
2. Move the sha1 checksum calculation code forward.
3. Assign file to mFile (in order to share with different method).
diff --git a/lib/bcc/CacheWriter.cpp b/lib/bcc/CacheWriter.cpp
index 21ed2a8..87c554c 100644
--- a/lib/bcc/CacheWriter.cpp
+++ b/lib/bcc/CacheWriter.cpp
@@ -253,6 +253,8 @@
mpStringPoolSection = pool;
mpHeaderSection->str_pool_size = size;
+ pool->count = mStringPool.size();
+
char *strPtr = reinterpret_cast<char *>(pool) + strOffset;
for (size_t i = 0; i < mStringPool.size(); ++i) {
@@ -265,7 +267,7 @@
strPtr += str->length;
*strPtr++ = '\0';
- strOffset += str->length;
+ strOffset += str->length + 1;
}
return true;