summaryrefslogtreecommitdiffstats
path: root/ipecamera/events.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2011-12-12 10:01:53 +0100
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2011-12-12 10:01:53 +0100
commit3ee180e93e32c46f3949d1177266a47849b3af70 (patch)
treeda8911fd1e662e45abe019f9570ac947d2b2b10f /ipecamera/events.c
parent5539f1abc90c28b9ea5e559edc87aa84abb377c3 (diff)
downloadipecamera-3ee180e93e32c46f3949d1177266a47849b3af70.tar.gz
ipecamera-3ee180e93e32c46f3949d1177266a47849b3af70.tar.bz2
ipecamera-3ee180e93e32c46f3949d1177266a47849b3af70.tar.xz
ipecamera-3ee180e93e32c46f3949d1177266a47849b3af70.zip
Fix handling of return values from frame decoder and event callback
Diffstat (limited to 'ipecamera/events.c')
-rw-r--r--ipecamera/events.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ipecamera/events.c b/ipecamera/events.c
index 58d2971..173423b 100644
--- a/ipecamera/events.c
+++ b/ipecamera/events.c
@@ -21,7 +21,7 @@
#include "events.h"
int ipecamera_stream(pcilib_context_t *vctx, pcilib_event_callback_t callback, void *user) {
- int err = 0;
+ int res, err = 0;
int do_stop = 0;
ipecamera_event_info_t info;
@@ -54,9 +54,9 @@ int ipecamera_stream(pcilib_context_t *vctx, pcilib_event_callback_t callback, v
memcpy(&info, ctx->frame + ((ctx->reported_id-1)%ctx->buffer_size), sizeof(ipecamera_event_info_t));
if ((ctx->event_id - ctx->reported_id) < ctx->buffer_size) {
- err = callback(ctx->reported_id, (pcilib_event_info_t*)&info, user);
- if (err <= 0) {
- if (err < 0) err = -err;
+ res = callback(ctx->reported_id, (pcilib_event_info_t*)&info, user);
+ if (res <= 0) {
+ if (res < 0) err = -res;
break;
}
}