diff --git a/trunk/tinySAK/src/makefile b/trunk/tinySAK/src/makefile new file mode 100644 index 00000000..f75e0a83 --- /dev/null +++ b/trunk/tinySAK/src/makefile @@ -0,0 +1,59 @@ +APP := libtinySAK.so + +INSTALL_DIR = /system/lib + +CFLAGS := $(CFLAGS) +LDFLAGS := $(LDFLAGS) -Wl,-soname,libtinySAK.so,-Bsymbolic,-shared,--whole-archive -Wl,-Map=$(OUTPUT_DIR)/libtinySAK.map + +all: $(APP) + +OBJS = tsk.o\ + tsk_base64.o\ + tsk_binaryutils.o\ + tsk_buffer.o\ + tsk_condwait.o\ + tsk_debug.o\ + tsk_heap.o\ + tsk_hmac.o\ + tsk_list.o\ + tsk_md5.o\ + tsk_memory.o\ + tsk_mutex.o\ + tsk_object.o\ + tsk_params.o\ + tsk_ppfcs16.o\ + tsk_ppfcs32.o\ + tsk_runnable.o\ + tsk_safeobj.o\ + tsk_semaphore.o\ + tsk_sha1.o\ + tsk_string.o\ + tsk_thread.o\ + tsk_time.o\ + tsk_timer.o\ + tsk_url.o\ + tsk_xml.o + +$(APP): $(OBJS) + $(CPP) $(LDFLAGS) -o $@ $^ + +%.o: %.c + $(CC) -c $(INCLUDE) $(CFLAGS) $< -o $@ + +install: $(APP) + $(ANDROID_SDK_ROOT)/tools/adb remount + $(ANDROID_SDK_ROOT)/tools/adb push $(APP) $(INSTALL_DIR)/$(APP) + $(ANDROID_SDK_ROOT)/tools/adb shell chmod 777 $(INSTALL_DIR)/$(APP) + +shell: + $(ANDROID_SDK_ROOT)/tools/adb shell + +run: + $(ANDROID_SDK_ROOT)/tools/adb shell $(INSTALL_DIR)/$(APP) + +#dbg: +# $(MAKE) $(MAKEFILE) DEBUG="-g -DDEBUG" +# $(MAKE) $(MAKEFILE) install + +clean: + @rm -f $(OBJS) $(APP) \ No newline at end of file diff --git a/trunk/tinySAK/src/tsk_memory.c b/trunk/tinySAK/src/tsk_memory.c index c833777c..21b01b39 100644 --- a/trunk/tinySAK/src/tsk_memory.c +++ b/trunk/tinySAK/src/tsk_memory.c @@ -177,7 +177,7 @@ void* tsk_calloc(size_t num, size_t size) void* ret = calloc(num, size); if(!ret) { - TSK_DEBUG_ERROR("Memory allocation failed"); + TSK_DEBUG_ERROR("Memory allocation failed. num=%u and size=%u", num, size); } return ret; diff --git a/trunk/tinySAK/test/makefile b/trunk/tinySAK/test/makefile new file mode 100644 index 00000000..a2be59b7 --- /dev/null +++ b/trunk/tinySAK/test/makefile @@ -0,0 +1,31 @@ +APP := test + +#TINYSAK_INCLUDE := -I../src +#TINYSAK_LIB := -L../ -ltinySAK + +CFLAGS := $(CFLAGS) -I../src -static +LDFLAGS := $(LDFLAGS) -Bsymbolic -L$(OUTPUT_DIR) -ltinySAK + +all: $(APP) + +OBJS += $(APP).o + +$(APP): $(OBJS) + $(CPP) $(LDFLAGS) -o $@ $^ + +%.o: %.c + $(CC) -c $(INCLUDE) $(CFLAGS) $< -o $@ + +install: $(APP) + $(ANDROID_SDK_ROOT)/tools/adb push $(APP) $(INSTALL_DIR)/$(APP) + $(ANDROID_SDK_ROOT)/tools/adb shell chmod 777 $(INSTALL_DIR)/$(APP) + +run: + $(ANDROID_SDK_ROOT)/tools/adb shell $(INSTALL_DIR)/$(APP) + +#dbg: +# $(MAKE) $(MAKEFILE) DEBUG="-g -DDEBUG" +# $(MAKE) $(MAKEFILE) install + +clean: + @rm -f $(OBJS) $(APP) \ No newline at end of file diff --git a/trunk/tinySAK/test/test.c b/trunk/tinySAK/test/test.c index 96bf0584..4a03530f 100644 --- a/trunk/tinySAK/test/test.c +++ b/trunk/tinySAK/test/test.c @@ -34,7 +34,7 @@ #define LOOP 1 #define RUN_TEST_ALL 0 -#define RUN_TEST_LISTS 0 +#define RUN_TEST_LISTS 1 #define RUN_TEST_HEAP 0 #define RUN_TEST_STRINGS 0 #define RUN_TEST_URL 0 @@ -45,7 +45,7 @@ #define RUN_TEST_OBJECT 0 #define RUN_TEST_PARAMS 0 #define RUN_TEST_TIMER 0 -#define RUN_TEST_RUNNABLE 1 +#define RUN_TEST_RUNNABLE 0 #define RUN_TEST_BUFFER 0 #define RUN_TEST_MD5 0 #define RUN_TEST_SHA1 0 diff --git a/trunk/tinySAK/test/test_lists.h b/trunk/tinySAK/test/test_lists.h index ab2fcffb..0e27986b 100644 --- a/trunk/tinySAK/test/test_lists.h +++ b/trunk/tinySAK/test/test_lists.h @@ -119,7 +119,7 @@ void test_basic_list() tsk_list_remove_item(list, list->tail); /* delete all items in the list */ - TSK_LIST_SAFE_FREE(list); + TSK_OBJECT_SAFE_FREE(list); } void test_filtered_list() @@ -203,7 +203,7 @@ void test_filtered_list() } /* delete all items in the list */ - TSK_LIST_SAFE_FREE(list); + TSK_OBJECT_SAFE_FREE(list); #undef PUSH_FILTERED } @@ -255,7 +255,7 @@ void test_complex_list() } /* delete all items in the list */ - TSK_LIST_SAFE_FREE(list); + TSK_OBJECT_SAFE_FREE(list); } #endif /* _TEST_LISTS_H_ */ diff --git a/trunk/tinySAK/test/test_runnable.h b/trunk/tinySAK/test/test_runnable.h index 979a576c..45e97a09 100644 --- a/trunk/tinySAK/test/test_runnable.h +++ b/trunk/tinySAK/test/test_runnable.h @@ -117,7 +117,7 @@ void test_runnable() tsk_thread_sleep(3000); - TSK_TIMER_MANAGER_SAFE_FREE(timer_mgr); + TSK_OBJECT_SAFE_FREE(timer_mgr); tsk_runnable_stop(runnable); tsk_free((void**)&runnable); }