mirror of
https://github.com/openharmony/developtools_global_resource_tool.git
synced 2026-07-19 19:33:46 -04:00
!164 支持element目录下string资源配置为空字符串
Merge pull request !164 from liduo/string_can_be_empty
This commit is contained in:
@@ -47,11 +47,17 @@ bool ResourceItem::SetData(const string &data)
|
||||
|
||||
bool ResourceItem::SetData(const int8_t *data, uint32_t length)
|
||||
{
|
||||
if (data == nullptr || length <= 0) {
|
||||
if (data == nullptr || length < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ReleaseData();
|
||||
if (length == 0) {
|
||||
// the string in the element directory can be empty
|
||||
data_ = new (nothrow) int8_t[0];
|
||||
dataLen_ = 0;
|
||||
return true;
|
||||
}
|
||||
int8_t *buffer = reinterpret_cast<int8_t *>(new (nothrow) int8_t[length]);
|
||||
if (buffer == nullptr) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user