- cppcheck fixes
- new macro to hanlde free on error path
- better error message in RIEx macros
merge-requests/1/head
Stphane Voltz 2013-02-11 21:50:00 +01:00
rodzic 1fb646582b
commit c62d5879a7
2 zmienionych plików z 30 dodań i 3 usunięć

Wyświetl plik

@ -325,7 +325,7 @@ genesys_shrink_lines_1 (
static SANE_Status
genesys_crop(Genesys_Scanner *s)
{
SANE_Status status = SANE_STATUS_GOOD;
SANE_Status status;
Genesys_Device *dev = s->dev;
int top = 0;
int bottom = 0;
@ -441,7 +441,7 @@ genesys_despeck(Genesys_Scanner *s)
static SANE_Status
genesys_derotate (Genesys_Scanner * s)
{
SANE_Status status = SANE_STATUS_GOOD;
SANE_Status status;
int angle = 0;
int resolution = s->val[OPT_RESOLUTION].w;

Wyświetl plik

@ -91,9 +91,36 @@
#define DBG_io2 7 /* io functions that are called very often */
#define DBG_data 8 /* log image data */
/**
* call a function and return on error
*/
#define RIE(function) \
do { status = function; \
if (status != SANE_STATUS_GOOD) return status; \
if (status != SANE_STATUS_GOOD) \
{ \
DBG(DBG_error, "%s: %s\n", __FUNCTION__, sane_strstatus (status)); \
return status; \
} \
} while (SANE_FALSE)
#define RIEF(function, mem) \
do { status = function; \
if (status != SANE_STATUS_GOOD) \
{ \
free(mem); \
DBG(DBG_error, "%s: %s\n", __FUNCTION__, sane_strstatus (status)); \
return status; \
} \
} while (SANE_FALSE)
#define RIEF2(function, mem1, mem2) \
do { status = function; \
if (status != SANE_STATUS_GOOD) \
{ \
free(mem1); \
free(mem2); \
return status; \
} \
} while (SANE_FALSE)
#define DBGSTART DBG (DBG_proc, "%s start\n", __FUNCTION__);