-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
142 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/gif.node | ||
/build/ | ||
.lock-wscript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#include <node.h> | ||
#include <node_buffer.h> | ||
#include <node_version.h> | ||
#include <v8.h> | ||
#include "buffer_compat.h" | ||
|
||
|
||
#if NODE_MINOR_VERSION < 3 | ||
|
||
|
||
char *BufferData(node::Buffer *b) { | ||
return b->data(); | ||
} | ||
|
||
|
||
size_t BufferLength(node::Buffer *b) { | ||
return b->length(); | ||
} | ||
|
||
|
||
char *BufferData(v8::Local<v8::Object> buf_obj) { | ||
v8::HandleScope scope; | ||
node::Buffer *buf = node::ObjectWrap::Unwrap<node::Buffer>(buf_obj); | ||
return buf->data(); | ||
} | ||
|
||
|
||
size_t BufferLength(v8::Local<v8::Object> buf_obj) { | ||
v8::HandleScope scope; | ||
node::Buffer *buf = node::ObjectWrap::Unwrap<node::Buffer>(buf_obj); | ||
return buf->length(); | ||
} | ||
|
||
#else // NODE_VERSION | ||
|
||
|
||
char *BufferData(node::Buffer *b) { | ||
return node::Buffer::Data(b->handle_); | ||
} | ||
|
||
|
||
size_t BufferLength(node::Buffer *b) { | ||
return node::Buffer::Length(b->handle_); | ||
} | ||
|
||
|
||
char *BufferData(v8::Local<v8::Object> buf_obj) { | ||
v8::HandleScope scope; | ||
return node::Buffer::Data(buf_obj); | ||
} | ||
|
||
|
||
size_t BufferLength(v8::Local<v8::Object> buf_obj) { | ||
v8::HandleScope scope; | ||
return node::Buffer::Length(buf_obj); | ||
} | ||
|
||
#endif // NODE_VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef buffer_compat_h | ||
#define buffer_compat_h | ||
|
||
#include <node.h> | ||
#include <node_buffer.h> | ||
#include <v8.h> | ||
|
||
char *BufferData(node::Buffer *b); | ||
size_t BufferLength(node::Buffer *b); | ||
|
||
char *BufferData(v8::Local<v8::Object> buf_obj); | ||
size_t BufferLength(v8::Local<v8::Object> buf_obj); | ||
|
||
|
||
#endif // buffer_compat_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ struct encode_request { | |
char *gif; | ||
int gif_len; | ||
char *error; | ||
char *buf_data; | ||
}; | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.