Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update for node v0.6

  • Loading branch information...
commit bdfdb7a46492e2c76717f3a2fdd1cdfc28de66df 1 parent 1dc0601
@davepacheco authored
View
6 package.json
@@ -1,7 +1,7 @@
{
"name": "png",
- "version": "2.0.1",
- "main": "png",
+ "version": "2.1.0",
+ "main":"./build/Release/png",
"description": "A C++ module for node-js that converts an RGB and RGBA buffers to PNG images (in memory).",
"keywords": [
"png",
@@ -34,7 +34,7 @@
"src": "src"
},
"engines": {
- "node": ">=0.3.0 <0.5"
+ "node": ">=0.6.0"
},
"scripts": {
"install": "node-waf configure build"
View
8 src/dynamic_png_stack.cpp
@@ -225,7 +225,7 @@ DynamicPngStack::PngEncodeSync(const Arguments &args)
return scope.Close(png_stack->PngEncodeSync());
}
-int
+void
DynamicPngStack::EIO_PngEncode(eio_req *req)
{
encode_request *enc_req = (encode_request *)req->data;
@@ -243,7 +243,7 @@ DynamicPngStack::EIO_PngEncode(eio_req *req)
unsigned char *data = (unsigned char*)malloc(sizeof(*data) * png->width * png->height * 4);
if (!data) {
enc_req->error = strdup("malloc failed in DynamicPngStack::EIO_PngEncode.");
- return 0;
+ return;
}
memset(data, 0xFF, png->width*png->height*4);
@@ -260,7 +260,7 @@ DynamicPngStack::EIO_PngEncode(eio_req *req)
enc_req->png = (char *)malloc(sizeof(*enc_req->png)*enc_req->png_len);
if (!enc_req->png) {
enc_req->error = strdup("malloc in DynamicPngStack::EIO_PngEncode failed.");
- return 0;
+ return;
}
else {
memcpy(enc_req->png, encoder.get_png(), enc_req->png_len);
@@ -269,8 +269,6 @@ DynamicPngStack::EIO_PngEncode(eio_req *req)
catch (const char *err) {
enc_req->error = strdup(err);
}
-
- return 0;
}
int
View
2  src/dynamic_png_stack.h
@@ -38,7 +38,7 @@ class DynamicPngStack : public node::ObjectWrap {
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);
void construct_png_data(unsigned char *data, Point &top);
View
8 src/fixed_png_stack.cpp
@@ -172,7 +172,7 @@ FixedPngStack::PngEncodeSync(const Arguments &args)
return png_stack->PngEncodeSync();
}
-int
+void
FixedPngStack::EIO_PngEncode(eio_req *req)
{
encode_request *enc_req = (encode_request *)req->data;
@@ -185,7 +185,7 @@ FixedPngStack::EIO_PngEncode(eio_req *req)
enc_req->png = (char *)malloc(sizeof(*enc_req->png)*enc_req->png_len);
if (!enc_req->png) {
enc_req->error = strdup("malloc in FixedPngStack::EIO_PngEncode failed.");
- return 0;
+ return;
}
else {
memcpy(enc_req->png,encoder.get_png(), enc_req->png_len);
@@ -194,8 +194,6 @@ FixedPngStack::EIO_PngEncode(eio_req *req)
catch (const char *err) {
enc_req->error = strdup(err);
}
-
- return 0;
}
int
@@ -232,7 +230,7 @@ FixedPngStack::EIO_PngEncodeAfter(eio_req *req)
((FixedPngStack *)enc_req->png_obj)->Unref();
free(enc_req);
-
+
return 0;
}
View
2  src/fixed_png_stack.h
@@ -11,7 +11,7 @@ class FixedPngStack : public node::ObjectWrap {
unsigned char *data;
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);
public:
View
6 src/png.cpp
@@ -109,7 +109,7 @@ Png::PngEncodeSync(const Arguments &args)
return scope.Close(png->PngEncodeSync());
}
-int
+void
Png::EIO_PngEncode(eio_req *req)
{
encode_request *enc_req = (encode_request *)req->data;
@@ -122,7 +122,7 @@ Png::EIO_PngEncode(eio_req *req)
enc_req->png = (char *)malloc(sizeof(*enc_req->png)*enc_req->png_len);
if (!enc_req->png) {
enc_req->error = strdup("malloc in Png::EIO_PngEncode failed.");
- return 0;
+ return;
}
else {
memcpy(enc_req->png, encoder.get_png(), enc_req->png_len);
@@ -131,8 +131,6 @@ Png::EIO_PngEncode(eio_req *req)
catch (const char *err) {
enc_req->error = strdup(err);
}
-
- return 0;
}
int
View
2  src/png.h
@@ -11,7 +11,7 @@ class Png : public node::ObjectWrap {
int height;
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);
public:
static void Initialize(v8::Handle<v8::Object> target);
Please sign in to comment.
Something went wrong with that request. Please try again.