From dea9deca836e2730e463806d444b5c990e372b0b Mon Sep 17 00:00:00 2001 From: jamienoss Date: Wed, 26 Nov 2014 20:37:14 +0000 Subject: [PATCH] HPCC-12622 Deprecate toCharArray() Signed-off-by: jamienoss --- common/deftype/defvalue.cpp | 36 +++++++++---------- common/fileview2/fvtransform.cpp | 4 +-- dali/base/dacoven.cpp | 4 +-- dali/base/dasds.cpp | 24 ++++++------- dali/daliadmin/daliadmin.cpp | 4 +-- dali/dfuXRefLib/XRefFilesNode.cpp | 6 ++-- dali/dfuXRefLib/XRefNodeManager.cpp | 6 ++-- dali/dfuplus/dfuplus.cpp | 2 +- dali/ft/daftformat.cpp | 8 ++--- dali/sasha/saxref.cpp | 2 +- dali/treeview/connect.cpp | 2 +- dali/treeview/inspectctrl.cpp | 4 +-- dali/treeview/treeviewdlg.cpp | 2 +- dali/treeview/util.cpp | 2 +- deployment/configgen/main.cpp | 2 +- deployment/configutils/confighelper.hpp | 10 +++--- deployment/deploy/DeployTask.cpp | 8 ++--- deployment/deploy/DeploymentEngine.cpp | 2 +- deployment/deployutils/deployutils.cpp | 6 ++-- ecl/eclagent/eclagent.cpp | 8 ++--- ecl/eclcc/eclcc.cpp | 10 +++--- ecl/hql/hqlesp.cpp | 2 +- ecl/hql/hqlexpr.cpp | 8 ++--- ecl/hql/hqlfold.cpp | 4 +-- ecl/hql/hqlgram2.cpp | 16 ++++----- ecl/hqlcpp/hqlwcpp.cpp | 2 +- ecl/hthor/hthor.cpp | 4 +-- esp/clients/LoggingClient/LocalDataLogger.cpp | 2 +- esp/esdllib/esdl_def.cpp | 6 ++-- esp/services/WsDeploy/WsDeployService.cpp | 12 +++---- esp/services/WsDeploy/WsDeployService.hpp | 2 +- esp/services/ws_dfu/ws_dfuService.cpp | 2 +- .../ws_esdlconfig/ws_esdlconfigservice.cpp | 2 +- .../ws_topology/ws_topologyService.cpp | 2 +- esp/smc/SMCLib/TpWrapper.cpp | 2 +- roxie/ccd/ccdlistener.cpp | 6 ++-- roxie/udplib/udptrr.cpp | 8 ++--- roxie/udplib/udptrs.cpp | 6 ++-- rtl/eclrtl/rtlkey.cpp | 2 +- services/runagent/frunagent.cpp | 2 +- services/runagent/hodisp_base.cpp | 6 ++-- system/hrpc/hrpc.cpp | 12 +++---- system/jhtree/jhtree.cpp | 2 +- system/jlib/jcomp.cpp | 6 ++-- system/jlib/jexcept.cpp | 4 +-- system/jlib/jfile.cpp | 2 +- system/jlib/jmisc.cpp | 2 +- system/jlib/jprop.cpp | 4 +-- system/jlib/jptree.cpp | 32 ++++++++--------- system/jlib/jsocket.cpp | 2 +- system/jlib/jstring.cpp | 24 ++++++------- system/jlib/jstring.hpp | 5 ++- system/jlib/jutil.cpp | 2 +- system/mp/mpcomm.cpp | 14 ++++---- system/mp/mptag_test.cpp | 4 +-- system/security/shared/basesecurity.hpp | 6 ++-- testing/unittests/jlibtests.cpp | 2 +- .../distribution/thdistribution.cpp | 4 +-- .../hashdistrib/thhashdistribslave.cpp | 2 +- thorlcr/activities/msort/thmsort.cpp | 2 +- thorlcr/activities/thactivityutil.cpp | 2 +- .../activities/xmlwrite/thxmlwriteslave.cpp | 8 ++--- thorlcr/master/thmastermain.cpp | 4 +-- thorlcr/slave/thslavemain.cpp | 14 ++++---- thorlcr/thorutil/thormisc.cpp | 8 ++--- tools/esdlcmd/esdl2ecl.cpp | 2 +- tools/testsocket/testsocket.cpp | 4 +-- 67 files changed, 210 insertions(+), 211 deletions(-) diff --git a/common/deftype/defvalue.cpp b/common/deftype/defvalue.cpp index 2bd4fcf4a41..902a3f94ef2 100644 --- a/common/deftype/defvalue.cpp +++ b/common/deftype/defvalue.cpp @@ -250,13 +250,13 @@ VarStringValue::VarStringValue(unsigned len, const char *v, ITypeInfo *_type) : const char *VarStringValue::generateECL(StringBuffer &out) { - return appendStringAsQuotedECL(out, val.length(), val).toCharArray(); + return appendStringAsQuotedECL(out, val.length(), val).str(); } const char *VarStringValue::generateCPP(StringBuffer &out, CompilerType compiler) { unsigned len = val.length(); - return appendStringAsQuotedCPP(out, len, val.get(), len>120).toCharArray(); + return appendStringAsQuotedCPP(out, len, val.get(), len>120).str(); } void VarStringValue::toMem(void *target) @@ -324,7 +324,7 @@ __int64 VarStringValue::getIntValue() const char *VarStringValue::getStringValue(StringBuffer &out) { out.append(val); - return out.toCharArray(); + return out.str(); } void VarStringValue::pushDecimalValue(void) @@ -469,7 +469,7 @@ StringValue::StringValue(const char *v, ITypeInfo *_type) : MemoryValue(_type) const char *StringValue::generateECL(StringBuffer &out) { - return appendStringAsQuotedECL(out, type->getSize(), (const char *)val.get()).toCharArray(); + return appendStringAsQuotedECL(out, type->getSize(), (const char *)val.get()).str(); } int StringValue::compare(IValue * to) @@ -541,7 +541,7 @@ __int64 StringValue::getIntValue() const char *StringValue::getStringValue(StringBuffer &out) { out.append(type->getSize(), (const char *)val.get()); - return out.toCharArray(); + return out.str(); } const char *StringValue::getUTF8Value(StringBuffer &out) @@ -559,7 +559,7 @@ const char *StringValue::getUTF8Value(StringBuffer &out) unsigned bufflen; rtlStrToUtf8X(bufflen, temp.refstr(), type->getSize(), (const char *)val.get()); out.append(rtlUtf8Size(bufflen, temp.getstr()), temp.getstr()); - return out.toCharArray(); + return out.str(); } void StringValue::pushDecimalValue() @@ -869,7 +869,7 @@ const char * VarUnicodeValue::generateCPP(StringBuffer & out, CompilerType compi { out.append("(UChar *)"); unsigned len = val.length()*2+1; // not pretty, but adds one null, so that string is double-null-terminated as required - return appendStringAsQuotedCPP(out, len, (char const *)val.get(), len>120).toCharArray(); + return appendStringAsQuotedCPP(out, len, (char const *)val.get(), len>120).str(); } const char * VarUnicodeValue::generateECL(StringBuffer & out) @@ -1232,7 +1232,7 @@ const char *DataValue::generateECL(StringBuffer &out) out.append("X'"); appendDataAsHex(out, val.length(), val.get()); out.append('\''); - return out.toCharArray(); + return out.str(); } @@ -1321,7 +1321,7 @@ bool DataValue::getBoolValue() const char *DataValue::getStringValue(StringBuffer &out) { appendDataAsHex(out, val.length(), val.get()); - return out.toCharArray(); + return out.str(); } IValue *createDataValue(const char *val, unsigned size) @@ -1435,7 +1435,7 @@ const char *QStringValue::getStringValue(StringBuffer &out) rtlQStrToStr(strLen, strData, strLen, (const char *)val.get()); out.append(strLen, strData); free(strData); - return out.toCharArray(); + return out.str(); } void QStringValue::pushDecimalValue() @@ -1486,7 +1486,7 @@ const char *CharValue::generateCPP(StringBuffer &out, CompilerType compiler) out.append((int)val); break; } - return out.toCharArray(); + return out.str(); } void CharValue::toMem(void *target) @@ -1538,7 +1538,7 @@ bool CharValue::getBoolValue() const char *CharValue::getStringValue(StringBuffer &out) { - return out.append(val).toCharArray(); + return out.append(val).str(); } void CharValue::pushDecimalValue() @@ -1728,7 +1728,7 @@ const char *IntValue::getStringValue(StringBuffer &s) s.append((__int64)val); else s.append(val); - return s.toCharArray(); + return s.str(); } bool IntValue::getBoolValue() @@ -2173,7 +2173,7 @@ const char *DecimalValue::generateCPP(StringBuffer &s, CompilerType compiler) s.appendhex(c, false); } s.append('"'); - return s.toCharArray(); + return s.str(); } const char *DecimalValue::getStringValue(StringBuffer &s) @@ -2183,7 +2183,7 @@ const char *DecimalValue::getStringValue(StringBuffer &s) pushDecimalValue(); DecPopCString(sizeof(strval), strval); s.append(strval); - return s.toCharArray(); + return s.str(); } bool DecimalValue::getBoolValue() @@ -2254,19 +2254,19 @@ IValue *createDecimalValueFromStack(ITypeInfo * type) const char *BoolValue::generateECL(StringBuffer &s) { s.append(val ? "true" : "false"); - return s.toCharArray(); + return s.str(); } const char *BoolValue::generateCPP(StringBuffer &s, CompilerType compiler) { s.append(val ? "true" : "false"); - return s.toCharArray(); + return s.str(); } const char *BoolValue::getStringValue(StringBuffer &s) { s.append(val ? "true" : "false"); - return s.toCharArray(); + return s.str(); } bool BoolValue::getBoolValue() diff --git a/common/fileview2/fvtransform.cpp b/common/fileview2/fvtransform.cpp index acfb2097226..3ff4944c2d0 100644 --- a/common/fileview2/fvtransform.cpp +++ b/common/fileview2/fvtransform.cpp @@ -351,11 +351,11 @@ void * ViewTransformerRegistry::resolveExternal(IHqlExpression * funcdef) ensureFileExtension(lib, SharedObjectExtension); - Owned match = loadedPlugins->getPluginDll(lib.toCharArray(), NULL, false); // MORE - shouldn't it check the version???? + Owned match = loadedPlugins->getPluginDll(lib.str(), NULL, false); // MORE - shouldn't it check the version???? if (!match) return NULL; - return GetSharedProcedure(match->getInstance(), entry.toCharArray()); + return GetSharedProcedure(match->getInstance(), entry.str()); } diff --git a/dali/base/dacoven.cpp b/dali/base/dacoven.cpp index 4f032212b34..21fd155c155 100644 --- a/dali/base/dacoven.cpp +++ b/dali/base/dacoven.cpp @@ -495,13 +495,13 @@ class CCovenServer: public CCovenBase toXML(t, xml); Owned f = createIFile(storename.get()); Owned io = f->open(IFOcreate); - io->write(0, xml.length(), xml.toCharArray()); + io->write(0, xml.length(), xml.str()); io.clear(); if (!backupname.isEmpty()) { try { f.setown(createIFile(backupname.get())); io.setown(f->open(IFOcreate)); - io->write(0, xml.length(), xml.toCharArray()); + io->write(0, xml.length(), xml.str()); io.clear(); } catch (IException *e) { diff --git a/dali/base/dasds.cpp b/dali/base/dasds.cpp index 9253181620e..55db0495f2e 100644 --- a/dali/base/dasds.cpp +++ b/dali/base/dasds.cpp @@ -979,11 +979,11 @@ void writeDelta(StringBuffer &xml, IFile &iFile, const char *msg="", unsigned re lastGood = iFileIO->size(); } stream->seek(0, IFSend); - stream->write(xml.length(), xml.toCharArray()); + stream->write(xml.length(), xml.str()); stream->flush(); stream.clear(); offset_t fLen = lastGood + xml.length(); - unsigned crc = crc32(xml.toCharArray(), xml.length(), startCrc); + unsigned crc = crc32(xml.str(), xml.length(), startCrc); char *headerPtr = (char *)header.bufferBase(); sprintf(strNum, "%010u", ~crc); memcpy(headerPtr + deltaHeaderCrcOff, strNum, 10); @@ -1432,7 +1432,7 @@ class CLegacyBinaryFileExternal : public CExternalFile, implements IExternalHand LOG(MCoperatorWarning, unknownJob, e, s.str()); StringBuffer str("EXTERNAL BINARY FILE: \""); str.append(filename.str()).append("\" MISSING"); - CPTValue v(str.length()+1, str.toCharArray(), false); + CPTValue v(str.length()+1, str.str(), false); v.serialize(mb); } else @@ -1469,7 +1469,7 @@ class CLegacyBinaryFileExternal : public CExternalFile, implements IExternalHand { StringBuffer str("EXTERNAL BINARY FILE: \""); str.append(filename.str()).append("\" MISSING"); - CPTValue v(str.length()+1, str.toCharArray(), false); + CPTValue v(str.length()+1, str.str(), false); v.serialize(mb); } else @@ -1537,7 +1537,7 @@ class CBinaryFileExternal : public CExternalFile, implements IExternalHandler LOG(MCoperatorWarning, unknownJob, e, s.str()); StringBuffer str("EXTERNAL BINARY FILE: \""); str.append(filename.str()).append("\" MISSING"); - CPTValue v(str.length()+1, str.toCharArray(), false); + CPTValue v(str.length()+1, str.str(), false); v.serialize(mb); } else @@ -1570,7 +1570,7 @@ class CBinaryFileExternal : public CExternalFile, implements IExternalHandler { StringBuffer str("EXTERNAL BINARY FILE: \""); str.append(filename.str()).append("\" MISSING"); - CPTValue v(str.length()+1, str.toCharArray(), false); + CPTValue v(str.length()+1, str.str(), false); v.serialize(mb); } else @@ -1637,7 +1637,7 @@ class CXMLFileExternal : public CExternalFile, implements IExternalHandler LOG(MCoperatorWarning, unknownJob, e, s.str()); StringBuffer str("EXTERNAL XML FILE: \""); str.append(filename.str()).append("\" MISSING"); - CPTValue v(str.length()+1, str.toCharArray(), false); + CPTValue v(str.length()+1, str.str(), false); v.serialize(mb); } else @@ -1669,7 +1669,7 @@ class CXMLFileExternal : public CExternalFile, implements IExternalHandler str.append(filename.str()).append("\" MISSING"); tree.setown(createPTree(owner.queryName())); if (withValue) - tree->setProp(NULL, str.toCharArray()); + tree->setProp(NULL, str.str()); } else { @@ -3805,7 +3805,7 @@ int CSDSTransactionServer::run() SDSManager->getLocks(out); mb.clear().append(DAMP_SDSREPLY_OK); mb.append(out.length()); - mb.append(out.length(), out.toCharArray()); + mb.append(out.length(), out.str()); break; } @@ -5285,9 +5285,9 @@ class CStoreHelper : public CInterface, implements IStoreHelper di->getName(fname); if ('_' != fname.charAt(7)) // Unhelpful naming convention to differentiate store files from externals! { - if (0 == memicmp("inc", fname.toCharArray()+4, 3) || 0 == memicmp("sds", fname.toCharArray()+4, 3)) + if (0 == memicmp("inc", fname.str()+4, 3) || 0 == memicmp("sds", fname.str()+4, 3)) { - const char *num = fname.toCharArray()+7; + const char *num = fname.str()+7; const char *dot = (const char *)strchr(num, '.'); unsigned fileEdition = atoi_l(num, dot-num); int d = (int)fileEdition-(int)edition; @@ -7115,7 +7115,7 @@ CServerConnection *CCovenSDSManager::createConnectionInstance(CRemoteTreeBase *r if (l && '/' == _xpath[l-1]) { tXpath.append(l-1, _xpath); - _xpath = tXpath.toCharArray(); + _xpath = tXpath.str(); } } bool newNode = false; diff --git a/dali/daliadmin/daliadmin.cpp b/dali/daliadmin/daliadmin.cpp index 0ed47e0bf81..b1bc0a07c76 100644 --- a/dali/daliadmin/daliadmin.cpp +++ b/dali/daliadmin/daliadmin.cpp @@ -2078,7 +2078,7 @@ struct CTreeItem : public CInterface { if (parent) parent->getXPath(xpath); - xpath.append('/').append(tail->toCharArray()); + xpath.append('/').append(tail->str()); if ((index!=0)||tail->IsShared()) xpath.append('[').append(index+1).append(']'); } @@ -2131,7 +2131,7 @@ class CXMLSizesParser : public CInterface virtual void beginNode(const char *tag, offset_t startOffset) { String *tail = levtail; - if (levtail&&(0 == strcmp(tag, levtail->toCharArray()))) + if (levtail&&(0 == strcmp(tag, levtail->str()))) tail->Link(); else tail = new String(tag); diff --git a/dali/dfuXRefLib/XRefFilesNode.cpp b/dali/dfuXRefLib/XRefFilesNode.cpp index de160c693ff..a7891077136 100644 --- a/dali/dfuXRefLib/XRefFilesNode.cpp +++ b/dali/dfuXRefLib/XRefFilesNode.cpp @@ -71,7 +71,7 @@ void CXRefFilesNode::Deserialize(IPropertyTree& inTree) CleanTree(inTree); StringBuffer datastr; toXML(&inTree,datastr); - m_baseTree.setPropBin("data",datastr.length(),(void*)datastr.toCharArray()); + m_baseTree.setPropBin("data",datastr.length(),(void*)datastr.str()); } IPropertyTree* CXRefFilesNode::FindNode(const char* NodeName) @@ -312,7 +312,7 @@ bool CXRefFilesNode::AttachPhysical(const char *Partmask,IUserDescriptor* udesc, return false; } - if (queryDistributedFileDirectory().exists(logicalName.toCharArray(),udesc)) + if (queryDistributedFileDirectory().exists(logicalName.str(),udesc)) { ERRLOG("Logical File %s already Exists. Can not reattach to Dali",logicalName.str()); errstr.appendf("Logical File %s already Exists. Can not reattach to Dali",logicalName.str()); @@ -364,7 +364,7 @@ bool CXRefFilesNode::AttachPhysical(const char *Partmask,IUserDescriptor* udesc, } Owned dFile = queryDistributedFileDirectory().createNew(fileDesc); - dFile->attach(logicalName.toCharArray(),udesc); + dFile->attach(logicalName.str(),udesc); if (!RemoveTreeNode(Partmask)) { ERRLOG("Removing XRef Branch %s",Partmask); diff --git a/dali/dfuXRefLib/XRefNodeManager.cpp b/dali/dfuXRefLib/XRefNodeManager.cpp index 10bcb99a462..8f80e4deb6f 100644 --- a/dali/dfuXRefLib/XRefNodeManager.cpp +++ b/dali/dfuXRefLib/XRefNodeManager.cpp @@ -270,7 +270,7 @@ void CXRefNode::deserializeMessages(IPropertyTree& inTree) } StringBuffer datastr; toXML(&inTree,datastr); - m_messages->setPropBin("data",datastr.length(),(void*)datastr.toCharArray()); + m_messages->setPropBin("data",datastr.length(),(void*)datastr.str()); } StringBuffer &CXRefNode::serializeDirectories(StringBuffer &buf) @@ -311,7 +311,7 @@ void CXRefNode::deserializeDirectories(IPropertyTree& inTree) } StringBuffer datastr; toXML(&inTree,datastr); - m_directories->setPropBin("data",datastr.length(),(void*)datastr.toCharArray()); + m_directories->setPropBin("data",datastr.length(),(void*)datastr.str()); } @@ -465,7 +465,7 @@ bool CXRefNode::removeEmptyDirectories(StringBuffer &errstr) ForEachItemInRev(i,todelete) t->removeTree((IPropertyTree *)todelete.item(i)); // probably should check succeeded above but next run will correct toXML(t,dataStr.clear()); - m_directories->setPropBin("data",dataStr.length(),(void*)dataStr.toCharArray()); + m_directories->setPropBin("data",dataStr.length(),(void*)dataStr.str()); emptyScopes(); return true; } diff --git a/dali/dfuplus/dfuplus.cpp b/dali/dfuplus/dfuplus.cpp index f3fc08ffa85..3e4f6d3adfc 100644 --- a/dali/dfuplus/dfuplus.cpp +++ b/dali/dfuplus/dfuplus.cpp @@ -1095,7 +1095,7 @@ int CDfuPlusHelper::list() StringBuffer output; output.append(onefile->getName()); output.append("\n"); - fputs(output.toCharArray(),f); + fputs(output.str(),f); } } } diff --git a/dali/ft/daftformat.cpp b/dali/ft/daftformat.cpp index b77dd8b6c69..4b4ccd1679b 100644 --- a/dali/ft/daftformat.cpp +++ b/dali/ft/daftformat.cpp @@ -688,7 +688,7 @@ void CCsvPartitioner::storeFieldName(const char * start, unsigned len) } // Check discovered field name uniqueness - const char * fn = fieldName.toCharArray(); + const char * fn = fieldName.str(); if ( fields->find(fn) != NULL ) { time_t t; @@ -699,7 +699,7 @@ void CCsvPartitioner::storeFieldName(const char * start, unsigned len) recordStructure.append(fieldName); recordStructure.append(";\n"); - fields->addAtom(fieldName.toCharArray()); + fields->addAtom(fieldName.str()); } size32_t CCsvPartitioner::getSplitRecordSize(const byte * start, unsigned maxToRead, bool processFullBuffer, bool ateof) @@ -1017,7 +1017,7 @@ void CUtfPartitioner::storeFieldName(const char * start, unsigned len) } // Check discovered field name uniqueness - const char * fn = fieldName.toCharArray(); + const char * fn = fieldName.str(); if ( fields->find(fn) != NULL ) { time_t t; @@ -1028,7 +1028,7 @@ void CUtfPartitioner::storeFieldName(const char * start, unsigned len) recordStructure.append(fieldName); recordStructure.append(";\n"); - fields->addAtom(fieldName.toCharArray()); + fields->addAtom(fieldName.str()); } size32_t CUtfPartitioner::getSplitRecordSize(const byte * start, unsigned maxToRead, bool processFullBuffer, bool ateof) diff --git a/dali/sasha/saxref.cpp b/dali/sasha/saxref.cpp index a41e1e7ed12..7a2bf547ca6 100644 --- a/dali/sasha/saxref.cpp +++ b/dali/sasha/saxref.cpp @@ -561,7 +561,7 @@ class CNewXRefManagerBase branch->setProp("Cluster",clustname); StringBuffer datastr; toXML(branch,datastr); - root->addPropTree(name,createPTree(name))->setPropBin("data",datastr.length(),datastr.toCharArray()); + root->addPropTree(name,createPTree(name))->setPropBin("data",datastr.length(),datastr.str()); } CNewXRefManagerBase() diff --git a/dali/treeview/connect.cpp b/dali/treeview/connect.cpp index 8af51c71caf..8991eb12ca3 100644 --- a/dali/treeview/connect.cpp +++ b/dali/treeview/connect.cpp @@ -236,7 +236,7 @@ class RemoteConnection : public Connection, implements IConnection ISDSManager & sdsManager = querySDS(); if(xpath) pathToRoot.append(xpath).append("/"); - conn = sdsManager.connect(pathToRoot.toCharArray(), myProcessSession(), 0, 5000); + conn = sdsManager.connect(pathToRoot.str(), myProcessSession(), 0, 5000); } catch(IException * e) { diff --git a/dali/treeview/inspectctrl.cpp b/dali/treeview/inspectctrl.cpp index 67ab0d14810..667251240fd 100644 --- a/dali/treeview/inspectctrl.cpp +++ b/dali/treeview/inspectctrl.cpp @@ -145,7 +145,7 @@ class CTreeListItem buf.append("["); buf.append(parent->queryChildIndex(pTree) + 1); buf.append("]"); - return buf.toCharArray(); + return buf.str(); } return type == TLT_attribute ? name + 1 : pTree->queryName(); } @@ -158,7 +158,7 @@ class CTreeListItem else pTree->getProp(name, buf.clear()); - return buf.toCharArray(); + return buf.str(); } inline TreeList_t getType() const { return type; } diff --git a/dali/treeview/treeviewdlg.cpp b/dali/treeview/treeviewdlg.cpp index 473ae6c73e4..f7172d7f76e 100644 --- a/dali/treeview/treeviewdlg.cpp +++ b/dali/treeview/treeviewdlg.cpp @@ -719,7 +719,7 @@ bool saveTree(LPCSTR fname, IPropertyTree & pTree) IFileIO * io = f->open(IFOcreate); if(io) { - if(io->write(0, xml.length(), xml.toCharArray()) != xml.length()) + if(io->write(0, xml.length(), xml.str()) != xml.length()) { showFIOErr(fname, false); r = false; diff --git a/dali/treeview/util.cpp b/dali/treeview/util.cpp index 7393bbdf08b..d2359da1c2c 100644 --- a/dali/treeview/util.cpp +++ b/dali/treeview/util.cpp @@ -101,7 +101,7 @@ void reportException(IException * e) StringBuffer eMsg; e->errorMessage(eMsg); CString msg("An error occured whilst attempting connection:\n"); - msg += eMsg.toCharArray(); + msg += eMsg.str(); msg += "."; MessageBox(NULL, msg, "Connection Error", MB_OK | MB_ICONEXCLAMATION); e->Release(); diff --git a/deployment/configgen/main.cpp b/deployment/configgen/main.cpp index 83b917c692a..7840fc54251 100644 --- a/deployment/configgen/main.cpp +++ b/deployment/configgen/main.cpp @@ -645,7 +645,7 @@ int processRequest(const char* in_cfgname, const char* out_dirname, const char* { IPropertyTree* pInst = &itInst->query(); String instName(pInst->queryName()); - if (!strcmp(instName.toCharArray(), "ThorMasterProcess") || instName.startsWith("RoxieServerProcess")) + if (!strcmp(instName.str(), "ThorMasterProcess") || instName.startsWith("RoxieServerProcess")) { out.appendf("%s=%s;%s%c%s;%s\n", pComponent->queryProp("@name"), pComponent->queryProp("@buildSet"), out_dirname, PATHSEPCHAR, pComponent->queryProp("@name"),"master"); } diff --git a/deployment/configutils/confighelper.hpp b/deployment/configutils/confighelper.hpp index 0fb420c1b61..f38c0b5c4a7 100644 --- a/deployment/configutils/confighelper.hpp +++ b/deployment/configutils/confighelper.hpp @@ -30,23 +30,23 @@ class CONFIGUTILS_API CConfigHelper const char* getConfigXMLDir() const { - return m_strConfigXMLDir.toCharArray(); + return m_strConfigXMLDir.str(); } const char* getBuildSetFileName() const { - return m_strBuildSetFileName.toCharArray(); + return m_strBuildSetFileName.str(); } const char* getEnvConfFile() const { - return m_strEnvConfFile.toCharArray(); + return m_strEnvConfFile.str(); } const char* getConfFile() const { - return m_strConfFile.toCharArray(); + return m_strConfFile.str(); } const char* getBuildSetFilePath() const { - return m_strBuildSetFilePath.toCharArray(); + return m_strBuildSetFilePath.str(); } void getNewComponentListFromBuildSet(const IPropertyTree *pEnvTree, StringArray &sCompArray) const; diff --git a/deployment/deploy/DeployTask.cpp b/deployment/deploy/DeployTask.cpp index c42c9fbfb79..047ae59a6d3 100644 --- a/deployment/deploy/DeployTask.cpp +++ b/deployment/deploy/DeployTask.cpp @@ -646,7 +646,7 @@ class CDeployTask : public CInterface, implements IDeployTask String err(errbuf.str()); int index = err.indexOf('\n'); String* perr = err.substring(0, index > 0? index : err.length()); - m_errorString.clear().appendf("%s", perr->toCharArray()); + m_errorString.clear().appendf("%s", perr->str()); delete perr; bCopyRC = false; @@ -1067,7 +1067,7 @@ class CDeployTask : public CInterface, implements IDeployTask String err(errbuf.str()); int index = err.indexOf('\n'); String* perr = err.substring(0, index > 0? index : err.length()); - m_errorString.clear().appendf("%s", perr->toCharArray()); + m_errorString.clear().appendf("%s", perr->str()); delete perr; return false; } @@ -1551,7 +1551,7 @@ class CDeployTask : public CInterface, implements IDeployTask unsigned int len = outputStr.length(); outputStr.ensureCapacity(len+sz); - if (sz == pFileIO->read(0, sz, (void*)(outputStr.toCharArray() + len))) + if (sz == pFileIO->read(0, sz, (void*)(outputStr.str() + len))) outputStr.setLength(sz+len); } } @@ -1592,7 +1592,7 @@ class CDeployTask : public CInterface, implements IDeployTask String err(errmsg.str()); int index = err.indexOf('\n'); String* perr = err.substring(0, index > 0? index : err.length()); - m_errorString.clear().appendf("%s", perr->toCharArray()); + m_errorString.clear().appendf("%s", perr->str()); delete perr; return false; } diff --git a/deployment/deploy/DeploymentEngine.cpp b/deployment/deploy/DeploymentEngine.cpp index 6eb7df1f892..9e3bdd17145 100644 --- a/deployment/deploy/DeploymentEngine.cpp +++ b/deployment/deploy/DeploymentEngine.cpp @@ -966,7 +966,7 @@ void CDeploymentEngine::writeFile(const char* filename, const char* str, EnvMach String errmsg(err.str()); int index = errmsg.indexOf('\n'); String* perr = errmsg.substring(0, index > 0? index : errmsg.length()); - output.clear().appendf("%s", perr->toCharArray()); + output.clear().appendf("%s", perr->str()); delete perr; throw MakeStringException(-1, "%s", output.str()); } diff --git a/deployment/deployutils/deployutils.cpp b/deployment/deployutils/deployutils.cpp index dd4be5bdbf0..e947354f100 100644 --- a/deployment/deployutils/deployutils.cpp +++ b/deployment/deployutils/deployutils.cpp @@ -2590,7 +2590,7 @@ bool checkComponentReferences(const IPropertyTree* pEnv, { String str(xpath); String* pStr = str.substring(0, strcspn(xpath, "/")); - xpath1.append(pStr->toCharArray()); + xpath1.append(pStr->str()); delete pStr; xpath2 = pSlash+1; } @@ -3758,7 +3758,7 @@ bool updateDirsWithConfSettings(IPropertyTree* pEnvRoot, IProperties* pParams, b if (str.indexOf('[') > 0) sb.append(pParams->queryProp("runtime")).append(PATHSEPCHAR).append(sbdir.str() + str.indexOf('[')); else - sb.append(str.toCharArray()); + sb.append(str.str()); pEnvRoot->setProp("Software/Directories/Category[@name='run']/@dir", sb.str()); ret = true; @@ -3777,7 +3777,7 @@ bool updateDirsWithConfSettings(IPropertyTree* pEnvRoot, IProperties* pParams, b if (str.indexOf('[') > 0) sb.append(pParams->queryProp("log")).append(PATHSEPCHAR).append(sbdir.str() + str.indexOf('[')); else - sb.append(str.toCharArray()); + sb.append(str.str()); pEnvRoot->setProp("Software/Directories/Category[@name='log']/@dir", sb.str()); ret = true; diff --git a/ecl/eclagent/eclagent.cpp b/ecl/eclagent/eclagent.cpp index ab335bae22a..44a10e6764c 100644 --- a/ecl/eclagent/eclagent.cpp +++ b/ecl/eclagent/eclagent.cpp @@ -296,15 +296,15 @@ class CHThorDebugSocketWorker : public CInterface, implements IPooledThread if (reqName.endsWith(requestArrayString)) { isRequestArray = true; - queryName.set(reqName.toCharArray(), reqName.length() - requestArrayString.length()); + queryName.set(reqName.str(), reqName.length() - requestArrayString.length()); } else if (reqName.endsWith(requestString)) { isRequest = true; - queryName.set(reqName.toCharArray(), reqName.length() - requestString.length()); + queryName.set(reqName.str(), reqName.length() - requestString.length()); } else - queryName.set(reqName.toCharArray()); + queryName.set(reqName.str()); queryXML->renameProp("/", queryName.get()); // reset the name of the tree } @@ -3125,7 +3125,7 @@ void printStart(int argc, const char *argv[]) cmd.append(' '); cmd.append('"').append(argv[argno]).append('"'); } - PrintLog("Starting %s", cmd.toCharArray()); + PrintLog("Starting %s", cmd.str()); } //-------------------------------------------------------------- diff --git a/ecl/eclcc/eclcc.cpp b/ecl/eclcc/eclcc.cpp index 17aff680fde..dff05a09da3 100644 --- a/ecl/eclcc/eclcc.cpp +++ b/ecl/eclcc/eclcc.cpp @@ -681,7 +681,7 @@ void EclCC::reportCompileErrors(IErrorReceiver & errorProcessor, const char * pr absCCLogName = "log file"; failText.appendf("Compile/Link failed for %s (see '%s' for details)",processName,absCCLogName.str()); - errorProcessor.reportError(ERR_INTERNALEXCEPTION, failText.toCharArray(), processName, 0, 0, 0); + errorProcessor.reportError(ERR_INTERNALEXCEPTION, failText.str(), processName, 0, 0, 0); try { StringBuffer s; @@ -726,7 +726,7 @@ void EclCC::instantECL(EclCompileInstance & instance, IWorkUnit *wu, const char bool optSaveCpp = optSaveTemps || optNoCompile || wu->getDebugValueBool("saveCppTempFiles", false); //New scope - testing things are linked correctly { - Owned generator = createDllGenerator(&errorProcessor, processName.toCharArray(), NULL, wu, templateDir, optTargetClusterType, this, false, false); + Owned generator = createDllGenerator(&errorProcessor, processName.str(), NULL, wu, templateDir, optTargetClusterType, this, false, false); setWorkunitHash(wu, instance.query); if (!optShared) @@ -745,7 +745,7 @@ void EclCC::instantECL(EclCompileInstance & instance, IWorkUnit *wu, const char instance.stats.cppSize = generator->getGeneratedSize(); if (generateOk && !optNoCompile) { - Owned compiler = createCompiler(processName.toCharArray()); + Owned compiler = createCompiler(processName.str()); compiler->setSaveTemps(optSaveTemps); bool compileOk = true; @@ -799,7 +799,7 @@ void EclCC::instantECL(EclCompileInstance & instance, IWorkUnit *wu, const char { StringBuffer exceptionText; e->errorMessage(exceptionText); - errorProcessor.reportError(ERR_INTERNALEXCEPTION, exceptionText.toCharArray(), queryFullName, 1, 0, 0); + errorProcessor.reportError(ERR_INTERNALEXCEPTION, exceptionText.str(), queryFullName, 1, 0, 0); } e->Release(); } @@ -1160,7 +1160,7 @@ void EclCC::processSingleQuery(EclCompileInstance & instance, { StringBuffer s; e->errorMessage(s); - errorProcessor.reportError(3, s.toCharArray(), defaultErrorPathname, 1, 0, 0); + errorProcessor.reportError(3, s.str(), defaultErrorPathname, 1, 0, 0); e->Release(); } } diff --git a/ecl/hql/hqlesp.cpp b/ecl/hql/hqlesp.cpp index e98872d875b..60eb2b40763 100644 --- a/ecl/hql/hqlesp.cpp +++ b/ecl/hql/hqlesp.cpp @@ -190,7 +190,7 @@ void WebServicesExtractor::getAttributeText(StringBuffer & text, const char* att { StringBuffer txt; txt.append("Could not read attribute: ").append(attributeName); - DBGLOG("%s", txt.toCharArray()); + DBGLOG("%s", txt.str()); throw MakeStringException(ERR_NO_ATTRIBUTE_TEXT, "%s", txt.str()); } diff --git a/ecl/hql/hqlexpr.cpp b/ecl/hql/hqlexpr.cpp index 8457b1b876e..a60c8df0190 100644 --- a/ecl/hql/hqlexpr.cpp +++ b/ecl/hql/hqlexpr.cpp @@ -7919,7 +7919,7 @@ void CHqlScope::throwRecursiveError(IIdAtom * searchName) StringBuffer msg("Definition of "); msg.append(*searchName).append(" contains a recursive dependency"); - throw createECLError(ERR_RECURSIVE_DEPENDENCY, msg.toCharArray(), filename, 0, 0, 1); + throw createECLError(ERR_RECURSIVE_DEPENDENCY, msg.str(), filename, 0, 0, 1); } inline bool namesMatch(const char * lName, const char * rName) @@ -8114,7 +8114,7 @@ IHqlExpression *CHqlRemoteScope::lookupSymbol(IIdAtom * searchName, unsigned loo { StringBuffer msg("Definition for "); msg.append(*searchName).append(" contains no text"); - throw createECLError(ERR_EXPORT_OR_SHARE, msg.toCharArray(), filename, 0, 0, 1); + throw createECLError(ERR_EXPORT_OR_SHARE, msg.str(), filename, 0, 0, 1); } OwnedHqlExpr recursionGuard = createSymbol(searchName, LINK(processingMarker), ob_exported); @@ -8140,7 +8140,7 @@ IHqlExpression *CHqlRemoteScope::lookupSymbol(IIdAtom * searchName, unsigned loo resolved->removeSymbol(searchName); StringBuffer msg("Definition must contain EXPORT or SHARED value for "); msg.append(*searchName); - throw createECLError(ERR_EXPORT_OR_SHARE, msg.toCharArray(), filename, 0, 0, 1); + throw createECLError(ERR_EXPORT_OR_SHARE, msg.str(), filename, 0, 0, 1); } //Preserve ob_sandbox etc. annotated on the original definition, but not on the parsed code. @@ -9313,7 +9313,7 @@ IHqlExpression *CHqlForwardScope::lookupSymbol(IIdAtom * searchName, unsigned lo const char * filename = parentCtx->sourcePath->str(); StringBuffer msg("Definition must contain EXPORT or SHARED value for "); msg.append(*searchName); - throw createECLError(ERR_EXPORT_OR_SHARE, msg.toCharArray(), filename, oldSymbol->getStartLine(), oldSymbol->getStartColumn(), 1); + throw createECLError(ERR_EXPORT_OR_SHARE, msg.str(), filename, oldSymbol->getStartLine(), oldSymbol->getStartColumn(), 1); } if (!(newSymbol->isExported() || (lookupFlags & LSFsharedOK))) diff --git a/ecl/hql/hqlfold.cpp b/ecl/hql/hqlfold.cpp index 36b44ee12f9..34f8214aced 100644 --- a/ecl/hql/hqlfold.cpp +++ b/ecl/hql/hqlfold.cpp @@ -617,8 +617,8 @@ IValue * foldExternalCall(IHqlExpression* expr, unsigned foldOptions, ITemplateC ensureFileExtension(lib, SharedObjectExtension); } - const char * entrypoint = entry.toCharArray(); - const char * library = lib.toCharArray(); + const char * entrypoint = entry.str(); + const char * library = lib.str(); if(!body->hasAttribute(pureAtom) && !body->hasAttribute(templateAtom) && !(foldOptions & (HFOfoldimpure|HFOforcefold))) { if (foldOptions & HFOthrowerror) diff --git a/ecl/hql/hqlgram2.cpp b/ecl/hql/hqlgram2.cpp index 99b7981c897..a1d6553cb10 100644 --- a/ecl/hql/hqlgram2.cpp +++ b/ecl/hql/hqlgram2.cpp @@ -10124,7 +10124,7 @@ IHqlExpression * HqlGram::resolveImportModule(const attribute & errpos, IHqlExpr msg.appendf("Import names unknown module \"%s\"", id->getAtomNamePtr()); else msg.appendf("Import item \"%s\" is not a module", id->getAtomNamePtr()); - reportError(ERR_MODULE_UNKNOWN, msg.toCharArray(), + reportError(ERR_MODULE_UNKNOWN, msg.str(), lexObject->getActualLineNo(), lexObject->getActualColumn(), lexObject->get_yyPosition()); @@ -10903,7 +10903,7 @@ void HqlGram::syntaxError(const char *s, int token, int *expected) if (yytext && *yytext) msg.append(" \"").append(yytext).append('\"'); - reportError(ERR_UNKNOWN_IDENTIFIER,msg.toCharArray(), lineno, column, pos); + reportError(ERR_UNKNOWN_IDENTIFIER,msg.str(), lineno, column, pos); return; } else if ((token == '.') && (expected[0] == ASSIGN) && !expected[1]) @@ -10954,7 +10954,7 @@ void HqlGram::syntaxError(const char *s, int token, int *expected) if (yytext && *yytext) msg.append(yytext); msg.append("' is already defined"); - reportError(ERR_ID_REDEFINE,msg.toCharArray(), lineno, column, pos); + reportError(ERR_ID_REDEFINE,msg.str(), lineno, column, pos); return; } } @@ -10986,7 +10986,7 @@ void HqlGram::syntaxError(const char *s, int token, int *expected) } } - reportError(ERR_EXPECTED, msg.toCharArray(), lineno, column, pos); + reportError(ERR_EXPECTED, msg.str(), lineno, column, pos); } @@ -11584,13 +11584,13 @@ extern HQL_API IHqlExpression * parseQuery(IHqlScope *scope, IFileContents * con if (E->errorCode()==0) { StringBuffer s; - ctx.errs->reportError(ERR_INTERNALEXCEPTION, E->errorMessage(s).toCharArray(), sourcePath->str(), 0, 0, 1); + ctx.errs->reportError(ERR_INTERNALEXCEPTION, E->errorMessage(s).str(), sourcePath->str(), 0, 0, 1); } else { StringBuffer s("Internal error: "); E->errorMessage(s); - ctx.errs->reportError(ERR_INTERNALEXCEPTION, s.toCharArray(), sourcePath->str(), 0, 0, 1); + ctx.errs->reportError(ERR_INTERNALEXCEPTION, s.str(), sourcePath->str(), 0, 0, 1); } } E->Release(); @@ -11620,13 +11620,13 @@ extern HQL_API void parseModule(IHqlScope *scope, IFileContents * contents, HqlL if (E->errorCode()==0) { StringBuffer s; - ctx.errs->reportError(ERR_INTERNALEXCEPTION, E->errorMessage(s).toCharArray(), sourcePath->str(), 0, 0, 1); + ctx.errs->reportError(ERR_INTERNALEXCEPTION, E->errorMessage(s).str(), sourcePath->str(), 0, 0, 1); } else { StringBuffer s("Internal error: "); E->errorMessage(s); - ctx.errs->reportError(ERR_INTERNALEXCEPTION, s.toCharArray(), sourcePath->str(), 0, 0, 1); + ctx.errs->reportError(ERR_INTERNALEXCEPTION, s.str(), sourcePath->str(), 0, 0, 1); } } E->Release(); diff --git a/ecl/hqlcpp/hqlwcpp.cpp b/ecl/hqlcpp/hqlwcpp.cpp index 5277b00169f..46e3174c339 100644 --- a/ecl/hqlcpp/hqlwcpp.cpp +++ b/ecl/hqlcpp/hqlwcpp.cpp @@ -1551,7 +1551,7 @@ void HqlCppWriter::flush() { if (target) { - target->write(out.length(), out.toCharArray()); + target->write(out.length(), out.str()); out.clear(); startOffset = 0; } diff --git a/ecl/hthor/hthor.cpp b/ecl/hthor/hthor.cpp index abc929f11d9..5e7a95bf611 100644 --- a/ecl/hthor/hthor.cpp +++ b/ecl/hthor/hthor.cpp @@ -8118,7 +8118,7 @@ bool CHThorDiskReadBaseActivity::checkOpenedFile(char const * filename, char con } else s.append("Could not open local physical file ").append(filename).append(" (").append((unsigned)GetLastError()).append(")"); - agent.fail(1, s.toCharArray()); + agent.fail(1, s.str()); } } else @@ -8130,7 +8130,7 @@ bool CHThorDiskReadBaseActivity::checkOpenedFile(char const * filename, char con { StringBuffer s; s.append("File ").append(filename).append(" size is ").append(filesize).append(" which is not a multiple of ").append(fixedDiskRecordSize); - agent.fail(1, s.toCharArray()); + agent.fail(1, s.str()); } unsigned readBufferSize = queryReadBufferSize(); diff --git a/esp/clients/LoggingClient/LocalDataLogger.cpp b/esp/clients/LoggingClient/LocalDataLogger.cpp index 2b22783b29b..dec09053523 100644 --- a/esp/clients/LoggingClient/LocalDataLogger.cpp +++ b/esp/clients/LoggingClient/LocalDataLogger.cpp @@ -113,7 +113,7 @@ StringBuffer& CLocalDataLogger::writeData(const StringBuffer& dataToCache,const try{ Owned io = file->open(IFOwrite); size32_t filesize = dataToCache.length(); - void* filedata = (void*)dataToCache.toCharArray(); + void* filedata = (void*)dataToCache.str(); io->write(0,filesize ,filedata ); if(m_UrlRoot.length()==0) returnPath.appendf("/Cache?Name=%s.HTML",tokenName.str()); diff --git a/esp/esdllib/esdl_def.cpp b/esp/esdllib/esdl_def.cpp index 6b03932bd28..6b023968352 100644 --- a/esp/esdllib/esdl_def.cpp +++ b/esp/esdllib/esdl_def.cpp @@ -964,7 +964,7 @@ class EsdlDefMethod : public EsdlDefObject, implements IEsdlDefMethod const char * finger = product; while(*finger && *finger !=':'){val.append(*finger++);} - props->setProp("product_", val.toCharArray()); + props->setProp("product_", val.str()); props->setProp("productdefault_", true); } else @@ -987,8 +987,8 @@ class EsdlDefMethod : public EsdlDefObject, implements IEsdlDefMethod if (prod.length() > 0) { if(prod.endsWith(":default")) - return prod.substring(0, prod.indexOf(":"))->toCharArray(); - return prod.toCharArray(); + return prod.substring(0, prod.indexOf(":"))->str(); + return prod.str(); } else return NULL; diff --git a/esp/services/WsDeploy/WsDeployService.cpp b/esp/services/WsDeploy/WsDeployService.cpp index e3aa33c71a8..0a010b03582 100644 --- a/esp/services/WsDeploy/WsDeployService.cpp +++ b/esp/services/WsDeploy/WsDeployService.cpp @@ -125,21 +125,21 @@ void substituteParameters(const IPropertyTree* pEnv, const char *xpath, IPropert int pos2 = xpath2.lastIndexOf('/'); if (pos1 != -1 && pos2 != -1) - sb.clear().append(xpath2.substring(0, pos2)->toCharArray()); + sb.clear().append(xpath2.substring(0, pos2)->str()); else if (pos1 != -1) - sb.clear().append(xpath2.substring(0, pos1)->toCharArray()); + sb.clear().append(xpath2.substring(0, pos1)->str()); Owned elems = pNode->getElements(sb.str()); if (pos2 != -1) - sb.clear().append(xpath2.substring(pos2+ 1, pos1)->toCharArray()); + sb.clear().append(xpath2.substring(pos2+ 1, pos1)->str()); ForEach(*elems) { IPropertyTree* elem = &elems->query(); result.append('\"'); result.append(elem->queryProp(sb.str())); - result.append("\"").append("][").append(pstr->toCharArray()); + result.append("\"").append("][").append(pstr->str()); } result.setLength(result.length() - pstr->length() - 2); @@ -153,7 +153,7 @@ void substituteParameters(const IPropertyTree* pEnv, const char *xpath, IPropert StringBuffer sb(xpath2); int pos = xpath2.indexOf(']'); if (pos != -1) - sb.clear().append(xpath2.toCharArray(), 0, pos); + sb.clear().append(xpath2.str(), 0, pos); result.append('\"'); result.append(pNode->queryProp(sb.str())); @@ -4252,7 +4252,7 @@ bool CWsDeployFileInfo::handleHardwareCopy(IPropertyTree *pComponents, IProperty String strTagName(xpath3); strTagName = *strTagName.substring(1,strTagName.indexOf(' ')); - if (CWsDeployFileInfo::addCopyToPropTree(pEnvRoot2, dupTree, strTagName.toCharArray()) == false) + if (CWsDeployFileInfo::addCopyToPropTree(pEnvRoot2, dupTree, strTagName.str()) == false) return false; bWrite = true; diff --git a/esp/services/WsDeploy/WsDeployService.hpp b/esp/services/WsDeploy/WsDeployService.hpp index 30af4fccc11..2bb0c27c805 100644 --- a/esp/services/WsDeploy/WsDeployService.hpp +++ b/esp/services/WsDeploy/WsDeployService.hpp @@ -731,7 +731,7 @@ class CCloudActionHandler : public CInterface, implements IInterface if (str.startsWith("SOAP Connection error")) msg.appendf("\nIpAddress: %s\nResult:%s\n", key, "SOAP Connection error - Could not connect to the target"); else - msg.appendf("\nIpAddress: %s\nResult:%s\n", key, str.toCharArray()); + msg.appendf("\nIpAddress: %s\nResult:%s\n", key, str.str()); } //Perform the appropriate cancel action diff --git a/esp/services/ws_dfu/ws_dfuService.cpp b/esp/services/ws_dfu/ws_dfuService.cpp index ea406163c3a..c07c7d2594d 100644 --- a/esp/services/ws_dfu/ws_dfuService.cpp +++ b/esp/services/ws_dfu/ws_dfuService.cpp @@ -1446,7 +1446,7 @@ bool CWsDfuEx::onDFUDefFile(IEspContext &context,IEspDFUDefFileRequest &req, IEs //set the file MemoryBuffer buff; - buff.setBuffer(returnStr.length(), (void*)returnStr.toCharArray()); + buff.setBuffer(returnStr.length(), (void*)returnStr.str()); resp.setDefFile(buff); //set the type diff --git a/esp/services/ws_esdlconfig/ws_esdlconfigservice.cpp b/esp/services/ws_esdlconfig/ws_esdlconfigservice.cpp index 31f622c8fc1..60b29b0dc5e 100644 --- a/esp/services/ws_esdlconfig/ws_esdlconfigservice.cpp +++ b/esp/services/ws_esdlconfig/ws_esdlconfigservice.cpp @@ -224,7 +224,7 @@ void CWsESDLConfigEx::init(IPropertyTree *cfg, const char *process, const char * #ifdef _DEBUG StringBuffer thexml; toXML(cfg, thexml,0,0); - fprintf(stderr, "%s", thexml.toCharArray()); + fprintf(stderr, "%s", thexml.str()); #endif StringBuffer xpath; diff --git a/esp/services/ws_topology/ws_topologyService.cpp b/esp/services/ws_topology/ws_topologyService.cpp index e38144b7d6b..ac4a1fd079c 100644 --- a/esp/services/ws_topology/ws_topologyService.cpp +++ b/esp/services/ws_topology/ws_topologyService.cpp @@ -402,7 +402,7 @@ bool CWsTopologyEx::onTpXMLFile(IEspContext &context,IEspTpXMLFileRequest &req, strBuff.append(xmlBuff); MemoryBuffer membuff; - membuff.setBuffer(strBuff.length(), (void*)strBuff.toCharArray()); + membuff.setBuffer(strBuff.length(), (void*)strBuff.str()); resp.setThefile_mimetype(HTTP_TYPE_APPLICATION_XML); resp.setThefile(membuff); diff --git a/esp/smc/SMCLib/TpWrapper.cpp b/esp/smc/SMCLib/TpWrapper.cpp index 6495ca50aa8..150c3be8585 100644 --- a/esp/smc/SMCLib/TpWrapper.cpp +++ b/esp/smc/SMCLib/TpWrapper.cpp @@ -1735,7 +1735,7 @@ void CTpWrapper::setAttPath(StringBuffer& Path,const char* PathToAppend,const ch Path.append(AttValue); Path.append("\"]"); StringBuffer rawPath; - const void* buff = (void*)Path.toCharArray(); + const void* buff = (void*)Path.str(); JBASE64_Encode(buff,Path.length(),rawPath, false); returnStr.append(rawPath.str()); } diff --git a/roxie/ccd/ccdlistener.cpp b/roxie/ccd/ccdlistener.cpp index 7428a7660a1..c067d7b9e9e 100644 --- a/roxie/ccd/ccdlistener.cpp +++ b/roxie/ccd/ccdlistener.cpp @@ -1372,15 +1372,15 @@ class RoxieSocketWorker : public RoxieQueryWorker if (reqName.endsWith(requestArrayString)) { isRequestArray = true; - queryName.set(reqName.toCharArray(), reqName.length() - requestArrayString.length()); + queryName.set(reqName.str(), reqName.length() - requestArrayString.length()); } else if (reqName.endsWith(requestString)) { isRequest = true; - queryName.set(reqName.toCharArray(), reqName.length() - requestString.length()); + queryName.set(reqName.str(), reqName.length() - requestString.length()); } else - queryName.set(reqName.toCharArray()); + queryName.set(reqName.str()); queryXML->renameProp("/", queryName.get()); // reset the name of the tree } diff --git a/roxie/udplib/udptrr.cpp b/roxie/udplib/udptrr.cpp index 1c09f14dd38..13d55b13812 100644 --- a/roxie/udplib/udptrr.cpp +++ b/roxie/udplib/udptrr.cpp @@ -258,7 +258,7 @@ class CReceiveManager : public CInterface, implements IReceiveManager catch(IException *e) { StringBuffer s; - DBGLOG("UdpReceiver: send_acknowledge failed node=%u %s", destNodeIndex, e->errorMessage(s).toCharArray()); + DBGLOG("UdpReceiver: send_acknowledge failed node=%u %s", destNodeIndex, e->errorMessage(s).str()); e->Release(); } } @@ -546,7 +546,7 @@ class CReceiveManager : public CInterface, implements IReceiveManager if (running && e->errorCode() != JSOCKERR_timeout_expired) { StringBuffer s; - DBGLOG("UdpReceiver: receive_sniffer::run read failed %s", e->errorMessage(s).toCharArray()); + DBGLOG("UdpReceiver: receive_sniffer::run read failed %s", e->errorMessage(s).str()); MilliSleep(1000); } e->Release(); @@ -657,7 +657,7 @@ class CReceiveManager : public CInterface, implements IReceiveManager if (running && e->errorCode() != JSOCKERR_timeout_expired) { StringBuffer s; - DBGLOG("UdpReceiver: failed %i %s", flow_port, e->errorMessage(s).toCharArray()); + DBGLOG("UdpReceiver: failed %i %s", flow_port, e->errorMessage(s).str()); } e->Release(); } @@ -754,7 +754,7 @@ class CReceiveManager : public CInterface, implements IReceiveManager if (running && e->errorCode() != JSOCKERR_timeout_expired) { StringBuffer s; - DBGLOG("UdpReceiver: receive_data::run read failed port=%u - Exp: %s", parent.data_port, e->errorMessage(s).toCharArray()); + DBGLOG("UdpReceiver: receive_data::run read failed port=%u - Exp: %s", parent.data_port, e->errorMessage(s).str()); MilliSleep(1000); // Give a chance for mem free } e->Release(); diff --git a/roxie/udplib/udptrs.cpp b/roxie/udplib/udptrs.cpp index 48f33c36c8e..5792407f170 100644 --- a/roxie/udplib/udptrs.cpp +++ b/roxie/udplib/udptrs.cpp @@ -98,7 +98,7 @@ class UdpReceiverEntry catch(IException *e) { StringBuffer s; - DBGLOG("UdpSender: sendRequest write failed - %s", e->errorMessage(s).toCharArray()); + DBGLOG("UdpSender: sendRequest write failed - %s", e->errorMessage(s).str()); e->Release(); } catch (...) @@ -961,7 +961,7 @@ class CSendManager : public CInterface, implements ISendManager if (running && e->errorCode() != JSOCKERR_timeout_expired) { StringBuffer s; - DBGLOG("UdpSender: send_receive_flow::read failed port=%i %s", receive_port, e->errorMessage(s).toCharArray()); + DBGLOG("UdpSender: send_receive_flow::read failed port=%i %s", receive_port, e->errorMessage(s).str()); } e->Release(); } @@ -1008,7 +1008,7 @@ class CSendManager : public CInterface, implements ISendManager { StringBuffer s; StringBuffer url; - DBGLOG("UdpSender: multicast_connect or write failed ep=%s - %s", ep.getUrlStr(url).str(), e->errorMessage(s).toCharArray()); + DBGLOG("UdpSender: multicast_connect or write failed ep=%s - %s", ep.getUrlStr(url).str(), e->errorMessage(s).str()); e->Release(); } catch(...) diff --git a/rtl/eclrtl/rtlkey.cpp b/rtl/eclrtl/rtlkey.cpp index 94f58bee716..ed8b09c2780 100644 --- a/rtl/eclrtl/rtlkey.cpp +++ b/rtl/eclrtl/rtlkey.cpp @@ -1996,7 +1996,7 @@ const char *CStringSet::describe(StringBuffer &ret) appendURL(&ret, (char *) t.getValue(), size, true); } ret.append(']'); - return ret.toCharArray(); + return ret.str(); } bool CStringSet::inRange(const void *val) const diff --git a/services/runagent/frunagent.cpp b/services/runagent/frunagent.cpp index 0adde254c60..705bc6b2865 100644 --- a/services/runagent/frunagent.cpp +++ b/services/runagent/frunagent.cpp @@ -215,7 +215,7 @@ void cmd_dispatch::action() if (result.length()) { - printf("%s\n", result.toCharArray()); + printf("%s\n", result.str()); } transport->Release(); } diff --git a/services/runagent/hodisp_base.cpp b/services/runagent/hodisp_base.cpp index 9968d46a7e5..4217fe33205 100644 --- a/services/runagent/hodisp_base.cpp +++ b/services/runagent/hodisp_base.cpp @@ -163,16 +163,16 @@ int c_dispatch::run() { ex1=strdup(s); } catch(IHRPC_Exception *e) { StringBuffer s; - ex1=alloccat(e->errorMessage(s).toCharArray()," ",id," ",0); + ex1=alloccat(e->errorMessage(s).str()," ",id," ",0); e->Release(); } catch(IJSOCK_Exception *e) { StringBuffer s; - ex1=alloccat(e->errorMessage(s).toCharArray()," ",id," ",0); + ex1=alloccat(e->errorMessage(s).str()," ",id," ",0); e->Release(); } catch (IException *e) { StringBuffer s; - ex1=alloccat(e->errorMessage(s).toCharArray()," ",id," ",0); + ex1=alloccat(e->errorMessage(s).str()," ",id," ",0); e->Release(); } catch (...) diff --git a/system/hrpc/hrpc.cpp b/system/hrpc/hrpc.cpp index 9a513376539..fc996a40da6 100644 --- a/system/hrpc/hrpc.cpp +++ b/system/hrpc/hrpc.cpp @@ -103,7 +103,7 @@ class HRPCException: public CInterface, public IHRPC_Exception } if (excstr.length()) { str.append(" ["); - str.append(excstr.toCharArray()); + str.append(excstr.str()); str.append(']'); } return str; @@ -364,12 +364,12 @@ void HRPCcommon::doproxy(HRPCcallframe &frame,int fn,IHRPCtransport *tr,HRPCbuff } catch (ISEH_Exception *e) { StringBuffer msg; - _sendexception(rbuff,IRemoteException::EX_HARDWARE,e->errorCode(),e->errorMessage(msg).toCharArray()); + _sendexception(rbuff,IRemoteException::EX_HARDWARE,e->errorCode(),e->errorMessage(msg).str()); e->Release(); } catch (IException *e) { StringBuffer msg; - _sendexception(rbuff,IRemoteException::EX_STANDARD,e->errorCode(),e->errorMessage(msg).toCharArray()); + _sendexception(rbuff,IRemoteException::EX_STANDARD,e->errorCode(),e->errorMessage(msg).str()); e->Release(); } catch (const char *s) { @@ -666,13 +666,13 @@ void HRPCserver::DoRun(size32_t base) catch (ISEH_Exception *e) { if (async) throw e; StringBuffer msg; - sp->_sendexception(retbuff,IRemoteException::EX_HARDWARE,e->errorCode(),e->errorMessage(msg).toCharArray()); + sp->_sendexception(retbuff,IRemoteException::EX_HARDWARE,e->errorCode(),e->errorMessage(msg).str()); e->Release(); } catch (IException *e) { if (async) throw e; StringBuffer msg; - sp->_sendexception(retbuff,IRemoteException::EX_STANDARD,e->errorCode(),e->errorMessage(msg).toCharArray()); + sp->_sendexception(retbuff,IRemoteException::EX_STANDARD,e->errorCode(),e->errorMessage(msg).str()); e->Release(); } catch (const char *s) { @@ -710,7 +710,7 @@ void HRPCserver::DoRun(size32_t base) if (sp==NULL) { IHRPC_Exception *e=MakeHRPCexception(HRPCERR_module_not_found,head->module); StringBuffer msg; - dosendexception(retbuff,IRemoteException::EX_STANDARD,e->errorCode(),NULL,e->errorMessage(msg).toCharArray()); + dosendexception(retbuff,IRemoteException::EX_STANDARD,e->errorCode(),NULL,e->errorMessage(msg).str()); e->Release(); transport->Transmit(retbuff); } diff --git a/system/jhtree/jhtree.cpp b/system/jhtree/jhtree.cpp index 05ccd1bd4d0..7cb8b91a7c3 100644 --- a/system/jhtree/jhtree.cpp +++ b/system/jhtree/jhtree.cpp @@ -1505,7 +1505,7 @@ void dumpNode(FILE *out, CJHTreeNode *node, int length, unsigned rowCount, bool offset_t pos = node->getFPosAt(i); StringBuffer s; appendURL(&s, dst, length, true); - fprintf(out, "keyVal %d [%"I64F"d] = %s\n", i, pos, s.toCharArray()); + fprintf(out, "keyVal %d [%"I64F"d] = %s\n", i, pos, s.str()); } } if (!raw) diff --git a/system/jlib/jcomp.cpp b/system/jlib/jcomp.cpp index 2254d905a7f..2df1acfa9ce 100644 --- a/system/jlib/jcomp.cpp +++ b/system/jlib/jcomp.cpp @@ -500,7 +500,7 @@ bool CppCompiler::compileFile(IThreadPool * pool, const char * filename, Semapho Owned parm; if (verbose) - PrintLog("%s", expanded.toCharArray()); + PrintLog("%s", expanded.str()); parm.setown(new CCompilerThreadParam(expanded, finishedCompiling, logFile)); pool->start(parm.get()); @@ -551,10 +551,10 @@ bool CppCompiler::doLink() DWORD runcode = 0; if (verbose) - PrintLog("%s", expanded.toCharArray()); + PrintLog("%s", expanded.str()); StringBuffer logFile = StringBuffer(CORE_NAME).append("_link.log.tmp"); logFiles.append(logFile); - bool ret = invoke_program(expanded.toCharArray(), runcode, true, logFile) && (runcode == 0); + bool ret = invoke_program(expanded.str(), runcode, true, logFile) && (runcode == 0); return ret; } diff --git a/system/jlib/jexcept.cpp b/system/jlib/jexcept.cpp index 38ae08a2112..49aae1fc1fd 100644 --- a/system/jlib/jexcept.cpp +++ b/system/jlib/jexcept.cpp @@ -480,7 +480,7 @@ IMultiException *makeMultiException(const char* source/*=NULL*/) void pexception(const char *msg,IException *e) { // like perror except for exceptions StringBuffer s; - fprintf(stderr,"%s : %s\n",msg,e?e->errorMessage(s).toCharArray():"NULL Exception!"); + fprintf(stderr,"%s : %s\n",msg,e?e->errorMessage(s).str():"NULL Exception!"); } void userBreakpoint() @@ -537,7 +537,7 @@ void raiseAssertException(const char *assertion, const char *file, unsigned line #endif #endif - throw makeStringException(3000, s.toCharArray()); // 3000: internal error + throw makeStringException(3000, s.str()); // 3000: internal error } void raiseAssertCore(const char *assertion, const char *file, unsigned line) diff --git a/system/jlib/jfile.cpp b/system/jlib/jfile.cpp index dfddef2fe70..bc50fd19cf7 100644 --- a/system/jlib/jfile.cpp +++ b/system/jlib/jfile.cpp @@ -1631,7 +1631,7 @@ IFileIO * createIFileIO(unsigned len, void * buffer) IFileIO * createIFileIO(StringBuffer & buffer) { - return _createIFileIO((void *)buffer.toCharArray(), buffer.length(), true); + return _createIFileIO((void *)buffer.str(), buffer.length(), true); } IFileIO * createIFileIO(MemoryBuffer & buffer) diff --git a/system/jlib/jmisc.cpp b/system/jlib/jmisc.cpp index 6c5c6125be3..e187c76851f 100644 --- a/system/jlib/jmisc.cpp +++ b/system/jlib/jmisc.cpp @@ -577,7 +577,7 @@ bool invoke_program(const char *command_line, DWORD &runcode, bool wait, const c else s.append(errno); - ERRLOG("%s",s.toCharArray()); + ERRLOG("%s",s.str()); if(throwException) throw MakeStringExceptionDirect(-1, s.str()); return false; diff --git a/system/jlib/jprop.cpp b/system/jlib/jprop.cpp index 853002a70f0..036ca67b604 100644 --- a/system/jlib/jprop.cpp +++ b/system/jlib/jprop.cpp @@ -117,7 +117,7 @@ class CPropertiesBase : public CInterface, implements IPROP prop.clip(); val.clip(); if (prop.length()) - setProp(toPType(prop.toCharArray()), val.toCharArray()); + setProp(toPType(prop.str()), val.str()); } } void loadProp(const char *finger, int dft) @@ -204,7 +204,7 @@ class CPropertiesBase : public CInterface, implements IPROP prop.clip(); val.clip(); if (prop.length()) - setProp(toPType(prop.toCharArray()), val.toCharArray()); + setProp(toPType(prop.str()), val.str()); } if (*finger) finger++; diff --git a/system/jlib/jptree.cpp b/system/jlib/jptree.cpp index d752f3c9759..822af1df984 100644 --- a/system/jlib/jptree.cpp +++ b/system/jlib/jptree.cpp @@ -2704,7 +2704,7 @@ void PTree::clone(IPropertyTree &srcTree, IPropertyTree &dstTree, bool sub) { StringBuffer s; verifyex(srcTree.getProp(NULL, s)); - dstTree.setProp(NULL, s.toCharArray()); + dstTree.setProp(NULL, s.str()); } else dstTree.setProp(NULL, srcTree.queryProp(NULL)); @@ -3148,7 +3148,7 @@ bool PTree::checkPattern(const char *&xxpath) const { StringBuffer s; matchElem->getProp(tProp, s); - ret = match(wild, numeric, xxpath, tType, s.toCharArray(), s.length(), rhs, rhslength, nocase); + ret = match(wild, numeric, xxpath, tType, s.str(), s.length(), rhs, rhslength, nocase); } else { @@ -4519,7 +4519,7 @@ class CXMLReader : public CXMLReaderBase, implements IPTreeReader if ((colon = strchr(tagName.str(), ':')) != NULL) tagName.remove(0, (size32_t)(colon - tagName.str() + 1)); } - iEvent->beginNode(tagName.toCharArray(), startOffset); + iEvent->beginNode(tagName.str(), startOffset); skipWS(); bool endTag = false; bool base64 = false; @@ -4578,7 +4578,7 @@ class CXMLReader : public CXMLReaderBase, implements IPTreeReader readNext(); skipWS(); } - iEvent->beginNodeContent(tagName.toCharArray()); + iEvent->beginNodeContent(tagName.str()); StringBuffer tagText; bool binary = base64; if (!endTag) @@ -4606,7 +4606,7 @@ class CXMLReader : public CXMLReaderBase, implements IPTreeReader mark.setLength(l+1); } tagText.ensureCapacity(mark.length()); - _decodeXML(r, mark.toCharArray(), tagText); + _decodeXML(r, mark.str(), tagText); } readNext(); if ('!' == nextChar) @@ -4655,7 +4655,7 @@ class CXMLReader : public CXMLReaderBase, implements IPTreeReader expecting(">"); } } - iEvent->endNode(tagName.toCharArray(), tagText.length(), tagText.toCharArray(), binary, curOffset); + iEvent->endNode(tagName.str(), tagText.length(), tagText.str(), binary, curOffset); } }; @@ -4953,7 +4953,7 @@ class CPullXMLReader : public CXMLReaderBase, implements IPullPTreeReader { if (ignoreWhiteSpace) { - const char *tb = mark.toCharArray(); + const char *tb = mark.str(); const char *t = tb+l-1; if (isspace(*t)) { @@ -4962,11 +4962,11 @@ class CPullXMLReader : public CXMLReaderBase, implements IPullPTreeReader } } stateInfo->tagText.ensureCapacity(mark.length()); - _decodeXML(r, mark.toCharArray(), stateInfo->tagText); + _decodeXML(r, mark.str(), stateInfo->tagText); } if (endOfRoot && mark.length()) { - const char *m = mark.toCharArray(); + const char *m = mark.str(); const char *e = m+mark.length(); do { if (!isspace(*m++)) error("Trailing content after close of root tag"); } while (m!=e); @@ -4994,7 +4994,7 @@ class CPullXMLReader : public CXMLReaderBase, implements IPullPTreeReader { if (endOfRoot && PTreeRead_EOS == e->errorCode() && (state != tagContent2 && mark.length())) // only to provide more meaningful error { - const char *m = mark.toCharArray(); + const char *m = mark.str(); const char *es = m+mark.length(); do { @@ -5039,7 +5039,7 @@ class CPullXMLReader : public CXMLReaderBase, implements IPullPTreeReader case tagClose: { readNext(); - const char *t = stateInfo->tag.toCharArray(); + const char *t = stateInfo->tag.str(); const char *te = t+stateInfo->tag.length(); loop { @@ -5061,7 +5061,7 @@ class CPullXMLReader : public CXMLReaderBase, implements IPullPTreeReader } case tagEnd: { - iEvent->endNode(stateInfo->wnsTag, stateInfo->tagText.length(), stateInfo->tagText.toCharArray(), stateInfo->binary, curOffset); + iEvent->endNode(stateInfo->wnsTag, stateInfo->tagText.length(), stateInfo->tagText.str(), stateInfo->binary, curOffset); freeStateInfo.append(*stateInfo); stack.pop(); endOfRoot = 0==stack.ordinality(); @@ -5310,7 +5310,7 @@ static void _toXML(const IPropertyTree *tree, IIOStream &out, unsigned indent, u { empty = false; // can't be empty if compressed; verifyex(tree->getProp(NULL, _thislevel)); - thislevel = _thislevel.toCharArray(); + thislevel = _thislevel.str(); } else empty = (NULL == (thislevel = tree->queryProp(NULL))); @@ -5589,7 +5589,7 @@ static void _toJSON(const IPropertyTree *tree, IIOStream &out, unsigned indent, { isNull = false; // can't be empty if compressed; verifyex(tree->getProp(NULL, _thislevel)); - thislevel = _thislevel.toCharArray(); + thislevel = _thislevel.str(); } else isNull = (NULL == (thislevel = tree->queryProp(NULL))); @@ -5916,7 +5916,7 @@ bool validateXMLParseXPath(const char *xpath, StringBuffer *error) } return false; } - return validateXPathSyntax(head.toCharArray(), error); + return validateXPathSyntax(head.str(), error); } return true; } @@ -6884,7 +6884,7 @@ class CPullJSONReader : public CJSONReaderBase, implements IPullPTreeReader if (stateInfo->type==elementTypeNull) iEvent->endNode(stateInfo->wnsTag, 0, "", false, offset); else - iEvent->endNode(stateInfo->wnsTag, stateInfo->tagText.length(), stateInfo->tagText.toCharArray(), false, offset); + iEvent->endNode(stateInfo->wnsTag, stateInfo->tagText.length(), stateInfo->tagText.str(), false, offset); } freeStateInfo.append(*stateInfo); stack.pop(); diff --git a/system/jlib/jsocket.cpp b/system/jlib/jsocket.cpp index bec7c5fadd0..d552050e912 100644 --- a/system/jlib/jsocket.cpp +++ b/system/jlib/jsocket.cpp @@ -3179,7 +3179,7 @@ void SocketEndpoint::getUrlStr(char * str, size32_t len) const l = len-1; str[l] = 0; } - memcpy(str,_str.toCharArray(),l); + memcpy(str,_str.str(),l); } StringBuffer &SocketEndpoint::getUrlStr(StringBuffer &str) const diff --git a/system/jlib/jstring.cpp b/system/jlib/jstring.cpp index 554472ea8fa..18af9fea1b8 100644 --- a/system/jlib/jstring.cpp +++ b/system/jlib/jstring.cpp @@ -951,7 +951,7 @@ StringBuffer & StringBuffer::stripChar(char oldChar) return *this; } -const char * StringBuffer::toCharArray() const +const char * StringBuffer::str() const { buffer[curLen] = '\0'; // There is always room for this null return buffer; @@ -1000,7 +1000,7 @@ String::String(const char * value, int offset, int _count) String::String(String & value) { - text = strdup(value.toCharArray()); + text = strdup(value.str()); } String::String(StringBuffer & value) @@ -1023,7 +1023,7 @@ char String::charAt(size32_t index) const int String::compareTo(const String & value) const { - return strcmp(text, value.toCharArray()); + return strcmp(text, value.str()); } int String::compareTo(const char* value) const @@ -1033,7 +1033,7 @@ int String::compareTo(const char* value) const String * String::concat(const String & value) const { - StringBuffer temp(toCharArray()); + StringBuffer temp(str()); temp.append(value); return new String(temp.str()); } @@ -1044,7 +1044,7 @@ bool String::endsWith(const String & value) const unsigned len = (size32_t)strlen(text); if (len >= lenValue) - return (memcmp(text+(len-lenValue),value.toCharArray(),lenValue) == 0); + return (memcmp(text+(len-lenValue),value.str(),lenValue) == 0); return false; } @@ -1056,13 +1056,13 @@ bool String::endsWith(const char* value) const bool String::equals(String & value) const { - return strcmp(text, value.toCharArray())==0; + return strcmp(text, value.str())==0; } bool String::equalsIgnoreCase(const String & value) const { - return stricmp(text, value.toCharArray())==0; + return stricmp(text, value.str())==0; } void String::getBytes(int srcBegin, int srcEnd, void * dest, int dstBegin) const @@ -1094,14 +1094,14 @@ int String::indexOf(int ch, int from) const int String::indexOf(const String & search) const { - const char * str = search.toCharArray(); + const char * str = search.str(); const char * match = strstr(text, str); return match ? (int)(match - text) : -1; } int String::indexOf(const String & search, int from) const { - const char * str = search.toCharArray(); + const char * str = search.str(); const char * match = strstr(text + from, str); return match ? (int)(match - text) : -1; } @@ -1140,14 +1140,14 @@ size32_t String::length() const bool String::startsWith(String & value) const { unsigned lenValue = value.length(); - const char * search = value.toCharArray(); + const char * search = value.str(); return (memcmp(text, search, lenValue) == 0); } bool String::startsWith(String & value, int offset) const { unsigned lenValue = value.length(); - const char * search = value.toCharArray(); + const char * search = value.str(); return (memcmp(text + offset, search, lenValue) == 0); } @@ -1166,7 +1166,7 @@ String * String::substring(int beginIndex, int endIndex) const return new String(text, beginIndex, endIndex - beginIndex); } -const char *String::toCharArray() const +const char *String::str() const { return text; } diff --git a/system/jlib/jstring.hpp b/system/jlib/jstring.hpp index 451ddbf3f70..8cd67c389c0 100644 --- a/system/jlib/jstring.hpp +++ b/system/jlib/jstring.hpp @@ -101,14 +101,13 @@ class jlib_decl StringBuffer StringBuffer & newline(); StringBuffer & pad(unsigned count); StringBuffer & padTo(unsigned count); - inline const char * str() const { return toCharArray(); } char * detach(); StringBuffer & clip(); StringBuffer & trim(); StringBuffer & trimLeft(); inline StringBuffer & trimRight() { return clip(); } StringBuffer & remove(unsigned start, unsigned len); - const char * toCharArray() const; + const char * str() const; StringBuffer & toLowerCase(); StringBuffer & toUpperCase(); StringBuffer & replace(char oldChar, char newChar); @@ -227,7 +226,7 @@ class jlib_decl String : public CInterface, implements IInterface bool startsWith(const char* value) const; String * substring(int beginIndex) const; String * substring(int beginIndex, int endIndex) const; - const char *toCharArray() const; + const char *str() const; String * toLowerCase() const; String * toString(); // Links this String * toUpperCase() const; diff --git a/system/jlib/jutil.cpp b/system/jlib/jutil.cpp index 4f0e87c65f6..5baf2d902b0 100644 --- a/system/jlib/jutil.cpp +++ b/system/jlib/jutil.cpp @@ -2080,7 +2080,7 @@ extern jlib_decl void serializeAtom(MemoryBuffer & target, IAtom * name) { StringBuffer lower(name->str()); lower.toLowerCase(); - serialize(target, lower.toCharArray()); + serialize(target, lower.str()); } extern jlib_decl IAtom * deserializeAtom(MemoryBuffer & source) diff --git a/system/mp/mpcomm.cpp b/system/mp/mpcomm.cpp index 7caba718cde..194e62f209c 100644 --- a/system/mp/mpcomm.cpp +++ b/system/mp/mpcomm.cpp @@ -203,10 +203,10 @@ class CMPException: public CInterface, public IMP_Exception StringBuffer tmp; switch (error) { case MPERR_ok: str.append("OK"); break; - case MPERR_connection_failed: str.appendf("MP connect failed (%s)",endpoint.getUrlStr(tmp).toCharArray()); break; + case MPERR_connection_failed: str.appendf("MP connect failed (%s)",endpoint.getUrlStr(tmp).str()); break; case MPERR_process_not_in_group: str.appendf("Current process not in Communicator group"); break; - case MPERR_protocol_version_mismatch: str.appendf("Protocol version mismatch (%s)",endpoint.getUrlStr(tmp).toCharArray()); break; - case MPERR_link_closed: str.appendf("MP link closed (%s)",endpoint.getUrlStr(tmp).toCharArray()); break; + case MPERR_protocol_version_mismatch: str.appendf("Protocol version mismatch (%s)",endpoint.getUrlStr(tmp).str()); break; + case MPERR_link_closed: str.appendf("MP link closed (%s)",endpoint.getUrlStr(tmp).str()); break; } return str; } @@ -693,7 +693,7 @@ protected: friend class CMPPacketReader; try { StringBuffer str; #ifdef _TRACE - LOG(MCdebugInfo(100), unknownJob, "MP: connecting to %s",remoteep.getUrlStr(str).toCharArray()); + LOG(MCdebugInfo(100), unknownJob, "MP: connecting to %s",remoteep.getUrlStr(str).str()); #endif if (((int)tm.timeout)<0) remaining = CONNECT_TIMEOUT; @@ -735,7 +735,7 @@ protected: friend class CMPPacketReader; if (attachSocket(newsock,remoteep,hostep,true, NULL)) { newsock->Release(); #ifdef _TRACE - LOG(MCdebugInfo(100), unknownJob, "MP: connected to %s",str.toCharArray()); + LOG(MCdebugInfo(100), unknownJob, "MP: connected to %s",str.str()); #endif lastxfer = msTick(); closed = false; @@ -763,7 +763,7 @@ protected: friend class CMPPacketReader; } #ifdef _TRACE str.clear(); - LOG(MCdebugInfo(100), unknownJob, "MP: Retrying connection to %s, %d attempts left",remoteep.getUrlStr(str).toCharArray(),retrycount+1); + LOG(MCdebugInfo(100), unknownJob, "MP: Retrying connection to %s, %d attempts left",remoteep.getUrlStr(str).str(),retrycount+1); #endif } ::Release(newsock); @@ -1752,7 +1752,7 @@ int CMPConnectThread::run() #ifdef _TRACE StringBuffer str1; StringBuffer str2; - LOG(MCdebugInfo(100), unknownJob, "MP Connect Thread: connected to %s",remoteep.getUrlStr(str1).toCharArray()); + LOG(MCdebugInfo(100), unknownJob, "MP Connect Thread: connected to %s",remoteep.getUrlStr(str1).str()); #endif } #ifdef _FULLTRACE diff --git a/system/mp/mptag_test.cpp b/system/mp/mptag_test.cpp index 6b0c366cbd2..701fc0f29bd 100644 --- a/system/mp/mptag_test.cpp +++ b/system/mp/mptag_test.cpp @@ -114,11 +114,11 @@ void test4() printf("***Freeing Tag that does not exist****\n"); try{ freeMPtag((mptag_t)999); - }catch(IException *e){printf("%s\n", e->errorMessage(msg).toCharArray());e->Release();} + }catch(IException *e){printf("%s\n", e->errorMessage(msg).str());e->Release();} try{ printf("***Getting Formater for Tag that does not exist***\n"); queryFormatter((mptag_t)999); - }catch(IException *e){printf("%s\n", e->errorMessage(msg2).toCharArray());e->Release();} + }catch(IException *e){printf("%s\n", e->errorMessage(msg2).str());e->Release();} } diff --git a/system/security/shared/basesecurity.hpp b/system/security/shared/basesecurity.hpp index 49546919927..9fccee52d04 100644 --- a/system/security/shared/basesecurity.hpp +++ b/system/security/shared/basesecurity.hpp @@ -290,9 +290,9 @@ class CBaseSecurityManager : public CInterface, virtual bool clearPermissionsCache(ISecUser& user) {return false;} virtual bool authenticateUser(ISecUser & user, bool &superUser) {return false;} protected: - const char* getServer(){return m_dbserver.toCharArray();} - const char* getUser(){return m_dbuser.toCharArray();} - const char* getPassword(){return m_dbpassword.toCharArray();} + const char* getServer(){return m_dbserver.str();} + const char* getUser(){return m_dbuser.str();} + const char* getPassword(){return m_dbpassword.str();} int getPoolsize() { return m_poolsize;} void setUserMap(const char* user,int uid){synchronized block(m_usermap_mutex); m_usermap.setValue(user, uid);} int getUserID(ISecUser& user); diff --git a/testing/unittests/jlibtests.cpp b/testing/unittests/jlibtests.cpp index e504a7394be..53b755963c4 100644 --- a/testing/unittests/jlibtests.cpp +++ b/testing/unittests/jlibtests.cpp @@ -210,7 +210,7 @@ class JlibFileIOTest : public CppUnit::TestFixture if (ep != NULL) { ifile = createRemoteFile(*ep, tmpfile); - fprintf(stdout, "Remote: (%s)\n", server.toCharArray()); + fprintf(stdout, "Remote: (%s)\n", server.str()); } else { diff --git a/thorlcr/activities/distribution/thdistribution.cpp b/thorlcr/activities/distribution/thdistribution.cpp index 85c2fe4d3e3..b90a3ad8f12 100644 --- a/thorlcr/activities/distribution/thdistribution.cpp +++ b/thorlcr/activities/distribution/thdistribution.cpp @@ -61,10 +61,10 @@ class CDistributionActivityMaster : public CMasterActivity tmp.append(""); #if THOR_TRACE_LEVEL >= 5 - ActPrintLog("Distribution result: %s", tmp.toCharArray()); + ActPrintLog("Distribution result: %s", tmp.str()); #endif - helper->sendResult(tmp.length(), tmp.toCharArray()); + helper->sendResult(tmp.length(), tmp.str()); destroyThorRow(result); } diff --git a/thorlcr/activities/hashdistrib/thhashdistribslave.cpp b/thorlcr/activities/hashdistrib/thhashdistribslave.cpp index 304443bd1dc..7153b4146f7 100644 --- a/thorlcr/activities/hashdistrib/thhashdistribslave.cpp +++ b/thorlcr/activities/hashdistrib/thhashdistribslave.cpp @@ -1075,7 +1075,7 @@ class CDistributorBase : public CSimpleInterface, implements IHashDistributor, i { StringBuffer temp; GetTempName(temp,"hddrecvbuff", true); - piperd.setown(createSmartBuffer(activity, temp.toCharArray(), pullBufferSize, rowIf)); + piperd.setown(createSmartBuffer(activity, temp.str(), pullBufferSize, rowIf)); } else piperd.setown(createSmartInMemoryBuffer(activity, rowIf, pullBufferSize)); diff --git a/thorlcr/activities/msort/thmsort.cpp b/thorlcr/activities/msort/thmsort.cpp index e0da5d9dd55..a1087d6d8e6 100644 --- a/thorlcr/activities/msort/thmsort.cpp +++ b/thorlcr/activities/msort/thmsort.cpp @@ -159,7 +159,7 @@ class CMSortActivityMaster : public CMasterActivity Owned auxrowif = createRowInterfaces(helper->querySortedRecordSize(),queryActivityId(),queryCodeContext()); try { - imaster->SortSetup(rowif,helper->queryCompare(),helper->querySerialize(),cosortfilenames.length()!=0,true,cosortfilenames.toCharArray(),auxrowif); + imaster->SortSetup(rowif,helper->queryCompare(),helper->querySerialize(),cosortfilenames.length()!=0,true,cosortfilenames.str(),auxrowif); if (barrier->wait(false)) // local sort complete { size32_t maxdeviance = getOptUInt(THOROPT_SORT_MAX_DEVIANCE, 10*1024*1024); diff --git a/thorlcr/activities/thactivityutil.cpp b/thorlcr/activities/thactivityutil.cpp index fc2beb8fdf1..25826f14cdb 100644 --- a/thorlcr/activities/thactivityutil.cpp +++ b/thorlcr/activities/thactivityutil.cpp @@ -122,7 +122,7 @@ class ThorLookaheadCache: public IThorDataLink, public CSimpleInterface GetTempName(temp,"lookahd",true); assertex(bufsize); if (allowspill) - smartbuf.setown(createSmartBuffer(&activity, temp.toCharArray(), bufsize, queryRowInterfaces(in))); + smartbuf.setown(createSmartBuffer(&activity, temp.str(), bufsize, queryRowInterfaces(in))); else smartbuf.setown(createSmartInMemoryBuffer(&activity, queryRowInterfaces(in), bufsize)); if (notify) diff --git a/thorlcr/activities/xmlwrite/thxmlwriteslave.cpp b/thorlcr/activities/xmlwrite/thxmlwriteslave.cpp index c5274faf7e1..d87d6a297b2 100644 --- a/thorlcr/activities/xmlwrite/thxmlwriteslave.cpp +++ b/thorlcr/activities/xmlwrite/thxmlwriteslave.cpp @@ -64,9 +64,9 @@ class CXmlWriteSlaveActivity : public CDiskWriteSlaveActivityBase out.set(suppliedHeader); else out.set("").newline(); - outraw->write(out.length(), out.toCharArray()); + outraw->write(out.length(), out.str()); if (calcFileCrc) - fileCRC.tally(out.length(), out.toCharArray()); + fileCRC.tally(out.length(), out.str()); } Owned writer = createIXmlWriterExt(helper->getXmlFlags(), 0, NULL, (kind==TAKjsonwrite) ? WTJSON : WTStandard); writer->outputBeginArray(rowTag); //need this to format rows, even if not outputting it below @@ -92,9 +92,9 @@ class CXmlWriteSlaveActivity : public CDiskWriteSlaveActivityBase out.set(suppliedFooter); else out.set("").newline(); - outraw->write(out.length(), out.toCharArray()); + outraw->write(out.length(), out.str()); if (calcFileCrc) - fileCRC.tally(out.length(), out.toCharArray()); + fileCRC.tally(out.length(), out.str()); } } virtual bool wantRaw() { return true; } diff --git a/thorlcr/master/thmastermain.cpp b/thorlcr/master/thmastermain.cpp index 0049077d26f..aebe338a7ed 100644 --- a/thorlcr/master/thmastermain.cpp +++ b/thorlcr/master/thmastermain.cpp @@ -506,7 +506,7 @@ int main( int argc, char *argv[] ) logHandler = lf->beginLogging(); createUNCFilename(lf->queryLogFileSpec(), logUrl, false); } - LOG(MCdebugProgress, thorJob, "Opened log file %s", logUrl.toCharArray()); + LOG(MCdebugProgress, thorJob, "Opened log file %s", logUrl.str()); LOG(MCdebugProgress, thorJob, "Build %s", BUILD_TAG); globals->setProp("@logURL", logUrl.str()); @@ -763,7 +763,7 @@ int main( int argc, char *argv[] ) Owned registry = new CRegistryServer(); StringBuffer thorEpStr; - LOG(MCdebugProgress, thorJob, "ThorMaster version %d.%d, Started on %s", THOR_VERSION_MAJOR,THOR_VERSION_MINOR,thorEp.getUrlStr(thorEpStr).toCharArray()); + LOG(MCdebugProgress, thorJob, "ThorMaster version %d.%d, Started on %s", THOR_VERSION_MAJOR,THOR_VERSION_MINOR,thorEp.getUrlStr(thorEpStr).str()); LOG(MCdebugProgress, thorJob, "Thor name = %s, queue = %s, nodeGroup = %s",thorname,queueName.str(),nodeGroup.str()); serverStatus.queryProperties()->setProp("@thorname", thorname); diff --git a/thorlcr/slave/thslavemain.cpp b/thorlcr/slave/thslavemain.cpp index 78c671aee44..f34f1922a64 100644 --- a/thorlcr/slave/thslavemain.cpp +++ b/thorlcr/slave/thslavemain.cpp @@ -92,7 +92,7 @@ static bool RegisterSelf(SocketEndpoint &masterEp) { StringBuffer slfStr; StringBuffer masterStr; - LOG(MCdebugProgress, thorJob, "registering %s - master %s",slfEp.getUrlStr(slfStr).toCharArray(),masterEp.getUrlStr(masterStr).toCharArray()); + LOG(MCdebugProgress, thorJob, "registering %s - master %s",slfEp.getUrlStr(slfStr).str(),masterEp.getUrlStr(masterStr).str()); try { SocketEndpoint ep = masterEp; @@ -158,7 +158,7 @@ static bool RegisterSelf(SocketEndpoint &masterEp) else PROGLOG("verified mp connection to rest of cluster"); ::masterNode = LINK(masterNode); - LOG(MCdebugProgress, thorJob, "registered %s",slfStr.toCharArray()); + LOG(MCdebugProgress, thorJob, "registered %s",slfStr.str()); } catch (IException *e) { @@ -173,17 +173,17 @@ void UnregisterSelf() { StringBuffer slfStr; slfEp.getUrlStr(slfStr); - LOG(MCdebugProgress, thorJob, "Unregistering slave : %s", slfStr.toCharArray()); + LOG(MCdebugProgress, thorJob, "Unregistering slave : %s", slfStr.str()); try { CMessageBuffer msg; msg.append((int)rc_deregister); if (!queryWorldCommunicator().send(msg, masterNode, MPTAG_THORREGISTRATION, 60*1000)) { - LOG(MCerror, thorJob, "Failed to unregister slave : %s", slfStr.toCharArray()); + LOG(MCerror, thorJob, "Failed to unregister slave : %s", slfStr.str()); return; } - LOG(MCdebugProgress, thorJob, "Unregistered slave : %s", slfStr.toCharArray()); + LOG(MCdebugProgress, thorJob, "Unregistered slave : %s", slfStr.str()); } catch (IException *e) { FLLOG(MCexception(e), thorJob, e,"slave unregistration error"); @@ -228,7 +228,7 @@ void startSlaveLog() StringBuffer url; createUNCFilename(lf->queryLogFileSpec(), url); - LOG(MCdebugProgress, thorJob, "Opened log file %s", url.toCharArray()); + LOG(MCdebugProgress, thorJob, "Opened log file %s", url.str()); LOG(MCdebugProgress, thorJob, "Build %s", BUILD_TAG); globals->setProp("@logURL", url.str()); } @@ -362,7 +362,7 @@ int main( int argc, char *argv[] ) LOG(MCdebugProgress, thorJob, "ThorSlave Version LCR - %d.%d started",THOR_VERSION_MAJOR,THOR_VERSION_MINOR); StringBuffer url; - LOG(MCdebugProgress, thorJob, "Slave %s - temporary dir set to : %s", slfEp.getUrlStr(url).toCharArray(), queryTempDir()); + LOG(MCdebugProgress, thorJob, "Slave %s - temporary dir set to : %s", slfEp.getUrlStr(url).str(), queryTempDir()); #ifdef _WIN32 ULARGE_INTEGER userfree; ULARGE_INTEGER total; diff --git a/thorlcr/thorutil/thormisc.cpp b/thorlcr/thorutil/thormisc.cpp index f3dcc7290c6..44c359f5c6d 100644 --- a/thorlcr/thorutil/thormisc.cpp +++ b/thorlcr/thorutil/thormisc.cpp @@ -314,7 +314,7 @@ CThorException *_ThorWrapException(IException *e, const char *format, va_list ar eStr.appendf("%d, ", e->errorCode()); e->errorMessage(eStr).append(" : "); eStr.limited_valist_appendf(2048, format, args); - CThorException *te = new CThorException(e->errorAudience(), e->errorCode(), eStr.toCharArray()); + CThorException *te = new CThorException(e->errorAudience(), e->errorCode(), eStr.str()); return te; } @@ -551,7 +551,7 @@ void SetLogName(const char *prefix, const char *logdir, const char *thorname, bo #endif logname.append(".log"); StringBuffer lf; - openLogFile(lf, logname.toCharArray()); + openLogFile(lf, logname.str()); PrintLog("Opened log file %s", lf.str()); PrintLog("Build %s", BUILD_TAG); } @@ -592,7 +592,7 @@ class CTempNameHandler tempPrefix.set(_tempPrefix); StringBuffer base(name); addPathSepChar(base); - tempdir.set(base.toCharArray()); + tempdir.set(base.str()); recursiveCreateDirectory(tempdir); #ifdef _WIN32 altallowed = false; @@ -717,7 +717,7 @@ void loadCmdProp(IPropertyTree *tree, const char *cmdProp) prop.clip(); val.clip(); if (prop.length()) - tree->setProp(prop.toCharArray(), val.toCharArray()); + tree->setProp(prop.str(), val.str()); } } diff --git a/tools/esdlcmd/esdl2ecl.cpp b/tools/esdlcmd/esdl2ecl.cpp index cb9e6dd0586..26f51b58d8b 100644 --- a/tools/esdlcmd/esdl2ecl.cpp +++ b/tools/esdlcmd/esdl2ecl.cpp @@ -422,7 +422,7 @@ class Esdl2EclCmd : public EsdlConvertCmd params->setProp("sourceFileName", finger); StringBuffer esdl2eclxslt (optHPCCCompFilesDir.get()); esdl2eclxslt.append("/xslt/esdl2ecl.xslt"); - esdl2eclxsltTransform(expstr.str(), esdl2eclxslt.toCharArray(), params, outfile.str()); + esdl2eclxsltTransform(expstr.str(), esdl2eclxslt.str(), params, outfile.str()); } void esdl2eclxsltTransform(const char* xml, const char* sheet, IProperties *params, const char *filename) diff --git a/tools/testsocket/testsocket.cpp b/tools/testsocket/testsocket.cpp index aa1df34fe43..3da2a60d268 100644 --- a/tools/testsocket/testsocket.cpp +++ b/tools/testsocket/testsocket.cpp @@ -483,7 +483,7 @@ int doSendQuery(const char * ip, unsigned port, const char * base) fullQuery.append(base); } - const char * query = fullQuery.toCharArray(); + const char * query = fullQuery.str(); int len=strlen(query); int sendlen = len; if (persistConnections) @@ -896,7 +896,7 @@ int main(int argc, char **argv) } if (in != stdin) fclose(in); - ret = sendQuery(ip, socketPort, fileContents.toCharArray()); + ret = sendQuery(ip, socketPort, fileContents.str()); } else printf("File %s could not be opened\n", query);