Skip to content

Commit

Permalink
Fix tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
dumganhar committed Jul 31, 2024
1 parent c93d69f commit 433bc5a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
10 changes: 5 additions & 5 deletions native/cocos/base/UTF8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "ConvertUTF/ConvertUTF.h"

#if CC_USE_SIMD_UTF
#include "simdutf/simdutf.cpp"
#include "simdutf/simdutf.cpp" //NOLINT
#include "simdutf/simdutf.h"
#endif

Expand Down Expand Up @@ -227,8 +227,8 @@ bool UTF8ToUTF16(const ccstd::string &utf8, std::u16string &outUtf16) { //NOLINT
}

// We need a buffer of size where to write the UTF-16LE words.
size_t expected_utf16words = simdutf::utf16_length_from_utf8(utf8.c_str(), utf8.length());
outUtf16.resize(expected_utf16words);
size_t expectedUtf16words = simdutf::utf16_length_from_utf8(utf8.c_str(), utf8.length());
outUtf16.resize(expectedUtf16words);

// convert to UTF-16LE
size_t utf16words = simdutf::convert_utf8_to_utf16le(utf8.c_str(), utf8.length(), outUtf16.data());
Expand Down Expand Up @@ -267,7 +267,7 @@ bool UTF32ToUTF16(const std::u32string &utf32, std::u16string &outUtf16) { //NOL
#if (CC_PLATFORM == CC_PLATFORM_ANDROID || CC_PLATFORM == CC_PLATFORM_OHOS)
ccstd::string getStringUTFCharsJNI(JNIEnv *env, jstring srcjStr, bool *ret) {
ccstd::string utf8Str;
auto *unicodeChar = static_cast<const uint16_t *>(env->GetStringChars(srcjStr, nullptr));
const auto *unicodeChar = static_cast<const uint16_t *>(env->GetStringChars(srcjStr, nullptr));
size_t unicodeCharLength = env->GetStringLength(srcjStr);
const std::u16string unicodeStr(reinterpret_cast<const char16_t *>(unicodeChar), unicodeCharLength);
bool flag = UTF16ToUTF8(unicodeStr, utf8Str);
Expand Down Expand Up @@ -342,7 +342,7 @@ void StringUTF8::replace(const ccstd::string &newStr) {
ccstd::string StringUTF8::getAsCharSequence() const {
ccstd::string charSequence;

for (auto &charUtf8 : _str) {
for (const auto &charUtf8 : _str) {
charSequence.append(charUtf8._char);
}

Expand Down
5 changes: 2 additions & 3 deletions native/cocos/bindings/jswrapper/v8/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,12 @@ void clearPrivate(v8::Isolate *isolate, ObjectWrap &wrap);

class ExternalStringResource : public v8::String::ExternalStringResource {
public:
ExternalStringResource(std::u16string &s)
explicit ExternalStringResource(std::u16string &s)
: _s(std::move(s)) {

}

~ExternalStringResource() {
}
~ExternalStringResource() override = default;

const uint16_t* data() const override {
return reinterpret_cast<const uint16_t*>(_s.data());
Expand Down
2 changes: 1 addition & 1 deletion native/cocos/bindings/manual/jsb_cocos_manual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ static bool js_readFile(se::State &s) { // NOLINT
// fullPathForFilename is not threadsafe, so don't invoke it in thread pool.
ccstd::string fullPath = cc::FileUtils::getInstance()->fullPathForFilename(path);

gIOThreadPool->pushTask([fullPath, callbackPtr](int tid) {
gIOThreadPool->pushTask([fullPath, callbackPtr](int/* tid */) {
auto *fs = cc::FileUtils::getInstance();
if (fs == nullptr) {
return;
Expand Down
1 change: 0 additions & 1 deletion native/cocos/bindings/manual/jsb_global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include "platform/interfaces/modules/ISystem.h"
#include "platform/interfaces/modules/ISystemWindow.h"
#include "ui/edit-box/EditBox.h"
#include "v8/Object.h"
#include "xxtea/xxtea.h"

#include <chrono>
Expand Down

0 comments on commit 433bc5a

Please sign in to comment.