if ( nLength > 0 ) {
AllocBuffer(nLength);
-
+
wxASSERT( sizeof(char) == 1 ); // can't use memset if not
memset(m_pchData, ch, nLength);
wxASSERT( nLen != 0 ); // doesn't make any sense
// must not share string and must have enough space
- register wxStringData* pData = GetStringData();
+ register wxStringData* pData = GetStringData();
if ( pData->IsShared() || (nLen > pData->nAllocLength) ) {
// can't work with old buffer, get new one
pData->Unlock();
AllocBuffer(nLen);
}
- wxASSERT( !pData->IsShared() ); // we must be the only owner
+ wxASSERT( !GetStringData()->IsShared() ); // we must be the only owner
}
// get the pointer to writable buffer of (at least) nLen bytes
return iLen;
}
+#if 0
+int wxString::Scanf(const char *pszFormat, ...) const
+{
+ va_list argptr;
+ va_start(argptr, pszFormat);
+
+ int iLen = ScanfV(pszFormat, argptr);
+
+ va_end(argptr);
+
+ return iLen;
+}
+
+int wxString::ScanfV(const char *pszFormat, va_list argptr) const
+{
+#ifdef __WINDOWS__
+ wxMessageBox("ScanfV not implemented");
+ return 0;
+#else
+ return vsscanf(c_str(), pszFormat, argptr);
+#endif
+}
+#endif
+
// ---------------------------------------------------------------------------
// standard C++ library string functions
// ---------------------------------------------------------------------------
wxASSERT( nPos <= Len() );
wxString strTmp;
- char *pc = strTmp.GetWriteBuf(Len() + str.Len() + 1);
+ char *pc = strTmp.GetWriteBuf(Len() + str.Len());
strncpy(pc, c_str(), nPos);
strcpy(pc + nPos, str);
strcpy(pc + nPos + str.Len(), c_str() + nPos);