mirror of
https://gitee.com/openharmony/commonlibrary_ets_utils
synced 2025-02-09 11:32:55 +00:00
Fix static alarms in public basic libraries
Signed-off-by: @lixingyang-li <lixingyang13@huawei.com> https://gitee.com/openharmony/commonlibrary_ets_utils/issues/I9KGMU
This commit is contained in:
parent
5c460ca478
commit
f360237cfa
@ -77,7 +77,7 @@ Buffer::~Buffer()
|
||||
}
|
||||
}
|
||||
|
||||
EncodingType Buffer::GetEncodingType(string encode)
|
||||
EncodingType Buffer::GetEncodingType(std::string encode)
|
||||
{
|
||||
if (encode == "hex") {
|
||||
return HEX;
|
||||
@ -303,7 +303,7 @@ unsigned int Buffer::WriteString(std::string value, unsigned int size)
|
||||
|
||||
unsigned int Buffer::WriteString(string value, unsigned int offset, unsigned int size)
|
||||
{
|
||||
uint8_t *str = reinterpret_cast<uint8_t *>(const_cast<char *>(value.c_str()));
|
||||
uint8_t *str = const_cast<uint8_t *>(reinterpret_cast<const uint8_t *>(value.data()));
|
||||
bool isWriteSuccess = WriteBytes(str, size, raw_ + byteOffset_ + offset);
|
||||
return isWriteSuccess ? size : 0; // 0: write failed
|
||||
}
|
||||
@ -315,7 +315,7 @@ void Buffer::WriteStringLoop(string value, unsigned int offset, unsigned int end
|
||||
}
|
||||
unsigned int loop = length > end - offset ? end - offset : length;
|
||||
|
||||
uint8_t *str = reinterpret_cast<uint8_t *>(const_cast<char *>(value.c_str()));
|
||||
uint8_t *str = const_cast<uint8_t *>(reinterpret_cast<const uint8_t *>(value.data()));
|
||||
while (offset < end) {
|
||||
if (loop + offset > end) {
|
||||
WriteBytes(str, end - offset, raw_ + byteOffset_ + offset);
|
||||
|
@ -299,7 +299,7 @@ type Options = {
|
||||
|
||||
const _log = console.log;
|
||||
|
||||
console.log = function (...args) {
|
||||
console.log = function (...args) : void {
|
||||
if (args.length === 1 && args[0] instanceof Buffer) {
|
||||
let buf: Buffer = args[0];
|
||||
let bufArr: Array<number> = buf[bufferSymbol].getBufferData();
|
||||
@ -1783,7 +1783,7 @@ class Buffer {
|
||||
return this[bufferSymbol].getBufferData().entries();
|
||||
}
|
||||
|
||||
[Symbol.iterator]() {
|
||||
[Symbol.iterator](): IterableIterator<[number, number]> {
|
||||
return this[bufferSymbol].getBufferData().entries();
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ const TypeErrorCode = 401;
|
||||
class BusinessError extends Error {
|
||||
code: number;
|
||||
constructor(msg: string) {
|
||||
super(msg)
|
||||
super(msg);
|
||||
this.name = 'BusinessError';
|
||||
this.code = TypeErrorCode;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ const SyntaxErrorCodeId = 10200002;
|
||||
class BusinessError extends Error {
|
||||
code: number;
|
||||
constructor(msg: string) {
|
||||
super(msg)
|
||||
super(msg);
|
||||
this.name = 'BusinessError';
|
||||
this.code = TypeErrorCodeId;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ declare function requireInternal(s: string): UrlInterface;
|
||||
const UrlInterface = requireInternal('url');
|
||||
|
||||
|
||||
var seachParamsArr: Array<string> = [];
|
||||
let seachParamsArr: Array<string> = [];
|
||||
const typeErrorCodeId = 401; // 401:ErrorCodeId
|
||||
const syntaxErrorCodeId = 10200002; // 10200002:syntaxErrorCodeId
|
||||
|
||||
@ -256,7 +256,7 @@ class URLParams {
|
||||
}
|
||||
}
|
||||
|
||||
forEach(objfun: Function, thisArg?: Object) {
|
||||
forEach(objfun: Function, thisArg?: Object): void {
|
||||
if (typeof objfun !== 'function') {
|
||||
throw new BusinessError(`Parameter error.The type of ${objfun} must be function`);
|
||||
}
|
||||
@ -426,7 +426,7 @@ class URLSearchParams {
|
||||
return this.urlClass.entries();
|
||||
}
|
||||
|
||||
updateParams(input: string) {
|
||||
updateParams(input: string): void {
|
||||
let out = [];
|
||||
out = parameterProcessing(input);
|
||||
this.urlClass.array = out;
|
||||
@ -437,7 +437,7 @@ function toHleString(arg: string | symbol | number): string {
|
||||
return arg.toString();
|
||||
}
|
||||
|
||||
function parameterProcess(input: object | string | Iterable<[]>) {
|
||||
function parameterProcess(input: object | string | Iterable<[]>): Array<string> {
|
||||
if (input === null || typeof input === 'undefined' || input === '') {
|
||||
seachParamsArr = [];
|
||||
return seachParamsArr;
|
||||
@ -448,7 +448,7 @@ function parameterProcess(input: object | string | Iterable<[]>) {
|
||||
}
|
||||
}
|
||||
|
||||
function parameterProcessing(input: object | string | Iterable<[]>) {
|
||||
function parameterProcessing(input: object | string | Iterable<[]>): Array<string> {
|
||||
if (input === null || typeof input === 'undefined' || input === '') {
|
||||
seachParamsArr = [];
|
||||
return seachParamsArr;
|
||||
|
@ -70,7 +70,7 @@ napi_value StrToNapiValue(napi_env env, const std::string &result)
|
||||
return output;
|
||||
}
|
||||
|
||||
bool IsEscapeRange(const char ch)
|
||||
static bool IsEscapeRange(const char ch)
|
||||
{
|
||||
if ((ch > 0 && ch < '*') || (ch > '*' && ch < '-') || (ch == '/') ||
|
||||
(ch > '9' && ch < 'A') || (ch > 'Z' && ch < '_') || (ch == '`') || (ch > 'z')) {
|
||||
@ -79,7 +79,7 @@ bool IsEscapeRange(const char ch)
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string ReviseStr(std::string &str, std::string *reviseChar)
|
||||
static std::string ReviseStr(std::string &str, std::string *reviseChar)
|
||||
{
|
||||
icu::StringPiece sp(str.c_str());
|
||||
icu::UnicodeString wstr = icu::UnicodeString::fromUTF8(sp);
|
||||
@ -160,7 +160,7 @@ napi_value ToString(napi_env env, std::vector<std::string> &searchParams)
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<std::string> GetParamsStrig(napi_env env, const napi_value tempStr)
|
||||
static std::vector<std::string> GetParamsStrig(napi_env env, const napi_value tempStr)
|
||||
{
|
||||
std::vector<std::string> vec;
|
||||
size_t arraySize = 0;
|
||||
@ -1815,8 +1815,8 @@ HWTEST_F(NativeEngineTest, testUrlutilities001, testing::ext::TestSize.Level0)
|
||||
OHOS::Url::AnalysisOpaqueHost(inPut, temp, flags);
|
||||
inPut = "asdsad";
|
||||
OHOS::Url::AnalysisOpaqueHost(inPut, temp, flags);
|
||||
bool IsHexDigit = OHOS::Url::IsHexDigit('/');
|
||||
ASSERT_FALSE(IsHexDigit);
|
||||
bool isHexDigit = OHOS::Url::IsHexDigit('/');
|
||||
ASSERT_FALSE(isHexDigit);
|
||||
}
|
||||
|
||||
HWTEST_F(NativeEngineTest, testUrlutilities002, testing::ext::TestSize.Level0)
|
||||
@ -1858,11 +1858,12 @@ HWTEST_F(NativeEngineTest, testUrlutilities002, testing::ext::TestSize.Level0)
|
||||
OHOS::Url::AnalysisNoDefaultProtocol(inPut, urlDataInfo, flags);
|
||||
inPut = "";
|
||||
OHOS::Url::AnalysisOnlyHost(inPut, urlDataInfo, flags, i);
|
||||
bool IsHexDigit = OHOS::Url::IsHexDigit('b');
|
||||
ASSERT_TRUE(IsHexDigit);
|
||||
bool isHexDigit = OHOS::Url::IsHexDigit('b');
|
||||
ASSERT_TRUE(isHexDigit);
|
||||
}
|
||||
|
||||
std::string GetStringUtf8(napi_env env, napi_value str) {
|
||||
std::string GetStringUtf8(napi_env env, napi_value str)
|
||||
{
|
||||
std::string buffer = "";
|
||||
size_t bufferSize = 0;
|
||||
if (napi_get_value_string_utf8(env, str, nullptr, 0, &bufferSize) != napi_ok) {
|
||||
|
@ -48,7 +48,7 @@ namespace OHOS::xml {
|
||||
return;
|
||||
}
|
||||
if (type == "isAttri" || type == "isStart") {
|
||||
for (int i = 0; i < CurNspNum; ++i) {
|
||||
for (int i = 0; i < curNspNum; ++i) {
|
||||
out_.append(" xmlns:");
|
||||
out_.append(multNsp[depth_ - 1][i * 2]); // 2: number of args
|
||||
out_.append("=\"");
|
||||
@ -56,7 +56,7 @@ namespace OHOS::xml {
|
||||
out_.append("\"");
|
||||
}
|
||||
multNsp[depth_ - 1].clear();
|
||||
CurNspNum = 0;
|
||||
curNspNum = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,9 +106,9 @@ namespace OHOS::xml {
|
||||
}
|
||||
elementStack[depth_ * 3] = prefix; // 3: number of args
|
||||
elementStack[depth_ * 3 + 1] = nsTemp; // 3: number of args
|
||||
multNsp[depth_][CurNspNum * 2] = elementStack[depth_ * 3]; // 3: number of args 2: number of args
|
||||
multNsp[depth_][CurNspNum * 2 + 1] = elementStack[depth_ * 3 + 1]; // 3: number of args 2: number of args
|
||||
++CurNspNum;
|
||||
multNsp[depth_][curNspNum * 2] = elementStack[depth_ * 3]; // 3: number of args 2: number of args
|
||||
multNsp[depth_][curNspNum * 2 + 1] = elementStack[depth_ * 3 + 1]; // 3: number of args 2: number of args
|
||||
++curNspNum;
|
||||
type = "isNsp";
|
||||
size_t iLenTemp = out_.length();
|
||||
if (iLength_ > iPos_ + iLenTemp - 1) {
|
||||
|
@ -154,7 +154,7 @@ namespace OHOS::xml {
|
||||
std::string type {};
|
||||
std::vector<std::string> elementStack = { "", "", ""};
|
||||
std::map<int, std::map<int, std::string>> multNsp;
|
||||
int CurNspNum {};
|
||||
int curNspNum {};
|
||||
std::string out_ {};
|
||||
bool isHasDecl {};
|
||||
};
|
||||
|
@ -44,7 +44,7 @@ class BusinessError extends Error {
|
||||
code: number;
|
||||
constructor(msg: string) {
|
||||
super(msg);
|
||||
this.name = 'BusinessError'
|
||||
this.name = 'BusinessError';
|
||||
this.code = TypeErrorCode;
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ using namespace OHOS::xml;
|
||||
ASSERT_EQ(valueType, type); \
|
||||
}
|
||||
|
||||
std::string testStr = "";
|
||||
static std::string g_testStr = "";
|
||||
napi_value Method(napi_env env, napi_callback_info info)
|
||||
{
|
||||
napi_value thisVar = nullptr;
|
||||
@ -64,7 +64,7 @@ napi_value Method(napi_env env, napi_callback_info info)
|
||||
buffer2.reserve(bufferSize2 + 1);
|
||||
buffer2.resize(bufferSize2);
|
||||
napi_get_value_string_utf8(env, value, buffer2.data(), bufferSize2 + 1, &bufferSize2);
|
||||
testStr += buffer1 + buffer2;
|
||||
g_testStr += buffer1 + buffer2;
|
||||
napi_value result = nullptr;
|
||||
napi_get_boolean(env, true, &result);
|
||||
return result;
|
||||
@ -1077,7 +1077,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest001, testing::ext::TestSize.Level0)
|
||||
std::string str7 = "<h:td>Apples</h:td> <h:td>Bananas</h:td> </h:tr>";
|
||||
std::string str8 = "</h:table></note>";
|
||||
std::string strXml = str1 + str2 + str3 + str4 + str5 + str6 + str7 + str8;
|
||||
testStr = "";
|
||||
g_testStr = "";
|
||||
OHOS::xml::XmlPullParser xmlPullParser(strXml, "utf-8");
|
||||
napi_value options = nullptr;
|
||||
napi_create_object(env, &options);
|
||||
@ -1102,7 +1102,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest001, testing::ext::TestSize.Level0)
|
||||
std::string res2 = "Hello, World! companyJohn & Hanscompany titleHappytitletitleHappytitle";
|
||||
std::string res3 = " todoWorktodo todoPlaytodo go thereabba table trtdApplestd tdBananastd trtablenote";
|
||||
std::string result = res1 + res2 + res3;
|
||||
ASSERT_STREQ(testStr.c_str(), result.c_str());
|
||||
ASSERT_STREQ(g_testStr.c_str(), result.c_str());
|
||||
}
|
||||
|
||||
/* @tc.name: XmlParseTest002
|
||||
@ -1121,7 +1121,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest002, testing::ext::TestSize.Level0)
|
||||
std::string str7 = " <h:td>Apples</h:td> <h:td>Bananas</h:td> </h:tr>";
|
||||
std::string str8 = " </h:table></note>";
|
||||
std::string strXml = str1 + str2 + str3 + str4 + str5 + str6 + str7 + str8;
|
||||
testStr = "";
|
||||
g_testStr = "";
|
||||
OHOS::xml::XmlPullParser xmlPullParser(strXml, "utf-8");
|
||||
napi_value options = nullptr;
|
||||
napi_create_object(env, &options);
|
||||
@ -1142,7 +1142,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest002, testing::ext::TestSize.Level0)
|
||||
napi_set_named_property(env, object, key3, value3);
|
||||
xmlPullParser.DealOptionInfo(env, object);
|
||||
xmlPullParser.Parse(env, options);
|
||||
ASSERT_STREQ(testStr.c_str(), "importancehighloggedtruexmlns:hhttp://www.w3.org/TR/html4/");
|
||||
ASSERT_STREQ(g_testStr.c_str(), "importancehighloggedtruexmlns:hhttp://www.w3.org/TR/html4/");
|
||||
}
|
||||
|
||||
/* @tc.name: XmlParseTest003
|
||||
@ -1161,7 +1161,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest003, testing::ext::TestSize.Level0)
|
||||
std::string str7 = "<h:td>Apples</h:td> <h:td>Bananas</h:td> </h:tr>";
|
||||
std::string str8 = "</h:table></note>";
|
||||
std::string strXml = str1 + str2 + str3 + str4 + str5 + str6 + str7 + str8;
|
||||
testStr = "";
|
||||
g_testStr = "";
|
||||
OHOS::xml::XmlPullParser xmlPullParser(strXml, "utf-8");
|
||||
napi_value options = nullptr;
|
||||
napi_create_object(env, &options);
|
||||
@ -1186,7 +1186,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest003, testing::ext::TestSize.Level0)
|
||||
std::string res2 = " Hanscompany titleHappytitletitleHappytitle todoWorktodo todoPlaytodo go thereabba h:table";
|
||||
std::string res3 = " h:trh:tdApplesh:td h:tdBananash:td h:trh:tablenote";
|
||||
std::string result = res1 + res2 + res3;
|
||||
ASSERT_STREQ(testStr.c_str(), result.c_str());
|
||||
ASSERT_STREQ(g_testStr.c_str(), result.c_str());
|
||||
}
|
||||
|
||||
/* @tc.name: XmlParseTest004
|
||||
@ -1205,7 +1205,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest004, testing::ext::TestSize.Level0)
|
||||
std::string str7 = " <h:td>Apples</h:td> <h:td>Bananas</h:td> </h:tr>";
|
||||
std::string str8 = " </h:table></note>";
|
||||
std::string strXml = str1 + str2 + str3 + str4 + str5 + str6 + str7 + str8;
|
||||
testStr = "";
|
||||
g_testStr = "";
|
||||
OHOS::xml::XmlPullParser xmlPullParser(strXml, "utf-8");
|
||||
napi_value options = nullptr;
|
||||
napi_create_object(env, &options);
|
||||
@ -1226,7 +1226,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest004, testing::ext::TestSize.Level0)
|
||||
napi_set_named_property(env, object, key3, value3);
|
||||
xmlPullParser.DealOptionInfo(env, object);
|
||||
xmlPullParser.Parse(env, options);
|
||||
ASSERT_STREQ(testStr.c_str(), "importancehighloggedtruexmlns:hhttp://www.w3.org/TR/html4/");
|
||||
ASSERT_STREQ(g_testStr.c_str(), "importancehighloggedtruexmlns:hhttp://www.w3.org/TR/html4/");
|
||||
}
|
||||
|
||||
/* @tc.name: XmlParseTest005
|
||||
@ -1245,7 +1245,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest005, testing::ext::TestSize.Level0)
|
||||
std::string str7 = "<h:td>Apples</h:td> <h:td>Bananas</h:td> </h:tr>";
|
||||
std::string str8 = "</h:table></note>";
|
||||
std::string strXml = str1 + str2 + str3 + str4 + str5 + str6 + str7 + str8;
|
||||
testStr = "";
|
||||
g_testStr = "";
|
||||
OHOS::xml::XmlPullParser xmlPullParser(strXml, "utf-8");
|
||||
napi_value options = nullptr;
|
||||
napi_create_object(env, &options);
|
||||
@ -1270,7 +1270,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest005, testing::ext::TestSize.Level0)
|
||||
std::string res2 = "Hello, World! companyJohn & Hanscompany titleHappytitletitleHappytitle todoWorktodo";
|
||||
std::string res3 = " todoPlaytodo go thereabba h:table h:trh:tdApplesh:td h:tdBananash:td h:trh:tablenote";
|
||||
std::string result = res1 + res2 + res3;
|
||||
ASSERT_STREQ(testStr.c_str(), result.c_str());
|
||||
ASSERT_STREQ(g_testStr.c_str(), result.c_str());
|
||||
}
|
||||
|
||||
/* @tc.name: XmlParseTest006
|
||||
@ -1313,7 +1313,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest006, testing::ext::TestSize.Level0)
|
||||
std::string res2 = "Hello, World! companyJohn & Hanscompany titleHappytitletitleHappytitle todoWorktodo";
|
||||
std::string res3 = " todoPlaytodo go thereabba h:table h:trh:tdApplesh:td h:tdBananash:td h:trh:tablenote";
|
||||
std::string result = res1 + res2 + res3;
|
||||
ASSERT_STREQ(testStr.c_str(), result.c_str());
|
||||
ASSERT_STREQ(g_testStr.c_str(), result.c_str());
|
||||
}
|
||||
|
||||
/* @tc.name: XmlParseTest007
|
||||
@ -1332,7 +1332,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest007, testing::ext::TestSize.Level0)
|
||||
std::string str7 = " <h:td>Apples</h:td> <h:td>Bananas</h:td> </h:tr>";
|
||||
std::string str8 = " </h:table></note>";
|
||||
std::string strXml = str1 + str2 + str3 + str4 + str5 + str6 + str7 + str8;
|
||||
testStr = "";
|
||||
g_testStr = "";
|
||||
OHOS::xml::XmlPullParser xmlPullParser(strXml, "utf-8");
|
||||
napi_value options = nullptr;
|
||||
napi_create_object(env, &options);
|
||||
@ -1353,7 +1353,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest007, testing::ext::TestSize.Level0)
|
||||
napi_set_named_property(env, object, key3, value3);
|
||||
xmlPullParser.DealOptionInfo(env, object);
|
||||
xmlPullParser.Parse(env, options);
|
||||
ASSERT_STREQ(testStr.c_str(), "importancehighloggedtruexmlns:hhttp://www.w3.org/TR/html4/");
|
||||
ASSERT_STREQ(g_testStr.c_str(), "importancehighloggedtruexmlns:hhttp://www.w3.org/TR/html4/");
|
||||
}
|
||||
|
||||
/* @tc.name: XmlParseTest008
|
||||
@ -1372,7 +1372,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest008, testing::ext::TestSize.Level0)
|
||||
std::string str7 = "<h:td>Apples</h:td> <h:td>Bananas</h:td> </h:tr>";
|
||||
std::string str8 = "</h:table></note>";
|
||||
std::string strXml = str1 + str2 + str3 + str4 + str5 + str6 + str7 + str8;
|
||||
testStr = "";
|
||||
g_testStr = "";
|
||||
OHOS::xml::XmlPullParser xmlPullParser(strXml, "utf-8");
|
||||
napi_value options = nullptr;
|
||||
napi_create_object(env, &options);
|
||||
@ -1397,7 +1397,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest008, testing::ext::TestSize.Level0)
|
||||
std::string res2 = " Hanscompany titleHappytitletitleHappytitle todoWorktodo todoPlaytodo go thereabba h:table ";
|
||||
std::string res3 = "h:trh:tdApplesh:td h:tdBananash:td h:trh:tablenote";
|
||||
std::string result = res1 + res2 + res3;
|
||||
ASSERT_STREQ(testStr.c_str(), result.c_str());
|
||||
ASSERT_STREQ(g_testStr.c_str(), result.c_str());
|
||||
}
|
||||
|
||||
/* @tc.name: XmlParseTest009
|
||||
@ -1440,7 +1440,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest009, testing::ext::TestSize.Level0)
|
||||
std::string res2 = " Hanscompany titleHappytitletitleHappytitle todoWorktodo todoPlaytodo go thereabba h:table";
|
||||
std::string res3 = " h:trh:tdApplesh:td h:tdBananash:td h:trh:tablenote";
|
||||
std::string result = res1 + res2 + res3;
|
||||
ASSERT_STREQ(testStr.c_str(), result.c_str());
|
||||
ASSERT_STREQ(g_testStr.c_str(), result.c_str());
|
||||
}
|
||||
|
||||
/* @tc.name: XmlParseTest0010
|
||||
@ -1459,7 +1459,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest0010, testing::ext::TestSize.Level0)
|
||||
std::string str7 = "<h:td>Apples</h:td> <h:td>Bananas</h:td> </h:tr>";
|
||||
std::string str8 = "</h:table></note>";
|
||||
std::string strXml = str1 + str2 + str3 + str4 + str5 + str6 + str7 + str8;
|
||||
testStr = "";
|
||||
g_testStr = "";
|
||||
OHOS::xml::XmlPullParser xmlPullParser(strXml, "utf-8");
|
||||
napi_value options = nullptr;
|
||||
napi_create_object(env, &options);
|
||||
@ -1484,7 +1484,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest0010, testing::ext::TestSize.Level0)
|
||||
std::string res2 = "Hello, World! companyJohn & Hanscompany titleHappytitletitleHappytitle todoWorktodo";
|
||||
std::string res3 = " todoPlaytodo go thereabba table trtdApplestd tdBananastd trtablenote";
|
||||
std::string result = res1 + res2 + res3;
|
||||
ASSERT_STREQ(testStr.c_str(), result.c_str());
|
||||
ASSERT_STREQ(g_testStr.c_str(), result.c_str());
|
||||
}
|
||||
|
||||
/* @tc.name: XmlParseTest0011
|
||||
@ -1503,7 +1503,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest0011, testing::ext::TestSize.Level0)
|
||||
std::string str7 = " <h:td>Apples</h:td> <h:td>Bananas</h:td> </h:tr>";
|
||||
std::string str8 = " </h:table></note>";
|
||||
std::string strXml = str1 + str2 + str3 + str4 + str5 + str6 + str7 + str8;
|
||||
testStr = "";
|
||||
g_testStr = "";
|
||||
OHOS::xml::XmlPullParser xmlPullParser(strXml, "utf-8");
|
||||
napi_value options = nullptr;
|
||||
napi_create_object(env, &options);
|
||||
@ -1524,7 +1524,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest0011, testing::ext::TestSize.Level0)
|
||||
napi_set_named_property(env, object, key3, value3);
|
||||
xmlPullParser.DealOptionInfo(env, object);
|
||||
xmlPullParser.Parse(env, options);
|
||||
ASSERT_STREQ(testStr.c_str(), "");
|
||||
ASSERT_STREQ(g_testStr.c_str(), "");
|
||||
}
|
||||
|
||||
/* @tc.name: XmlParseTest0012
|
||||
@ -1563,7 +1563,7 @@ HWTEST_F(NativeEngineTest, XmlParseTest0012, testing::ext::TestSize.Level0)
|
||||
napi_set_named_property(env, object, key3, value3);
|
||||
xmlPullParser.DealOptionInfo(env, object);
|
||||
xmlPullParser.Parse(env, options);
|
||||
ASSERT_STREQ(testStr.c_str(), "");
|
||||
ASSERT_STREQ(g_testStr.c_str(), "");
|
||||
}
|
||||
|
||||
/* @tc.name: Xmlfunctest001
|
||||
|
@ -1704,7 +1704,7 @@ void Worker::TerminateInner()
|
||||
// 1. Update State
|
||||
UpdateWorkerState(TERMINATEING);
|
||||
// 2. send null signal
|
||||
PostMessageInner(NULL);
|
||||
PostMessageInner(nullptr);
|
||||
}
|
||||
|
||||
void Worker::CloseInner()
|
||||
|
@ -46,7 +46,7 @@ static OHOS::JsSysModule::Process::ChildProcess RunCommand(napi_env env, napi_va
|
||||
|
||||
return objectInfo;
|
||||
}
|
||||
std::string testStr = "";
|
||||
static std::string testStr = "";
|
||||
napi_value Method(napi_env env, napi_callback_info info)
|
||||
{
|
||||
napi_value thisVar = nullptr;
|
||||
|
@ -101,14 +101,13 @@ if (flag || fastHashMap === undefined) {
|
||||
}
|
||||
keys(): IterableIterator<K> {
|
||||
errorUtil.checkBindError('keys', HashMap, this);
|
||||
let data: HashMap<K, V> = this;
|
||||
let count: number = 0;
|
||||
return {
|
||||
next: function (): { done: boolean, value: K } {
|
||||
let done: boolean = false;
|
||||
let value: K = undefined;
|
||||
done = count >= data.memberNumber;
|
||||
value = done ? undefined : data.keyValueArray[count].key;
|
||||
done = count >= this.memberNumber;
|
||||
value = done ? undefined : this.keyValueArray[count].key;
|
||||
count++;
|
||||
return {
|
||||
done: done,
|
||||
@ -119,14 +118,13 @@ if (flag || fastHashMap === undefined) {
|
||||
}
|
||||
values(): IterableIterator<V> {
|
||||
errorUtil.checkBindError('values', HashMap, this);
|
||||
let data: HashMap<K, V> = this;
|
||||
let count: number = 0;
|
||||
return {
|
||||
next: function (): { done: boolean, value: V } {
|
||||
let done: boolean = false;
|
||||
let value: V = undefined;
|
||||
done = count >= data.memberNumber;
|
||||
value = done ? undefined : data.keyValueArray[count].value;
|
||||
done = count >= this.memberNumber;
|
||||
value = done ? undefined : this.keyValueArray[count].value;
|
||||
count++;
|
||||
return {
|
||||
done: done,
|
||||
@ -151,14 +149,13 @@ if (flag || fastHashMap === undefined) {
|
||||
}
|
||||
entries(): IterableIterator<[K, V]> {
|
||||
errorUtil.checkBindError('entries', HashMap, this);
|
||||
let data: HashMap<K, V> = this;
|
||||
let count: number = 0;
|
||||
return {
|
||||
next: function (): { done: boolean, value: [K, V] } {
|
||||
let done: boolean = false;
|
||||
let value: [K, V] = undefined;
|
||||
done = count >= data.memberNumber;
|
||||
value = done ? undefined : data.keyValueArray[count].entry();
|
||||
done = count >= this.memberNumber;
|
||||
value = done ? undefined : this.keyValueArray[count].entry();
|
||||
count++;
|
||||
return {
|
||||
done: done,
|
||||
|
@ -99,14 +99,13 @@ if (flag || fastHashSet === undefined) {
|
||||
}
|
||||
values(): IterableIterator<T> {
|
||||
errorUtil.checkBindError('values', HashSet, this);
|
||||
let data: HashSet<T> = this;
|
||||
let count: number = 0;
|
||||
return {
|
||||
next: function (): { done: boolean, value: T } {
|
||||
let done: boolean = false;
|
||||
let value: T = undefined;
|
||||
done = count >= data.memberNumber;
|
||||
value = done ? undefined : data.keyValueArray[count].key;
|
||||
done = count >= this.memberNumber;
|
||||
value = done ? undefined : this.keyValueArray[count].key;
|
||||
count++;
|
||||
return {
|
||||
done: done,
|
||||
@ -117,14 +116,13 @@ if (flag || fastHashSet === undefined) {
|
||||
}
|
||||
entries(): IterableIterator<[T, T]> {
|
||||
errorUtil.checkBindError('entries', HashSet, this);
|
||||
let data: HashSet<T> = this;
|
||||
let count: number = 0;
|
||||
return {
|
||||
next: function (): { done: boolean, value: [T, T] } {
|
||||
let done: boolean = false;
|
||||
let value: [T, T] = undefined;
|
||||
done = count >= data.memberNumber;
|
||||
value = done ? undefined : data.keyValueArray[count].entry();
|
||||
done = count >= this.memberNumber;
|
||||
value = done ? undefined : this.keyValueArray[count].entry();
|
||||
count++;
|
||||
return {
|
||||
done: done,
|
||||
|
@ -90,14 +90,13 @@ if (flag || fastLightWeightMap === undefined) {
|
||||
}
|
||||
entries(): IterableIterator<[K, V]> {
|
||||
errorUtil.checkBindError('entries', LightWeightMap, this);
|
||||
let data: LightWeightMap<K, V> = this;
|
||||
let count: number = 0;
|
||||
return {
|
||||
next: function (): { done: boolean, value: [K, V] } {
|
||||
let done: boolean = false;
|
||||
let value: [K, V] = undefined;
|
||||
done = count >= data.memberNumber;
|
||||
value = done ? undefined : [data.members.keys[count], data.members.values[count]] as [K, V];
|
||||
done = count >= this.memberNumber;
|
||||
value = done ? undefined : [this.members.keys[count], this.members.values[count]] as [K, V];
|
||||
count++;
|
||||
return {
|
||||
done: done,
|
||||
@ -132,14 +131,13 @@ if (flag || fastLightWeightMap === undefined) {
|
||||
}
|
||||
keys(): IterableIterator<K> {
|
||||
errorUtil.checkBindError('keys', LightWeightMap, this);
|
||||
let data: LightWeightMap<K, V> = this;
|
||||
let count: number = 0;
|
||||
return {
|
||||
next: function (): { done: boolean, value: K } {
|
||||
let done: boolean = false;
|
||||
let value: K = undefined;
|
||||
done = count >= data.memberNumber;
|
||||
value = done ? undefined : data.members.keys[count];
|
||||
done = count >= this.memberNumber;
|
||||
value = done ? undefined : this.members.keys[count];
|
||||
count++;
|
||||
return {
|
||||
done: done,
|
||||
@ -207,9 +205,8 @@ if (flag || fastLightWeightMap === undefined) {
|
||||
thisArg?: Object): void {
|
||||
errorUtil.checkBindError('forEach', LightWeightMap, this);
|
||||
errorUtil.checkTypeError('callbackfn', 'callable', callbackfn);
|
||||
let data: LightWeightMap<K, V> = this;
|
||||
for (let i: number = 0; i < data.memberNumber; i++) {
|
||||
callbackfn.call(thisArg, data.members.values[i], data.members.keys[i], data);
|
||||
for (let i: number = 0; i < this.memberNumber; i++) {
|
||||
callbackfn.call(thisArg, this.members.values[i], this.members.keys[i], this);
|
||||
}
|
||||
}
|
||||
[Symbol.iterator](): IterableIterator<[K, V]> {
|
||||
@ -232,14 +229,13 @@ if (flag || fastLightWeightMap === undefined) {
|
||||
}
|
||||
values(): IterableIterator<V> {
|
||||
errorUtil.checkBindError('values', LightWeightMap, this);
|
||||
let data: LightWeightMap<K, V> = this;
|
||||
let count: number = 0;
|
||||
return {
|
||||
next: function (): { done: boolean, value: V } {
|
||||
let done: boolean = false;
|
||||
let value: V = undefined;
|
||||
done = count >= data.memberNumber;
|
||||
value = done ? undefined : data.members.values[count];
|
||||
done = count >= this.memberNumber;
|
||||
value = done ? undefined : this.members.values[count];
|
||||
count++;
|
||||
return {
|
||||
done: done,
|
||||
|
@ -158,21 +158,19 @@ if (flag || fastLightWeightSet === undefined) {
|
||||
thisArg?: Object): void {
|
||||
errorUtil.checkBindError('forEach', LightWeightSet, this);
|
||||
errorUtil.checkTypeError('callbackfn', 'callable', callbackfn);
|
||||
let data: LightWeightSet<T> = this;
|
||||
for (let i: number = 0; i < data.memberNumber; i++) {
|
||||
callbackfn.call(thisArg, data.members.keys[i], data.members.keys[i], data);
|
||||
for (let i: number = 0; i < this.memberNumber; i++) {
|
||||
callbackfn.call(thisArg, this.members.keys[i], this.members.keys[i], this);
|
||||
}
|
||||
}
|
||||
[Symbol.iterator](): IterableIterator<T> {
|
||||
errorUtil.checkBindError('Symbol.iterator', LightWeightSet, this);
|
||||
let data: LightWeightSet<T> = this;
|
||||
let count: number = 0;
|
||||
return {
|
||||
next: function (): { done: boolean, value: T } {
|
||||
let done: boolean = false;
|
||||
let value: T = undefined;
|
||||
done = count >= data.memberNumber;
|
||||
value = done ? undefined : data.members.keys[count];
|
||||
done = count >= this.memberNumber;
|
||||
value = done ? undefined : this.members.keys[count];
|
||||
count++;
|
||||
return {
|
||||
done: done,
|
||||
@ -200,15 +198,14 @@ if (flag || fastLightWeightSet === undefined) {
|
||||
}
|
||||
entries(): IterableIterator<[T, T]> {
|
||||
errorUtil.checkBindError('entries', LightWeightSet, this);
|
||||
let data: LightWeightSet<T> = this;
|
||||
let count: number = 0;
|
||||
return {
|
||||
next: function (): { done: boolean, value: [T, T] } {
|
||||
let done: boolean = false;
|
||||
let value: [T, T] = undefined;
|
||||
let tempValue: T = undefined;
|
||||
done = count >= data.memberNumber;
|
||||
tempValue = data.members.keys[count];
|
||||
done = count >= this.memberNumber;
|
||||
tempValue = this.members.keys[count];
|
||||
value = done ? undefined : ([tempValue, tempValue] as [T, T]);
|
||||
count++;
|
||||
return {
|
||||
|
@ -406,13 +406,12 @@ if (flag || fastLinkedList === undefined) {
|
||||
[Symbol.iterator](): IterableIterator<T> {
|
||||
errorUtil.checkBindError('Symbol.iterator', LinkedList, this);
|
||||
let count: number = 0;
|
||||
let linkedlist: LinkedList<T> = this;
|
||||
return {
|
||||
next: function (): { done: boolean, value: T } {
|
||||
let done: boolean = false;
|
||||
let value: T = undefined;
|
||||
done = count >= linkedlist.elementNum;
|
||||
value = done ? undefined : linkedlist.getNode(count++).element;
|
||||
done = count >= this.elementNum;
|
||||
value = done ? undefined : this.getNode(count++).element;
|
||||
return {
|
||||
done: done,
|
||||
value: value,
|
||||
|
@ -394,13 +394,12 @@ if (flag || fastList === undefined) {
|
||||
[Symbol.iterator](): IterableIterator<T> {
|
||||
errorUtil.checkBindError('Symbol.iterator', List, this);
|
||||
let count: number = 0;
|
||||
let list: List<T> = this;
|
||||
return {
|
||||
next: function (): { done: boolean, value: T } {
|
||||
let done: boolean = false;
|
||||
let value: T = undefined;
|
||||
done = count >= list.elementNum;
|
||||
value = done ? undefined : list.getNode(count++).element;
|
||||
done = count >= this.elementNum;
|
||||
value = done ? undefined : this.getNode(count++).element;
|
||||
return {
|
||||
done: done,
|
||||
value: value,
|
||||
|
@ -170,14 +170,13 @@ if (flag || fastPlainArray === undefined) {
|
||||
}
|
||||
[Symbol.iterator](): IterableIterator<[number, T]> {
|
||||
errorUtil.checkBindError('Symbol.iterator', PlainArray, this);
|
||||
let data: PlainArray<T> = this;
|
||||
let count: number = 0;
|
||||
return {
|
||||
next: function (): { done: boolean, value: [number, T] } {
|
||||
let done: boolean = false;
|
||||
let value: [number, T] = undefined;
|
||||
done = count >= data.memberNumber;
|
||||
value = done ? undefined : [data.members.keys[count], data.members.values[count]] as [number, T];
|
||||
done = count >= this.memberNumber;
|
||||
value = done ? undefined : [this.members.keys[count], this.members.values[count]] as [number, T];
|
||||
count++;
|
||||
return {
|
||||
done: done,
|
||||
|
@ -150,14 +150,13 @@ if (flag || fastQueue === undefined) {
|
||||
[Symbol.iterator](): IterableIterator<T> {
|
||||
errorUtil.checkBindError('Symbol.iterator', Queue, this);
|
||||
let count: number = this.front;
|
||||
let queue: Queue<T> = this;
|
||||
return {
|
||||
next: function (): { done: boolean, value: T } {
|
||||
let done: boolean = false;
|
||||
let value: T = undefined;
|
||||
done = count === queue.rear;
|
||||
value = done ? undefined : queue[count];
|
||||
count = (count + 1) % queue.capacity;
|
||||
done = count === this.rear;
|
||||
value = done ? undefined : this[count];
|
||||
count = (count + 1) % this.capacity;
|
||||
return {
|
||||
done: done,
|
||||
value: value,
|
||||
|
@ -148,13 +148,12 @@ if (flag || fastStack === undefined) {
|
||||
[Symbol.iterator](): IterableIterator<T> {
|
||||
errorUtil.checkBindError('Symbol.iterator', Stack, this);
|
||||
let count: number = 0;
|
||||
let stack: Stack<T> = this;
|
||||
return {
|
||||
next: function (): { done: boolean, value: T } {
|
||||
let done: boolean = false;
|
||||
let value: T = undefined;
|
||||
done = count >= stack.elementNum;
|
||||
value = done ? undefined : stack[count++];
|
||||
done = count >= this.elementNum;
|
||||
value = done ? undefined : this[count++];
|
||||
return {
|
||||
done: done,
|
||||
value: value,
|
||||
|
@ -79,30 +79,24 @@ if (flag || fastTreeMap === undefined) {
|
||||
}
|
||||
get(key: K): V {
|
||||
errorUtil.checkBindError('get', TreeMap, this);
|
||||
let tempNode: any = undefined;
|
||||
tempNode = this.constitute.getNode(key);
|
||||
if (tempNode === undefined) {
|
||||
return tempNode;
|
||||
if (this.constitute.getNode(key) === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
return tempNode.value;
|
||||
return this.constitute.getNode(key).value;
|
||||
}
|
||||
getFirstKey(): K {
|
||||
errorUtil.checkBindError('getFirstKey', TreeMap, this);
|
||||
let tempNode: any = undefined;
|
||||
tempNode = this.constitute.firstNode();
|
||||
if (tempNode === undefined) {
|
||||
return tempNode;
|
||||
if (this.constitute.firstNode() === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
return tempNode.key;
|
||||
return this.constitute.firstNode().key;
|
||||
}
|
||||
getLastKey(): K {
|
||||
errorUtil.checkBindError('getLastKey', TreeMap, this);
|
||||
let tempNode: any = undefined;
|
||||
tempNode = this.constitute.lastNode();
|
||||
if (tempNode === undefined) {
|
||||
return tempNode;
|
||||
if (this.constitute.lastNode() === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
return tempNode.key;
|
||||
return this.constitute.lastNode().key;
|
||||
}
|
||||
setAll(map: TreeMap<K, V>): void {
|
||||
errorUtil.checkBindError('setAll', TreeMap, this);
|
||||
@ -124,15 +118,13 @@ if (flag || fastTreeMap === undefined) {
|
||||
getLowerKey(key: K): K {
|
||||
errorUtil.checkBindError('getLowerKey', TreeMap, this);
|
||||
let result: K | undefined = undefined;
|
||||
let tempNode: any = undefined;
|
||||
tempNode = this.constitute.getNode(key);
|
||||
if (tempNode === undefined) {
|
||||
return tempNode;
|
||||
if (this.constitute.getNode(key) === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (tempNode.left !== undefined) {
|
||||
return tempNode.left.key;
|
||||
if (this.constitute.getNode(key).left !== undefined) {
|
||||
return this.constitute.getNode(key).left.key;
|
||||
}
|
||||
let node: any = tempNode;
|
||||
let node = this.constitute.getNode(key);
|
||||
while (node.parent !== undefined) {
|
||||
if (node.parent.right === node) {
|
||||
return node.parent.key;
|
||||
@ -144,15 +136,13 @@ if (flag || fastTreeMap === undefined) {
|
||||
getHigherKey(key: K): K {
|
||||
errorUtil.checkBindError('getHigherKey', TreeMap, this);
|
||||
let result: K | undefined = undefined;
|
||||
let tempNode: any = undefined;
|
||||
tempNode = this.constitute.getNode(key);
|
||||
if (tempNode === undefined) {
|
||||
return tempNode;
|
||||
if (this.constitute.getNode(key) === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (tempNode.right !== undefined) {
|
||||
return tempNode.right.key;
|
||||
if (this.constitute.getNode(key).right !== undefined) {
|
||||
return this.constitute.getNode(key).right.key;
|
||||
}
|
||||
let node: any = tempNode;
|
||||
let node = this.constitute.getNode(key);
|
||||
while (node.parent !== undefined) {
|
||||
if (node.parent.left === node) {
|
||||
return node.parent.key;
|
||||
@ -163,14 +153,13 @@ if (flag || fastTreeMap === undefined) {
|
||||
}
|
||||
keys(): IterableIterator<K> {
|
||||
errorUtil.checkBindError('keys', TreeMap, this);
|
||||
let data: any = this.constitute;
|
||||
let count: number = 0;
|
||||
return {
|
||||
next: function (): { done: boolean, value: K } {
|
||||
let done: boolean = false;
|
||||
let value: K = undefined;
|
||||
done = count >= data.memberNumber;
|
||||
value = done ? undefined : data.keyValueArray[count].key;
|
||||
done = count >= this.constitute.memberNumber;
|
||||
value = done ? undefined : this.constitute.keyValueArray[count].key;
|
||||
count++;
|
||||
return {
|
||||
done: done,
|
||||
@ -181,14 +170,13 @@ if (flag || fastTreeMap === undefined) {
|
||||
}
|
||||
values(): IterableIterator<V> {
|
||||
errorUtil.checkBindError('values', TreeMap, this);
|
||||
let data: any = this.constitute;
|
||||
let count: number = 0;
|
||||
return {
|
||||
next: function (): { done: boolean, value: V } {
|
||||
let done: boolean = false;
|
||||
let value: V = undefined;
|
||||
done = count >= data.memberNumber;
|
||||
value = done ? undefined : data.keyValueArray[count].value;
|
||||
done = count >= this.constitute.memberNumber;
|
||||
value = done ? undefined : this.constitute.keyValueArray[count].value;
|
||||
count++;
|
||||
return {
|
||||
done: done,
|
||||
@ -199,34 +187,29 @@ if (flag || fastTreeMap === undefined) {
|
||||
}
|
||||
replace(key: K, newValue: V): boolean {
|
||||
errorUtil.checkBindError('replace', TreeMap, this);
|
||||
let targetNode: any = this.constitute.getNode(key);
|
||||
if (targetNode === undefined) {
|
||||
if (this.constitute.getNode(key) === undefined) {
|
||||
return false;
|
||||
}
|
||||
targetNode.value = newValue;
|
||||
this.constitute.getNode(key).value = newValue;
|
||||
return true;
|
||||
}
|
||||
forEach(callbackfn: (value?: V, key?: K, map?: TreeMap<K, V>) => void,
|
||||
thisArg?: Object): void {
|
||||
errorUtil.checkBindError('forEach', TreeMap, this);
|
||||
errorUtil.checkTypeError('callbackfn', 'callable', callbackfn);
|
||||
let data: any = this.constitute;
|
||||
let tagetArray: Array<any> = [];
|
||||
tagetArray = data.keyValueArray;
|
||||
for (let i: number = 0; i < data.memberNumber; i++) {
|
||||
callbackfn.call(thisArg, tagetArray[i].value as V, tagetArray[i].key);
|
||||
for (let i: number = 0; i < this.constitute.memberNumber; i++) {
|
||||
callbackfn.call(thisArg, this.constitute.keyValueArray[i].value as V, this.constitute.keyValueArray[i].key);
|
||||
}
|
||||
}
|
||||
entries(): IterableIterator<[K, V]> {
|
||||
errorUtil.checkBindError('entries', TreeMap, this);
|
||||
let data: any = this.constitute;
|
||||
let count: number = 0;
|
||||
return {
|
||||
next: function (): { done: boolean, value: [K, V] } {
|
||||
let done: boolean = false;
|
||||
let value: [K, V] = undefined;
|
||||
done = count >= data.memberNumber;
|
||||
value = done ? undefined : data.keyValueArray[count].entry();
|
||||
done = count >= this.constitute.memberNumber;
|
||||
value = done ? undefined : this.constitute.keyValueArray[count].entry();
|
||||
count++;
|
||||
return {
|
||||
done: done,
|
||||
|
@ -90,33 +90,27 @@ if (flag || fastTreeSet === undefined) {
|
||||
}
|
||||
getFirstValue(): T {
|
||||
errorUtil.checkBindError('getFirstValue', TreeSet, this);
|
||||
let tempNode: any = undefined;
|
||||
tempNode = this.constitute.firstNode();
|
||||
if (tempNode === undefined) {
|
||||
return tempNode;
|
||||
if (this.constitute.firstNode() === undefined) {
|
||||
return this.constitute.firstNode();;
|
||||
}
|
||||
return tempNode.key;
|
||||
return this.constitute.firstNode().key;
|
||||
}
|
||||
getLastValue(): T {
|
||||
errorUtil.checkBindError('getLastValue', TreeSet, this);
|
||||
let tempNode: any = undefined;
|
||||
tempNode = this.constitute.lastNode();
|
||||
if (tempNode === undefined) {
|
||||
return tempNode;
|
||||
if (this.constitute.lastNode() === undefined) {
|
||||
return this.constitute.lastNode();
|
||||
}
|
||||
return tempNode.key;
|
||||
return this.constitute.lastNode().key;
|
||||
}
|
||||
getLowerValue(key: T): T {
|
||||
errorUtil.checkBindError('getLowerValue', TreeSet, this);
|
||||
let tempNode: any = undefined;
|
||||
tempNode = this.constitute.getNode(key);
|
||||
if (tempNode === undefined) {
|
||||
return tempNode;
|
||||
if (this.constitute.getNode(key) === undefined) {
|
||||
return this.constitute.getNode(key);
|
||||
}
|
||||
if (tempNode.left !== undefined) {
|
||||
return tempNode.left.key;
|
||||
if (this.constitute.getNode(key).left !== undefined) {
|
||||
return this.constitute.getNode(key).left.key;
|
||||
}
|
||||
let node: any = tempNode;
|
||||
let node = this.constitute.getNode(key);
|
||||
while (node.parent !== undefined) {
|
||||
if (node.parent.right === node) {
|
||||
return node.parent.key;
|
||||
@ -127,15 +121,13 @@ if (flag || fastTreeSet === undefined) {
|
||||
}
|
||||
getHigherValue(key: T): T {
|
||||
errorUtil.checkBindError('getHigherValue', TreeSet, this);
|
||||
let tempNode: any = undefined;
|
||||
tempNode = this.constitute.getNode(key);
|
||||
if (tempNode === undefined) {
|
||||
return tempNode;
|
||||
if (this.constitute.getNode(key) === undefined) {
|
||||
return this.constitute.getNode(key);
|
||||
}
|
||||
if (tempNode.right !== undefined) {
|
||||
return tempNode.right.key;
|
||||
if (this.constitute.getNode(key).right !== undefined) {
|
||||
return this.constitute.getNode(key).right.key;
|
||||
}
|
||||
let node: any = tempNode;
|
||||
let node = this.constitute.getNode(key);
|
||||
while (node.parent !== undefined) {
|
||||
if (node.parent.left === node) {
|
||||
return node.parent.key;
|
||||
@ -168,14 +160,13 @@ if (flag || fastTreeSet === undefined) {
|
||||
}
|
||||
values(): IterableIterator<T> {
|
||||
errorUtil.checkBindError('values', TreeSet, this);
|
||||
let data: any = this.constitute;
|
||||
let count: number = 0;
|
||||
return {
|
||||
next: function (): { done: boolean, value: T } {
|
||||
let done: boolean = false;
|
||||
let value: T = undefined;
|
||||
done = count >= data.memberNumber;
|
||||
value = done ? undefined : data.keyValueArray[count].value as T;
|
||||
done = count >= this.memberNumber;
|
||||
value = done ? undefined : this.keyValueArray[count].value as T;
|
||||
count++;
|
||||
return {
|
||||
done: done,
|
||||
@ -188,22 +179,20 @@ if (flag || fastTreeSet === undefined) {
|
||||
thisArg?: Object): void {
|
||||
errorUtil.checkBindError('forEach', TreeSet, this);
|
||||
errorUtil.checkTypeError('callbackfn', 'callable', callbackfn);
|
||||
let data: any = this.constitute;
|
||||
let tagetArray: Array<any> = data.keyValueArray;
|
||||
for (let i: number = 0; i < data.memberNumber; i++) {
|
||||
let tagetArray: Array<any> = this.constitute.keyValueArray;
|
||||
for (let i: number = 0; i < this.constitute.memberNumber; i++) {
|
||||
callbackfn.call(thisArg, tagetArray[i].value as T, tagetArray[i].key);
|
||||
}
|
||||
}
|
||||
entries(): IterableIterator<[T, T]> {
|
||||
errorUtil.checkBindError('entries', TreeSet, this);
|
||||
let data: any = this.constitute;
|
||||
let count: number = 0;
|
||||
return {
|
||||
next: function (): { done: boolean, value: [T, T] } {
|
||||
let done: boolean = false;
|
||||
let value: [T, T] = undefined;
|
||||
done = count >= data.memberNumber;
|
||||
value = done ? undefined : data.keyValueArray[count].entry();
|
||||
done = count >= this.constitute.memberNumber;
|
||||
value = done ? undefined : this.constitute.keyValueArray[count].entry();
|
||||
count++;
|
||||
return {
|
||||
done: done,
|
||||
|
@ -358,13 +358,12 @@ if (flag || fastVector === undefined) {
|
||||
}
|
||||
[Symbol.iterator](): IterableIterator<T> {
|
||||
let count: number = 0;
|
||||
let vector: Vector<T> = this;
|
||||
return {
|
||||
next: function (): { done: boolean, value: T } {
|
||||
let done: boolean = false;
|
||||
let value: T = undefined;
|
||||
done = count >= vector.elementNum;
|
||||
value = done ? undefined : vector[count++];
|
||||
done = count >= this.elementNum;
|
||||
value = done ? undefined : this[count++];
|
||||
return {
|
||||
done: done,
|
||||
value: value,
|
||||
|
@ -630,7 +630,7 @@ function callbackified(original: Fn, ...args: Array<string | number | Fn>): void
|
||||
if (typeof maybeCb !== 'function') {
|
||||
throw new Error('maybe is not function');
|
||||
}
|
||||
const cb = (...args: Array<null>) => {
|
||||
const cb = (...args: Array<null>) : void => {
|
||||
Reflect.apply(maybeCb, this, args);
|
||||
};
|
||||
Reflect.apply(original, this, args).then((ret: null) => cb(null, ret), (rej: null) => cb(rej));
|
||||
@ -658,7 +658,7 @@ function callbackWrapper(original: Fn): Function {
|
||||
if (typeof descriptors.name.value === 'string') {
|
||||
descriptors.name.value += 'callbackified';
|
||||
}
|
||||
function cb(...args: Array<string | number | Fn>) {
|
||||
function cb(...args: Array<string | number | Fn>): void {
|
||||
callbackified(original, ...args);
|
||||
}
|
||||
Object.defineProperties(cb, descriptors);
|
||||
@ -1278,8 +1278,8 @@ class RationalNumber {
|
||||
private mnum: number = 0;
|
||||
private mden: number = 0;
|
||||
|
||||
public constructor()
|
||||
public constructor(num: number, den: number)
|
||||
public constructor();
|
||||
public constructor(num: number, den: number);
|
||||
public constructor(num?: number, den?: number) {
|
||||
if (!num && !den) {
|
||||
|
||||
|
@ -593,8 +593,8 @@ HWTEST_F(NativeEngineTest, textEncodeIntoTest001, testing::ext::TestSize.Level0)
|
||||
uint32_t resWritten = 0;
|
||||
napi_get_value_uint32(env, read, &resWritten);
|
||||
|
||||
ASSERT_EQ(resRead, (uint32_t)6);
|
||||
ASSERT_EQ(resWritten, (uint32_t)6);
|
||||
ASSERT_EQ(resRead, static_cast<uint32_t>(6));
|
||||
ASSERT_EQ(resWritten, static_cast<uint32_t>(6));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -635,8 +635,8 @@ HWTEST_F(NativeEngineTest, textEncodeIntoTest002, testing::ext::TestSize.Level0)
|
||||
uint32_t resWritten = 0;
|
||||
napi_get_value_uint32(env, read, &resWritten);
|
||||
|
||||
ASSERT_EQ(resRead, (uint32_t)4);
|
||||
ASSERT_EQ(resWritten, (uint32_t)4);
|
||||
ASSERT_EQ(resRead, static_cast<uint32_t>(4));
|
||||
ASSERT_EQ(resWritten, static_cast<uint32_t>(4));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -677,8 +677,8 @@ HWTEST_F(NativeEngineTest, textEncodeIntoTest003, testing::ext::TestSize.Level0)
|
||||
uint32_t resWritten = 0;
|
||||
napi_get_value_uint32(env, read, &resWritten);
|
||||
|
||||
ASSERT_EQ(resRead, (uint32_t)5);
|
||||
ASSERT_EQ(resWritten, (uint32_t)5);
|
||||
ASSERT_EQ(resRead, static_cast<uint32_t>(5));
|
||||
ASSERT_EQ(resWritten, static_cast<uint32_t>(5));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -720,8 +720,8 @@ HWTEST_F(NativeEngineTest, textEncodeIntoTest004, testing::ext::TestSize.Level0)
|
||||
uint32_t resWritten = 0;
|
||||
napi_get_value_uint32(env, read, &resWritten);
|
||||
|
||||
ASSERT_EQ(resRead, (uint32_t)6);
|
||||
ASSERT_EQ(resWritten, (uint32_t)6);
|
||||
ASSERT_EQ(resRead, static_cast<uint32_t>(6));
|
||||
ASSERT_EQ(resWritten, static_cast<uint32_t>(6));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -763,8 +763,8 @@ HWTEST_F(NativeEngineTest, textEncodeIntoTest005, testing::ext::TestSize.Level0)
|
||||
uint32_t resWritten = 0;
|
||||
napi_get_value_uint32(env, read, &resWritten);
|
||||
|
||||
ASSERT_EQ(resRead, (uint32_t)7);
|
||||
ASSERT_EQ(resWritten, (uint32_t)7);
|
||||
ASSERT_EQ(resRead, static_cast<uint32_t>(7));
|
||||
ASSERT_EQ(resWritten, static_cast<uint32_t>(7));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -806,8 +806,8 @@ HWTEST_F(NativeEngineTest, textEncodeIntoTest006, testing::ext::TestSize.Level0)
|
||||
uint32_t resWritten = 0;
|
||||
napi_get_value_uint32(env, read, &resWritten);
|
||||
|
||||
ASSERT_EQ(resRead, (uint32_t)7);
|
||||
ASSERT_EQ(resWritten, (uint32_t)7);
|
||||
ASSERT_EQ(resRead, static_cast<uint32_t>(7));
|
||||
ASSERT_EQ(resWritten, static_cast<uint32_t>(7));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -849,8 +849,8 @@ HWTEST_F(NativeEngineTest, textEncodeIntoTest007, testing::ext::TestSize.Level0)
|
||||
uint32_t resWritten = 0;
|
||||
napi_get_value_uint32(env, read, &resWritten);
|
||||
|
||||
ASSERT_EQ(resRead, (uint32_t)7);
|
||||
ASSERT_EQ(resWritten, (uint32_t)7);
|
||||
ASSERT_EQ(resRead, static_cast<uint32_t>(7));
|
||||
ASSERT_EQ(resWritten, static_cast<uint32_t>(7));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1382,10 +1382,10 @@ HWTEST_F(NativeEngineTest, decoderUtf16le003, testing::ext::TestSize.Level0)
|
||||
}
|
||||
std::u16string tempU16str02 =
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> {}.from_bytes(tempStr01);
|
||||
ASSERT_EQ(0xFEFF, (int)tempU16str02[0]);
|
||||
ASSERT_EQ(0x61, (int)tempU16str02[1]);
|
||||
ASSERT_EQ(0x62, (int)tempU16str02[2]);
|
||||
ASSERT_EQ(0x63, (int)tempU16str02[3]);
|
||||
ASSERT_EQ(0xFEFF, static_cast<int>(tempU16str02[0]));
|
||||
ASSERT_EQ(0x61, static_cast<int>(tempU16str02[1]));
|
||||
ASSERT_EQ(0x62, static_cast<int>(tempU16str02[2]));
|
||||
ASSERT_EQ(0x63, static_cast<int>(tempU16str02[3]));
|
||||
if (ch != nullptr) {
|
||||
delete []ch;
|
||||
ch = nullptr;
|
||||
@ -1431,10 +1431,10 @@ HWTEST_F(NativeEngineTest, decoderUtf16le004, testing::ext::TestSize.Level0)
|
||||
}
|
||||
std::u16string tempU16str02 =
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> {}.from_bytes(tempStr01);
|
||||
ASSERT_EQ(0xFEFF, (int)tempU16str02[0]);
|
||||
ASSERT_EQ(0x61, (int)tempU16str02[1]);
|
||||
ASSERT_EQ(0x62, (int)tempU16str02[2]);
|
||||
ASSERT_EQ(0x63, (int)tempU16str02[3]);
|
||||
ASSERT_EQ(0xFEFF, static_cast<int>(tempU16str02[0]));
|
||||
ASSERT_EQ(0x61, static_cast<int>(tempU16str02[1]));
|
||||
ASSERT_EQ(0x62, static_cast<int>(tempU16str02[2]));
|
||||
ASSERT_EQ(0x63, static_cast<int>(tempU16str02[3]));
|
||||
if (ch != nullptr) {
|
||||
delete []ch;
|
||||
ch = nullptr;
|
||||
@ -1522,10 +1522,10 @@ HWTEST_F(NativeEngineTest, decoderUtf16be002, testing::ext::TestSize.Level0)
|
||||
}
|
||||
std::u16string tempU16str02 =
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> {}.from_bytes(tempStr01);
|
||||
ASSERT_EQ(0xFEFF, (int)tempU16str02[0]);
|
||||
ASSERT_EQ(0x61, (int)tempU16str02[1]);
|
||||
ASSERT_EQ(0x62, (int)tempU16str02[2]);
|
||||
ASSERT_EQ(0x63, (int)tempU16str02[3]);
|
||||
ASSERT_EQ(0xFEFF, static_cast<int>(tempU16str02[0]));
|
||||
ASSERT_EQ(0x61, static_cast<int>(tempU16str02[1]));
|
||||
ASSERT_EQ(0x62, static_cast<int>(tempU16str02[2]));
|
||||
ASSERT_EQ(0x63, static_cast<int>(tempU16str02[3]));
|
||||
if (ch != nullptr) {
|
||||
delete []ch;
|
||||
ch = nullptr;
|
||||
@ -1571,10 +1571,10 @@ HWTEST_F(NativeEngineTest, decoderUtf16be003, testing::ext::TestSize.Level0)
|
||||
}
|
||||
std::u16string tempU16str02 =
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> {}.from_bytes(tempStr01);
|
||||
ASSERT_EQ(0xFEFF, (int)tempU16str02[0]);
|
||||
ASSERT_EQ(0x61, (int)tempU16str02[1]);
|
||||
ASSERT_EQ(0x62, (int)tempU16str02[2]);
|
||||
ASSERT_EQ(0x63, (int)tempU16str02[3]);
|
||||
ASSERT_EQ(0xFEFF, static_cast<int>(tempU16str02[0]));
|
||||
ASSERT_EQ(0x61, static_cast<int>(tempU16str02[1]));
|
||||
ASSERT_EQ(0x62, static_cast<int>(tempU16str02[2]));
|
||||
ASSERT_EQ(0x63, static_cast<int>(tempU16str02[3]));
|
||||
if (ch != nullptr) {
|
||||
delete []ch;
|
||||
ch = nullptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user