Skip to content

Commit

Permalink
fix(ios): eliminate all warnings and open treat_warning_as_error
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwcg committed Jul 8, 2024
1 parent d5335a0 commit 11356f1
Show file tree
Hide file tree
Showing 26 changed files with 140 additions and 78 deletions.
12 changes: 6 additions & 6 deletions devtools/devtools-backend/include/module/domain/base_domain.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class BaseDomain {

/**
* @brief handle domain.enable and domain.disable switch
* @param id
* @param method
* @param id frontend id
* @param method event name
* @return if switch enable or disable return true, else return false
*/
bool HandleDomainSwitchEvent(int32_t id, const std::string& method);
Expand All @@ -77,15 +77,15 @@ class BaseDomain {

/**
* @brief handle domain.method fail response
* @param id
* @param error_code
* @param error_msg
* @param id frontend id
* @param error_code error code
* @param error_msg error msg
*/
void ResponseErrorToFrontend(int32_t id, const int32_t error_code, const std::string& error_msg);

/**
* @brief send event to frontend
* @param inspect event that need to implement ToJsonString
* @param event event that need to implement ToJsonString
*/
void SendEventToFrontend(InspectEvent&& event);

Expand Down
2 changes: 1 addition & 1 deletion devtools/devtools-backend/include/module/domain_dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class DomainDispatch : public std::enable_shared_from_this<DomainDispatch> {

/**
* @brief receive msg from frontend
* @param params passing from frontend
* @param data passing from frontend
*/
bool ReceiveDataFromFrontend(const std::string& data);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class TdfParseJsonUtil {
public:
/**
* @brief get the corresponding key value from the Json structure
* @tparam T
* @param json Json data
* @param key the key that needs to be retrieved
* @param default_value default value if no key exists
Expand Down
2 changes: 1 addition & 1 deletion devtools/devtools-backend/include/tunnel/net_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class NetChannel {

/**
* @brief send data to frontend
* @param rsp_data
* @param rsp_data string
*/
virtual void Send(const std::string &rsp_data) = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wunknown-warning-option"
#pragma clang diagnostic ignored "-Wextra"
#pragma clang diagnostic ignored "-Wdocumentation"
#define ASIO_STANDALONE
#include "asio.hpp"
#include "websocketpp/client.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#include "module/domain_register.h"

namespace hippy::devtools {
#if defined(JS_V8) && !defined(V8_WITHOUT_INSPECTOR)
constexpr const char kCmdChromeSocketClose[] = "chrome_socket_closed";
#endif

std::string TdfRuntimeDomain::GetDomainName() { return kFrontendKeyDomainNameTDFRuntime; }

Expand Down
30 changes: 25 additions & 5 deletions devtools/devtools-backend/src/tunnel/tcp/socket.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*
* Tencent is pleased to support the open source community by making
* Hippy available.
*
* Copyright (C) 2017-2019 THL A29 Limited, a Tencent company.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* socket.c
*
Expand Down Expand Up @@ -235,7 +255,7 @@ int socket_connect_unix(const char *filename) {

struct timeval timeout;
timeout.tv_sec = CONNECT_TIMEOUT / 1000;
timeout.tv_usec = (CONNECT_TIMEOUT - (timeout.tv_sec * 1000)) * 1000;
timeout.tv_usec = (int32_t)(CONNECT_TIMEOUT - (timeout.tv_sec * 1000)) * 1000;
if (select(sfd + 1, NULL, &fds, NULL, &timeout) == 1) {
int so_error;
socklen_t len = sizeof(so_error);
Expand Down Expand Up @@ -392,7 +412,7 @@ int socket_connect_addr(struct sockaddr *addr, uint16_t port) {

struct timeval timeout;
timeout.tv_sec = CONNECT_TIMEOUT / 1000;
timeout.tv_usec = (CONNECT_TIMEOUT - (timeout.tv_sec * 1000)) * 1000;
timeout.tv_usec = (int32_t)(CONNECT_TIMEOUT - (timeout.tv_sec * 1000)) * 1000;
if (select(sfd + 1, NULL, &fds, NULL, &timeout) == 1) {
int so_error;
socklen_t len = sizeof(so_error);
Expand Down Expand Up @@ -472,7 +492,7 @@ int socket_connect(const char *addr, uint16_t port) {
hints.ai_flags = 0;
hints.ai_protocol = IPPROTO_TCP;

sprintf(portstr, "%d", port);
snprintf(portstr, sizeof(portstr), "%d", port);

res = getaddrinfo(addr, portstr, &hints, &result);
if (res != 0) {
Expand Down Expand Up @@ -524,7 +544,7 @@ int socket_connect(const char *addr, uint16_t port) {

struct timeval timeout;
timeout.tv_sec = CONNECT_TIMEOUT / 1000;
timeout.tv_usec = (CONNECT_TIMEOUT - (timeout.tv_sec * 1000)) * 1000;
timeout.tv_usec = (int32_t)(CONNECT_TIMEOUT - (timeout.tv_sec * 1000)) * 1000;
if (select(sfd + 1, NULL, &fds, NULL, &timeout) == 1) {
int so_error;
socklen_t len = sizeof(so_error);
Expand Down Expand Up @@ -584,7 +604,7 @@ int socket_check_fd(int fd, fd_mode fdm, unsigned int timeout) {
do {
if (timeout > 0) {
to.tv_sec = (time_t) (timeout / 1000);
to.tv_usec = (time_t) ((timeout - static_cast<unsigned long>(to.tv_sec) * 1000) * 1000);
to.tv_usec = (int32_t)((timeout - static_cast<unsigned long>(to.tv_sec) * 1000) * 1000);
pto = &to;
} else {
pto = NULL;
Expand Down
8 changes: 4 additions & 4 deletions dom/include/dom/layout_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ class LayoutNode {

/**
* @brief 插入子节点
* @param child
* @param index
* @param child LayoutNode ptr
* @param index int32
*/
virtual void InsertChild(std::shared_ptr<LayoutNode> child, uint32_t index) = 0;

/**
* @brief 删除子节点
* @param child
* @param child LayoutNode ptr
*/
virtual void RemoveChild(const std::shared_ptr<LayoutNode> child) = 0;

Expand All @@ -117,7 +117,7 @@ class LayoutNode {

/**
* @brief 设置属性
* @param style_map 属性的map
* @param style_update 属性的map
*/
virtual void SetLayoutStyles(
const std::unordered_map<std::string, std::shared_ptr<footstone::value::HippyValue>>& style_update,
Expand Down
56 changes: 27 additions & 29 deletions dom/include/dom/taitank_layout_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class TaitankLayoutNode : public LayoutNode, public std::enable_shared_from_this

/**
* @brief 设置 Taitank Layout 的属性
* @param style_map 属性的map
* @param style_update 属性的map
*/
void SetLayoutStyles(
const std::unordered_map<std::string, std::shared_ptr<footstone::value::HippyValue>>& style_update,
Expand All @@ -69,7 +69,7 @@ class TaitankLayoutNode : public LayoutNode, public std::enable_shared_from_this

/**
* @brief 设置 position 属性
* @param css_direction(EdgeLeft|EdgeTop|EdgeRight|EdgeBottom|EdgeStart|EdgeEnd)
* @param edge (EdgeLeft|EdgeTop|EdgeRight|EdgeBottom|EdgeStart|EdgeEnd)
* @param position 位置
*/
void SetPosition(Edge edge, float position) override;
Expand Down Expand Up @@ -126,21 +126,21 @@ class TaitankLayoutNode : public LayoutNode, public std::enable_shared_from_this

/**
* @brief 获取 margin 属性
* @param edge
* @param edge Edge
* @return left 属性
*/
float GetMargin(Edge edge) override;

/**
* @brief 获取 padding 属性
* @param edge
* @param edge Edge
* @return padding 属性
*/
float GetPadding(Edge edge) override;

/**
* @brief 获取 border 属性
* @param edge
* @param edge Edge
* @return border 属性
*/
float GetBorder(Edge edge) override;
Expand All @@ -159,7 +159,6 @@ class TaitankLayoutNode : public LayoutNode, public std::enable_shared_from_this

/**
* @brief 是否 overflow
* @param overflow
* @return border 属性
*/
bool LayoutHadOverflow();
Expand All @@ -172,14 +171,14 @@ class TaitankLayoutNode : public LayoutNode, public std::enable_shared_from_this

/**
* @brief 插入子节点
* @param child
* @param index
* @param child LayoutNode ptr
* @param index uint32
*/
void InsertChild(std::shared_ptr<LayoutNode> child, uint32_t index) override;

/**
* @brief 删除子节点
* @param child
* @param child LayoutNode ptr
*/
void RemoveChild(const std::shared_ptr<LayoutNode> child) override;

Expand All @@ -191,7 +190,7 @@ class TaitankLayoutNode : public LayoutNode, public std::enable_shared_from_this

/**
* @brief 设置 has new layout 属性
* @param has_new_layout
* @param has_new_layout bool
*/
void SetHasNewLayout(bool has_new_layout) override;

Expand Down Expand Up @@ -257,7 +256,7 @@ class TaitankLayoutNode : public LayoutNode, public std::enable_shared_from_this

/**
* @brief 设置 flex basis 属性
* @param flex basis
* @param flex_basis flex basis
*/
void SetFlexBasis(float flex_basis);

Expand All @@ -269,59 +268,59 @@ class TaitankLayoutNode : public LayoutNode, public std::enable_shared_from_this

/**
* @brief 设置 flex grow属性
* @param flex grow
* @param flex_grow flex grow
*/
void SetFlexGrow(float flex_grow);

/**
* @brief 设置 flex shrink属性
* @param flex shrink
* @param flex_shrink flex shrink
*/
void SetFlexShrink(float flex_shrink);

/**
* @brief 设置 flex direction 属性
* @param flex direction (FLexDirectionRow|FLexDirectionRowReverse|FLexDirectionColumn|FLexDirectionColumnReverse)
* @param flex_direction (FLexDirectionRow|FLexDirectionRowReverse|FLexDirectionColumn|FLexDirectionColumnReverse)
*/
void SetFlexDirection(FlexDirection flex_direction);

/**
* @brief 设置 position type 属性
* @param position_type(PositionTypeRelative|PositionTypeAbsolute)
* @param position_type (PositionTypeRelative|PositionTypeAbsolute)
*/
void SetPositionType(PositionType position_type);

/**
* @brief 设置 position 属性
* @param css_direction(CSSLeft|CSSTop|CSSRight|CSSBottom|CSSStart|CSSEnd)
* @param position
* @param css_direction (CSSLeft|CSSTop|CSSRight|CSSBottom|CSSStart|CSSEnd)
* @param position float
*/
void SetPosition(CSSDirection css_direction, float position);

/**
* @brief 设置 margin 属性
* @param css_direction
* @param margin
* @param css_direction CSSDirection
* @param margin float
*/
void SetMargin(CSSDirection css_direction, float margin);

/**
* @brief 设置 margin auto属性
* @param css_direction
* @param css_direction CSSDirection
*/
void SetMarginAuto(CSSDirection css_direction);

/**
* @brief 设置 padding 属性
* @param css_direction
* @param padding
* @param css_direction CSSDirection
* @param padding float
*/
void SetPadding(CSSDirection css_direction, float padding);

/**
* @brief 设置 border 属性
* @param css_direction
* @param border
* @param css_direction CSSDirection
* @param border float
*/
void SetBorder(CSSDirection css_direction, float border);

Expand All @@ -333,25 +332,25 @@ class TaitankLayoutNode : public LayoutNode, public std::enable_shared_from_this

/**
* @brief 设置 justify content 属性
* @param justify
* @param justify FlexAlign
*/
void SetJustifyContent(FlexAlign justify);

/**
* @brief 设置 align content 属性
* @param align_content
* @param align_content FlexAlign
*/
void SetAlignContent(FlexAlign align_content);

/**
* @brief 设置 align items 属性
* @param align_items
* @param align_items FlexAlign
*/
void SetAlignItems(FlexAlign align_items);

/**
* @brief 设置 align self 属性
* @param align_self
* @param align_self FlexAlign
*/
void SetAlignSelf(FlexAlign align_self);

Expand All @@ -375,7 +374,6 @@ class TaitankLayoutNode : public LayoutNode, public std::enable_shared_from_this

/**
* @brief 分配节点
* @param overflow_type (OverflowVisible|OverflowHidden|OverflowScroll)
*/
void Allocate();

Expand Down
7 changes: 3 additions & 4 deletions driver/js/src/napi/jsc/jsc_ctx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/

#include "driver/napi/jsc/jsc_ctx.h"

#include "footstone/logging.h"
#include "footstone/string_view_utils.h"
#include "driver/napi/jsc/jsc_ctx_value.h"
Expand All @@ -41,11 +40,12 @@ using JSCVM = hippy::vm::JSCVM;

constexpr char16_t kFunctionName[] = u"Function";
constexpr char16_t kDefinePropertyStr[] = u"defineProperty";
constexpr char16_t kPrototypeStr[] = u"prototype";
constexpr char16_t kObjectStr[] = u"Object";
constexpr char16_t kGetStr[] = u"get";
constexpr char16_t kSetStr[] = u"set";
constexpr char16_t kSetPrototypeOfName[] = u"setPrototypeOf";
// not used:
//constexpr char16_t kPrototypeStr[] = u"prototype";
//constexpr char16_t kSetPrototypeOfName[] = u"setPrototypeOf";

static std::once_flag global_class_flag;
static JSClassRef global_class;
Expand Down Expand Up @@ -1112,7 +1112,6 @@ std::shared_ptr<CtxValue> JSCCtx::GetProperty(const std::shared_ptr<CtxValue>& o
}
JSValueRef prop_ref = JSObjectGetProperty(context_, obj_ref, key_str_ref, &exception);
if (JSValueIsNull(context_, prop_ref) || JSValueIsUndefined(context_, prop_ref)) {
auto xxx = JSObjectGetPrototype(context_, obj_ref);
return nullptr;
}
JSStringRelease(key_str_ref);
Expand Down
Loading

0 comments on commit 11356f1

Please sign in to comment.