Skip to content

Commit

Permalink
update for node v0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Pacheco committed Dec 14, 2011
1 parent 1dc0601 commit bdfdb7a
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 20 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
{ {
"name": "png", "name": "png",
"version": "2.0.1", "version": "2.1.0",
"main": "png", "main":"./build/Release/png",
"description": "A C++ module for node-js that converts an RGB and RGBA buffers to PNG images (in memory).", "description": "A C++ module for node-js that converts an RGB and RGBA buffers to PNG images (in memory).",
"keywords": [ "keywords": [
"png", "png",
Expand Down Expand Up @@ -34,7 +34,7 @@
"src": "src" "src": "src"
}, },
"engines": { "engines": {
"node": ">=0.3.0 <0.5" "node": ">=0.6.0"
}, },
"scripts": { "scripts": {
"install": "node-waf configure build" "install": "node-waf configure build"
Expand Down
8 changes: 3 additions & 5 deletions src/dynamic_png_stack.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ DynamicPngStack::PngEncodeSync(const Arguments &args)
return scope.Close(png_stack->PngEncodeSync()); return scope.Close(png_stack->PngEncodeSync());
} }


int void
DynamicPngStack::EIO_PngEncode(eio_req *req) DynamicPngStack::EIO_PngEncode(eio_req *req)
{ {
encode_request *enc_req = (encode_request *)req->data; encode_request *enc_req = (encode_request *)req->data;
Expand All @@ -243,7 +243,7 @@ DynamicPngStack::EIO_PngEncode(eio_req *req)
unsigned char *data = (unsigned char*)malloc(sizeof(*data) * png->width * png->height * 4); unsigned char *data = (unsigned char*)malloc(sizeof(*data) * png->width * png->height * 4);
if (!data) { if (!data) {
enc_req->error = strdup("malloc failed in DynamicPngStack::EIO_PngEncode."); enc_req->error = strdup("malloc failed in DynamicPngStack::EIO_PngEncode.");
return 0; return;
} }
memset(data, 0xFF, png->width*png->height*4); memset(data, 0xFF, png->width*png->height*4);


Expand All @@ -260,7 +260,7 @@ DynamicPngStack::EIO_PngEncode(eio_req *req)
enc_req->png = (char *)malloc(sizeof(*enc_req->png)*enc_req->png_len); enc_req->png = (char *)malloc(sizeof(*enc_req->png)*enc_req->png_len);
if (!enc_req->png) { if (!enc_req->png) {
enc_req->error = strdup("malloc in DynamicPngStack::EIO_PngEncode failed."); enc_req->error = strdup("malloc in DynamicPngStack::EIO_PngEncode failed.");
return 0; return;
} }
else { else {
memcpy(enc_req->png, encoder.get_png(), enc_req->png_len); memcpy(enc_req->png, encoder.get_png(), enc_req->png_len);
Expand All @@ -269,8 +269,6 @@ DynamicPngStack::EIO_PngEncode(eio_req *req)
catch (const char *err) { catch (const char *err) {
enc_req->error = strdup(err); enc_req->error = strdup(err);
} }

return 0;
} }


int int
Expand Down
2 changes: 1 addition & 1 deletion src/dynamic_png_stack.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class DynamicPngStack : public node::ObjectWrap {


std::pair<Point, Point> optimal_dimension(); std::pair<Point, Point> optimal_dimension();


static int EIO_PngEncode(eio_req *req); static void EIO_PngEncode(eio_req *req);
static int EIO_PngEncodeAfter(eio_req *req); static int EIO_PngEncodeAfter(eio_req *req);
void construct_png_data(unsigned char *data, Point &top); void construct_png_data(unsigned char *data, Point &top);


Expand Down
8 changes: 3 additions & 5 deletions src/fixed_png_stack.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ FixedPngStack::PngEncodeSync(const Arguments &args)
return png_stack->PngEncodeSync(); return png_stack->PngEncodeSync();
} }


int void
FixedPngStack::EIO_PngEncode(eio_req *req) FixedPngStack::EIO_PngEncode(eio_req *req)
{ {
encode_request *enc_req = (encode_request *)req->data; encode_request *enc_req = (encode_request *)req->data;
Expand All @@ -185,7 +185,7 @@ FixedPngStack::EIO_PngEncode(eio_req *req)
enc_req->png = (char *)malloc(sizeof(*enc_req->png)*enc_req->png_len); enc_req->png = (char *)malloc(sizeof(*enc_req->png)*enc_req->png_len);
if (!enc_req->png) { if (!enc_req->png) {
enc_req->error = strdup("malloc in FixedPngStack::EIO_PngEncode failed."); enc_req->error = strdup("malloc in FixedPngStack::EIO_PngEncode failed.");
return 0; return;
} }
else { else {
memcpy(enc_req->png,encoder.get_png(), enc_req->png_len); memcpy(enc_req->png,encoder.get_png(), enc_req->png_len);
Expand All @@ -194,8 +194,6 @@ FixedPngStack::EIO_PngEncode(eio_req *req)
catch (const char *err) { catch (const char *err) {
enc_req->error = strdup(err); enc_req->error = strdup(err);
} }

return 0;
} }


int int
Expand Down Expand Up @@ -232,7 +230,7 @@ FixedPngStack::EIO_PngEncodeAfter(eio_req *req)


((FixedPngStack *)enc_req->png_obj)->Unref(); ((FixedPngStack *)enc_req->png_obj)->Unref();
free(enc_req); free(enc_req);

return 0; return 0;
} }


Expand Down
2 changes: 1 addition & 1 deletion src/fixed_png_stack.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class FixedPngStack : public node::ObjectWrap {
unsigned char *data; unsigned char *data;
buffer_type buf_type; buffer_type buf_type;


static int EIO_PngEncode(eio_req *req); static void EIO_PngEncode(eio_req *req);
static int EIO_PngEncodeAfter(eio_req *req); static int EIO_PngEncodeAfter(eio_req *req);


public: public:
Expand Down
6 changes: 2 additions & 4 deletions src/png.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Png::PngEncodeSync(const Arguments &args)
return scope.Close(png->PngEncodeSync()); return scope.Close(png->PngEncodeSync());
} }


int void
Png::EIO_PngEncode(eio_req *req) Png::EIO_PngEncode(eio_req *req)
{ {
encode_request *enc_req = (encode_request *)req->data; encode_request *enc_req = (encode_request *)req->data;
Expand All @@ -122,7 +122,7 @@ Png::EIO_PngEncode(eio_req *req)
enc_req->png = (char *)malloc(sizeof(*enc_req->png)*enc_req->png_len); enc_req->png = (char *)malloc(sizeof(*enc_req->png)*enc_req->png_len);
if (!enc_req->png) { if (!enc_req->png) {
enc_req->error = strdup("malloc in Png::EIO_PngEncode failed."); enc_req->error = strdup("malloc in Png::EIO_PngEncode failed.");
return 0; return;
} }
else { else {
memcpy(enc_req->png, encoder.get_png(), enc_req->png_len); memcpy(enc_req->png, encoder.get_png(), enc_req->png_len);
Expand All @@ -131,8 +131,6 @@ Png::EIO_PngEncode(eio_req *req)
catch (const char *err) { catch (const char *err) {
enc_req->error = strdup(err); enc_req->error = strdup(err);
} }

return 0;
} }


int int
Expand Down
2 changes: 1 addition & 1 deletion src/png.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Png : public node::ObjectWrap {
int height; int height;
buffer_type buf_type; buffer_type buf_type;


static int EIO_PngEncode(eio_req *req); static void EIO_PngEncode(eio_req *req);
static int EIO_PngEncodeAfter(eio_req *req); static int EIO_PngEncodeAfter(eio_req *req);
public: public:
static void Initialize(v8::Handle<v8::Object> target); static void Initialize(v8::Handle<v8::Object> target);
Expand Down

0 comments on commit bdfdb7a

Please sign in to comment.