diff options
Diffstat (limited to 'tipper/options.cpp')
-rw-r--r-- | tipper/options.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/tipper/options.cpp b/tipper/options.cpp index 260ccbb..c6fdccd 100644 --- a/tipper/options.cpp +++ b/tipper/options.cpp @@ -3,6 +3,7 @@ #include "resource.h" #include "popwin.h" #include <commctrl.h> +#include "str_utils.h" Options options; @@ -136,13 +137,13 @@ bool LoadDS(DisplaySubst *ds, int index) { mir_snprintf(setting, 512, "Name%d", index); ds->name[0] = 0; if(!DBGetContactSettingWString(0, MODULE, setting, &dbv)) { - _tcsncpy(ds->name, dbv.pwszVal, LABEL_LEN); + w2t(dbv.pwszVal, ds->name, LABEL_LEN); DBFreeVariant(&dbv); } else if(!DBGetContactSettingStringUtf(0, MODULE, setting, &dbv)) { - MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, ds->name, LABEL_LEN); + u2t(dbv.pszVal, ds->name, LABEL_LEN); DBFreeVariant(&dbv); } else if(!DBGetContactSetting(0, MODULE, setting, &dbv)) { - if(dbv.type == DBVT_ASCIIZ) MultiByteToWideChar(code_page, 0, dbv.pszVal, -1, ds->name, LABEL_LEN); + if(dbv.type == DBVT_ASCIIZ) a2t(dbv.pszVal, ds->name, LABEL_LEN); DBFreeVariant(&dbv); } else return false; @@ -181,10 +182,9 @@ bool LoadDS(DisplaySubst *ds, int index) { void SaveDS(DisplaySubst *ds, int index) { char setting[512]; mir_snprintf(setting, 512, "Name%d", index); - if(DBWriteContactSettingWString(0, MODULE, setting, ds->name)) { + if(DBWriteContactSettingTString(0, MODULE, setting, ds->name)) { char buff[LABEL_LEN]; - WideCharToMultiByte(code_page, 0, ds->name, -1, buff, LABEL_LEN, 0, 0); - buff[LABEL_LEN] = 0; + t2a(ds->name, buff, LABEL_LEN); DBWriteContactSettingString(0, MODULE, setting, buff); } mir_snprintf(setting, 512, "Type%d", index); @@ -203,13 +203,13 @@ bool LoadDI(DisplayItem *di, int index) { mir_snprintf(setting, 512, "DILabel%d", index); di->label[0] = 0; if(!DBGetContactSettingWString(0, MODULE, setting, &dbv)) { - _tcsncpy(di->label, dbv.pwszVal, LABEL_LEN); + w2t(dbv.pwszVal, di->label, LABEL_LEN); DBFreeVariant(&dbv); } else if(!DBGetContactSettingStringUtf(0, MODULE, setting, &dbv)) { - MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, di->label, LABEL_LEN); + u2t(dbv.pszVal, di->label, LABEL_LEN); DBFreeVariant(&dbv); } else if(!DBGetContactSetting(0, MODULE, setting, &dbv)) { - if(dbv.type == DBVT_ASCIIZ) MultiByteToWideChar(code_page, 0, dbv.pszVal, -1, di->label, LABEL_LEN); + if(dbv.type == DBVT_ASCIIZ) a2t(dbv.pszVal, di->label, LABEL_LEN); DBFreeVariant(&dbv); } else return false; @@ -218,13 +218,13 @@ bool LoadDI(DisplayItem *di, int index) { mir_snprintf(setting, 512, "DIValue%d", index); di->value[0] = 0; if(!DBGetContactSettingWString(0, MODULE, setting, &dbv)) { - _tcsncpy(di->value, dbv.pwszVal, VALUE_LEN); + w2t(dbv.pwszVal, di->value, VALUE_LEN); DBFreeVariant(&dbv); } else if(!DBGetContactSettingStringUtf(0, MODULE, setting, &dbv)) { - MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, di->value, VALUE_LEN); + u2t(dbv.pszVal, di->value, VALUE_LEN); DBFreeVariant(&dbv); } else if(!DBGetContactSetting(0, MODULE, setting, &dbv)) { - MultiByteToWideChar(code_page, 0, dbv.pszVal, -1, di->value, VALUE_LEN); + if(dbv.type == DBVT_ASCIIZ) a2t(dbv.pszVal, di->value, VALUE_LEN); DBFreeVariant(&dbv); } @@ -241,15 +241,15 @@ bool LoadDI(DisplayItem *di, int index) { void SaveDI(DisplayItem *di, int index) { char setting[512]; mir_snprintf(setting, 512, "DILabel%d", index); - if(DBWriteContactSettingWString(0, MODULE, setting, di->label)) { + if(DBWriteContactSettingTString(0, MODULE, setting, di->label)) { char buff[LABEL_LEN]; - WideCharToMultiByte(code_page, 0, di->label, -1, buff, LABEL_LEN, 0, 0); + t2a(di->label, buff, LABEL_LEN); DBWriteContactSettingString(0, MODULE, setting, buff); } mir_snprintf(setting, 512, "DIValue%d", index); - if(DBWriteContactSettingWString(0, MODULE, setting, di->value)) { + if(DBWriteContactSettingTString(0, MODULE, setting, di->value)) { char buff[VALUE_LEN]; - WideCharToMultiByte(code_page, 0, di->value, -1, buff, VALUE_LEN, 0, 0); + t2a(di->value, buff, VALUE_LEN); DBWriteContactSettingString(0, MODULE, setting, buff); } mir_snprintf(setting, 512, "DILineAbove%d", index); |