Commit Graph

394 Commits

Author SHA1 Message Date
Václav Slavík
c9f7896861 first phase of transition to unified Unicode build:
1. changed c_str() to return wxCStrData (implicitly convertible to wxChar*)
2. added template type-safe wrappers for vararg functions
3. added wxUniChar class representing single Unicode character
4. changed wxString::operator[] and wxString::iterator to return wxUniChar


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44865 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-17 10:26:10 +00:00
Václav Slavík
b7452b3a0e removed wxArrayString casting hack, it doesn't work with the new wxString class
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44848 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-16 12:57:46 +00:00
Václav Slavík
d8a4b666cf deprecated wxString::GetWriteBuf() and friends in favour of wxStringBuffer
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44637 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-07 20:01:52 +00:00
Vadim Zeitlin
c1dc9f8394 removed WXWIN_COMPATIBILITY_2_4 from common and wxMSW files (patch 1675546)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44625 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-07 11:35:04 +00:00
Václav Slavík
001ad728a4 changed wxArrayString::m_pItems from wxChar* to const wxChar*, the strings are not modified by the class
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44563 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-02-24 15:19:16 +00:00
Vadim Zeitlin
f2bbe5b675 fixes and workarounds to return value of our own wxVsnprintf_() implementation: handle -1 as error and not an indication that there is not enough space (patch 1623077)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44122 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-01-07 16:17:28 +00:00
Vadim Zeitlin
c56d73fe00 NUL terminate the string in UngetWriteBuf(len) (bug 1594189)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43685 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-11-27 15:03:06 +00:00
Michael Wetherell
b2c31089c2 Make the function passed to wxStringToIntType a template parameter instead of
assuming its type.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43278 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-11-10 16:00:44 +00:00
Vadim Zeitlin
9129836e62 wxArrayString::Alloc() shouldn't clear the array contents
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43203 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-11-08 18:52:43 +00:00
Włodzimierz Skiba
122f3c5dc0 Simplest fix received from OW community (Peter C. Chapin).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42743 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-30 18:40:50 +00:00
Włodzimierz Skiba
92df97b87b wxWinCE build fix.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42737 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-30 18:06:44 +00:00
Vadim Zeitlin
ead067dedf slightly reduce the number of #ifndef __WATCOMC__
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42708 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-30 11:20:11 +00:00
Włodzimierz Skiba
bca6a3a555 Temporary ugly trick to make release for OpenWatcom possible.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42707 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-30 11:08:48 +00:00
Vadim Zeitlin
64f8f94ca0 deal correctly with vsnprintf() implementations which always NUL-terminate the buffer, even if there is not enough space (recent glibc ones do it like this)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42620 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-29 15:51:10 +00:00
Vadim Zeitlin
d6718dd17b added wxString::ToLongLong() and ToULongLong() (feature request 1290937)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42581 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-28 16:46:03 +00:00
Vadim Zeitlin
e71e5b3726 also reset errno iin ToDouble()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42579 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-28 15:42:28 +00:00
Vadim Zeitlin
4ea4767ef9 reset errno before testing it
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42578 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-28 15:41:32 +00:00
Vadim Zeitlin
619dcb095e extracted common code of ToLong and ToULong in a separate template helper
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42577 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-28 15:24:07 +00:00
Vadim Zeitlin
bda041e561 check for under/overflow in ToLong/ULong/Double() as well
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42573 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-28 14:58:56 +00:00
Václav Slavík
422d020d99 fixed the check in previous commit
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41824 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-09 18:47:20 +00:00
Václav Slavík
a425518dc4 assert if wxString(void* pStart,void *pEnd) ctor is used incorrectly
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41823 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-09 18:37:33 +00:00
Vadim Zeitlin
e66eb2dfae fixed Contains() to pass the unit test (didn't work for empty strings)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41487 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-09-28 11:38:51 +00:00
Vadim Zeitlin
639e001d87 removed operator>>(istream&, wxString&) -- it's better to not have it at all than have an empty function which compiles but doesn't work
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41338 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-09-20 23:59:17 +00:00
Włodzimierz Skiba
32c62191d7 Final fix for Bug #1472688 'wxString::Trim() is broken'
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39758 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-06-15 23:21:28 +00:00
Włodzimierz Skiba
d4d02bd565 Code symetry for both directions of trimming towards fixing bug #1472688.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39723 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-06-14 16:42:35 +00:00
Włodzimierz Skiba
3458e408ba Source cleaning.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39713 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-06-14 10:19:14 +00:00
Vadim Zeitlin
eaba6eba3a wxArrayString::Sort() wasn't MT-safe even though it tried to
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39541 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-06-03 22:32:36 +00:00
Vadim Zeitlin
3affcd078b added wxString::EndsWith() (patch 1483049)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39069 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-05-06 17:27:52 +00:00
Włodzimierz Skiba
8898456df4 wx/wxprec.h already includes wx/defs.h (with other minor cleaning).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38787 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-04-18 07:24:35 +00:00
Vadim Zeitlin
467e04791c 1. use a manifest constant wxNO_LEN instead of -1 for lengths everywhere
2. reimplemented UTF-16/32 conversions using To/FromWChar() API instead
   of MB2WC/WC2MB for Windows (or rather SIZEOF_WCHAR_T == 2 platforms),
   the first tangible result is that reading UTF-32BE text streams now
   works too
3. more off by 1 fixes


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38585 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-04-05 22:12:45 +00:00
Vadim Zeitlin
830f8f11bc 1. changed all "wxMBConv& conv" parameters to "const wxMBConv&"
2. this allows to use wxConvAuto() instead of wxConvUTF8 as default value
   for this parameter in the classes which read text from the file: wxConvAuto
   automatically recognizes the BOM at the start of file and uses the correct
   conversion
3. don't use Windows for UTF-7 conversions as there is no way to make it
   fail on invalid UTF-7 strings; use our own wxMBConvUtf7 instead


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38570 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-04-05 14:37:47 +00:00
Vadim Zeitlin
eec47cc6c4 Described in the comments and documented the semantics of the parameters and
return values of wxMBConv methods and tried to make them more consistent. The
only (intentional) backwards incompatible change is that cMB2WC/cWC2MB now
return the length of the converted string in outLen parameter and not length+1

Added wxMBConv::GetMBNul() and use it instead of supposing that all multibyte
strings are always terminated with a single NUL which is wrong for UTF-16/32.

Using GetMBNul(), completely rewrote cMB2WC/cWC2MB() to accept a string of the
specified length, whether it is NUL-terminated or not. This means that they
don't overwrite the provided buffer any more and convert the entire string in
all cases.

Fixed bug in wxMBConvUTF16::WC2MB() which didn't NUL-terminate the string
properlyv even if there was enough space.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38498 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-04-01 12:43:03 +00:00
Vadim Zeitlin
de2589be08 avoid multiple reallocations in wxString::PrintfV() if vsnprintf() returns the total required size
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36303 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-11-30 14:49:47 +00:00
Vadim Zeitlin
a815cb29f2 removed (now) unnecessary errno.h include
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36292 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-11-30 02:42:39 +00:00
Vadim Zeitlin
b1727cfef7 don't expect errno to be set to EOVERFLOW if vsnprintf() fails
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36290 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-11-29 22:59:02 +00:00
Vadim Zeitlin
17a1ebd101 first round of Intel compiler warning fixes: down from a few thousands just to slightly more than 100
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-09-25 19:59:19 +00:00
Vadim Zeitlin
c15b8bfd6f qsort() should be passedonly extern C functions
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35487 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-09-13 14:35:50 +00:00
Włodzimierz Skiba
7448de8d8d [1231183] 'cleanup: mismatched indentation' and other cleanings.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34914 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-07-22 17:08:42 +00:00
Włodzimierz Skiba
73f507f52d Prevent crash in wxString::Mid under STL builds (fixes #1231725).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34811 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-07-04 11:12:52 +00:00
Vadim Zeitlin
6c0b29749c fixed EOVERFLOW handlign after previous commit and also explained what's going on
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33949 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-05-04 19:32:53 +00:00
Vadim Zeitlin
1495b91505 replace complicated OS tests with simple ifdef EOVERFLOW in wxString::PrintfV()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33943 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-05-04 17:14:43 +00:00
Michael Wetherell
5dc6072884 Compilation fix for djgpp
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33822 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-04-22 13:23:47 +00:00
Michael Wetherell
368bb66293 No EOVERFLOW on openbsd
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33673 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-04-16 17:13:14 +00:00
Włodzimierz Skiba
7220e45533 Simpler for readable diffs in future new ports.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33628 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-04-15 16:47:28 +00:00
Włodzimierz Skiba
ad5bb7d6a6 Sending wxChar* outputs pointer instead of text under Borland.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33582 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-04-13 17:53:28 +00:00
Ryan Norton
2df0258e2b fix wxString::Replace when new strings are longer than old string
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33494 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-04-11 09:05:40 +00:00
Ryan Norton
92413909e8 Get rid of superflous if statement - taken care of by the following for loop
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33446 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-04-09 06:42:42 +00:00
Ryan Norton
510bb7480c REWRITE wxStringBase::append and wxString::Replace.
This had to be done because they did not take into account null characters.
([ 1179490 ] wxString::Replace() truncates strings containing null bytes) notified me of this.
Please test and let me know of any problems!


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33439 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-04-08 22:53:27 +00:00
Stefan Neis
33cc6200a8 Compilation fix for old OS/2 compilers.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33128 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-03-28 19:21:09 +00:00
David Elliott
d95fb7ebf8 EOVERFLOW is not available on classic Mac OS.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33084 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2005-03-27 04:15:30 +00:00