projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Documenting WX_MONOLITHIC build option.
[wxWidgets.git]
/
src
/
common
/
string.cpp
diff --git
a/src/common/string.cpp
b/src/common/string.cpp
index 9e72b8aa59bad2fc791ba288391aa226f2eaf420..5bb461cb176b4f019fd5609950f8d2b4c09c2e36 100644
(file)
--- a/
src/common/string.cpp
+++ b/
src/common/string.cpp
@@
-39,10
+39,6
@@
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
-#ifndef __WXMSW__
-#include <errno.h>
-#endif
-
#ifdef __SALFORDC__
#include <clib.h>
#endif
#ifdef __SALFORDC__
#include <clib.h>
#endif
@@
-365,8
+361,8
@@
bool wxStringBase::Alloc(size_t nLen)
if ( pData->IsEmpty() ) {
nLen += EXTRA_ALLOC;
if ( pData->IsEmpty() ) {
nLen += EXTRA_ALLOC;
-
wxStringData* pData = (wxStringData
*)
- malloc(sizeof(wxStringData) + (nLen + 1)*sizeof(wxChar));
+
pData = (wxStringData
*)
+
malloc(sizeof(wxStringData) + (nLen + 1)*sizeof(wxChar));
if ( pData == NULL ) {
// allocation failure handled by caller
if ( pData == NULL ) {
// allocation failure handled by caller
@@
-1817,7
+1813,7
@@
int wxString::PrintfV(const wxChar* pszFormat, va_list argptr)
for ( ;; )
{
wxStringBuffer tmp(*this, size + 1);
for ( ;; )
{
wxStringBuffer tmp(*this, size + 1);
- wxChar
*
buf = tmp;
+ wxChar
*
buf = tmp;
if ( !buf )
{
if ( !buf )
{
@@
-1839,25
+1835,21
@@
int wxString::PrintfV(const wxChar* pszFormat, va_list argptr)
// vsnprintf() may return either -1 (traditional Unix behaviour) or the
// total number of characters which would have been written if the
// vsnprintf() may return either -1 (traditional Unix behaviour) or the
// total number of characters which would have been written if the
- // buffer were large enough
- if ( len
>= 0 && len <= size
)
+ // buffer were large enough
(newer standards such as Unix98)
+ if ( len
< 0
)
{
{
- // ok, there was enough space
- break;
+ // still not enough, as we don't know how much we need, double the
+ // current size of the buffer
+ size *= 2;
}
}
-
-#ifdef EOVERFLOW
- // if the error is not due to not having enough space (it could be e.g.
- // EILSEQ), break too -- we'd just eat all available memory uselessly
- if ( errno != EOVERFLOW )
+ else if ( len > size )
+ {
+ size = len;
+ }
+ else // ok, there was enough space
{
{
- // no sense in continuing
break;
}
break;
}
-#endif // EOVERFLOW
-
- // still not enough, double it again
- size *= 2;
}
// we could have overshot
}
// we could have overshot
@@
-2497,7
+2489,11
@@
void wxArrayString::Sort(CompareFunction compareFunction)
END_SORT();
}
END_SORT();
}
-typedef int (wxC_CALLING_CONV * wxStringCompareFn)(const void *first, const void *second);
+extern "C"
+{
+ typedef int (wxC_CALLING_CONV * wxStringCompareFn)(const void *first,
+ const void *second);
+}
void wxArrayString::Sort(CompareFunction2 compareFunction)
{
void wxArrayString::Sort(CompareFunction2 compareFunction)
{