diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2015-04-24 09:40:10 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2015-04-24 09:40:10 +0000 |
commit | 5585955fe703030dfcda3be1c66b81635375fc03 (patch) | |
tree | 3ef63fb867d4855ccd80fe746c44383582610908 /plugins/DbEditorPP | |
parent | 5cf0f0757def7cadf17f9d66de9dd56e2031a999 (diff) |
StrReplace function removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@13076 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/DbEditorPP')
-rw-r--r-- | plugins/DbEditorPP/src/exportimport.cpp | 42 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/headers.h | 1 |
2 files changed, 6 insertions, 37 deletions
diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index a89e69265b..3537a3a04e 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -44,39 +44,6 @@ static int Openfile(TCHAR *outputFile, const char *module) return 1;
}
-char* StrReplace(char* Search, char* Replace, char* Resource)
-{
- int i = 0;
- int SearchLen = (int)_tcslen(Search);
- char* Work = mir_tstrdup(Replace);
- int ReplaceLen = (int)_tcslen(Work);
-
- char* Pointer = _tcsstr(Resource, Search);
-
- while (Pointer != NULL) {
- int PointerLen = (int)_tcslen(Pointer);
- int ResourceLen = (int)_tcslen(Resource);
-
- char* NewText = (char*)mir_calloc((ResourceLen - SearchLen + ReplaceLen + 1)*sizeof(char));
-
- _tcsncpy(NewText, Resource, ResourceLen - PointerLen);
- _tcscat(NewText, Work);
- _tcscat(NewText, Pointer + SearchLen);
-
- Resource = (char*)mir_realloc(Resource, (ResourceLen - SearchLen + ReplaceLen + 1)*sizeof(char));
-
- for (i = 0; i < (ResourceLen - SearchLen + ReplaceLen); i++)
- Resource[i] = NewText[i];
- Resource[i] = 0;
- mir_free(NewText);
-
- Pointer = _tcsstr(Resource + (ResourceLen - PointerLen + ReplaceLen), Search);
- }
- mir_free(Work);
-
- return Resource;
-}
-
void exportModule(MCONTACT hContact, char *module, FILE *file)
{
char tmp[32];
@@ -107,10 +74,11 @@ void exportModule(MCONTACT hContact, char *module, FILE *file) case DBVT_ASCIIZ:
case DBVT_UTF8:
if (strchr(dbv.pszVal, '\r')) {
- char *end = StrReplace("\\", "\\\\", dbv.pszVal);
- end = StrReplace("\r", "\\r", end);
- end = StrReplace("\n", "\\n", end);
- fprintf(file, "\n%s=g%s", setting->name, end);
+ CMStringA end = dbv.pszVal;
+ end.Replace("\\", "\\\\");
+ end.Replace("\r", "\\r");
+ end.Replace("\n", "\\n");
+ fprintf(file, "\n%s=g%s", setting->name, end.c_str());
break;
}
fprintf(file, "\n%s=%c", setting->name, (dbv.type == DBVT_UTF8) ? 'u' : 's');
diff --git a/plugins/DbEditorPP/src/headers.h b/plugins/DbEditorPP/src/headers.h index 1c45c21b71..1dbf4f640c 100644 --- a/plugins/DbEditorPP/src/headers.h +++ b/plugins/DbEditorPP/src/headers.h @@ -40,6 +40,7 @@ #include <m_popup.h>
#include <m_icolib.h>
#include <m_hotkeys.h>
+#include <m_string.h>
#include "m_toptoolbar.h"
|