Browse files

Change method signatures to return void for eio_custom functions

  • Loading branch information...
1 parent a045509 commit 5f6d74592534a76c35f526a5df4b6c6f070c15a2 @tmcw tmcw committed Jan 29, 2012
Showing with 22 additions and 22 deletions.
  1. +11 −11 src/async_animated_gif.cpp
  2. +2 −2 src/async_animated_gif.h
  3. +4 −4 src/dynamic_gif_stack.cpp
  4. +1 −1 src/dynamic_gif_stack.h
  5. +3 −3 src/gif.cpp
  6. +1 −1 src/gif.h
View
22 src/async_animated_gif.cpp
@@ -32,7 +32,7 @@ AsyncAnimatedGif::AsyncAnimatedGif(int wwidth, int hheight, buffer_type bbuf_typ
transparency_color(0xFF, 0xFF, 0xFE),
push_id(0), fragment_id(0) {}
-int
+void
AsyncAnimatedGif::EIO_Push(eio_req *req)
{
push_request *push_req = (push_request *)req->data;
@@ -43,7 +43,7 @@ AsyncAnimatedGif::EIO_Push(eio_req *req)
// async with no callback
fprintf(stderr, "Could not mkdir(%s) in AsyncAnimatedGif::EIO_Push.\n",
push_req->tmp_dir);
- return 0;
+ return;
}
}
@@ -54,7 +54,7 @@ AsyncAnimatedGif::EIO_Push(eio_req *req)
if (mkdir(fragment_dir, 0775) == -1) {
fprintf(stderr, "Could not mkdir(%s) in AsyncAnimatedGif::EIO_Push.\n",
fragment_dir);
- return 0;
+ return;
}
}
@@ -67,15 +67,15 @@ AsyncAnimatedGif::EIO_Push(eio_req *req)
if (!out) {
fprintf(stderr, "Failed to open %s in AsyncAnimatedGif::EIO_Push.\n",
filename);
- return 0;
+ return;
}
int written = fwrite(push_req->data, sizeof(unsigned char), push_req->data_size, out);
if (written != push_req->data_size) {
fprintf(stderr, "Failed to write all data to %s. Wrote only %d of %d.\n",
filename, written, push_req->data_size);
}
- return 0;
+ return;
}
int
@@ -313,7 +313,7 @@ AsyncAnimatedGif::rect_dims(const char *fragment_name)
return Rect(x, y, w, h);
}
-int
+void
AsyncAnimatedGif::EIO_Encode(eio_req *req)
{
async_encode_request *enc_req = (async_encode_request *)req->data;
@@ -331,7 +331,7 @@ AsyncAnimatedGif::EIO_Encode(eio_req *req)
snprintf(error, 600, "Error in AsyncAnimatedGif::EIO_Encode %s is not a dir.",
fragment_path);
enc_req->error = strdup(error);
- return 0;
+ return;
}
char **fragments = find_files(fragment_path);
@@ -344,7 +344,7 @@ AsyncAnimatedGif::EIO_Encode(eio_req *req)
LOKI_ON_BLOCK_EXIT(free, frame);
if (!frame) {
enc_req->error = strdup("malloc failed in AsyncAnimatedGif::EIO_Encode.");
- return 0;
+ return;
}
for (int i = 0; i < nfragments; i++) {
@@ -356,7 +356,7 @@ AsyncAnimatedGif::EIO_Encode(eio_req *req)
snprintf(error, 600, "Failed opening %s in AsyncAnimatedGif::EIO_Encode.",
fragment_path);
enc_req->error = strdup(error);
- return 0;
+ return;
}
LOKI_ON_BLOCK_EXIT(fclose, in);
int size = file_size(fragment_path);
@@ -367,7 +367,7 @@ AsyncAnimatedGif::EIO_Encode(eio_req *req)
char error[600];
snprintf(error, 600, "Error - should have read %d but read only %d from %s in AsyncAnimatedGif::EIO_Encode", size, read, fragment_path);
enc_req->error = strdup(error);
- return 0;
+ return;
}
Rect dims = rect_dims(fragments[i]);
push_fragment(frame, gif->width, gif->height, gif->buf_type,
@@ -377,7 +377,7 @@ AsyncAnimatedGif::EIO_Encode(eio_req *req)
}
encoder.finish();
- return 0;
+ return;
}
int
View
4 src/async_animated_gif.h
@@ -35,10 +35,10 @@ class AsyncAnimatedGif : public node::ObjectWrap {
unsigned int push_id, fragment_id;
std::string tmp_dir, output_file;
- static int EIO_Push(eio_req *req);
+ static void EIO_Push(eio_req *req);
static int EIO_PushAfter(eio_req *req);
- static int EIO_Encode(eio_req *req);
+ static void EIO_Encode(eio_req *req);
static int EIO_EncodeAfter(eio_req *req);
static unsigned char *init_frame(int width, int height, Color &transparency_color);
View
8 src/dynamic_gif_stack.cpp
@@ -250,7 +250,7 @@ DynamicGifStack::GifEncodeSync(const Arguments &args)
return scope.Close(gif_stack->GifEncodeSync());
}
-int
+void
DynamicGifStack::EIO_GifEncode(eio_req *req)
{
encode_request *enc_req = (encode_request *)req->data;
@@ -266,7 +266,7 @@ DynamicGifStack::EIO_GifEncode(eio_req *req)
unsigned char *data = (unsigned char*)malloc(sizeof(*data)*gif->width*gif->height*3);
if (!data) {
enc_req->error = strdup("malloc failed in DynamicGifStack::EIO_GifEncode.");
- return 0;
+ return;
}
unsigned char *datap = data;
@@ -290,7 +290,7 @@ DynamicGifStack::EIO_GifEncode(eio_req *req)
enc_req->gif = (char *)malloc(sizeof(*enc_req->gif)*enc_req->gif_len);
if (!enc_req->gif) {
enc_req->error = strdup("malloc in DynamicGifStack::EIO_GifEncode failed.");
- return 0;
+ return;
}
else {
memcpy(enc_req->gif, encoder.get_gif(), enc_req->gif_len);
@@ -300,7 +300,7 @@ DynamicGifStack::EIO_GifEncode(eio_req *req)
enc_req->error = strdup(err);
}
- return 0;
+ return;
}
int
View
2 src/dynamic_gif_stack.h
@@ -39,7 +39,7 @@ class DynamicGifStack : public node::ObjectWrap {
std::pair<Point, Point> optimal_dimension();
- static int EIO_GifEncode(eio_req *req);
+ static void EIO_GifEncode(eio_req *req);
static int EIO_GifEncodeAfter(eio_req *req);
void construct_gif_data(unsigned char *data, Point &top);
View
6 src/gif.cpp
@@ -145,7 +145,7 @@ Gif::SetTransparencyColor(const Arguments &args)
return Undefined();
}
-int
+void
Gif::EIO_GifEncode(eio_req *req)
{
encode_request *enc_req = (encode_request *)req->data;
@@ -161,7 +161,7 @@ Gif::EIO_GifEncode(eio_req *req)
enc_req->gif = (char *)malloc(sizeof(*enc_req->gif)*enc_req->gif_len);
if (!enc_req->gif) {
enc_req->error = strdup("malloc in Gif::EIO_GifEncode failed.");
- return 0;
+ return;
}
else {
memcpy(enc_req->gif, encoder.get_gif(), enc_req->gif_len);
@@ -171,7 +171,7 @@ Gif::EIO_GifEncode(eio_req *req)
enc_req->error = strdup(err);
}
- return 0;
+ return;
}
int
View
2 src/gif.h
@@ -11,7 +11,7 @@ class Gif : public node::ObjectWrap {
buffer_type buf_type;
Color transparency_color;
- static int EIO_GifEncode(eio_req *req);
+ static void EIO_GifEncode(eio_req *req);
static int EIO_GifEncodeAfter(eio_req *req);
public:

0 comments on commit 5f6d745

Please sign in to comment.