mirror of
https://gitee.com/openharmony/appexecfwk_standard
synced 2024-11-23 13:09:48 +00:00
fix codex
Signed-off-by: longwei <longwei27@huawei.com> Change-Id: Ifbcbe031ce8ef5a0debcd193269793e46da026df
This commit is contained in:
parent
3c868cedc7
commit
1d89eb7a9f
@ -103,7 +103,7 @@ struct ApplicationInfo : public Parcelable {
|
||||
std::string versionName;
|
||||
int32_t minCompatibleVersionCode = 0;
|
||||
|
||||
int32_t apiCompatibleVersion = 0;
|
||||
uint32_t apiCompatibleVersion = 0;
|
||||
int32_t apiTargetVersion = 0;
|
||||
|
||||
std::string iconPath;
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
* @return Returns true if the application is successfully obtained; returns false otherwise.
|
||||
*/
|
||||
virtual bool GetApplicationInfos(
|
||||
const ApplicationFlag flag, const int userId, std::vector<ApplicationInfo> &appInfos) = 0;
|
||||
const ApplicationFlag flag, int userId, std::vector<ApplicationInfo> &appInfos) = 0;
|
||||
/**
|
||||
* @brief Obtains information about all installed applications of a specified user.
|
||||
* @param flags Indicates the flag used to specify information contained
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
* @return Returns true if the application is successfully obtained; returns false otherwise.
|
||||
*/
|
||||
virtual bool GetApplicationInfos(
|
||||
const ApplicationFlag flag, const int userId, std::vector<ApplicationInfo> &appInfos) override;
|
||||
const ApplicationFlag flag, int userId, std::vector<ApplicationInfo> &appInfos) override;
|
||||
/**
|
||||
* @brief Obtains information about all installed applications of a specified user through the proxy object.
|
||||
* @param flags Indicates the flag used to specify information contained
|
||||
|
@ -107,7 +107,7 @@ bool BundleMgrProxy::GetApplicationInfo(
|
||||
}
|
||||
|
||||
bool BundleMgrProxy::GetApplicationInfos(
|
||||
const ApplicationFlag flag, const int userId, std::vector<ApplicationInfo> &appInfos)
|
||||
const ApplicationFlag flag, int userId, std::vector<ApplicationInfo> &appInfos)
|
||||
{
|
||||
BYTRACE_NAME(BYTRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||
APP_LOGD("begin to get GetApplicationInfos of specific userId id %{private}d", userId);
|
||||
|
@ -47,7 +47,7 @@ void BundleStatusCallback::OnBundleAdded(const std::string& bundleName, const in
|
||||
loop, work, [](uv_work_t* work) {},
|
||||
[](uv_work_t* work, int status) {
|
||||
// JS Thread
|
||||
AsyncCallbackInfo* asyncCallbackInfo = (AsyncCallbackInfo*)work->data;
|
||||
AsyncCallbackInfo* asyncCallbackInfo = reinterpret_cast<AsyncCallbackInfo*>(work->data);
|
||||
napi_value callback = nullptr;
|
||||
napi_value placeHolder = nullptr;
|
||||
napi_value result[2] = { 0 };
|
||||
@ -92,7 +92,7 @@ void BundleStatusCallback::OnBundleUpdated(const std::string& bundleName, const
|
||||
loop, work, [](uv_work_t* work) {},
|
||||
[](uv_work_t* work, int status) {
|
||||
// JS Thread
|
||||
AsyncCallbackInfo* asyncCallbackInfo = (AsyncCallbackInfo*)work->data;
|
||||
AsyncCallbackInfo* asyncCallbackInfo = reinterpret_cast<AsyncCallbackInfo*>(work->data);
|
||||
napi_value callback = nullptr;
|
||||
napi_value placeHolder = nullptr;
|
||||
napi_value result[2] = { 0 };
|
||||
@ -137,7 +137,7 @@ void BundleStatusCallback::OnBundleRemoved(const std::string& bundleName, const
|
||||
loop, work, [](uv_work_t* work) {},
|
||||
[](uv_work_t* work, int status) {
|
||||
// JS Thread
|
||||
AsyncCallbackInfo* asyncCallbackInfo = (AsyncCallbackInfo*)work->data;
|
||||
AsyncCallbackInfo* asyncCallbackInfo = reinterpret_cast<AsyncCallbackInfo*>(work->data);
|
||||
napi_value callback = nullptr;
|
||||
napi_value placeHolder = nullptr;
|
||||
napi_value result[2] = { 0 };
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
std::atomic_int g_installedHapNum = 0;
|
||||
std::atomic_uint g_installedHapNum = 0;
|
||||
|
||||
class UserReceiverImpl : public StatusReceiverHost {
|
||||
public:
|
||||
|
@ -421,7 +421,7 @@ bool ZipFile::UnzipWithStore(const ZipEntry &zipEntry, const uint16_t extraSize,
|
||||
size_t readLen = (remainSize > UNZIP_BUF_OUT_LEN) ? UNZIP_BUF_OUT_LEN : remainSize;
|
||||
readBytes = fread(&(readBuffer[0]), sizeof(Byte), readLen, file_);
|
||||
if (readBytes == 0) {
|
||||
APP_LOGE("unzip store read failed, error: %{public}d", errno);
|
||||
APP_LOGE("unzip store read failed, error: %{public}d", ferror(file_));
|
||||
return false;
|
||||
}
|
||||
remainSize -= readBytes;
|
||||
@ -469,7 +469,7 @@ bool ZipFile::ReadZStream(const BytePtr &buffer, z_stream &zstream, uint32_t &re
|
||||
size_t remainBytes = (remainCompressedSize > UNZIP_BUF_IN_LEN) ? UNZIP_BUF_IN_LEN : remainCompressedSize;
|
||||
readBytes = fread(buffer, sizeof(Byte), remainBytes, file_);
|
||||
if (readBytes == 0) {
|
||||
APP_LOGE("unzip inflated read failed, error: %{public}d", errno);
|
||||
APP_LOGE("unzip inflated read failed, error: %{public}d", ferror(file_));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
int32_t EncodeJPGFile(std::shared_ptr<ImageBuffer>& imageBuffer);
|
||||
int32_t ResizeRGBImage(std::shared_ptr<ImageBuffer>& imageBufferIn, std::shared_ptr<ImageBuffer>& imageBufferOut);
|
||||
std::shared_ptr<ImageBuffer> CompressImage(std::string inFileName);
|
||||
void ReleasePngPointer(png_bytep* p, uint32_t h);
|
||||
bool DoubleEqual(double left, double right);
|
||||
bool IsPathValid(std::string& fileName);
|
||||
static void PngToBuffer(png_structp png_ptr, png_bytep data, png_size_t lenght);
|
||||
|
@ -42,10 +42,18 @@ namespace {
|
||||
const std::string JPEG = "jpeg";
|
||||
struct EncodeMemo {
|
||||
ImageRow buffer;
|
||||
int32_t size;
|
||||
uint32_t size;
|
||||
};
|
||||
}
|
||||
|
||||
void ImageCompress::ReleasePngPointer(png_bytep* rowPointers, uint32_t h)
|
||||
{
|
||||
for (uint32_t i = 0; i < h; ++i) {
|
||||
free(rowPointers[i]);
|
||||
}
|
||||
free(rowPointers);
|
||||
}
|
||||
|
||||
bool ImageCompress::IsPathValid(std::string& fileName)
|
||||
{
|
||||
return access(fileName.c_str(), F_OK) == 0;
|
||||
@ -126,7 +134,6 @@ bool ImageCompress::InitPngFile(std::shared_ptr<ImageBuffer>& imageBuffer,
|
||||
imageBuffer->SetColorType(png_get_color_type(png, info));
|
||||
imageBuffer->SetBitDepth(png_get_bit_depth(png, info));
|
||||
imageBuffer->SetPngComponents(png_get_channels(png, info));
|
||||
|
||||
if (imageBuffer->GetBitDepth() == BITDEPTH_SIXTHEN) {
|
||||
png_set_strip_16(png);
|
||||
}
|
||||
@ -160,14 +167,12 @@ bool ImageCompress::InitPngFile(std::shared_ptr<ImageBuffer>& imageBuffer,
|
||||
ImageRow imageRow = imageBuffer->GetImageDataPointer().get();
|
||||
for (uint32_t h = 0; h < imageBuffer->GetHeight(); ++h) {
|
||||
if (memcpy_s(imageRow, strides, rowPointers[h], strides) != EOK) {
|
||||
ReleasePngPointer(rowPointers, imageBuffer->GetHeight());
|
||||
return false;
|
||||
}
|
||||
imageRow += strides;
|
||||
}
|
||||
for (uint32_t h = 0; h < imageBuffer->GetHeight(); ++h) {
|
||||
free(rowPointers[h]);
|
||||
}
|
||||
free(rowPointers);
|
||||
ReleasePngPointer(rowPointers, imageBuffer->GetHeight());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -210,6 +215,11 @@ int ImageCompress::DecodePngFile(std::string fileName, std::shared_ptr<ImageBuff
|
||||
png_read_info(png, info);
|
||||
|
||||
if (!InitPngFile(imageBuffer, png, info)) {
|
||||
if (fclose(inFile) != EOK) {
|
||||
APP_LOGE("ImageCompress: fclose file %{public}s error", fileName.c_str());
|
||||
return -1;
|
||||
}
|
||||
png_destroy_read_struct(&png, &info, NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -255,6 +265,7 @@ int32_t ImageCompress::EncodePngFile(std::shared_ptr<ImageBuffer>& imageBuffer)
|
||||
memo.buffer = (ImageRow)malloc(FILE_MAX_SIZE * RGBA_COMPONENTS);
|
||||
memo.size = 0;
|
||||
if (!imageBuffer->GetImageDataPointer()) {
|
||||
free(memo.buffer);
|
||||
APP_LOGE("ImageCompress: EncodePngFile should input image buffer");
|
||||
return -1;
|
||||
}
|
||||
|
@ -165,9 +165,9 @@ void FilePath::StripTrailingSeparatorsInternal()
|
||||
if (path_.size() == 0) {
|
||||
return;
|
||||
}
|
||||
int one = 1;
|
||||
int two = 2;
|
||||
int start = 1;
|
||||
uint32_t one = 1;
|
||||
uint32_t two = 2;
|
||||
uint32_t start = 1;
|
||||
std::string::size_type lastStripped = std::string::npos;
|
||||
for (std::string::size_type pos = path_.length(); pos > start && FilePath::IsSeparator(path_[pos - one]); --pos) {
|
||||
if (pos != start + one || lastStripped == start + two || !FilePath::IsSeparator(path_[start - one])) {
|
||||
|
@ -158,7 +158,7 @@ uLong ReadZipBuffer(void *opaque, void *, void *buf, uLong size)
|
||||
// because this implementation is only for reading compressed data.
|
||||
uLong WriteZipBuffer(void *opaque, void *stream, const void *buf, uLong)
|
||||
{
|
||||
APP_LOGI("%{public}s called. opaque=%p, stream=%p, buf=%p", __func__, opaque, stream, buf);
|
||||
APP_LOGI("WriteZipBuffer opaque=%p, stream=%p, buf=%p", opaque, stream, buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user