From ce731d0a121c4093e16364bc33688847419c5cf2 Mon Sep 17 00:00:00 2001 From: Michael Jauregui Date: Sat, 14 Jun 2025 23:28:57 -0300 Subject: [PATCH 01/14] hid/hid.c: set LIBAROMA_HID_EV_RET_EXIT event type When the hid_getevent() loop got LIBAROMA_HID_EV_RET_EXIT, it didn't set the event type after clearing; so the message queue loop never got a valid event. This prevented the application to receive and handle the LIBAROMA_MSG_EXIT message. It's working now :) Oh, and there was a minor indentation fix at hid/messages.c. --- src/aroma/hid/hid.c | 6 +++++- src/aroma/hid/messages.c | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/aroma/hid/hid.c b/src/aroma/hid/hid.c index ea42727..b89b0e8 100644 --- a/src/aroma/hid/hid.c +++ b/src/aroma/hid/hid.c @@ -298,13 +298,17 @@ byte libaroma_hid_get(LIBAROMA_HID_EVENTP e) { } /* clean destination variable */ memset(e, 0, sizeof(LIBAROMA_HID_EVENT)); - ALOGI("libaroma_hid_get got LIBAROMA_HID_EV_TYPE_EXIT"); + ALOGI("libaroma_hid_get got LIBAROMA_HID_EV_RET_EXIT"); + /* set type in order to post it */ + e->type=LIBAROMA_HID_EV_RET_EXIT; return ret; break; case LIBAROMA_HID_EV_RET_ERROR: /* clean destination variable */ memset(e, 0, sizeof(LIBAROMA_HID_EVENT)); ALOGE("libaroma_hid_get got LIBAROMA_HID_EV_RET_ERROR"); + /* set type in order to post it */ + e->type=LIBAROMA_HID_EV_RET_ERROR; return ret; break; case LIBAROMA_HID_EV_RET_TOUCH: { diff --git a/src/aroma/hid/messages.c b/src/aroma/hid/messages.c index 2143031..66e2e28 100644 --- a/src/aroma/hid/messages.c +++ b/src/aroma/hid/messages.c @@ -82,8 +82,7 @@ static void* _libaroma_msgqueue_hid_thread(void* cookie) { break; case LIBAROMA_HID_EV_TYPE_KEY: /* post key message */ - libaroma_msg_post_hid(LIBAROMA_MSG_KEY(ret), e.state, e.key, e.x, - e.y); + libaroma_msg_post_hid(LIBAROMA_MSG_KEY(ret), e.state, e.key, e.x, e.y); break; case LIBAROMA_HID_EV_RET_EXIT: libaroma_msg_post_hid(LIBAROMA_MSG_EXIT, 0, 0, 0, 0); From bc7b050aaed835dfeabe287f3cc176a7df503995 Mon Sep 17 00:00:00 2001 From: Michael Jauregui Date: Sat, 14 Jun 2025 23:40:34 -0300 Subject: [PATCH 02/14] src/fallbacks.h: switch to a "better" MIN/MAX macro alternative At the start, libaroma used the typical MIN/MAX macros: ``` #define MIN (((a)<(b))?(a):(b)) #define MAX (((a)>(b))?(a):(b)) ``` That always kinda worked, but double-evaluation may cause nasty bugs which are pretty hard to find. With the 1.5 update, the macros were changed to inline functions; this handled the double-evaluation issue at the cost of needing one function for every compared type (int, float and double), and needing to update all the macro usages for the right function (ensuring proper type and signedness comparison). That change also broke some animations, due to the wrong function being used (e.g. int MIN/MAX used for float values). The approach taken in this commit aims to prevent further issues: At the cost of needing two GNU extensions, we can use a macro that handles the data types properly while using a single evaluation. The result is pretty much like the inline functions without having to care about multiple types :D The corresponding changes were reverted in control's code, too. --- include/aroma/types.h | 21 ---------------- src/aroma/controls/ctl_bar.c | 4 ++-- src/aroma/controls/ctl_pager.c | 2 +- src/aroma/controls/listitem/listitem_option.c | 4 ++-- src/aroma/graph/engine/color.c | 4 ++-- src/fallbacks.h | 24 +++++++++---------- 6 files changed, 18 insertions(+), 41 deletions(-) diff --git a/include/aroma/types.h b/include/aroma/types.h index 2797a49..c340215 100644 --- a/include/aroma/types.h +++ b/include/aroma/types.h @@ -48,25 +48,4 @@ typedef void * voidp; typedef uint32_t uchar; typedef uchar * ucharp; -/* MIN / MAX */ -static inline int __MAX(int a, int b){ - return (a>b)?a:b; -} -static inline int __MIN(int a, int b){ - return (ab)?a:b; -} -static inline float __FMIN(float a, float b){ - return (ab)?a:b; -} -static inline double __DMIN(double a, double b){ - return (atools){ if (switch_idtools->n){ float outstate = 1.0-libaroma_cubic_bezier_swiftout( - __FMIN(__FMAX(0,( + MIN(MAX(0,( libaroma_ripple_current(&me->ripple,release_state)-0.5) *2),1) ); if (me->touched_switch>=2){ float xstate = libaroma_cubic_bezier_swiftout( - __FMIN(libaroma_ripple_current(&me->ripple,release_state)*2,1) + MIN(libaroma_ripple_current(&me->ripple,release_state)*2,1) ); _libaroma_ctl_bar_draw_switch( ctl, c, switch_id, 1, xstate, 0xff * outstate diff --git a/src/aroma/controls/ctl_pager.c b/src/aroma/controls/ctl_pager.c index dde37df..0313225 100644 --- a/src/aroma/controls/ctl_pager.c +++ b/src/aroma/controls/ctl_pager.c @@ -872,7 +872,7 @@ byte libaroma_ctl_pager_set_active_page( if (dx!=0) { int width = ctl->w; int halfWidth = width / 2; - float distanceRatio = __FMIN(1.0, 1.0 * abs(dx) / width); + float distanceRatio = MIN(1.0, 1.0 * abs(dx) / width); distanceRatio -= 0.5; distanceRatio *= 0.3; distanceRatio = sin(distanceRatio); diff --git a/src/aroma/controls/listitem/listitem_option.c b/src/aroma/controls/listitem/listitem_option.c index 098f31b..0b2e191 100644 --- a/src/aroma/controls/listitem/listitem_option.c +++ b/src/aroma/controls/listitem/listitem_option.c @@ -320,9 +320,9 @@ void _libaroma_listitem_option_draw( relstate=1; } else{ - relstate=__FMAX(__FMIN((curelstate-0.25) * 2,1),0); + relstate=MAX(MIN((curelstate-0.25) * 2,1),0); relstate=libaroma_cubic_bezier_swiftout(relstate); - relstate=__FMAX(__FMIN(1,relstate),0); + relstate=MAX(MIN(1,relstate),0); } } } diff --git a/src/aroma/graph/engine/color.c b/src/aroma/graph/engine/color.c index e2699b2..6f1afc5 100644 --- a/src/aroma/graph/engine/color.c +++ b/src/aroma/graph/engine/color.c @@ -141,8 +141,8 @@ int libaroma_color_hue(word color, int * saturation, int * luminance){ red/=255; green/=255; blue/=255; - float mn = __FMIN(__FMIN(red, green), blue); - float mx = __FMAX(__FMAX(red, green), blue); + float mn = MIN(MIN(red, green), blue); + float mx = MAX(MAX(red, green), blue); float hue = 0.0; if (mx == red) { diff --git a/src/fallbacks.h b/src/fallbacks.h index 0913420..4e3637b 100644 --- a/src/fallbacks.h +++ b/src/fallbacks.h @@ -27,23 +27,21 @@ #ifndef __libaroma_fallbacks_h__ #define __libaroma_fallbacks_h__ -/* min & max fallback */ +/* min/max fallback*/ #ifndef MIN -// #define MIN(a,b) (((a)<(b))?(a):(b)) -#else - #undef MIN + #define MIN(a, b) ({ \ + __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + _a > _b ? _a : _b; \ + }) #endif #ifndef MAX -// #define MAX(a,b) (((a)>(b))?(a):(b)) -#else - #undef MAX + #define MAX(a, b) ({ \ + __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + _a > _b ? _a : _b; \ + }) #endif -// #define MAX(a,b) ((__typeof__ (a)) __MAX(a,b)) -// #define MIN(a,b) ((__typeof__ (a)) __MIN(a,b)) - -#define MAX __MAX -#define MIN __MIN - #endif /* __libaroma_fallbacks_h__ */ From ef920b0d403461a2a164be14064d59a2c423f383 Mon Sep 17 00:00:00 2001 From: Michael Jauregui Date: Sun, 15 Jun 2025 00:03:56 -0300 Subject: [PATCH 03/14] platform/sdl: fix SDL building & correct #ifndef/#define Adjusted the SDL.h header path (it should always be inside a SDL directory in the compiler's include path). Also, fixed the main define check at platform.c --- src/contrib/platform/sdl/fb_driver.h | 2 +- src/contrib/platform/sdl/hid_driver.c | 4 ++-- src/contrib/platform/sdl/platform.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/contrib/platform/sdl/fb_driver.h b/src/contrib/platform/sdl/fb_driver.h index 79c030d..71a0684 100644 --- a/src/contrib/platform/sdl/fb_driver.h +++ b/src/contrib/platform/sdl/fb_driver.h @@ -31,7 +31,7 @@ #include #include #include -#include "SDL.h" +#include #include #ifdef LIBAROMA_CONFIG_OPENMP diff --git a/src/contrib/platform/sdl/hid_driver.c b/src/contrib/platform/sdl/hid_driver.c index a75ab2d..f7190db 100644 --- a/src/contrib/platform/sdl/hid_driver.c +++ b/src/contrib/platform/sdl/hid_driver.c @@ -40,7 +40,7 @@ #include #include #include -#include "SDL.h" +#include /* * structure : internal driver data @@ -113,7 +113,7 @@ byte LINUXHIDRV_getinput( /* polling loop */ do { - if(SDL_PollEvent(&event)) { + if(SDL_WaitEvent(&event)) { switch(event.type) { case SDL_QUIT: return LIBAROMA_HID_EV_RET_EXIT; diff --git a/src/contrib/platform/sdl/platform.c b/src/contrib/platform/sdl/platform.c index f21ab54..d049125 100644 --- a/src/contrib/platform/sdl/platform.c +++ b/src/contrib/platform/sdl/platform.c @@ -22,7 +22,7 @@ * */ #ifndef __libaroma_platform_c__ -#define __libaroma_platform +#define __libaroma_platform_c__ #include #include From 890adeed93e1dbed36c452505af08ce97a18defa Mon Sep 17 00:00:00 2001 From: Michael Jauregui Date: Sun, 15 Jun 2025 00:06:54 -0300 Subject: [PATCH 04/14] json: fix switch/case falling through --- src/aroma/utils/json.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/aroma/utils/json.c b/src/aroma/utils/json.c index e15dce2..e1289fe 100644 --- a/src/aroma/utils/json.c +++ b/src/aroma/utils/json.c @@ -365,17 +365,18 @@ static const char * parse_string(cJSON * item, const char * str) { case 4: *--ptr2 = ((uc | 0x80) & 0xBF); uc >>= 6; - + break; case 3: *--ptr2 = ((uc | 0x80) & 0xBF); uc >>= 6; - + break; case 2: *--ptr2 = ((uc | 0x80) & 0xBF); uc >>= 6; - + break; case 1: *--ptr2 = (uc | firstByteMark[len]); + break; } ptr2 += len; From ce0f22666436ffd276e416f2ecae90e3a4f5cd8b Mon Sep 17 00:00:00 2001 From: Michael Jauregui Date: Sun, 15 Jun 2025 00:07:59 -0300 Subject: [PATCH 05/14] graph/draw: use float variant of abs() where needed --- src/aroma/graph/draw/commondraw.c | 8 ++++---- src/aroma/graph/draw/path.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/aroma/graph/draw/commondraw.c b/src/aroma/graph/draw/commondraw.c index 6cfb64a..003bb8b 100644 --- a/src/aroma/graph/draw/commondraw.c +++ b/src/aroma/graph/draw/commondraw.c @@ -517,8 +517,8 @@ byte libaroma_draw_subpixel( int pos = y * dest->l; for (x=floor(dx-ht);x<=ceil(dx+ht);x++){ if ((x>=0)&&(xw)){ - px = abs((dxdata + pos + x; word cl = libaroma_alpha(*d, color, alp); @@ -729,7 +729,7 @@ byte _libaroma_draw_arc_findpoint( } float xt = dx + radius_w*cos(radian); float yt = dy + radius_h*sin(radian); - if ((abs(xt-xt0)>=2)||(abs(yt-yt0)>=2)) { + if ((fabs(xt-xt0)>=2)||(fabs(yt-yt0)>=2)) { _libaroma_draw_arc_findpoint( path, dx, dy, radius_w, radius_h, xt0, yt0, xt, yt, @@ -738,7 +738,7 @@ byte _libaroma_draw_arc_findpoint( } libaroma_path_add(path, xt, yt); - if ((abs(xt-xt1)>=2)||(abs(yt-yt1)>=2)) { + if ((fabs(xt-xt1)>=2)||(fabs(yt-yt1)>=2)) { _libaroma_draw_arc_findpoint( path, dx, dy, radius_w, radius_h, xt, yt, xt1, yt1, diff --git a/src/aroma/graph/draw/path.c b/src/aroma/graph/draw/path.c index 460b0a8..7d4242c 100644 --- a/src/aroma/graph/draw/path.c +++ b/src/aroma/graph/draw/path.c @@ -150,13 +150,13 @@ byte _libaroma_path_curve_findpoint( float xt, yt; libaroma_path_curve_calc(thalf, &xt, &yt,x0,y0,x1,y1,x2,y2,x3,y3); - if ((abs(xt-xt0)>=2)||(abs(yt-yt0)>=2)) { + if ((fabs(xt-xt0)>=2)||(fabs(yt-yt0)>=2)) { _libaroma_path_curve_findpoint( path,t0,thalf,x0,y0,x1,y1,x2,y2,x3,y3,xt0,yt0,xt,yt); } libaroma_path_add(path, xt, yt); - if ((abs(xt-xt1)>=2)||(abs(yt-yt1)>=2)) { + if ((fabs(xt-xt1)>=2)||(fabs(yt-yt1)>=2)) { _libaroma_path_curve_findpoint( path,thalf,t1,x0,y0,x1,y1,x2,y2,x3,y3,xt,yt,xt1,yt1); } From 55daa56c9ff5fcecdd6253c0a3461642709b1400 Mon Sep 17 00:00:00 2001 From: Michael Jauregui Date: Sun, 15 Jun 2025 00:09:06 -0300 Subject: [PATCH 06/14] utils/stream.c: use unsigned int for mem_sz --- src/aroma/utils/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aroma/utils/stream.c b/src/aroma/utils/stream.c index 3fbd3f3..cddd1c2 100644 --- a/src/aroma/utils/stream.c +++ b/src/aroma/utils/stream.c @@ -333,7 +333,7 @@ LIBAROMA_STREAMP libaroma_stream( #endif else if (strcmp(kwd, "mem://") == 0) { unsigned int mem; - int mem_sz; + unsigned int mem_sz; int rc; rc = sscanf(uri+6, "0x%x-0x%x", &mem, &mem_sz); From 7ea4343fbcc28224c35d3c7e2822877b06ceeb8a Mon Sep 17 00:00:00 2001 From: Michael Jauregui Date: Sun, 15 Jun 2025 00:10:40 -0300 Subject: [PATCH 07/14] build/x86_64: fix jpeg-turbo building Since building libjpeg-turbo with SSE support needs a NASM compiler which the build system doesn't support, I just disabled SIMD for it. Not the best fix, but I couldn't find a way to make it work with GCC. --- build/build-x86_64.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build/build-x86_64.sh b/build/build-x86_64.sh index 9560326..e670ec9 100644 --- a/build/build-x86_64.sh +++ b/build/build-x86_64.sh @@ -40,6 +40,7 @@ export LIBS_PATH=${LIBAROMA_PATH}/libs ## ARCH dependent sources ## export LIBEXTERNALS_ADD_SRC=" + ${LIBS_PATH}/jpeg-turbo/jsimd_none.c " export LIBAROMA_ARCH_FLAGS=" From 4d409985286d0f90b5ff23aaa7ead70dc4b345a3 Mon Sep 17 00:00:00 2001 From: Michael Jauregui Date: Fri, 20 Jun 2025 13:30:16 -0300 Subject: [PATCH 08/14] ctl/fragment: use unsigned window count --- src/aroma/controls/ctl_fragment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aroma/controls/ctl_fragment.c b/src/aroma/controls/ctl_fragment.c index eecdf3c..8541336 100644 --- a/src/aroma/controls/ctl_fragment.c +++ b/src/aroma/controls/ctl_fragment.c @@ -74,7 +74,7 @@ typedef struct __LIBAROMA_CTL_FRAGMENT _LIBAROMA_CTL_FRAGMENT; typedef struct __LIBAROMA_CTL_FRAGMENT * _LIBAROMA_CTL_FRAGMENTP; struct __LIBAROMA_CTL_FRAGMENT{ LIBAROMA_WINDOWP * wins; - int win_n; + unsigned int win_n; int win_pos; int win_pos_out; byte win_cleanup; From 97614234c66dcdadb006f99cef24d9ed21183142 Mon Sep 17 00:00:00 2001 From: Michael Jauregui Date: Fri, 20 Jun 2025 13:31:04 -0300 Subject: [PATCH 09/14] ctl/list: handle negative thread counts --- src/aroma/controls/ctl_list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aroma/controls/ctl_list.c b/src/aroma/controls/ctl_list.c index 6397dd2..2615319 100644 --- a/src/aroma/controls/ctl_list.c +++ b/src/aroma/controls/ctl_list.c @@ -84,7 +84,7 @@ byte __libaroma_ctl_list_item_reg_thread( */ LIBAROMA_CTL_LISTP mi = (LIBAROMA_CTL_LISTP) client->internal; - if (mi->threadn==0){ + if (mi->threadn < 1){ mi->threads = (LIBAROMA_CTL_LIST_ITEMP *) malloc(sizeof(LIBAROMA_CTL_LIST_ITEMP)); mi->threads[0] = item; From 7592a0a179395b43a7d05bb9595644657f7e14a5 Mon Sep 17 00:00:00 2001 From: Michael Jauregui Date: Fri, 20 Jun 2025 13:32:44 -0300 Subject: [PATCH 10/14] graph/canvas: fix blank() hicolor handling --- src/aroma/graph/canvas.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/aroma/graph/canvas.c b/src/aroma/graph/canvas.c index ad17d93..3544111 100644 --- a/src/aroma/graph/canvas.c +++ b/src/aroma/graph/canvas.c @@ -70,12 +70,12 @@ void libaroma_canvas_blank( memset(c->data, 0, c->s*2); if (c->alpha != NULL) { - memset(c->alpha, 0xff, c->s); + if (c->hicolor != NULL) { + memset(c->alpha, 0x00, c->s); + } + else memset(c->alpha, 0xff, c->s); } - if (c->hicolor != NULL) { - memset(c->alpha, 0x00, c->s); - } } else { /* Unaligned Canvas */ From 8b055332c8c3726a0e8595dd0105296418d9fa0d Mon Sep 17 00:00:00 2001 From: Michael Jauregui Date: Fri, 20 Jun 2025 13:33:45 -0300 Subject: [PATCH 11/14] graph/png: fix png_save() memory leak --- src/aroma/graph/png.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aroma/graph/png.c b/src/aroma/graph/png.c index 3011429..fc443de 100644 --- a/src/aroma/graph/png.c +++ b/src/aroma/graph/png.c @@ -751,7 +751,9 @@ int libaroma_png_save_buffer( png_write_end(png_ptr, NULL); result = adapter->p; finalize: - + if (adapter != NULL) { + free(adapter); + } if (info_ptr != NULL) { png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); } From dff71e67fe96fd7a424402a653ec3930e10b0973 Mon Sep 17 00:00:00 2001 From: Michael Jauregui Date: Fri, 20 Jun 2025 13:42:22 -0300 Subject: [PATCH 12/14] graph/text: prevent weird pointer cast issues --- src/aroma/graph/text/text_line.c | 4 ++-- src/aroma/graph/text/text_structures.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/aroma/graph/text/text_line.c b/src/aroma/graph/text/text_line.c index 5584e52..70c8717 100644 --- a/src/aroma/graph/text/text_line.c +++ b/src/aroma/graph/text/text_line.c @@ -481,7 +481,7 @@ _LIBAROMA_TEXTLINEP libaroma_textline( /* return hr now */ align = chunk->curr_state.flags & _LIBAROMA_TEXTCHUNK_ALIGN_BITWISE; - indent_size = (int) chunk->pending_data->param; + indent_size = (int) chunk->pending_data->dparam; limit_width -= indent_size; /* set line height */ line->h = libaroma_font_size_px( @@ -839,7 +839,7 @@ _LIBAROMA_TEXTLINEP libaroma_textline( chunk->pending_data = (_LIBAROMA_TEXTPENDINGP) malloc(sizeof(_LIBAROMA_TEXTPENDING)); chunk->pending_data->type = _LIBAROMA_TEXTSPAN_HR; - chunk->pending_data->param = (voidp) indent_size; + chunk->pending_data->dparam = (dword) indent_size; /* new line first */ return libaroma_textline_align( line, chunk, align, x, indent_size, limit_width); diff --git a/src/aroma/graph/text/text_structures.h b/src/aroma/graph/text/text_structures.h index 1bd1f0d..1307d1c 100644 --- a/src/aroma/graph/text/text_structures.h +++ b/src/aroma/graph/text/text_structures.h @@ -85,6 +85,7 @@ typedef struct __LIBAROMA_TEXTPENDING * _LIBAROMA_TEXTPENDINGP; struct __LIBAROMA_TEXTPENDING{ byte type; voidp param; + dword dparam; }; /* From e10485c1e4486ecae50850ace43903d97b4155c8 Mon Sep 17 00:00:00 2001 From: Michael Jauregui Date: Fri, 20 Jun 2025 13:42:49 -0300 Subject: [PATCH 13/14] platform/sdl: free struct on SDL_Init() fail --- src/contrib/platform/sdl/fb_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/contrib/platform/sdl/fb_driver.c b/src/contrib/platform/sdl/fb_driver.c index 2672b3e..8709f79 100644 --- a/src/contrib/platform/sdl/fb_driver.c +++ b/src/contrib/platform/sdl/fb_driver.c @@ -104,7 +104,8 @@ byte SDLFBDR_init(LIBAROMA_FBP me) { } if(SDL_Init(SDL_INIT_VIDEO) < 0) { - ALOGE("Couldn't init SDL: %s", SDL_GetError()); + ALOGE("Couldn't init SDL: %s", SDL_GetError()); + free(mi); return 0; } From c6d4b6e753bac1b72d4ecfb4ee2a350c346d283f Mon Sep 17 00:00:00 2001 From: Michael Jauregui Date: Fri, 20 Jun 2025 13:43:17 -0300 Subject: [PATCH 14/14] aroma/debug: add braces to log macros --- src/aroma/debug/debug.h | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/aroma/debug/debug.h b/src/aroma/debug/debug.h index aac9039..904205f 100644 --- a/src/aroma/debug/debug.h +++ b/src/aroma/debug/debug.h @@ -96,20 +96,22 @@ char * libaroma_debug_tag(); /* Error Logs */ #if LIBAROMA_CONFIG_DEBUG >= 1 -#define ALOGE(...) \ +#define ALOGE(...) { \ fprintf(libaroma_debug_output(), "E/%s: ",libaroma_debug_tag()); \ fprintf(libaroma_debug_output(), __VA_ARGS__); \ - fprintf(libaroma_debug_output(), "%s\n",LIBAROMA_DEBUG_SOURCE); + fprintf(libaroma_debug_output(), "%s\n",LIBAROMA_DEBUG_SOURCE); \ +} #else #define ALOGE(...) #endif /* Process/Info Logs */ #if LIBAROMA_CONFIG_DEBUG >= 2 -#define ALOGI(...) \ +#define ALOGI(...) { \ fprintf(libaroma_debug_output(), "I/%s: ",libaroma_debug_tag()); \ fprintf(libaroma_debug_output(), __VA_ARGS__); \ - fprintf(libaroma_debug_output(), "\n"); + fprintf(libaroma_debug_output(), "\n"); \ +} #define ALOGI_IF(x, ...) if(x){ ALOGI(__VA_ARGS__) } #else #define ALOGI(...) @@ -118,10 +120,11 @@ char * libaroma_debug_tag(); /* Important String Information Logs */ #if LIBAROMA_CONFIG_DEBUG >= 3 -#define ALOGS(...) \ +#define ALOGS(...) { \ fprintf(libaroma_debug_output(), "N/%s: ",libaroma_debug_tag()); \ fprintf(libaroma_debug_output(), __VA_ARGS__); \ - fprintf(libaroma_debug_output(), "\n"); + fprintf(libaroma_debug_output(), "\n"); \ +} #define ALOGS_IF(x, ...) if(x){ ALOGS(__VA_ARGS__) } #else #define ALOGS(...) @@ -132,10 +135,11 @@ char * libaroma_debug_tag(); /* Warning Logs */ #if LIBAROMA_CONFIG_DEBUG >= 4 -#define ALOGW(...) \ +#define ALOGW(...) { \ fprintf(libaroma_debug_output(), "W/%s: ",libaroma_debug_tag()); \ fprintf(libaroma_debug_output(), __VA_ARGS__); \ - fprintf(libaroma_debug_output(), "%s\n",LIBAROMA_DEBUG_SOURCE); + fprintf(libaroma_debug_output(), "%s\n",LIBAROMA_DEBUG_SOURCE); \ +} #define ALOGW_IF(x, ...) if(x){ ALOGW(__VA_ARGS__) } #else #define ALOGW(...) @@ -144,10 +148,11 @@ char * libaroma_debug_tag(); /* Verbose Logs */ #if LIBAROMA_CONFIG_DEBUG >= 5 -#define ALOGV(...) \ +#define ALOGV(...) { \ fprintf(libaroma_debug_output(), "D/%s: ",libaroma_debug_tag()); \ fprintf(libaroma_debug_output(), __VA_ARGS__); \ - fprintf(libaroma_debug_output(), "\n"); + fprintf(libaroma_debug_output(), "\n"); \ +} #define ALOGV_IF(x, ...) if(x){ ALOGV(__VA_ARGS__) } #else #define ALOGV(...) @@ -159,10 +164,11 @@ char * libaroma_debug_tag(); /* Event Logs */ #if LIBAROMA_CONFIG_DEBUG >= 6 -#define ALOGT(...) \ +#define ALOGT(...) { \ fprintf(libaroma_debug_output(), "V/%s: ",libaroma_debug_tag()); \ fprintf(libaroma_debug_output(), __VA_ARGS__); \ - fprintf(libaroma_debug_output(), "\n"); + fprintf(libaroma_debug_output(), "\n"); \ +} #define ALOGT_IF(x, ...) if(x){ ALOGT(__VA_ARGS__) } #else #define ALOGT(...) @@ -171,10 +177,11 @@ char * libaroma_debug_tag(); /* Event Logs */ #if LIBAROMA_CONFIG_DEBUG >= 7 -#define ALOGRT(...) \ +#define ALOGRT(...) { \ fprintf(libaroma_debug_output(), "V/%s: ",libaroma_debug_tag()); \ fprintf(libaroma_debug_output(), __VA_ARGS__); \ - fprintf(libaroma_debug_output(), "\n"); + fprintf(libaroma_debug_output(), "\n"); \ +} #define ALOGRT_IF(x, ...) if(x){ ALOGRT(__VA_ARGS__) } #else #define ALOGRT(...)