From 4278b7dbf1948fe87bf7a002db37715d48046127 Mon Sep 17 00:00:00 2001 From: Jaesung Ku Date: Thu, 25 Apr 2013 20:58:58 +0900 Subject: [PATCH] Update for handling bytebuffer Change-Id: I532bc2fc65996e8236ae1243e698c07eac316231 Signed-off-by: Jaesung Ku --- src/app/FApp_AppArg.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) mode change 100644 => 100755 src/app/FApp_AppArg.cpp diff --git a/src/app/FApp_AppArg.cpp b/src/app/FApp_AppArg.cpp old mode 100644 new mode 100755 index e8ba5b7..f1796ba --- a/src/app/FApp_AppArg.cpp +++ b/src/app/FApp_AppArg.cpp @@ -431,6 +431,24 @@ BundleIterFnCb(const char* pKey, const int type, const bundle_keyval_t* pVal, vo } } break; + case BUNDLE_TYPE_BYTE: + bundle_keyval_get_basic_val(const_cast(pVal), reinterpret_cast(&pStr), &size); + + SysLog(NID_IO, "Bundle byte value = %s, size = %d", pStr, size); + + if (pStr) + { + ByteBuffer* pBuffer = new (std::nothrow) ByteBuffer(); + SysTryLog(NID_IO, pBuffer != null, "The memory is insufficient."); + result r = pBuffer->Construct(size); + SysTryLog(NID_IO, r == E_SUCCESS, "Constructing pBuffer is failed."); + + pBuffer->SetArray((const byte*)pStr, 0, size); + pBuffer->Flip(); + + pMap->Add(new (std::nothrow) String(pKey), pBuffer); + } + break; default: SysLog(NID_APP, "Invalid type for %s : %d", pKey, type); break; @@ -702,6 +720,10 @@ _AppArg::AddStrMap(bundle* b, const IMap* pMap) else if (typeid(*pObj) == typeid(const ByteBuffer)) { SysLog(NID_APP, "ByteBuffer type"); + const ByteBuffer* pBuffer = static_cast(pObj); + + std::unique_ptr pBundleKey(_StringConverter::CopyToCharArrayN(*pKey)); + bundle_add_byte(b, pBundleKey.get(), pBuffer->GetPointer(), pBuffer->GetLimit()); } } } -- 2.7.4