Skip to content

Commit

Permalink
Merge branch 'main' into maxz-sb16-printfs
Browse files Browse the repository at this point in the history
Change-Id: I3c46ae6ee86bd60433ea15864bf799aa35205a63
  • Loading branch information
maxz-lab committed Dec 12, 2023
2 parents ee9f7ba + ee2f99f commit 5a40115
Show file tree
Hide file tree
Showing 90 changed files with 477 additions and 340 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/label-cherry-pick.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
REPOSITORY: ${{ github.repository }}
GITHUB_REF: ${{ github.ref }}
MERGE_COMMIT_SHA: ${{ github.event.pull_request.merge_commit_sha }}
CHERRY_PICK_BRANCH: cherry-pick-${{ matrix.target_branch }}-${{ github.event.pull_request.number }}
steps:
- name: Checkout repository
uses: kaidokert/[email protected]
Expand Down Expand Up @@ -101,7 +102,7 @@ jobs:
token: ${{ secrets.CHERRY_PICK_TOKEN }}
draft: ${{ steps.cherry-pick.outcome == 'failure' }}
base: ${{ matrix.target_branch }}
branch: "cherry-pick-${{ matrix.target_branch }}-${{ github.event.pull_request.number }}"
branch: ${{ env.CHERRY_PICK_BRANCH }}
committer: GitHub Release Automation <[email protected]>
reviewers: ${{ github.event.pull_request.user.login }}
title: "Cherry pick PR #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}"
Expand Down Expand Up @@ -129,6 +130,6 @@ jobs:
issue_number: '${{ steps.create-pr.outputs.pull-request-number }}',
owner: context.repo.owner,
repo: context.repo.repo,
body: '> [!IMPORTANT]\n> There were merge conflicts while cherry picking! Check out the PR branch (${{ matrix.target_branch }}-${{ github.event.pull_request.number }}) and fix the conflicts before proceeding. Check the log at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} for details.'
body: '> [!IMPORTANT]\n> There were merge conflicts while cherry picking! Check out [${{ env.CHERRY_PICK_BRANCH }}](${{ github.repository }}/tree/${{ env.CHERRY_PICK_BRANCH }}) and fix the conflicts before proceeding. Check the log at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} for details.'
});
}
2 changes: 2 additions & 0 deletions base/strings/string_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

#include <ctype.h>
#include <stdarg.h> // va_list
#if SB_API_VERSION >= 16
#include <stdio.h>
#endif

#include <initializer_list>
#include <string>
Expand Down
5 changes: 5 additions & 0 deletions base/strings/string_util_starboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@

namespace base {

inline int vsnprintf(char* buffer, size_t size,
const char* format, va_list arguments) {
return ::vsnprintf(buffer, size, format, arguments);
}

inline int strncmp16(const char16* s1, const char16* s2, size_t count) {
#if defined(WCHAR_T_IS_UTF16)
return wcsncmp(s1, s2, count);
Expand Down
2 changes: 1 addition & 1 deletion base/strings/stringprintf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ inline int vsnprintfT(char* buffer,
size_t buf_size,
const char* format,
va_list argptr) {
return ::vsnprintf(buffer, buf_size, format, argptr);
return base::vsnprintf(buffer, buf_size, format, argptr);
}

#if defined(OS_WIN)
Expand Down
2 changes: 1 addition & 1 deletion cobalt/browser/application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const int64_t kWatchdogTimeInterval = 10000000;
const int64_t kWatchdogTimeWait = 2000000;

bool IsStringNone(const std::string& str) {
return !base::strcasecmp(str.c_str(), "none");
return !strcasecmp(str.c_str(), "none");
}

#if defined(ENABLE_WEBDRIVER) || defined(ENABLE_DEBUGGER)
Expand Down
7 changes: 3 additions & 4 deletions cobalt/csp/source_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ bool IsSourceListNone(const char* begin, const char* end) {
const char* position = begin;
SkipWhile<IsSourceCharacter>(&position, end);
size_t len = static_cast<size_t>(position - begin);
if (base::strncasecmp("'none'", begin, len) != 0) {
if (strncasecmp("'none'", begin, len) != 0) {
return false;
}

Expand Down Expand Up @@ -400,7 +400,7 @@ bool SourceList::ParseNonce(const char* begin, const char* end,
const char* prefix = "'nonce-";

if (nonce_length <= strlen(prefix) ||
base::strncasecmp(prefix, begin, strlen(prefix)) != 0) {
strncasecmp(prefix, begin, strlen(prefix)) != 0) {
return true;
}

Expand Down Expand Up @@ -433,8 +433,7 @@ bool SourceList::ParseHash(const char* begin, const char* end,
for (size_t i = 0; i < arraysize(kSupportedPrefixes); ++i) {
const HashPrefix& algorithm = kSupportedPrefixes[i];
if (hash_length > strlen(algorithm.prefix) &&
base::strncasecmp(algorithm.prefix, begin, strlen(algorithm.prefix)) ==
0) {
strncasecmp(algorithm.prefix, begin, strlen(algorithm.prefix)) == 0) {
prefix = algorithm.prefix;
*hash_algorithm = algorithm.type;
break;
Expand Down
6 changes: 3 additions & 3 deletions cobalt/debug/console/command_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ ConsoleCommandManager::CommandHandler::~CommandHandler() {
// static
bool ConsoleCommandManager::CommandHandler::IsOnEnableOrTrue(
const std::string& message) {
return (SbStringCompareNoCase("on", message.c_str()) == 0) ||
(SbStringCompareNoCase("enable", message.c_str()) == 0) ||
(SbStringCompareNoCase("true", message.c_str()) == 0);
return (strcasecmp("on", message.c_str()) == 0) ||
(strcasecmp("enable", message.c_str()) == 0) ||
(strcasecmp("true", message.c_str()) == 0);
}


Expand Down
24 changes: 12 additions & 12 deletions cobalt/dom/document.cc
Original file line number Diff line number Diff line change
Expand Up @@ -235,26 +235,26 @@ scoped_refptr<web::Event> Document::CreateEvent(
script::ExceptionState* exception_state) {
// https://www.w3.org/TR/dom/#dom-document-createevent
// The match of interface name is case-insensitive.
if (base::strcasecmp(interface_name.c_str(), "event") == 0 ||
base::strcasecmp(interface_name.c_str(), "events") == 0 ||
base::strcasecmp(interface_name.c_str(), "htmlevents") == 0) {
if (strcasecmp(interface_name.c_str(), "event") == 0 ||
strcasecmp(interface_name.c_str(), "events") == 0 ||
strcasecmp(interface_name.c_str(), "htmlevents") == 0) {
return new web::Event(web::Event::Uninitialized);
} else if (base::strcasecmp(interface_name.c_str(), "keyboardevent") == 0 ||
base::strcasecmp(interface_name.c_str(), "keyevents") == 0) {
} else if (strcasecmp(interface_name.c_str(), "keyboardevent") == 0 ||
strcasecmp(interface_name.c_str(), "keyevents") == 0) {
return new KeyboardEvent(web::Event::Uninitialized);
} else if (base::strcasecmp(interface_name.c_str(), "messageevent") == 0) {
} else if (strcasecmp(interface_name.c_str(), "messageevent") == 0) {
return new web::MessageEvent(web::Event::Uninitialized);
} else if (base::strcasecmp(interface_name.c_str(), "mouseevent") == 0 ||
base::strcasecmp(interface_name.c_str(), "mouseevents") == 0) {
} else if (strcasecmp(interface_name.c_str(), "mouseevent") == 0 ||
strcasecmp(interface_name.c_str(), "mouseevents") == 0) {
return new MouseEvent(web::Event::Uninitialized);
} else if (base::strcasecmp(interface_name.c_str(), "uievent") == 0 ||
base::strcasecmp(interface_name.c_str(), "uievents") == 0) {
} else if (strcasecmp(interface_name.c_str(), "uievent") == 0 ||
strcasecmp(interface_name.c_str(), "uievents") == 0) {
return new UIEvent(web::Event::Uninitialized);
} else if (base::strcasecmp(interface_name.c_str(), "wheelevent") == 0) {
} else if (strcasecmp(interface_name.c_str(), "wheelevent") == 0) {
// This not in the spec, but commonly implemented to create a WheelEvent.
// https://www.w3.org/TR/2016/WD-uievents-20160804/#interface-wheelevent
return new WheelEvent(web::Event::Uninitialized);
} else if (base::strcasecmp(interface_name.c_str(), "customevent") == 0) {
} else if (strcasecmp(interface_name.c_str(), "customevent") == 0) {
return new web::CustomEvent(web::Event::Uninitialized);
}

Expand Down
Loading

0 comments on commit 5a40115

Please sign in to comment.