Permalink
Browse files

Merge pull request #8 from snd/master

function signature of libeio's `eio_custom` has changed - build fails
  • Loading branch information...
pkrumins committed Dec 15, 2011
2 parents d42f2db + a75bfe0 commit 7586879f4b8ccfcde2b25691d35534dd92d18665
Showing with 17 additions and 23 deletions.
  1. +1 −1 package.json
  2. +2 −4 src/dynamic_jpeg_stack.cpp
  3. +1 −1 src/dynamic_jpeg_stack.h
  4. +2 −4 src/fixed_jpeg_stack.cpp
  5. +1 −1 src/fixed_jpeg_stack.h
  6. +8 −10 src/jpeg.cpp
  7. +2 −2 src/jpeg.h
View
@@ -1,7 +1,7 @@
{
"name": "jpeg",
"version": "1.0.0",
- "main": "jpeg",
+ "main": "build/Release/jpeg",
"description": "A C++ module for node-js that converts RGB and RGBA buffers to a JPEG images (in memory).",
"keywords": [
"jpg",
@@ -377,7 +377,7 @@ DynamicJpegStack::SetQuality(const Arguments &args)
return Undefined();
}
-int
+void
DynamicJpegStack::EIO_JpegEncode(eio_req *req)
{
encode_request *enc_req = (encode_request *)req->data;
@@ -392,7 +392,7 @@ DynamicJpegStack::EIO_JpegEncode(eio_req *req)
enc_req->jpeg = (char *)malloc(sizeof(*enc_req->jpeg)*enc_req->jpeg_len);
if (!enc_req->jpeg) {
enc_req->error = strdup("malloc in DynamicJpegStack::EIO_JpegEncode failed.");
- return 0;
+ return;
}
else {
memcpy(enc_req->jpeg, encoder.get_jpeg(), enc_req->jpeg_len);
@@ -401,8 +401,6 @@ DynamicJpegStack::EIO_JpegEncode(eio_req *req)
catch (const char *err) {
enc_req->error = strdup(err);
}
-
- return 0;
}
int
View
@@ -21,7 +21,7 @@ class DynamicJpegStack : public node::ObjectWrap {
void update_optimal_dimension(int x, int y, int w, int h);
- static int EIO_JpegEncode(eio_req *req);
+ static void EIO_JpegEncode(eio_req *req);
static int EIO_JpegEncodeAfter(eio_req *req);
public:
DynamicJpegStack(buffer_type bbuf_type);
View
@@ -247,7 +247,7 @@ FixedJpegStack::SetQuality(const Arguments &args)
return Undefined();
}
-int
+void
FixedJpegStack::EIO_JpegEncode(eio_req *req)
{
encode_request *enc_req = (encode_request *)req->data;
@@ -260,7 +260,7 @@ FixedJpegStack::EIO_JpegEncode(eio_req *req)
enc_req->jpeg = (char *)malloc(sizeof(*enc_req->jpeg)*enc_req->jpeg_len);
if (!enc_req->jpeg) {
enc_req->error = strdup("malloc in FixedJpegStack::EIO_JpegEncode failed.");
- return 0;
+ return;
}
else {
memcpy(enc_req->jpeg, encoder.get_jpeg(), enc_req->jpeg_len);
@@ -269,8 +269,6 @@ FixedJpegStack::EIO_JpegEncode(eio_req *req)
catch (const char *err) {
enc_req->error = strdup(err);
}
-
- return 0;
}
int
View
@@ -13,7 +13,7 @@ class FixedJpegStack : public node::ObjectWrap {
unsigned char *data;
- static int EIO_JpegEncode(eio_req *req);
+ static void EIO_JpegEncode(eio_req *req);
static int EIO_JpegEncodeAfter(eio_req *req);
public:
View
@@ -25,8 +25,8 @@ Jpeg::Initialize(v8::Handle<v8::Object> target)
target->Set(String::NewSymbol("Jpeg"), t->GetFunction());
}
-Jpeg::Jpeg(Buffer *ddata, int wwidth, int hheight, buffer_type bbuf_type) :
- jpeg_encoder((unsigned char *)BufferData(ddata), wwidth, hheight, 60, bbuf_type) {}
+Jpeg::Jpeg(unsigned char *ddata, int wwidth, int hheight, buffer_type bbuf_type) :
+ jpeg_encoder(ddata, wwidth, hheight, 60, bbuf_type) {}
Handle<Value>
Jpeg::JpegEncodeSync()
@@ -42,7 +42,7 @@ Jpeg::JpegEncodeSync()
int jpeg_len = jpeg_encoder.get_jpeg_len();
Buffer *retbuf = Buffer::New(jpeg_len);
- memcpy(BufferData(retbuf), jpeg_encoder.get_jpeg(), jpeg_len);
+ memcpy(Buffer::Data(retbuf), jpeg_encoder.get_jpeg(), jpeg_len);
return scope.Close(retbuf->handle_);
}
@@ -98,8 +98,8 @@ Jpeg::New(const Arguments &args)
return VException("Buffer type wasn't 'rgb', 'bgr', 'rgba' or 'bgra'.");
}
- Buffer *data_buf = ObjectWrap::Unwrap<Buffer>(args[0]->ToObject());
- Jpeg *jpeg = new Jpeg(data_buf, w, h, buf_type);
+ Local<Object> buffer = args[0]->ToObject();
+ Jpeg *jpeg = new Jpeg((unsigned char*) Buffer::Data(buffer), w, h, buf_type);
jpeg->Wrap(args.This());
return args.This();
}
@@ -137,7 +137,7 @@ Jpeg::SetQuality(const Arguments &args)
return Undefined();
}
-int
+void
Jpeg::EIO_JpegEncode(eio_req *req)
{
encode_request *enc_req = (encode_request *)req->data;
@@ -149,7 +149,7 @@ Jpeg::EIO_JpegEncode(eio_req *req)
enc_req->jpeg = (char *)malloc(sizeof(*enc_req->jpeg)*enc_req->jpeg_len);
if (!enc_req->jpeg) {
enc_req->error = strdup("malloc in Jpeg::EIO_JpegEncode failed.");
- return 0;
+ return;
}
else {
memcpy(enc_req->jpeg, jpeg->jpeg_encoder.get_jpeg(), enc_req->jpeg_len);
@@ -158,8 +158,6 @@ Jpeg::EIO_JpegEncode(eio_req *req)
catch (const char *err) {
enc_req->error = strdup(err);
}
-
- return 0;
}
int
@@ -178,7 +176,7 @@ Jpeg::EIO_JpegEncodeAfter(eio_req *req)
}
else {
Buffer *buf = Buffer::New(enc_req->jpeg_len);
- memcpy(BufferData(buf), enc_req->jpeg, enc_req->jpeg_len);
+ memcpy(Buffer::Data(buf), enc_req->jpeg, enc_req->jpeg_len);
argv[0] = buf->handle_;
argv[1] = Undefined();
}
View
@@ -9,11 +9,11 @@
class Jpeg : public node::ObjectWrap {
JpegEncoder jpeg_encoder;
- static int EIO_JpegEncode(eio_req *req);
+ static void EIO_JpegEncode(eio_req *req);
static int EIO_JpegEncodeAfter(eio_req *req);
public:
static void Initialize(v8::Handle<v8::Object> target);
- Jpeg(node::Buffer *ddata, int wwidth, int hheight, buffer_type bbuf_type);
+ Jpeg(unsigned char *ddata, int wwidth, int hheight, buffer_type bbuf_type);
v8::Handle<v8::Value> JpegEncodeSync();
void SetQuality(int q);

0 comments on commit 7586879

Please sign in to comment.