diff --git a/build/build-x86_64.sh b/build/build-x86_64.sh index 9560326e..e670ec9b 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=" diff --git a/include/aroma/types.h b/include/aroma/types.h index 2797a491..c3402155 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_fragment.c b/src/aroma/controls/ctl_fragment.c index eecdf3c3..8541336c 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; diff --git a/src/aroma/controls/ctl_list.c b/src/aroma/controls/ctl_list.c index 6397dd26..26153191 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; diff --git a/src/aroma/controls/ctl_pager.c b/src/aroma/controls/ctl_pager.c index dde37dfc..03132256 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 098f31b0..0b2e191a 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/debug/debug.h b/src/aroma/debug/debug.h index aac9039a..904205fa 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(...) diff --git a/src/aroma/graph/canvas.c b/src/aroma/graph/canvas.c index ad17d934..35441119 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 */ diff --git a/src/aroma/graph/draw/commondraw.c b/src/aroma/graph/draw/commondraw.c index 6cfb64a4..003bb8b0 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 460b0a80..7d4242c4 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); } diff --git a/src/aroma/graph/engine/color.c b/src/aroma/graph/engine/color.c index e2699b26..6f1afc5c 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/aroma/graph/png.c b/src/aroma/graph/png.c index 30114297..fc443de3 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); } diff --git a/src/aroma/graph/text/text_line.c b/src/aroma/graph/text/text_line.c index 5584e52c..70c87179 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 1bd1f0d8..1307d1c9 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; }; /* diff --git a/src/aroma/hid/hid.c b/src/aroma/hid/hid.c index ea427279..b89b0e86 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 21430310..66e2e288 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); diff --git a/src/aroma/utils/json.c b/src/aroma/utils/json.c index e15dce20..e1289fea 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; diff --git a/src/aroma/utils/stream.c b/src/aroma/utils/stream.c index 3fbd3f30..cddd1c25 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); diff --git a/src/contrib/platform/sdl/fb_driver.c b/src/contrib/platform/sdl/fb_driver.c index 2672b3ed..8709f79c 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; } diff --git a/src/contrib/platform/sdl/fb_driver.h b/src/contrib/platform/sdl/fb_driver.h index 79c030df..71a0684d 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 a75ab2d3..f7190dba 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 f21ab54e..d049125c 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 diff --git a/src/fallbacks.h b/src/fallbacks.h index 09134208..4e3637be 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__ */