summaryrefslogtreecommitdiff
path: root/src/common_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common_util.cpp')
-rwxr-xr-xsrc/common_util.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/common_util.cpp b/src/common_util.cpp
index 02b4f51..396c6ba 100755
--- a/src/common_util.cpp
+++ b/src/common_util.cpp
@@ -1,12 +1,12 @@
/*
* Copyright 2012 Samsung Electronics Co., Ltd
- *
+ *
* Licensed under the Flora License, Version 1.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.tizenopensource.org/license
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,7 +39,6 @@ int search_util_date_time_format_init(void *data)
UErrorCode status = U_ZERO_ERROR;
UChar customSkeleton[64] = { '\0' };
char skeleton[128] = { 0, };
- int hr = 0;
int32_t bestPatternCapacity, bestPatternLength;
UChar bestPattern[64] = { 0, };
const char *locale;
@@ -108,8 +107,6 @@ void search_util_date_time_format_deinit()
{
SEARCH_FUNC_START;
- UErrorCode status = U_ZERO_ERROR;
-
if (search_pattern_generator) {
udatpg_close(search_pattern_generator);
search_pattern_generator = NULL;
@@ -163,7 +160,7 @@ void search_sql_make_keyword_bind_value(char *src, char *dest, int type)
if(type == SEARCH_SQL_BIND_TYPE_DUPLEX) {
*dest = '%';
++dest;
- }
+ }
for (tmp = src; *tmp; ++tmp, ++dest) {
if ((*tmp == '%') || (*tmp == '_') || (*tmp == *DB_ESCAPE_CHAR)) {
@@ -195,17 +192,18 @@ void search_get_date_string(char *date_string)
const char *search_markup_keyword(const char *string, char *searchword,
bool *result)
{
- SEARCH_FUNC_START;
-
char pstr[DEF_BUF_LEN + 1] = {0,};
char result_str[DEF_BUF_LEN + 1] = {0,};
- char start_str[DEF_BUF_LEN + 1] = {0,};
+ char start_str[DEF_BUF_LEN + 1] = {0,};
static char return_string[DEF_BUF_LEN + 1] = { 0, };
int word_len = 0;
int search_len = 0;
int i = 0;
bool found = false;
+ SEARCH_RET_IF_STR_INVALID(string, return_string);
+ SEARCH_RET_IF_STR_INVALID(searchword, return_string);
+
strncpy(pstr, string, DEF_BUF_LEN);
word_len = strlen(pstr);
@@ -240,8 +238,6 @@ const char *search_markup_keyword(const char *string, char *searchword,
snprintf(return_string, 128, "%s", pstr);
}
- SEARCH_FUNC_END;
-
return return_string;
}
@@ -280,12 +276,12 @@ const char *search_markup_keyword(const char *string, char *searchword,
*result = found;
memset(return_string, 0x00, DEF_BUF_LEN);
- if (found) {
+ if (found) {
if (i == 0) {
markup_text = g_markup_escape_text(&pstr[0], search_len);
markup_text_end = g_markup_escape_text(&pstr[search_len], word_len-search_len);
- snprintf(return_string,
- DEF_BUF_LEN,
+ snprintf(return_string,
+ DEF_BUF_LEN,
"<match>%s</match>%s",
markup_text,
(char*)markup_text_end);
@@ -295,8 +291,8 @@ const char *search_markup_keyword(const char *string, char *searchword,
markup_text_start = g_markup_escape_text(&pstr[0], i);
markup_text = g_markup_escape_text(&pstr[i], search_len);
markup_text_end = g_markup_escape_text(&pstr[i+search_len], word_len-(i+search_len));
- snprintf(return_string,
- DEF_BUF_LEN,
+ snprintf(return_string,
+ DEF_BUF_LEN,
"%s<match>%s</match>%s",
(char*)markup_text_start,
markup_text,