fix codedex

Signed-off-by: andrewhw <zhangzhao62@huawei.com>
This commit is contained in:
andrewhw 2022-03-14 11:36:38 +08:00
parent 0f8b2f6544
commit 3a299fbd0c
6 changed files with 18 additions and 23 deletions

View File

@ -15,7 +15,6 @@
#include "buffer_queue_producer.h" #include "buffer_queue_producer.h"
#include <cassert>
#include <mutex> #include <mutex>
#include <set> #include <set>
@ -132,13 +131,13 @@ int BufferQueueProducer::FlushBufferRemote(MessageParcel &arguments, MessageParc
int32_t BufferQueueProducer::AttachBufferRemote(MessageParcel &arguments, MessageParcel &reply, MessageOption &option) int32_t BufferQueueProducer::AttachBufferRemote(MessageParcel &arguments, MessageParcel &reply, MessageOption &option)
{ {
assert(!"not support remote"); BLOGNE("BufferQueueProducer::AttachBufferRemote not support remote");
return 0; return 0;
} }
int32_t BufferQueueProducer::DetachBufferRemote(MessageParcel &arguments, MessageParcel &reply, MessageOption &option) int32_t BufferQueueProducer::DetachBufferRemote(MessageParcel &arguments, MessageParcel &reply, MessageOption &option)
{ {
assert(!"not support remote"); BLOGNE("BufferQueueProducer::DetachBufferRemote not support remote");
return 0; return 0;
} }
@ -200,7 +199,7 @@ int BufferQueueProducer::CleanCacheRemote(MessageParcel &arguments, MessageParce
int32_t BufferQueueProducer::RegisterReleaseListenerRemote(MessageParcel &arguments, int32_t BufferQueueProducer::RegisterReleaseListenerRemote(MessageParcel &arguments,
MessageParcel &reply, MessageOption &option) MessageParcel &reply, MessageOption &option)
{ {
assert(!"not support remote"); BLOGNE("BufferQueueProducer::RegisterReleaseListenerRemote not support remote");
return 0; return 0;
} }

View File

@ -68,11 +68,8 @@ napi_value AssertFailedPromise(napi_env env, const char *fmt, ...)
auto &errormsg = param->errormsg; auto &errormsg = param->errormsg;
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
int ret = vsnprintf_s(errormsg, sizeof(errormsg), sizeof(errormsg) - 1, fmt, ap); (void)vsnprintf_s(errormsg, sizeof(errormsg), sizeof(errormsg) - 1, fmt, ap);
va_end(ap); va_end(ap);
if (ret < 0) {
return CreateError(env, "failed to prepare msg");
}
GNAPI_LOG("AssertFailedPromise %{public}s", errormsg); GNAPI_LOG("AssertFailedPromise %{public}s", errormsg);
return CreatePromise<AssertFailedParam>(env, __PRETTY_FUNCTION__, AssertFailedAsync, AssertFailedResolve, param); return CreatePromise<AssertFailedParam>(env, __PRETTY_FUNCTION__, AssertFailedAsync, AssertFailedResolve, param);
} }
@ -82,11 +79,8 @@ napi_value CreateError(napi_env env, const char *fmt, ...)
char errormsg[0x100]; char errormsg[0x100];
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
int ret = vsnprintf_s(errormsg, sizeof(errormsg), sizeof(errormsg) - 1, fmt, ap); (void)vsnprintf_s(errormsg, sizeof(errormsg), sizeof(errormsg) - 1, fmt, ap);
va_end(ap); va_end(ap);
if (ret < 0) {
return CreateError(env, "failed to prepare msg");
}
GNAPI_LOG("CreateError %{public}s", errormsg); GNAPI_LOG("CreateError %{public}s", errormsg);
napi_value msg; napi_value msg;

View File

@ -459,7 +459,7 @@ bool ConvertYUV420SPToRGBA(std::vector<uint8_t>& rgbaBuf, const sptr<OHOS::Surfa
} }
uint8_t* ybase = src; uint8_t* ybase = src;
uint8_t* ubase = &src[bufferWidth*bufferHeight]; uint8_t* ubase = &src[bufferWidth*bufferHeight];
int rgb[3] = {0, 0, 0}; int rgb[3] = {0, 0, 0};
int idx = 0; int idx = 0;
int rdif = 0; int rdif = 0;

View File

@ -16,7 +16,6 @@
#ifndef UTILS_OPTION_PARSER_EXPORT_OPTION_PARSER_H #ifndef UTILS_OPTION_PARSER_EXPORT_OPTION_PARSER_H
#define UTILS_OPTION_PARSER_EXPORT_OPTION_PARSER_H #define UTILS_OPTION_PARSER_EXPORT_OPTION_PARSER_H
#include <cassert>
#include <list> #include <list>
#include <string> #include <string>
#include <vector> #include <vector>
@ -29,7 +28,6 @@ public:
template<typename T> template<typename T>
int32_t AddOption(const std::string &shortOpt, const std::string &longOpt, T &result) int32_t AddOption(const std::string &shortOpt, const std::string &longOpt, T &result)
{ {
assert(!"not support");
return 0; return 0;
} }
@ -72,7 +70,6 @@ public:
template<typename T> template<typename T>
int32_t AddArguments(T &result) int32_t AddArguments(T &result)
{ {
assert(!"not support");
return 0; return 0;
} }

View File

@ -112,7 +112,6 @@ int32_t OptionParser::ParseShortOption(const char *arg1, const char *arg2)
ss >> option.result->str; ss >> option.result->str;
break; break;
default: default:
assert(!"no way");
break; break;
} }
@ -190,7 +189,6 @@ int32_t OptionParser::ParseLongOption(const char *arg1, const char *arg2)
ss >> option.result->str; ss >> option.result->str;
break; break;
default: default:
assert(!"no way");
break; break;
} }

View File

@ -15,7 +15,6 @@
#include "raw_maker.h" #include "raw_maker.h"
#include <cassert>
#include <cerrno> #include <cerrno>
#include <string> #include <string>
@ -33,7 +32,9 @@ void RawMaker::SetFilename(const std::string &filename)
if (firstFrame) { if (firstFrame) {
this->filename = filename; this->filename = filename;
} }
assert(this->height == height); if (this->filename != filename) {
GSLOG2HI(ERROR) << "RawMaker::SetFilename now filename is different to first frame filename";
}
} }
void RawMaker::SetWidth(uint32_t width) void RawMaker::SetWidth(uint32_t width)
@ -41,7 +42,9 @@ void RawMaker::SetWidth(uint32_t width)
if (firstFrame) { if (firstFrame) {
this->width = width; this->width = width;
} }
assert(this->width == width); if (this->width != width) {
GSLOG2HI(ERROR) << "RawMaker::SetWidth now width is different to first frame width";
}
size = static_cast<int32_t>(width * height * 0x4); size = static_cast<int32_t>(width * height * 0x4);
} }
@ -50,14 +53,18 @@ void RawMaker::SetHeight(uint32_t height)
if (firstFrame) { if (firstFrame) {
this->height = height; this->height = height;
} }
assert(this->height == height); if (this->height != height) {
GSLOG2HI(ERROR) << "RawMaker::SetHeight now height is different to first frame height";
}
size = static_cast<int32_t>(width * height * 0x4); size = static_cast<int32_t>(width * height * 0x4);
} }
void RawMaker::SetHeaderType(RawHeaderType type) void RawMaker::SetHeaderType(RawHeaderType type)
{ {
this->type = type; this->type = type;
assert(type != RAW_HEADER_TYPE_NONE); if (type != RAW_HEADER_TYPE_NONE) {
GSLOG2HI(ERROR) << "RawMaker::SetHeaderType now type is not RAW_HEADER_TYPE_NONE";
}
} }
int32_t RawMaker::WriteNextData(const uint8_t *addr) int32_t RawMaker::WriteNextData(const uint8_t *addr)