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

Unified Diff: src/serialize.cc

Issue 18583: Change type of snapshot from char array to byte array to avoid portability pr... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 11 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
« no previous file with comments | « src/serialize.h ('k') | src/snapshot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/serialize.cc
===================================================================
--- src/serialize.cc (revision 1142)
+++ src/serialize.cc (working copy)
@@ -686,15 +686,15 @@
SnapshotWriter() {
len_ = 0;
max_ = 8 << 10; // 8K initial size
- str_ = NewArray<char>(max_);
+ str_ = NewArray<byte>(max_);
}
~SnapshotWriter() {
DeleteArray(str_);
}
- void GetString(char** str, int* len) {
- *str = NewArray<char>(len_);
+ void GetBytes(byte** str, int* len) {
+ *str = NewArray<byte>(len_);
memcpy(*str, str_, len_);
*len = len_;
}
@@ -742,7 +742,7 @@
Address position() { return reinterpret_cast<Address>(&str_[len_]); }
private:
- char* str_; // the snapshot
+ byte* str_; // the snapshot
int len_; // the current length of str_
int max_; // the allocated size of str_
};
@@ -752,14 +752,14 @@
CHECK(0 <= pos && pos <= len_);
while (len_ + bytes >= max_) {
max_ *= 2;
- char* old = str_;
- str_ = NewArray<char>(max_);
+ byte* old = str_;
+ str_ = NewArray<byte>(max_);
memcpy(str_, old, len_);
DeleteArray(old);
}
if (pos < len_) {
- char* old = str_;
- str_ = NewArray<char>(max_);
+ byte* old = str_;
+ str_ = NewArray<byte>(max_);
memcpy(str_, old, pos);
memcpy(str_ + pos + bytes, old + pos, len_ - pos);
DeleteArray(old);
@@ -929,8 +929,8 @@
}
-void Serializer::Finalize(char** str, int* len) {
- writer_->GetString(str, len);
+void Serializer::Finalize(byte** str, int* len) {
+ writer_->GetBytes(str, len);
}
@@ -1180,7 +1180,7 @@
static const int kInitArraySize = 32;
-Deserializer::Deserializer(const char* str, int len)
+Deserializer::Deserializer(const byte* str, int len)
: reader_(str, len),
map_pages_(kInitArraySize),
old_pointer_pages_(kInitArraySize),
« no previous file with comments | « src/serialize.h ('k') | src/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698