THROW(BUNDLE_ERROR_KEY_EXISTS);
map_[key_info->GetKey()] = key_info;
- list_.push_back(key_info);
+ list_.push_back(std::move(key_info));
}
void Bundle::Set(const std::string& key, int index,
if (iter == map_.end())
THROW(BUNDLE_ERROR_KEY_NOT_AVAILABLE);
- int ret = iter->second->SetValue(index, value);
+ int ret = iter->second->SetValue(index, std::move(value));
if (ret != BUNDLE_ERROR_NONE)
THROW(ret);
}
unsigned char* raw;
try {
raw = EncodeRaw(&size);
- } catch (Exception& e) {
+ } catch (const Exception& e) {
THROW(e.GetErrorCode());
}
KeyInfo* new_key_info;
try {
- new_key_info = new KeyInfo(encoded_bytes);
- } catch (Exception& e) {
+ new_key_info = new KeyInfo(std::move(encoded_bytes));
+ } catch (const Exception& e) {
return e.GetErrorCode();
} catch (const std::bad_alloc& ba) {
return BUNDLE_ERROR_OUT_OF_MEMORY;
continue;
map_[key_info->GetKey()] = key_info;
- list_.push_back(key_info);
+ list_.push_back(std::move(key_info));
}
return BUNDLE_ERROR_NONE;
std::unique_ptr<gchar, decltype(g_free)*> base64_bytes_ptr(base64_bytes,
g_free);
- argv.push_back(base64_bytes);
+ argv.push_back(std::move(base64_bytes));
}
return argv;
KeyInfo* new_key_info;
try {
- new_key_info = new KeyInfo(Type::String, argv[idx], value);
- } catch (Exception& e) {
+ new_key_info = new KeyInfo(Type::String, argv[idx], std::move(value));
+ } catch (const Exception& e) {
return e.GetErrorCode();
} catch (const std::bad_alloc& ba) {
return BUNDLE_ERROR_OUT_OF_MEMORY;
KeyInfo* new_key_info;
try {
- new_key_info = new KeyInfo(decoded_bytes);
- } catch (Exception& e) {
+ new_key_info = new KeyInfo(std::move(decoded_bytes));
+ } catch (const Exception& e) {
return e.GetErrorCode();
} catch (const std::bad_alloc& ba) {
return BUNDLE_ERROR_OUT_OF_MEMORY;
continue;
map_[key_info->GetKey()] = key_info;
- list_.push_back(key_info);
+ list_.push_back(std::move(key_info));
}
return BUNDLE_ERROR_NONE;
auto* p = reinterpret_cast<unsigned char*>(const_cast<char*>(val));
std::vector<unsigned char> value;
std::copy(p, p + (strlen(val) + 1), std::back_inserter(value));
- values.push_back(value);
+ values.push_back(std::move(value));
}
try {
- key_info = new KeyInfo(Bundle::Type::StringArray, key, values);
- } catch (Exception& e) {
+ key_info = new KeyInfo(Bundle::Type::StringArray, key, std::move(values));
+ } catch (const Exception& e) {
_E("Error(%d)", e.GetErrorCode());
return;
} catch (const std::bad_alloc& ba) {
std::copy(p, p + (strlen(val) + 1), std::back_inserter(value));
try {
- key_info = new KeyInfo(Bundle::Type::String, key, value);
- } catch (Exception& e) {
+ key_info = new KeyInfo(Bundle::Type::String, key, std::move(value));
+ } catch (const Exception& e) {
_E("Error(%d)", e.GetErrorCode());
return;
} catch (const std::bad_alloc& ba) {
try {
b->Add(std::shared_ptr<KeyInfo>(key_info));
- } catch (Exception& e) {
+ } catch (const Exception& e) {
_W("Add() is failed. error(%d)", e.GetErrorCode());
return;
}
KeyInfo* key_info;
try {
- key_info = new KeyInfo(BUNDLE_TYPE_STR, key, value);
- } catch (Exception& e) {
+ key_info = new KeyInfo(BUNDLE_TYPE_STR, key, std::move(value));
+ } catch (const Exception& e) {
return e.GetErrorCode();
} catch (const std::bad_alloc& ba) {
return BUNDLE_ERROR_OUT_OF_MEMORY;
try {
h->Add(std::shared_ptr<KeyInfo>(key_info));
- } catch (Exception& e) {
+ } catch (const Exception& e) {
return e.GetErrorCode();
}
std::shared_ptr<KeyInfo> key_info;
try {
key_info = h->Get(key);
- } catch (Exception& e) {
+ } catch (const Exception& e) {
return e.GetErrorCode();
}
auto* h = reinterpret_cast<Bundle*>(b);
try {
h->Remove(key);
- } catch (Exception& e) {
+ } catch (const Exception& e) {
return e.GetErrorCode();
}
KeyInfo* k;
try {
k = new KeyInfo(*key_info);
- } catch (Exception& e) {
+ } catch (const Exception& e) {
set_last_result(e.GetErrorCode());
return nullptr;
} catch (const std::bad_alloc& ba) {
try {
auto* raw = const_cast<bundle_raw*>(r);
b = new Bundle(static_cast<unsigned char*>(raw), data_size);
- } catch (Exception& e) {
+ } catch (const Exception& e) {
set_last_result(e.GetErrorCode());
return nullptr;
} catch (const std::bad_alloc& ba) {
auto* h = reinterpret_cast<Bundle*>(b);
try {
*r = reinterpret_cast<bundle_raw*>(h->EncodeRaw(len));
- } catch (Exception& e) {
+ } catch (const Exception& e) {
return e.GetErrorCode();
}
return BUNDLE_ERROR_NONE;
try {
auto* raw = const_cast<bundle_raw*>(r);
b = new Bundle(static_cast<unsigned char*>(raw), data_size, false);
- } catch (Exception& e) {
+ } catch (const Exception& e) {
set_last_result(e.GetErrorCode());
return nullptr;
} catch (const std::bad_alloc& ba) {
std::shared_ptr<KeyInfo> key_info;
try {
key_info = h->Get(key);
- } catch (Exception& e) {
+ } catch (const Exception& e) {
set_last_result(e.GetErrorCode());
return BUNDLE_TYPE_NONE;
}
try {
key_info = new KeyInfo((BUNDLE_TYPE_STR_ARRAY | BUNDLE_TYPE_ARRAY),
key, values);
- } catch (Exception& e) {
+ } catch (const Exception& e) {
return e.GetErrorCode();
}
try {
h->Add(std::shared_ptr<KeyInfo>(key_info));
- } catch (Exception& e) {
+ } catch (const Exception& e) {
return e.GetErrorCode();
}
std::shared_ptr<KeyInfo> key_info;
try {
key_info = h->Get(key);
- } catch (Exception& e) {
+ } catch (const Exception& e) {
set_last_result(e.GetErrorCode());
return nullptr;
}
KeyInfo* key_info;
try {
- key_info = new KeyInfo(BUNDLE_TYPE_BYTE, key, value);
- } catch (Exception& e) {
+ key_info = new KeyInfo(BUNDLE_TYPE_BYTE, key, std::move(value));
+ } catch (const Exception& e) {
return e.GetErrorCode();
} catch (const std::bad_alloc& ba) {
return BUNDLE_ERROR_OUT_OF_MEMORY;
try {
h->Add(std::shared_ptr<KeyInfo>(key_info));
- } catch (Exception& e) {
+ } catch (const Exception& e) {
return e.GetErrorCode();
}
std::shared_ptr<KeyInfo> key_info;
try {
key_info = h->Get(key);
- } catch (Exception& e) {
+ } catch (const Exception& e) {
return e.GetErrorCode();
}
std::vector<std::string> exported_vt;
try {
exported_vt = h->Export();
- } catch (Exception& e) {
+ } catch (const Exception& e) {
set_last_result(e.GetErrorCode());
return -1;
}
Bundle* b = nullptr;
try {
b = new (std::nothrow) Bundle(argc, argv);
- } catch (Exception& e) {
+ } catch (const Exception& e) {
set_last_result(e.GetErrorCode());
return nullptr;
}
auto* h = reinterpret_cast<Bundle*>(b);
try {
- h->Set(key, idx, value);
- } catch (Exception& e) {
+ h->Set(key, idx, std::move(value));
+ } catch (const Exception& e) {
return e.GetErrorCode();
}
try {
std::vector<std::vector<unsigned char>> values(len);
key_info = new KeyInfo(Bundle::Type::ByteArray, key, std::move(values));
- } catch (Exception& e) {
+ } catch (const Exception& e) {
return e.GetErrorCode();
} catch (const std::bad_alloc& ba) {
return BUNDLE_ERROR_OUT_OF_MEMORY;
try {
h->Add(std::shared_ptr<KeyInfo>(key_info));
- } catch (Exception& e) {
+ } catch (const Exception& e) {
return e.GetErrorCode();
}
std::shared_ptr<KeyInfo> key_info;
try {
key_info = h->Get(key);
- } catch (Exception& e) {
+ } catch (const Exception& e) {
return e.GetErrorCode();
}
auto* h = reinterpret_cast<Bundle*>(b);
try {
- h->Set(key, idx, value);
- } catch (Exception& e) {
+ h->Set(key, idx, std::move(value));
+ } catch (const Exception& e) {
return e.GetErrorCode();
}
Json js(h);
try {
*json = strdup(js.ToString().c_str());
- } catch (Exception& e) {
+ } catch (const Exception& e) {
return e.GetErrorCode();
}
Json js(json);
try {
*b = reinterpret_cast<bundle*>(js.ToBundle());
- } catch (Exception& e) {
+ } catch (const Exception& e) {
return e.GetErrorCode();
}