[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : gerry
Repository : xara
Revision   : 838
Date       : Wed Apr 19 14:37:24 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxOil/basestr.h
   M /Trunk/XaraLX/wxOil/compatdef.h
   M /Trunk/XaraLX/wxOil/dlgmgr.cpp
   M /Trunk/XaraLX/wxOil/ensure.cpp
   M /Trunk/XaraLX/wxOil/errors.cpp

A few tweaks to the string handling


Diff:
Index: Trunk/XaraLX/wxOil/compatdef.h
===================================================================
--- Trunk/XaraLX/wxOil/compatdef.h	(revision 837)
+++ Trunk/XaraLX/wxOil/compatdef.h	(revision 838)
@@ -193,11 +193,11 @@
 
 // The following also need to be defined but do not have wx equivalents
 // camStrtok
+// camStrtof
 // camStrinc(v)
 // camStrninc(s, n)
 // camStrdec(s, v)
 
-
 // Define types that *nix doesn't have
 #if !defined(__WXMSW__)
 typedef char			CHAR;
@@ -225,12 +225,6 @@
 #define _strnicmp		strncasecmp
 #define _snprintf		snprintf
 
-//#define _tcsclen		wcslen
-
-//#define tcstof							wcstof
-
-//#define tprintf			wprintf
-
 #else // !wxUSE_UNICODE
 
 typedef char			TCHAR;
@@ -242,13 +236,6 @@
 #define _strnicmp		strncasecmp
 #define _snprintf		snprintf
 
-//#define _tcstok			strtok_r
-//#define _tcsclen		strlen
-
-//#define _ttof			atof
-
-//#define tprintf			printf
-
 #endif
 
 static void CharUpper( TCHAR *psz )
@@ -626,25 +613,14 @@
 
 #define SIZEOF_VOIDP	sizeof(void *)
 
-#define camStrtok	_tcstok
-#define camStrtof( str, pszMark )	tcstod( str, pszMark )
+#define camStrinc				_tcsinc
+#define camStrninc				_tcsninc
+#define camStrdec				_tcsdec
+#define camStrtok( t, d, x )	_tcstok( (t), (d) )
+#define camStrtof				_tcstod
 
-//#define tprintf			_tprintf
-
-#if 0 != wxUSE_UNICODE
-
-//#define tcstok( str, sep, pszMark )			wcstok( str, sep )
-//#define tcstof( str, pszMark )				wcstod( str, pszMark )
-
-#else
-
-//#define tcstok( str, sep, pszMark )			strtok( str, sep )
-//#define tcstof( str, pszMark )				strtod( str, pszMark )
-
 #endif
 
-#endif
-
 // Replacements for some MFC classes
 typedef TCHAR				TBYTE;
 typedef TCHAR			   *PTBYTE;
Index: Trunk/XaraLX/wxOil/basestr.h
===================================================================
--- Trunk/XaraLX/wxOil/basestr.h	(revision 837)
+++ Trunk/XaraLX/wxOil/basestr.h	(revision 838)
@@ -895,9 +895,9 @@
 	return (WCHAR)ch;
 
 #else
-	PORTNOTETRACE("other", "WCHAR StringBase::CharAt does nothing in non-UNICODE builds!")
+	PORTNOTETRACE("other", "WCHAR StringBase::CharAt does nothing in non-UNICODE builds!");
 	ERROR3("This function is unimplemented in non-UNICODE builds!");
-	return (WCHAR)ch;
+	return (WCHAR)0;
 #endif
 }
 
Index: Trunk/XaraLX/wxOil/errors.cpp
===================================================================
--- Trunk/XaraLX/wxOil/errors.cpp	(revision 837)
+++ Trunk/XaraLX/wxOil/errors.cpp	(revision 838)
@@ -923,7 +923,7 @@
 {
 	TCHAR buf[256];
 	CamProfile::GetTimeString(buf, 256);
-	TraceAll(_T("[%s] %s"),buf, t);
+	TraceAll(_T("[%s] %s"), buf, t);
 }
 
 #endif
Index: Trunk/XaraLX/wxOil/dlgmgr.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dlgmgr.cpp	(revision 837)
+++ Trunk/XaraLX/wxOil/dlgmgr.cpp	(revision 838)
@@ -98,10 +98,11 @@
 
 // Implementation of the DialogManager class (bodge central)
 
+// Include files
+#include "camtypes.h"
+
 #include <wx/tooltip.h>
 
-// Include files
-#include "camtypes.h"
 #include "dlgmgr.h"
 #include "dialogop.h"
 //#include "simon.h"
Index: Trunk/XaraLX/wxOil/ensure.cpp
===================================================================
--- Trunk/XaraLX/wxOil/ensure.cpp	(revision 837)
+++ Trunk/XaraLX/wxOil/ensure.cpp	(revision 838)
@@ -141,15 +141,22 @@
 
 #ifdef _ENSURES
 
-	TCHAR				sz[255];
+	TCHAR				sz[256];
 	static TCHAR BASED_CODE szTitle[] = wxT("Ensure Failed!");
 
-	// In Unicode we need %ls for AssertDescription
+	// In Unicode we need to convert the filename to TCHAR
 #if 0 != wxUSE_UNICODE
-	static TCHAR BASED_CODE szMessage[] = wxT("%ls, File %s, Line %d
No=Abort, Yes=Debug, Cancel=Continue");
+	TCHAR szRealFile[256];
+	size_t count = camMbstowcs(szRealFile, lpszFileName, 255);
+	if (count == (size_t)-1)
+		count = 0;
+	szRealFile[count] = (TCHAR)0;
+	const TCHAR* lpszRealFile = szRealFile;
 #else
+	const TCHAR* lpszRealFile = lpszFileName;
+#endif
+
 	static TCHAR BASED_CODE szMessage[] = wxT("%s, File %s, Line %d
No=Abort, Yes=Debug, Cancel=Continue");
-#endif
 	static TCHAR BASED_CODE szMessageNoReason[] = wxT("Error %d@%s
No=Abort, Yes=Debug, Cancel=Continue");			// note number first
 
 	// get app name or NULL if unknown (don't call assert)
@@ -160,7 +167,7 @@
 		camSnprintf(sz, 255,
 			szMessage,                       
 			AssertDescription, 
-			lpszFileName, 
+			lpszRealFile, 
 			nLine);    
 	}
 	else   
@@ -168,7 +175,7 @@
 		camSnprintf(sz, 255,
 			szMessageNoReason,
 			nLine,
-			lpszFileName);
+			lpszRealFile);
 	}
 	
 #ifdef _DEBUG


Xara