summaryrefslogtreecommitdiff
path: root/tipper/options.cpp
diff options
context:
space:
mode:
authorsje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2006-11-23 03:22:18 +0000
committersje <sje@4f64403b-2f21-0410-a795-97e2b3489a10>2006-11-23 03:22:18 +0000
commit6db050eb2d23035c71971cc88219211bbacca23d (patch)
tree29c91aa26ece9421eb638b33576fd7ad866418c7 /tipper/options.cpp
parent96101e2721d4cb277bf0b9d02f077dc2dd9087d8 (diff)
use ansi font services if unicode unavailable
bigfixes to allow pure ansi build git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@56 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'tipper/options.cpp')
-rw-r--r--tipper/options.cpp32
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);