mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
win: Provide strcasecmp() in <strings.h> in compat.
base::strcasecmp() has been deprecated since upstream 8a800901b78a2. BUG=chromium:472900 R=rsesek@chromium.org Review URL: https://codereview.chromium.org/1275633002 .
This commit is contained in:
parent
a3e313ecd7
commit
0366307615
@ -36,6 +36,8 @@
|
||||
'non_win/windows.h',
|
||||
'non_win/winnt.h',
|
||||
'win/getopt.h',
|
||||
'win/strings.cc',
|
||||
'win/strings.h',
|
||||
'win/sys/types.h',
|
||||
'win/time.cc',
|
||||
'win/time.h',
|
||||
|
25
compat/win/strings.cc
Normal file
25
compat/win/strings.cc
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright 2015 The Crashpad Authors. 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.
|
||||
|
||||
#include <strings.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
int strcasecmp(const char* s1, const char* s2) {
|
||||
return _stricmp(s1, s2);
|
||||
}
|
||||
|
||||
} // extern "C"
|
28
compat/win/strings.h
Normal file
28
compat/win/strings.h
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright 2015 The Crashpad Authors. 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.
|
||||
|
||||
#ifndef CRASHPAD_COMPAT_WIN_STRINGS_H_
|
||||
#define CRASHPAD_COMPAT_WIN_STRINGS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int strcasecmp(const char* s1, const char* s2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // CRASHPAD_COMPAT_WIN_STRINGS_H_
|
@ -17,6 +17,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
|
||||
@ -106,14 +107,14 @@ bool StringToBool(const char* string, bool* boolean) {
|
||||
};
|
||||
|
||||
for (size_t index = 0; index < arraysize(kFalseWords); ++index) {
|
||||
if (base::strcasecmp(string, kFalseWords[index]) == 0) {
|
||||
if (strcasecmp(string, kFalseWords[index]) == 0) {
|
||||
*boolean = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t index = 0; index < arraysize(kTrueWords); ++index) {
|
||||
if (base::strcasecmp(string, kTrueWords[index]) == 0) {
|
||||
if (strcasecmp(string, kTrueWords[index]) == 0) {
|
||||
*boolean = true;
|
||||
return true;
|
||||
}
|
||||
@ -135,7 +136,7 @@ std::string BoolToString(bool boolean) {
|
||||
// when true, causes |string| to be interpreted as a UTC time rather than a
|
||||
// local time when the time zone is ambiguous.
|
||||
bool StringToTime(const char* string, time_t* time, bool utc) {
|
||||
if (base::strcasecmp(string, "never") == 0) {
|
||||
if (strcasecmp(string, "never") == 0) {
|
||||
*time = 0;
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user