diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2011-04-03 15:49:36 +0200 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@gmail.com> | 2012-03-20 15:30:23 +0100 |
commit | c1403ee6bf4dfdd8f614f84ef145083b06a9f23e (patch) | |
tree | a0f72aa7e4ca235d3017760891bebc964dd530d8 /common/lz_decompress_tmpl.c | |
parent | bb133148d85e66349b34375dd849d5d8c422da67 (diff) | |
download | spice-common-c1403ee6bf4dfdd8f614f84ef145083b06a9f23e.tar.gz spice-common-c1403ee6bf4dfdd8f614f84ef145083b06a9f23e.tar.xz spice-common-c1403ee6bf4dfdd8f614f84ef145083b06a9f23e.zip |
Use a log handler to modify abort() behaviour
Be more library friendly, by not aborting in library errors.
spice_common now includes a proper log handler that will abort by
default when reaching a warning.
SPICE_ABORT_LEVEL can be changed to modify run-time abort level.
SPICE_DEBUG_LEVEL can be changed to be more verbose. By default, only
log level more importants than WARNING.
Only memory-related functions are allowed to abort(), since they are
not recoverable errors in the library.
Diffstat (limited to 'common/lz_decompress_tmpl.c')
-rw-r--r-- | common/lz_decompress_tmpl.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/common/lz_decompress_tmpl.c b/common/lz_decompress_tmpl.c index b0cbb2a..fb41e77 100644 --- a/common/lz_decompress_tmpl.c +++ b/common/lz_decompress_tmpl.c @@ -254,9 +254,9 @@ static size_t FNAME(decompress)(Encoder *encoder, OUT_PIXEL *out_buf, int size) #endif ref -= ofs; - ASSERT(encoder->usr, op + len <= op_limit); - ASSERT(encoder->usr, ref + len <= op_limit); - ASSERT(encoder->usr, ref >= out_buf); + spice_assert(op + len <= op_limit); + spice_assert(ref + len <= op_limit); + spice_assert(ref >= out_buf); // TODO: optimize by not calling loop at least 3 times when not PLT_TO_RGB32 (len is // always >=3). in PLT_TO_RGB32 len >= 3*number_of_pixels_per_byte @@ -270,29 +270,29 @@ static size_t FNAME(decompress)(Encoder *encoder, OUT_PIXEL *out_buf, int size) OUT_PIXEL b = *ref; for (; len; --len) { COPY_PIXEL(b, op); - ASSERT(encoder->usr, op <= op_limit); + spice_assert(op <= op_limit); } } else { for (; len; --len) { COPY_REF_PIXEL(ref, op); - ASSERT(encoder->usr, op <= op_limit); + spice_assert(op <= op_limit); } } } else { // copy ctrl++; // copy count is biased by 1 #if defined(TO_RGB32) && (defined(PLT4_BE) || defined(PLT4_LE) || defined(PLT1_BE) || \ defined(PLT1_LE)) - ASSERT(encoder->usr, op + CAST_PLT_DISTANCE(ctrl) <= op_limit); + spice_assert(op + CAST_PLT_DISTANCE(ctrl) <= op_limit); #else - ASSERT(encoder->usr, op + ctrl <= op_limit); + spice_assert(op + ctrl <= op_limit); #endif COPY_COMP_PIXEL(encoder, op); - ASSERT(encoder->usr, op <= op_limit); + spice_assert(op <= op_limit); for (--ctrl; ctrl; ctrl--) { COPY_COMP_PIXEL(encoder, op); - ASSERT(encoder->usr, op <= op_limit); + spice_assert(op <= op_limit); } } |