changeset 4449:cb49f6384eb5 libavcodec

Simplify checks, use that we know that cnt will not be < 0
author reimar
date Wed, 31 Jan 2007 21:00:48 +0000
parents 2dd1ace1919c
children 224f2889a9df
files lzo.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lzo.c	Wed Jan 31 20:57:30 2007 +0000
+++ b/lzo.c	Wed Jan 31 21:00:48 2007 +0000
@@ -86,11 +86,11 @@
 static inline void copy(LZOContext *c, int cnt) {
     register uint8_t *src = c->in;
     register uint8_t *dst = c->out;
-    if (src + cnt > c->in_end || src + cnt < src) {
+    if (cnt > c->in_end - src) {
         cnt = c->in_end - src;
         c->error |= LZO_INPUT_DEPLETED;
     }
-    if (dst + cnt > c->out_end || dst + cnt < dst) {
+    if (cnt > c->out_end - dst) {
         cnt = c->out_end - dst;
         c->error |= LZO_OUTPUT_FULL;
     }
@@ -121,7 +121,7 @@
         c->error |= LZO_INVALID_BACKPTR;
         return;
     }
-    if (dst + cnt > c->out_end || dst +  cnt < dst) {
+    if (cnt > c->out_end - dst) {
         cnt = c->out_end - dst;
         c->error |= LZO_OUTPUT_FULL;
     }