Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kesla committed Apr 7, 2011
1 parent ce94c47 commit cfb41cc
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@ v8::Handle<v8::Value> CompressWrapper(const v8::Arguments& args) {
return scope.Close(CreateBuffer(dst));
}

// Wrapper around the snappy::uncompress
// Wrapper around the snappy::uncompress method
// uncompresses a buffer or a string and returns a buffer
v8::Handle<v8::Value> UncompressWrapper(const v8::Arguments& args) {
v8::HandleScope scope;
std::string dst;
v8::Handle<v8::Object> buffer = args[0]->ToObject();
char* data = node::Buffer::Data(buffer);
size_t length = node::Buffer::Length(buffer);
snappy::Uncompress(data, length, &dst);
v8::String::Utf8Value data(args[0]->ToString());
snappy::Uncompress(*data, data.length(), &dst);
return scope.Close(CreateBuffer(dst));
}

Expand Down

0 comments on commit cfb41cc

Please sign in to comment.