diff options
Diffstat (limited to 'src/XmlHandler/XmlHandler.cpp')
-rwxr-xr-x | src/XmlHandler/XmlHandler.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/XmlHandler/XmlHandler.cpp b/src/XmlHandler/XmlHandler.cpp index 75964f0..d36ec2e 100755 --- a/src/XmlHandler/XmlHandler.cpp +++ b/src/XmlHandler/XmlHandler.cpp @@ -153,14 +153,11 @@ XmlHandler::EndElement(void *ctx, const xmlChar *name) XmlHandler *pHandler = null; pHandler = (XmlHandler *)ctx; bool xmlResult = false; - String* pCharacters = pHandler->GetCharacters(); + char* pCharacters = pHandler->GetCharacters(); - if (pCharacters && (pCharacters->IsEmpty() == false)) + if (pCharacters && (strlen(pCharacters) > 0)) { - std::unique_ptr<char[]> pCharacter(_StringConverter::CopyToCharArrayN(*pCharacters)); - TryReturnVoid(pCharacter, "pCharacter is null."); - - xmlResult = pHandler->OnCharacters(pCharacter.get()); + xmlResult = pHandler->OnCharacters(pCharacters); if (xmlResult == false) { pHandler->SetError(); @@ -406,16 +403,18 @@ XmlHandler::SetCharacters(const char* pCharacter) if (__pCharacters == null) { - __pCharacters = new (std::nothrow) String(4096); + __pCharacters = new (std::nothrow) char[4096]; TryReturn(__pCharacters, false, "[osp-installer] __pCharacters is null"); + + memset(__pCharacters, 0, 4096); } - __pCharacters->Append(pCharacter); + strncat(__pCharacters, pCharacter, strlen(pCharacter)); return true; } -String* +char* XmlHandler::GetCharacters(void) { return __pCharacters; @@ -424,7 +423,7 @@ XmlHandler::GetCharacters(void) void XmlHandler::DeleteCharacters(void) { - delete __pCharacters; + delete[] __pCharacters; __pCharacters = null; } |