Skip to content

Commit

Permalink
fix(android): fix lint warnings & errors
Browse files Browse the repository at this point in the history
  • Loading branch information
medns authored and zoomchan-cxj committed Feb 9, 2022
1 parent fcf67e3 commit dc7f4d3
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 10 deletions.
1 change: 0 additions & 1 deletion android/sdk/src/main/jni/src/bridge/entry.cc
@@ -1,4 +1,3 @@
#include <__bit_reference>
/*
*
* Tencent is pleased to support the open source community by making
Expand Down
2 changes: 1 addition & 1 deletion android/sdk/src/main/jni/src/jni/java_turbo_module.cc
Expand Up @@ -71,7 +71,7 @@ std::shared_ptr<CtxValue> JavaTurboModule::InvokeJavaMethod(
// arguments count
std::vector<std::shared_ptr<CtxValue>> arg_values;
arg_values.reserve(count);
for (int i = 0; i < count; i++) {
for (size_t i = 0; i < count; i++) {
arg_values.push_back(args[i]);
}
std::string call_info = std::string(name_).append(".").append(method);
Expand Down
6 changes: 4 additions & 2 deletions core/include/core/base/string_view_utils.h
Expand Up @@ -226,7 +226,7 @@ class StringViewUtils {
inline static unicode_string_view ConstCharPointerToStrView(const char *p,
size_t len = -1) {
size_t length;
if (len == -1) {
if (len == static_cast<size_t>(-1)) {
length = strlen(p);
} else {
length = len;
Expand All @@ -241,7 +241,9 @@ class StringViewUtils {
return std::string(U8ToConstCharPointer(str.c_str()), str.length());
}

inline static size_t FindLastOf(const unicode_string_view &str_view,
static const size_t npos = -1;

inline static size_t FindLastOf(const unicode_string_view &str_view,
unicode_string_view::char8_t_ u8_ch,
char ch,
char16_t u16_ch,
Expand Down
4 changes: 2 additions & 2 deletions core/include/core/napi/js_native_api_types.h
Expand Up @@ -178,8 +178,8 @@ struct VMInitParam {};

class VM {
public:
VM(std::shared_ptr<VMInitParam> param = nullptr){};
virtual ~VM() { TDF_BASE_DLOG(INFO) << "~VM"; };
VM(std::shared_ptr<VMInitParam> param = nullptr){}
virtual ~VM() { TDF_BASE_DLOG(INFO) << "~VM"; }

virtual std::shared_ptr<Ctx> CreateContext() = 0;
};
Expand Down
2 changes: 1 addition & 1 deletion core/include/core/napi/v8/js_native_turbo_v8.h
Expand Up @@ -133,7 +133,7 @@ class V8TurboEnv : public TurboEnv {
class HostFunctionProxy : public IHostProxy {
public:
HostFunctionProxy(V8TurboEnv &v8_turbo_env, HostFunctionType func)
: func_(std::move(func)), v8_turbo_env_(v8_turbo_env){};
: func_(std::move(func)), v8_turbo_env_(v8_turbo_env){}

static void Call(HostFunctionProxy &host_function_proxy,
const v8::FunctionCallbackInfo<v8::Value> &callback_info) {
Expand Down
2 changes: 1 addition & 1 deletion core/include/core/task/common_task.h
Expand Up @@ -29,6 +29,6 @@
class CommonTask : public hippy::base::Task {
public:
void Run() override;
virtual inline bool isPriorityTask() override { return false; };
virtual inline bool isPriorityTask() override { return false; }
std::function<void()> func_;
};
2 changes: 1 addition & 1 deletion core/src/modules/contextify_module.cc
Expand Up @@ -126,7 +126,7 @@ void ContextifyModule::LoadUntrustedContent(const CallbackInfo& info) {
unicode_string_view cur_dir;
unicode_string_view file_name;
size_t pos = StringViewUtils::FindLastOf(uri, '/', '/', u'/', U'/');
if (pos != -1) {
if (pos != StringViewUtils::npos) {
cur_dir = StringViewUtils::SubStr(uri, 0, pos + 1);
size_t len = StringViewUtils::GetLength(uri);
file_name = StringViewUtils::SubStr(uri, pos + 1, len);
Expand Down
2 changes: 1 addition & 1 deletion core/src/napi/callback_info.cc
Expand Up @@ -39,7 +39,7 @@ void CallbackInfo::AddValue(const std::shared_ptr<CtxValue>& value) {
}

std::shared_ptr<CtxValue> CallbackInfo::operator[](int index) const {
if (index < 0 || index >= Length()) {
if (index < 0 || static_cast<size_t>(index) >= Length()) {
return nullptr;
}
return values_[index];
Expand Down

0 comments on commit dc7f4d3

Please sign in to comment.