chore: cleanup usages of const char* (#29906)

This commit is contained in:
David Sanders 2021-07-01 17:51:52 -07:00 коммит произвёл GitHub
Родитель f6531166ae
Коммит 95a9ff952c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
8 изменённых файлов: 18 добавлений и 19 удалений

Просмотреть файл

@ -116,7 +116,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
#ifdef _DEBUG #ifdef _DEBUG
// Don't display assert dialog boxes in CI test runs // Don't display assert dialog boxes in CI test runs
static const char* kCI = "CI"; static const char kCI[] = "CI";
if (IsEnvSet(kCI)) { if (IsEnvSet(kCI)) {
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);

Просмотреть файл

@ -70,7 +70,7 @@ namespace electron {
namespace { namespace {
const char* kRelauncherProcess = "relauncher"; const char kRelauncherProcess[] = "relauncher";
constexpr base::StringPiece kElectronDisableSandbox("ELECTRON_DISABLE_SANDBOX"); constexpr base::StringPiece kElectronDisableSandbox("ELECTRON_DISABLE_SANDBOX");
constexpr base::StringPiece kElectronEnableStackDumping( constexpr base::StringPiece kElectronEnableStackDumping(

Просмотреть файл

@ -163,7 +163,7 @@ void RegisterSchemesAsPrivileged(gin_helper::ErrorThrower thrower,
namespace { namespace {
const char* kBuiltinSchemes[] = { const char* const kBuiltinSchemes[] = {
"about", "file", "http", "https", "data", "filesystem", "about", "file", "http", "https", "data", "filesystem",
}; };

Просмотреть файл

@ -84,7 +84,7 @@ namespace api {
namespace { namespace {
const char* kUserDataKey = "WebRequest"; const char kUserDataKey[] = "WebRequest";
// BrowserContext <=> WebRequest relationship. // BrowserContext <=> WebRequest relationship.
struct UserData : public base::SupportsUserData::Data { struct UserData : public base::SupportsUserData::Data {

Просмотреть файл

@ -17,15 +17,15 @@ namespace electron {
// This class implements the enumerator for reading all the attributes in // This class implements the enumerator for reading all the attributes in
// GPUInfo into a dictionary. // GPUInfo into a dictionary.
class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator { class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator {
const char* kGPUDeviceKey = "gpuDevice"; const char* const kGPUDeviceKey = "gpuDevice";
const char* kVideoDecodeAcceleratorSupportedProfileKey = const char* const kVideoDecodeAcceleratorSupportedProfileKey =
"videoDecodeAcceleratorSupportedProfile"; "videoDecodeAcceleratorSupportedProfile";
const char* kVideoEncodeAcceleratorSupportedProfileKey = const char* const kVideoEncodeAcceleratorSupportedProfileKey =
"videoEncodeAcceleratorSupportedProfile"; "videoEncodeAcceleratorSupportedProfile";
const char* kImageDecodeAcceleratorSupportedProfileKey = const char* const kImageDecodeAcceleratorSupportedProfileKey =
"imageDecodeAcceleratorSupportedProfile"; "imageDecodeAcceleratorSupportedProfile";
const char* kAuxAttributesKey = "auxAttributes"; const char* const kAuxAttributesKey = "auxAttributes";
const char* kOverlayInfo = "overlayInfo"; const char* const kOverlayInfo = "overlayInfo";
public: public:
GPUInfoEnumerator(); GPUInfoEnumerator();

Просмотреть файл

@ -15,7 +15,7 @@ namespace gin_helper {
namespace { namespace {
const char* kTrackedObjectKey = "TrackedObjectKey"; const char kTrackedObjectKey[] = "TrackedObjectKey";
class IDUserData : public base::SupportsUserData::Data { class IDUserData : public base::SupportsUserData::Data {
public: public:

Просмотреть файл

@ -41,11 +41,10 @@ namespace api {
namespace context_bridge { namespace context_bridge {
const char* const kProxyFunctionPrivateKey = "electron_contextBridge_proxy_fn"; const char kProxyFunctionPrivateKey[] = "electron_contextBridge_proxy_fn";
const char* const kSupportsDynamicPropertiesPrivateKey = const char kSupportsDynamicPropertiesPrivateKey[] =
"electron_contextBridge_supportsDynamicProperties"; "electron_contextBridge_supportsDynamicProperties";
const char* const kOriginalFunctionPrivateKey = const char kOriginalFunctionPrivateKey[] = "electron_contextBridge_original_fn";
"electron_contextBridge_original_fn";
} // namespace context_bridge } // namespace context_bridge
@ -439,7 +438,7 @@ void ProxyFunctionWrapper(const v8::FunctionCallbackInfo<v8::Value>& info) {
did_error = true; did_error = true;
v8::Local<v8::Value> exception = try_catch.Exception(); v8::Local<v8::Value> exception = try_catch.Exception();
const char* err_msg = const char err_msg[] =
"An unknown exception occurred in the isolated context, an error " "An unknown exception occurred in the isolated context, an error "
"occurred but a valid exception was not thrown."; "occurred but a valid exception was not thrown.";

Просмотреть файл

@ -211,7 +211,7 @@ class ScriptExecutionCallback : public blink::WebScriptExecutionCallback {
promise_.Resolve(value); promise_.Resolve(value);
} }
} else { } else {
const char* error_message = const char error_message[] =
"Script failed to execute, this normally means an error " "Script failed to execute, this normally means an error "
"was thrown. Check the renderer console for the error."; "was thrown. Check the renderer console for the error.";
if (!callback_.is_null()) { if (!callback_.is_null()) {
@ -226,7 +226,7 @@ class ScriptExecutionCallback : public blink::WebScriptExecutionCallback {
promise_.RejectWithErrorMessage(error_message); promise_.RejectWithErrorMessage(error_message);
} }
} else { } else {
const char* error_message = const char error_message[] =
"WebFrame was removed before script could run. This normally means " "WebFrame was removed before script could run. This normally means "
"the underlying frame was destroyed"; "the underlying frame was destroyed";
if (!callback_.is_null()) { if (!callback_.is_null()) {
@ -705,7 +705,7 @@ class WebFrameRenderer : public gin::Wrappable<WebFrameRenderer>,
script.Get("startLine", &start_line); script.Get("startLine", &start_line);
if (!script.Get("code", &code)) { if (!script.Get("code", &code)) {
const char* error_message = "Invalid 'code'"; const char error_message[] = "Invalid 'code'";
if (!completion_callback.is_null()) { if (!completion_callback.is_null()) {
std::move(completion_callback) std::move(completion_callback)
.Run(v8::Undefined(isolate), .Run(v8::Undefined(isolate),