APPLY_RSA
[apps/home/calculator.git] / src / calc-string.c
index 4481b79..9237df8 100644 (file)
@@ -1,20 +1,20 @@
 /*
-  * 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.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
-
+*
+* 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.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
 
 #include <stdio.h>
 #include <string.h>
@@ -52,13 +52,15 @@ void string_replace(char *str, char *a, char *b)
 {
        char *pch = NULL;
        char buf[BUFLEN] = { 0 };
-       while ((pch = strstr(str, a)) != NULL) {
-               strncpy(buf, str, pch - str);
-               buf[pch - str] = '\0';
-               g_strlcat(buf, b, sizeof(buf));
-               g_strlcat(buf, pch + strlen(a), sizeof(buf));
-               strcpy(str, buf);
-        }
+       if(strcmp(a, b)){
+               while ((pch = strstr(str, a)) != NULL) {
+                       strncpy(buf, str, pch - str);
+                       buf[pch - str] = '\0';
+                       g_strlcat(buf, b, sizeof(buf));
+                       g_strlcat(buf, pch + strlen(a), sizeof(buf));
+                       strcpy(str, buf);
+               }
+       }
 }
 
 void string_remove_at(char *str, int at, int length)
@@ -70,14 +72,6 @@ void string_remove_at(char *str, int at, int length)
 }
 
 
-/* @ attention
-    This is redundant comment.
-    Its only use is for Klocwork testing.
-    The comment rete should passed 25%.
-    But we have only one day to do this work.
-    So, sorry, I will delete this comment and add useful comment later.
-*/
-
 #ifdef _DEBUG
 /* @attention   DON'T REMOVE
 char* itoa(int i)