From: Sungmin Kwak Date: Wed, 3 Jun 2015 13:26:36 +0000 (+0900) Subject: Prevent fix X-Git-Tag: submit/tizen/20150605.090259^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F75%2F40575%2F1;p=platform%2Fcore%2Fuifw%2Flibscl-ui.git Prevent fix Change-Id: Icc9b9df989dbc2fbef1c4b610c86205bba206059 --- diff --git a/binary_xmlresource/include/metadata_provider.h b/binary_xmlresource/include/metadata_provider.h index 5416e6c..9066038 100644 --- a/binary_xmlresource/include/metadata_provider.h +++ b/binary_xmlresource/include/metadata_provider.h @@ -19,6 +19,8 @@ #define __METADATA_PROVIDER_H_ #include "imetadata_provider.h" #include "metadata_bin_parser.h" +#include + class Metadata_Provider:public IMetadata_Provider{ public: Metadata_Provider(const Metadata_Bin_Parser* metadataParser):m_metadataParser(metadataParser) { @@ -44,7 +46,7 @@ class Metadata_Provider:public IMetadata_Provider{ current_record_name = record_name; curRecordIndex = (int)find_metadata_record_index(record_name); if (curRecordIndex == -1) { - printf("Can not find %s metadata record.\n", record_name); + LOGW("Can not find %s metadata record.", record_name); } } } diff --git a/res/simple_debug.cpp b/res/simple_debug.cpp index fc48d81..d3c9fcc 100644 --- a/res/simple_debug.cpp +++ b/res/simple_debug.cpp @@ -73,7 +73,7 @@ SclLog::log(enum LOG_LEVEL level, char* fmt, ...) { char str_log[128]; va_list ap; va_start(ap, fmt); - vsprintf(str_log, fmt, ap); + vsnprintf(str_log, sizeof(str_log), fmt, ap); va_end(ap); /* @@ -100,7 +100,7 @@ SCLLOG(enum SclLog::LOG_LEVEL level, char* fmt, ...) { char str_log[128]; va_list ap; va_start(ap, fmt); - vsprintf(str_log, fmt, ap); + vsnprintf(str_log, sizeof(str_log), fmt, ap); va_end(ap); log->log(level, str_log); } diff --git a/scl/sclcontroller.cpp b/scl/sclcontroller.cpp index 4210cb5..c481760 100644 --- a/scl/sclcontroller.cpp +++ b/scl/sclcontroller.cpp @@ -32,6 +32,7 @@ #include "sclres_manager.h" #include "scleventhandler.h" #include "sclanimator.h" +#include //#define DIRECTLY_DRAW_ON_EVENTS @@ -1400,7 +1401,7 @@ CSCLController::process_button_over_event(sclwindow window, sclint x, sclint y, return FALSE; } if (key_index != highlighted_key || window != highlighted_window ) { - printf("%d != %d || %p != %p\n", key_index, highlighted_key, window, highlighted_window); + SECURE_LOGD("%d != %d || %p != %p", key_index, highlighted_key, window, highlighted_window); if(layout) { if (coordinate->key_type != KEY_TYPE_NONE) { if (context->get_tts_enabled()) { @@ -1842,7 +1843,7 @@ CSCLController::process_button_release_event(sclwindow window, sclint x, sclint sclres_manager->get_layout_id(sclres_input_mode_configure[popup_input_mode].layouts[display_mode]); if (popupLayoutId == NOT_USED){ // deal with NOT_USED - printf("popupLayoutID is not used.\n"); + LOGD("popupLayoutID is not used."); } SclLayout *layout = NULL; /* FIXME */ @@ -2981,7 +2982,7 @@ CSCLController::mouse_move(sclwindow window, sclint x, sclint y, scltouchdevice deltax = originx - startx; deltay = originy - starty; sclfloat dist_farthest = utils->get_approximate_distance(originx, originy, startx, starty); - printf("%d %d %d %d %f, %d %d\n", originx, originy, startx, starty, dist_farthest, cur_drag_state, next_drag_state); + //printf("%d %d %d %d %f, %d %d\n", originx, originy, startx, starty, dist_farthest, cur_drag_state, next_drag_state); /* Let's see how much we are away from the last farthest point */ sclfloat diffdir_recog_dist = SCL_DIRECTION_RELATIVE_DIFFDIR_RECOG_DIST * utils->get_smallest_scale_rate(); /* If we moved certain amount from the point where direction changed, process drag state change routine */ @@ -3034,7 +3035,7 @@ CSCLController::mouse_move(sclwindow window, sclint x, sclint y, scltouchdevice if (drag_state_changed) { /* When the dragging direction changes, save the current position as farthest point for future comparison */ context->set_farthest_move_point(touch_id, originx, originy); - printf("SET_FARTHEST : %d %d %d\n", originx, originy, context->get_cur_drag_state(touch_id)); + LOGD("SET_FARTHEST : %d %d %d", originx, originy, context->get_cur_drag_state(touch_id)); } } diff --git a/scl/sclresourcecache.cpp b/scl/sclresourcecache.cpp index 173d3d0..c156dfb 100644 --- a/scl/sclresourcecache.cpp +++ b/scl/sclresourcecache.cpp @@ -26,6 +26,7 @@ #include "scluibuilder.h" #include "sclres_manager.h" #include +#include //Includes for CSCLKeyFocusHandler #include "sclkeyfocushandler.h" @@ -742,7 +743,7 @@ CSCLResourceCache::add_private_key(SclPrivateKeyProperties* privProperties, sclb if (mPrivateKeyProperties[loop].valid == FALSE) break; } if (loop == MAX_PRIVATE_KEY) { - printf("Out of buffer!! could not insert new private data into buffer \n"); + LOGW("Out of buffer!! could not insert new private data into buffer"); return ret; } } @@ -781,7 +782,7 @@ CSCLResourceCache::add_private_key(SclPrivateKeyProperties* privProperties, sclb #endif if (ret == NOT_USED) { - printf("Failed!. Out of private data buffer\n"); + LOGW("Failed!. Out of private data buffer"); } return ret; } diff --git a/scl/sclwindows.cpp b/scl/sclwindows.cpp index 8cfff68..3eacde3 100644 --- a/scl/sclwindows.cpp +++ b/scl/sclwindows.cpp @@ -30,6 +30,7 @@ #include "sclactionstate.h" #include "sclres_manager.h" #include "sclkeyfocushandler.h" +#include using namespace scl; @@ -158,7 +159,7 @@ sclwindow CSCLWindows::open_popup(const SclWindowOpener opener, const SclRectang events->create_timer(SCL_TIMER_POPUP_TIMEOUT, timeout, layout); } - printf("create window (%p) x: %d, y:%d, width:%d, height:%d , layout:%d, popuptype:%d\n", + LOGD("create window (%p) x: %d, y:%d, width:%d, height:%d , layout:%d, popuptype:%d", window, geometry.x, geometry.y, geometry.width, geometry.height, layout, popup_type); events->connect_window_events(window, SCL_EVENT_MOUSE | SCL_EVENT_EXPOSE); @@ -271,7 +272,7 @@ sclwindow CSCLWindows::open_popup(const SclWindowOpener opener, const SclRectang bool CSCLWindows::close_popup(sclwindow window) { - printf("close_popup window (%p) \n",window); + LOGD("close_popup window (%p)",window); CSCLKeyFocusHandler *focus_handler = CSCLKeyFocusHandler::get_instance(); if (focus_handler) { @@ -391,7 +392,7 @@ CSCLWindows::create_window(const SclWindowOpener opener, const SclRectangle &geo //get_window_context(window, TRUE); if (window == NULL) { - printf("Failed to create a new window. The size of window buffer has exeeded.\n"); + LOGW("Failed to create a new window. The size of window buffer has exeeded."); } } return window; @@ -421,9 +422,9 @@ CSCLWindows::create_magnifier_window(const sclwindow parent, scl16 x, scl16 y, s set_parent(parent, window); if (window == NULL) { - printf("Failed to create a new window. The size of window buffer has exeeded.\n"); + LOGW("Failed to create a new window. The size of window buffer has exeeded."); } else { - printf("Magnifier Window %p created\n", window); + LOGD("Magnifier Window %p created", window); } } @@ -471,7 +472,7 @@ CSCLWindows::create_dim_window(const sclwindow parent, SclWindowContext *window_ } if (window == NULL) { - printf("Failed to create a new window. The size of window buffer has exeeded.\n"); + LOGW("Failed to create a new window. The size of window buffer has exeeded"); } } @@ -901,7 +902,7 @@ void CSCLWindows::set_window_rotation(const sclwindow window, SCLRotation rotati */ } else { impl->set_window_rotation(window, rotation); - printf("## set_window_rotation : %d \n", rotation); + LOGD("## set_window_rotation : %d", rotation); } } diff --git a/xml2binary/encode_modifier_decoration.cpp b/xml2binary/encode_modifier_decoration.cpp index fe6636a..cd1449d 100644 --- a/xml2binary/encode_modifier_decoration.cpp +++ b/xml2binary/encode_modifier_decoration.cpp @@ -20,6 +20,8 @@ #include "resource_storage_impl.h" #include "put_record.h" #include "_auto_metadata.h" +#include + using namespace xmlresource; static void encode_modifier_decoration_record(ResourceStorage& storage, const PSclModifierDecoration cur, const Modifier_decoration_width& record_width) { @@ -40,7 +42,7 @@ encode_modifier_decoration_file(ResourceStorage& storage, IMetaData_Helper& md_h XMLResource *xmlresource = XMLResource::get_instance(); PSclModifierDecoration modifierDecorationTable = xmlresource->get_modifier_decoration_table(); if (modifierDecorationTable == NULL) { - printf("Error. modifier decoration table is NULL\n"); + LOGW("Error. modifier decoration table is NULL"); return 0; } diff --git a/xml2binary/encode_nine_patch.cpp b/xml2binary/encode_nine_patch.cpp index 3749558..af0b684 100644 --- a/xml2binary/encode_nine_patch.cpp +++ b/xml2binary/encode_nine_patch.cpp @@ -22,6 +22,8 @@ #include "resource_storage_impl.h" #include "put_record.h" #include "_auto_metadata.h" +#include + using namespace std; using namespace xmlresource; static void @@ -45,12 +47,12 @@ encode_nine_patch_file(ResourceStorage& storage, IMetaData_Helper& md_helper) { XMLResource *xmlresource = XMLResource::get_instance(); if (xmlresource == NULL) { - printf("Error: failed to get xmlresource instance.\n"); + LOGW("Error: failed to get xmlresource instance."); return 0; } SclNinePatchInfo* ninePatchInfoTable = xmlresource->get_nine_patch_list(); if (ninePatchInfoTable == NULL) { - printf("Warning: nine patch list is null\n"); + LOGW("Warning: nine patch list is null"); return 0; } #ifdef __SCL_TXT_DEBUG diff --git a/xml2binary/include/resource_storage_impl.h b/xml2binary/include/resource_storage_impl.h index bc3d5e7..c792666 100644 --- a/xml2binary/include/resource_storage_impl.h +++ b/xml2binary/include/resource_storage_impl.h @@ -18,6 +18,7 @@ #ifndef __RESOURCE_STORAGE_IMPL_H__ #define __RESOURCE_STORAGE_IMPL_H__ #include "resource_storage.h" +#include inline ResourceStorage:: ResourceStorage() { @@ -144,13 +145,13 @@ inline void ResourceStorage:: expand_storage() { unsigned int _new_size = (unsigned int)(m_capability + __RE_NEW_LENGTH__); if (_new_size > (unsigned int)__MAX_NEW_SIZE__) { - printf("expand_storage failed: size is limited to %d\n", __MAX_NEW_SIZE__); + LOGW("expand_storage failed: size is limited to %d", __MAX_NEW_SIZE__); return; } char* _p = new char[_new_size]; if(_p == NULL) { - printf("expand_storage error"); + LOGW("expand_storage error"); return; } memset(_p, 0x00, _new_size); diff --git a/xml2binary/metadata_handler.cpp b/xml2binary/metadata_handler.cpp index f8eea3d..efa7add 100644 --- a/xml2binary/metadata_handler.cpp +++ b/xml2binary/metadata_handler.cpp @@ -213,21 +213,21 @@ parsing_metadata() { doc = xmlReadFile(file_name, NULL, 0); if (doc == NULL) { - printf("Could not load file.\n"); - exit(1); + LOGE("Could not load file.\n"); + return; } curNode = xmlDocGetRootElement(doc); if (curNode == NULL) { - printf("empty document.\n"); + LOGE("empty document.\n"); xmlFreeDoc(doc); - exit(1); + return; } if (0 != xmlStrcmp(curNode->name, (const xmlChar*)"metadata")) { - printf("root name %s error!\n", curNode->name); + LOGE("root name %s error!\n", curNode->name); xmlFreeDoc(doc); - exit(1); + return; } xmlChar* version = xmlGetProp(curNode, (const xmlChar*)"version"); @@ -236,7 +236,7 @@ parsing_metadata() { metadata.m_version[sizeof(metadata.m_version)-1] = '\0'; xmlFree(version); } else { - strcpy(metadata.m_version, (const char*)""); + metadata.m_version[0] = '\0'; } MetaData_Width metadataWidth; diff --git a/xmlresource/layout_parser.cpp b/xmlresource/layout_parser.cpp index a0ead26..5967189 100644 --- a/xmlresource/layout_parser.cpp +++ b/xmlresource/layout_parser.cpp @@ -27,6 +27,7 @@ #include "layout_parser_helper.h" #include "put_record.h" #include "simple_debug.h" +#include using namespace std; @@ -256,20 +257,23 @@ LayoutParserImpl::load(int layout_id) { doc = xmlReadFile(input_file.c_str(), NULL, 0); if (doc == NULL) { SCLLOG(SclLog::ERROR, "Could not load file: %s.", input_file.c_str()); - exit(1); + LOGE("Could not load file: %s.", input_file.c_str()); + return; } cur_node = xmlDocGetRootElement(doc); if (cur_node == NULL) { SCLLOG(SclLog::ERROR, "LayoutParserImpl: empty document.\n"); + LOGE("LayoutParserImpl: empty document."); xmlFreeDoc(doc); - exit(1); + return; } if (0 != xmlStrcmp(cur_node->name, (const xmlChar*)LAYOUT_TAG)) { SCLLOG(SclLog::ERROR, "LayoutParserImpl: root name error: %s\n!", (char *)cur_node->name); + LOGE("LayoutParserImpl: root name error: %s!", (char *)cur_node->name); xmlFreeDoc(doc); - exit(1); + return; } PSclLayout cur_rec_layout = m_layout_table + layout_id; diff --git a/xmlresource/layout_parser_helper.cpp b/xmlresource/layout_parser_helper.cpp index e304ce5..6d606e8 100644 --- a/xmlresource/layout_parser_helper.cpp +++ b/xmlresource/layout_parser_helper.cpp @@ -427,12 +427,12 @@ const int BOOLTypeHelper::Bool(const string str) { ///////////////////////////////////////////////// const string INTTypeHelper::dextoString(const int val) { char temp[8] = {0}; - sprintf(temp, "0x%x", val); + snprintf(temp, sizeof(temp), "0x%x", val); return string(temp); } const string INTTypeHelper::toString(const int val) { char temp[8] = {0}; - sprintf(temp, "%d", val); + snprintf(temp, sizeof(temp), "%d", val); return string(temp); } const int INTTypeHelper::Int(const string str) {