diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-10-11 07:38:57 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-10-11 07:38:57 +0000 |
commit | 5551a6e1727ea93f3fc7237dafdde42c2bdc1106 (patch) | |
tree | a75ac8240b8f5727e0aae83417422f4d24df1847 | |
parent | 62c8e11a253660294c360787369ecb656e9b67fc (diff) |
sync with miranda svn
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@362 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r-- | db3x_autobackups/commonheaders.h | 2 | ||||
-rw-r--r-- | db3x_autobackups/db3x_mmap_8.vcproj | 8 | ||||
-rw-r--r-- | db3x_autobackups/dbsettings.c | 34 |
3 files changed, 31 insertions, 13 deletions
diff --git a/db3x_autobackups/commonheaders.h b/db3x_autobackups/commonheaders.h index 521a985..e1cae64 100644 --- a/db3x_autobackups/commonheaders.h +++ b/db3x_autobackups/commonheaders.h @@ -72,3 +72,5 @@ extern HANDLE hDbFile; #else
#define mir_i64(x) (x##i64)
#endif
+
+#define NEWSTR_ALLOCA(A) (A==NULL)?NULL:strcpy((char*)alloca(strlen(A)+1),A)
diff --git a/db3x_autobackups/db3x_mmap_8.vcproj b/db3x_autobackups/db3x_mmap_8.vcproj index 8d09534..a929f70 100644 --- a/db3x_autobackups/db3x_mmap_8.vcproj +++ b/db3x_autobackups/db3x_mmap_8.vcproj @@ -50,7 +50,7 @@ AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DB3X_EXPORTS"
BasicRuntimeChecks="3"
- RuntimeLibrary="3"
+ RuntimeLibrary="1"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="commonheaders.h"
@@ -146,7 +146,7 @@ AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DB3X_EXPORTS"
StringPooling="true"
- RuntimeLibrary="2"
+ RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="commonheaders.h"
@@ -244,7 +244,7 @@ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DB3X_EXPORTS"
StringPooling="false"
BasicRuntimeChecks="3"
- RuntimeLibrary="3"
+ RuntimeLibrary="1"
EnableFunctionLevelLinking="true"
FloatingPointModel="0"
UsePrecompiledHeader="2"
@@ -342,7 +342,7 @@ AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DB3X_EXPORTS"
StringPooling="true"
- RuntimeLibrary="2"
+ RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="commonheaders.h"
diff --git a/db3x_autobackups/dbsettings.c b/db3x_autobackups/dbsettings.c index a8d347d..3e8f49d 100644 --- a/db3x_autobackups/dbsettings.c +++ b/db3x_autobackups/dbsettings.c @@ -26,6 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. DWORD GetModuleNameOfs(const char *szName);
DBCachedContactValueList* AddToCachedContactList(HANDLE hContact, int index);
+static int mirCp = CP_ACP;
+
HANDLE hCacheHeap = NULL;
SortedList lContacts = {0};
HANDLE hLastCachedContact = NULL;
@@ -386,12 +388,23 @@ static int GetContactSetting(WPARAM wParam,LPARAM lParam) return 1;
if ( dgs->pValue->type == DBVT_UTF8 ) {
- WCHAR* tmp;
- char* val = mir_utf8decode( dgs->pValue->pszVal, &tmp );
- if ( val == NULL ) {
- dgs->pValue->type = DBVT_WCHAR;
+ WCHAR* tmp = NULL;
+ char* p = NEWSTR_ALLOCA(dgs->pValue->pszVal);
+ if ( mir_utf8decode( p, &tmp ) != NULL ) {
+ BOOL bUsed = FALSE;
+ int result = WideCharToMultiByte( mirCp, 0, tmp, -1, NULL, 0, "?", &bUsed );
+
mir_free( dgs->pValue->pszVal );
- dgs->pValue->pwszVal = tmp;
+
+ if ( bUsed || result == 0 ) {
+ dgs->pValue->type = DBVT_WCHAR;
+ dgs->pValue->pwszVal = tmp;
+ }
+ else {
+ dgs->pValue->type = DBVT_ASCIIZ;
+ dgs->pValue->pszVal = mir_strdup( p );
+ mir_free( tmp );
+ }
}
else {
dgs->pValue->type = DBVT_ASCIIZ;
@@ -428,9 +441,10 @@ static int GetContactSettingStr(WPARAM wParam,LPARAM lParam) dgs->pValue->pwszVal = wszResult;
}
else {
- char* savePtr = dgs->pValue->pszVal;
- mir_utf8decode( dgs->pValue->pszVal, &dgs->pValue->pwszVal );
- mir_free( savePtr );
+ char* savePtr = NEWSTR_ALLOCA(dgs->pValue->pszVal);
+ mir_free( dgs->pValue->pszVal );
+ if ( !mir_utf8decode( savePtr, &dgs->pValue->pwszVal ))
+ return 1;
}
}
else if ( iSaveType == DBVT_UTF8 ) {
@@ -530,7 +544,7 @@ static int WriteContactSetting(WPARAM wParam,LPARAM lParam) int bytesRequired,bytesRemaining;
DWORD ofsContact,ofsSettingsGroup,ofsBlobPtr;
- if (dbcws == NULL)
+ if (dbcws == NULL || dbcws->szSetting==NULL || dbcws->szModule==NULL )
return 1;
// the db format can't tolerate more than 255 bytes of space (incl. null) for settings+module name
@@ -990,6 +1004,8 @@ int InitSettings(void) lGlobalSettings.increment=50;
lResidentSettings.sortFunc=stringCompare2;
lResidentSettings.increment=50;
+
+ mirCp = CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 );
return 0;
}
|