modify signed to unsigned

Signed-off-by: wangpeng <wangpeng477@huawei.com>
This commit is contained in:
wangpggg 2024-07-26 16:22:39 +08:00
parent b7857f76d3
commit b2dae5d474
19 changed files with 91 additions and 91 deletions

View File

@ -705,7 +705,7 @@ int FileAccessExtProxy::Query(const Uri &uri, std::vector<std::string> &columns,
HILOG_ERROR("Parameter Query fail to WriteInt64 count");
return E_IPCS;
}
if (count > FILE_RESULT_TYPE.size()) {
if (static_cast<size_t>(count) > FILE_RESULT_TYPE.size()) {
HILOG_ERROR(" The number of query operations exceeds %{public}zu ", FILE_RESULT_TYPE.size());
return EINVAL;
}

View File

@ -41,10 +41,11 @@ const int UID_DEFAULT = 0;
void SetNativeToken()
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -61,7 +62,6 @@ void SetNativeToken()
tokenId |= systemAppMask;
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
shared_ptr<FileAccessHelper> GetFileAccessHelper()

View File

@ -48,10 +48,11 @@ enum {
void SetNativeToken()
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -68,7 +69,6 @@ void SetNativeToken()
tokenId |= systemAppMask;
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
bool ExternalFileAccessAccessFuzzTest(std::unique_ptr<char[]> data, size_t size)

View File

@ -48,10 +48,11 @@ enum {
void SetNativeToken()
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -68,7 +69,6 @@ void SetNativeToken()
tokenId |= systemAppMask;
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
bool ExternalFileAccessCreateFileFuzzTest(std::unique_ptr<char[]> data, size_t size)

View File

@ -48,10 +48,11 @@ enum {
void SetNativeToken()
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -68,7 +69,6 @@ void SetNativeToken()
tokenId |= systemAppMask;
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
bool ExternalFileAccessDeleteFuzzTest(std::unique_ptr<char[]> data, size_t size)

View File

@ -48,10 +48,11 @@ enum {
void SetNativeToken()
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -68,7 +69,6 @@ void SetNativeToken()
tokenId |= systemAppMask;
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
bool ExternalFileAccessGetFileInfoFromRelativePathFuzzTest(std::unique_ptr<char[]> data, size_t size)

View File

@ -48,10 +48,11 @@ enum {
void SetNativeToken()
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -68,7 +69,6 @@ void SetNativeToken()
tokenId |= systemAppMask;
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
bool ExternalFileAccessGetFileInfoFromUriFuzzTest(std::unique_ptr<char[]> data, size_t size)

View File

@ -48,10 +48,11 @@ enum {
void SetNativeToken()
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -68,7 +69,6 @@ void SetNativeToken()
tokenId |= systemAppMask;
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
bool ExternalFileAccessGetRootsFuzzTest(std::unique_ptr<char[]> data, size_t size)

View File

@ -48,10 +48,11 @@ enum {
void SetNativeToken()
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -68,7 +69,6 @@ void SetNativeToken()
tokenId |= systemAppMask;
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
bool ExternalFileAccessListFileFuzzTest(std::unique_ptr<char[]> data, size_t size)

View File

@ -48,10 +48,11 @@ enum {
void SetNativeToken()
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -68,7 +69,6 @@ void SetNativeToken()
tokenId |= systemAppMask;
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
bool ExternalFileAccessMkdirFuzzTest(std::unique_ptr<char[]> data, size_t size)

View File

@ -48,10 +48,11 @@ enum {
void SetNativeToken()
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -68,7 +69,6 @@ void SetNativeToken()
tokenId |= systemAppMask;
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
bool ExternalFileAccessMoveFuzzTest(std::unique_ptr<char[]> data, size_t size)

View File

@ -48,10 +48,11 @@ enum {
void SetNativeToken()
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -68,7 +69,6 @@ void SetNativeToken()
tokenId |= systemAppMask;
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
bool ExternalFileAccessOpenFileFuzzTest(std::unique_ptr<char[]> data, size_t size)

View File

@ -48,10 +48,11 @@ enum {
void SetNativeToken()
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -68,7 +69,6 @@ void SetNativeToken()
tokenId |= systemAppMask;
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
bool ExternalFileAccessRenameFuzzTest(std::unique_ptr<char[]> data, size_t size)

View File

@ -48,10 +48,11 @@ enum {
void SetNativeToken()
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -68,7 +69,6 @@ void SetNativeToken()
tokenId |= systemAppMask;
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
bool ExternalFileAccessScanFileFuzzTest(std::unique_ptr<char[]> data, size_t size)

View File

@ -41,10 +41,11 @@ const int UID_DEFAULT = 0;
void SetNativeToken()
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -61,7 +62,6 @@ void SetNativeToken()
tokenId |= systemAppMask;
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
shared_ptr<FileAccessHelper> GetFileAccessHelper()

View File

@ -40,10 +40,11 @@ shared_ptr<OHOS::AbilityRuntime::Context> g_context = nullptr;
static void SetNativeToken(bool isSystemApp)
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -62,7 +63,6 @@ static void SetNativeToken(bool isSystemApp)
}
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
class AbnormalFileExtensionHelperTest : public testing::Test {

View File

@ -36,10 +36,11 @@ static shared_ptr<OHOS::AbilityRuntime::Context> g_context = nullptr;
void SetNativeToken()
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -56,7 +57,6 @@ void SetNativeToken()
tokenId |= systemAppMask;
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
void FileExtensionHelperTest::SetUpTestCase()

View File

@ -56,10 +56,11 @@ shared_ptr<OHOS::AbilityRuntime::Context> g_context = nullptr;
void SetNativeToken()
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -76,7 +77,6 @@ void SetNativeToken()
tokenId |= systemAppMask;
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
void SetNativeToken(const char* processName, const char*perms[], int32_t permsNum)

View File

@ -43,10 +43,11 @@ const int UID_DEFAULT = 0;
void SetNativeToken()
{
uint64_t tokenId;
const char **perms = new const char *[3];
perms[0] = "ohos.permission.FILE_ACCESS_MANAGER";
perms[1] = "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED";
perms[2] = "ohos.permission.CONNECT_FILE_ACCESS_EXTENSION";
const char *perms[] = {
"ohos.permission.FILE_ACCESS_MANAGER",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.CONNECT_FILE_ACCESS_EXTENSION"
};
NativeTokenInfoParams infoInstance = {
.dcapsNum = 0,
.permsNum = 3,
@ -63,7 +64,6 @@ void SetNativeToken()
tokenId |= systemAppMask;
SetSelfTokenID(tokenId);
OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
delete[] perms;
}
void FileAccessHelperTest::SetUpTestCase()