Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[Core] Remove C++ static initializers. (#2355)
Browse files Browse the repository at this point in the history
  • Loading branch information
wqyfavor authored and jianhan-he committed Apr 23, 2019
1 parent 5805330 commit 992d3ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions weex_core/Source/base/core_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <string>

const std::string OS_Android = "android";
const std::string OS_iOS = "iOS";
constexpr char OS_Android[] = "android";
constexpr char OS_iOS[] = "iOS";

#endif //WEEXV8_CONSTANTSNAME_H
16 changes: 8 additions & 8 deletions weex_core/Source/core/common/view_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@

namespace WeexCore {

const std::string WX("wx");
const std::string PX("px");
const std::string UNDEFINE("undefined");
const std::string SCALE("scale");
const std::string AUTO_UNIT("auto");
const std::string NONE("none");
constexpr char WX[] = "wx";
constexpr char PX[] = "px";
constexpr char UNDEFINE[] = "undefined";
constexpr char SCALE[] = "scale";
constexpr char AUTO_UNIT[] = "auto";
constexpr char NONE[] = "none";

template<typename T>
inline std::string to_string(const T &n) {
Expand Down Expand Up @@ -108,7 +108,7 @@ namespace WeexCore {
inline float transferWx(const std::string &stringWithWXPostfix, const float &viewport) {
std::string temp = stringWithWXPostfix;
if (endWidth(stringWithWXPostfix, WX)) {
temp = stringWithWXPostfix.substr(0, stringWithWXPostfix.size() - WX.size());
temp = stringWithWXPostfix.substr(0, stringWithWXPostfix.size() - strlen(WX));
}
float f = getFloat(temp.c_str());
float density = getFloat(WXCoreEnvironment::getInstance()->GetOption(SCALE).c_str());
Expand All @@ -127,7 +127,7 @@ namespace WeexCore {
if (endWidth(src, WX)) {
ret = getFloat(transferWx(src, viewport), viewport, round_off_deviation);
} else if (endWidth(src, PX)) {
ret = getFloat(src.substr(0, src.size() - PX.size()), viewport, round_off_deviation);
ret = getFloat(src.substr(0, src.size() - strlen(PX)), viewport, round_off_deviation);
} else {
ret = getFloat(src, viewport, round_off_deviation);
}
Expand Down

0 comments on commit 992d3ee

Please sign in to comment.