Permalink
Browse files

Hopefully added missing bits for 0.6-compability

  • Loading branch information...
1 parent bd15b6a commit 285db5e4fdc6b24beae48bb7a8a47f52517751a2 @kesla committed Dec 6, 2011
Showing with 18 additions and 12 deletions.
  1. +7 −1 lib/snappy.js
  2. +6 −6 src/binding.cc
  3. +5 −5 src/binding.h
View
@@ -23,7 +23,13 @@
/*
* The c++-module.
*/
-var binding = require('../build/default/binding');
+var binding;
+
+try {
+ binding = require('../build/default/binding');
+} catch(e) {
+ binding = require('../build/Release/binding');
+}
/*
* Parsers, used to parse a buffer when decompressing.
View
@@ -59,7 +59,7 @@ inline void Base::CallErrCallback(const v8::Handle<v8::Function>& callback,
// CompressUncompressBase
// PROTECTED
-async_rtn CompressUncompressBase::After(eio_req *req) {
+async_rtn CompressUncompressBase::After(uv_work_t *req) {
v8::HandleScope scope;
SnappyRequest<std::string>* snappy_req =
static_cast<SnappyRequest<std::string>*>(req->data);
@@ -105,7 +105,7 @@ v8::Handle<v8::Value> CompressBinding::Sync(const v8::Arguments& args) {
}
// PRIVATE
-async_rtn CompressBinding::AsyncOperation(eio_req *req) {
+async_rtn CompressBinding::AsyncOperation(uv_work_t *req) {
SnappyRequest<std::string>* snappy_req =
static_cast<SnappyRequest<std::string>*>(req->data);
std::string dst;
@@ -140,7 +140,7 @@ v8::Handle<v8::Value> UncompressBinding::Sync(const v8::Arguments& args) {
}
// PRIVATE
-async_rtn UncompressBinding::AsyncOperation(eio_req *req) {
+async_rtn UncompressBinding::AsyncOperation(uv_work_t *req) {
SnappyRequest<std::string>* snappy_req =
static_cast<SnappyRequest<std::string>*>(req->data);
std::string dst;
@@ -178,7 +178,7 @@ IsValidCompressedBinding::Sync(const v8::Arguments& args) {
}
// PRIVATE
-async_rtn IsValidCompressedBinding::After(eio_req *req) {
+async_rtn IsValidCompressedBinding::After(uv_work_t *req) {
v8::HandleScope scope;
SnappyRequest<bool>* snappy_req =
static_cast<SnappyRequest<bool>*>(req->data);
@@ -189,12 +189,12 @@ async_rtn IsValidCompressedBinding::After(eio_req *req) {
RETURN_ASYNC_AFTER;
}
-int IsValidCompressedBinding::AsyncOperation(eio_req *req) {
+async_rtn IsValidCompressedBinding::AsyncOperation(uv_work_t *req) {
SnappyRequest<bool>* snappy_req = (SnappyRequest<bool>*) req->data;
std::string* input = &snappy_req->input;
snappy_req->result =
snappy::IsValidCompressedBuffer(input->data(), input->length());
- return 0;
+ RETURN_ASYNC;
}
inline void
View
@@ -71,7 +71,7 @@ class Base {
class CompressUncompressBase : protected Base {
protected:
/* Method run after the async operation */
- static async_rtn After(eio_req*);
+ static async_rtn After(uv_work_t*);
/*
* Call the specifed callback when everything has gone well.
* Use null as first argument and use the specifed string (converted to a
@@ -94,7 +94,7 @@ class CompressBinding : CompressUncompressBase {
private:
- static async_rtn AsyncOperation(eio_req*);
+ static async_rtn AsyncOperation(uv_work_t*);
};
/*
@@ -109,7 +109,7 @@ class UncompressBinding : CompressUncompressBase {
static v8::Handle<v8::Value> Sync(const v8::Arguments&);
private:
- static async_rtn AsyncOperation(eio_req*);
+ static async_rtn AsyncOperation(uv_work_t*);
};
/*
@@ -124,8 +124,8 @@ class IsValidCompressedBinding : protected Base {
static v8::Handle<v8::Value> Sync(const v8::Arguments&);
private:
- static async_rtn After(eio_req*);
- static async_rtn AsyncOperation(eio_req*);
+ static async_rtn After(uv_work_t*);
+ static async_rtn AsyncOperation(uv_work_t*);
/*
* Call the specifed callback when everything has gone well.
* Use null as first argument and use the specifed bool (converted to a

0 comments on commit 285db5e

Please sign in to comment.