[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
RE: Strings and unicode (was Re: [XaraXtreme-dev] Re: [XaraXtreme-commits] Commit Complete)
- From: "Gerry Iles" <GerryI@xxxxxxxx>
- Date: Wed, 19 Apr 2006 12:31:33 +0100
- Subject: RE: Strings and unicode (was Re: [XaraXtreme-dev] Re: [XaraXtreme-commits] Commit Complete)
The %hs option should be available on all Unicode builds however, in
this case, it may be better to not use it as we can't be sure of how it
InternalAssert shouldn't really try to do anything that might fail so it
is probably safer to convert the filename string manually in Unicode
builds. I'll be checking in this version shortly.
FixFormat currently doesn't do anything but I've left the various calls
to it in place for the time being in case I needed to put it back for
From: owner-dev@xxxxxxxxxxxxxxxx [mailto:owner-dev@xxxxxxxxxxxxxxxx] On
Behalf Of Alex Bligh
Sent: 18 April 2006 19:54
Cc: Alex Bligh
Subject: Strings and unicode (was Re: [XaraXtreme-dev] Re:
[XaraXtreme-commits] Commit Complete)
Gerry Iles wrote:
> Basically, you should now always just use %s (or %c) which means a
> string in the camSprintf type functions though this does mean that you
> can't write a char string using them. E.g. you can't do:
OK. What if I want to print a "char *" into a TCHAR *? For instance,
debug asserts no longer print the file name, as (ensure.cpp, line 135)
static void InternalAssert(const TCHAR * AssertDescription,
const char * lpszFileName,
INT32 nLine, BOOL UseMFC)
So here lpszFileName is ALWAYS a char *, even under a Unicode build
(for better or for worse). We could just deprecate char * etc.
completely and fix all these to be long strings. Are you happy
for us to use the apparent wx extension that %hs means "yes
I am trying to print a non-unicode string into a unicode one"?
(annoyingly not supported in non-unicode builds but the cases
are sufficiently rare we can #ifdef this). I've tested this
as a fix and it works & can check it in if you like.
Also, should we not be zapping Error::FixFormat or rather the
calls to it where the users expect %s to be a platform
string (and won't take %ls as a Unicode string) - i.e.
where they call the camXXX string functions? These seem
to be restricted to errors.cpp and basestr.cpp.