# HG changeset patch # User Thinker K.F. Li # Date 1217021551 -28800 # Node ID 7cfecdce94cc5606d618c08237f7b8a5d81d3fdb # Parent 6eecdd331fe7bd02869b83389c5e0c8fc97d08dc Remove warning messages diff -r 6eecdd331fe7 -r 7cfecdce94cc src/Makefile --- a/src/Makefile Sat Jul 26 04:27:52 2008 +0800 +++ b/src/Makefile Sat Jul 26 05:32:31 2008 +0800 @@ -1,7 +1,7 @@ SRCS = coord.c geo.c shape_path.c OBJS = ${SRCS:C/(.*)\.c/\1.o/g} TESTCASE_OBJS = ${SRCS:C/(.*)\.c/testcase-\1.o/g} -CFLAGS = -I/usr/local/include `pkg-config --cflags cairo` +CFLAGS = -Wall -I/usr/local/include `pkg-config --cflags cairo` LDFLAGS = `pkg-config --libs cairo` BINS = testcase X_main diff -r 6eecdd331fe7 -r 7cfecdce94cc src/X_main.c --- a/src/X_main.c Sat Jul 26 04:27:52 2008 +0800 +++ b/src/X_main.c Sat Jul 26 05:32:31 2008 +0800 @@ -3,6 +3,7 @@ #include #include #include +#include #include #include "shapes.h" @@ -81,4 +82,5 @@ sleep(10); XCloseDisplay(display); + return 0; } diff -r 6eecdd331fe7 -r 7cfecdce94cc src/geo.c --- a/src/geo.c Sat Jul 26 04:27:52 2008 +0800 +++ b/src/geo.c Sat Jul 26 05:32:31 2008 +0800 @@ -16,20 +16,6 @@ struct _geo *subs; }; -static int is_pos_in(co_aix x, co_aix y, - co_aix rectx, co_aix recty, - co_aix rectw, co_aix recth) { - co_aix rel_x, rel_y; - - rel_x = x - rectx; - if(rel_x < 0 || rel_x >= rectw) - return 0; - rel_y = y - recty; - if(rel_y < 0 || rel_y >= recth) - return 0; - return 1; -} - static int is_scale_overlay(co_aix x1, co_aix w1, co_aix x2, co_aix w2) { if(x1 > x2) { if((x1 - x2) >= w2) @@ -42,8 +28,6 @@ } static int is_overlay(geo_t *r1, geo_t *r2) { - co_aix rel_x, rel_y; - if(!is_scale_overlay(r1->x, r1->w, r2->x, r2->w)) return 0; if(!is_scale_overlay(r1->y, r1->h, r2->y, r2->h)) diff -r 6eecdd331fe7 -r 7cfecdce94cc src/mb_types.h --- a/src/mb_types.h Sat Jul 26 04:27:52 2008 +0800 +++ b/src/mb_types.h Sat Jul 26 05:32:31 2008 +0800 @@ -30,5 +30,6 @@ extern void coord_init(coord_t *co, coord_t *parent); extern void coord_trans_pos(coord_t *co, co_aix *x, co_aix *y); +extern void update_aggr_matrix(coord_t *start); #endif /* __MB_TYPES_H_ */ diff -r 6eecdd331fe7 -r 7cfecdce94cc src/shape_path.c --- a/src/shape_path.c Sat Jul 26 04:27:52 2008 +0800 +++ b/src/shape_path.c Sat Jul 26 05:32:31 2008 +0800 @@ -18,6 +18,7 @@ char *user_data; char *dev_data; /* device space data */ } sh_path_t; +#define RESERVED_AIXS sizeof(co_aix[2]) #define ASSERT(x) #define SKIP_SPACE(x) while(*(x) && isspace(*(x))) { (x)++; } @@ -181,6 +182,8 @@ return OK; } +#define TO_ABS islower(cmd)? *(args - 2) + atof(old): atof(old) + static int sh_path_cmd_arg_fill(char *data, sh_path_t *path) { char *p, *old; char *cmds; @@ -205,41 +208,47 @@ SKIP_NUM(p); if(p == old) break; - *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); + *args = TO_ABS; + args++; SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); + *args = TO_ABS; + args++; SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); + *args = TO_ABS; + args++; SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); + *args = TO_ABS; + args++; SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); + *args = TO_ABS; + args++; SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); + *args = TO_ABS; + args++; } break; case 's': @@ -253,28 +262,32 @@ SKIP_NUM(p); if(p == old) break; - *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); + *args = TO_ABS; + args++; SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); + *args = TO_ABS; + args++; SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); + *args = TO_ABS; + args++; SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); + *args = TO_ABS; + args++; } break; case 'm': @@ -290,14 +303,16 @@ SKIP_NUM(p); if(p == old) break; - *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); + *args = TO_ABS; + args++; SKIP_SPACE(p); old = p; SKIP_NUM(p); if(p == old) return ERR; - *args++ = islower(cmd)? *(args - 2) + atof(old): atof(old); + *args = TO_ABS; + args++; } break; case 'h': @@ -332,7 +347,7 @@ * to make logic of transformation from relative to absolute * simple. */ - cmd_cnt += sizeof(co_aix) * 2; + cmd_cnt += RESERVED_AIXS; cmd_cnt = (cmd_cnt + 3) & ~0x3; path = (sh_path_t *)malloc(sizeof(sh_path_t)); @@ -521,7 +536,7 @@ path = (sh_path_t *)sh_path_new("M 33 25l33 55C 33 87 44 22 55 99L33 77z"); CU_ASSERT(path != NULL); - CU_ASSERT(path->cmd_len == ((5 + sizeof(co_aix) * 2 + 3) & ~0x3)); + CU_ASSERT(path->cmd_len == ((5 + RESERVED_AIXS + 3) & ~0x3)); CU_ASSERT(path->arg_len == 12); CU_ASSERT(strcmp(path->user_data, "MLCLZ") == 0); CU_ASSERT(strcmp(path->dev_data, "MLCLZ") == 0); @@ -549,7 +564,7 @@ path = (sh_path_t *)sh_path_new("M 33 25l33 55C 33 87 44 22 55 99L33 77z"); CU_ASSERT(path != NULL); - CU_ASSERT(path->cmd_len == ((5 + sizeof(co_aix) * 2 + 3) & ~0x3)); + CU_ASSERT(path->cmd_len == ((5 + RESERVED_AIXS + 3) & ~0x3)); CU_ASSERT(path->arg_len == 12); CU_ASSERT(strcmp(path->user_data, "MLCLZ") == 0); CU_ASSERT(strcmp(path->dev_data, "MLCLZ") == 0);