Replace use of GetMacOSStatusErrorString (deprecated) with use of NSOSStatusErrorDomain.
This should unblock the roll. TBR=kjellander@webrtc.org Review URL: https://codereview.webrtc.org/1921463002 . Cr-Commit-Position: refs/heads/master@{#12479}
This commit is contained in:
parent
809dcb4b3e
commit
09ca02ea5c
@ -174,6 +174,7 @@ static_library("rtc_base_approved") {
|
||||
sources += [
|
||||
"logging.cc",
|
||||
"logging.h",
|
||||
"logging_mac.mm",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,8 +160,19 @@
|
||||
'sources': [
|
||||
'logging.cc',
|
||||
'logging.h',
|
||||
'logging_mac.mm',
|
||||
],
|
||||
}],
|
||||
['OS=="mac" and build_with_chromium==0', {
|
||||
'all_dependent_settings': {
|
||||
'xcode_settings': {
|
||||
'OTHER_LDFLAGS': [
|
||||
# needed for logging_mac.mm
|
||||
'-framework Foundation',
|
||||
],
|
||||
},
|
||||
},
|
||||
}], # OS=="mac" and build_with_chromium==0
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@ -171,10 +171,8 @@ LogMessage::LogMessage(const char* file,
|
||||
#endif // WEBRTC_WIN
|
||||
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
|
||||
case ERRCTX_OSSTATUS: {
|
||||
tmp << " " << nonnull(GetMacOSStatusErrorString(err), "Unknown error");
|
||||
if (const char* desc = GetMacOSStatusCommentString(err)) {
|
||||
tmp << ": " << desc;
|
||||
}
|
||||
std::string desc(DescriptionFromOSStatus(err));
|
||||
tmp << " " << (desc.empty() ? "Unknown error" : desc.c_str());
|
||||
break;
|
||||
}
|
||||
#endif // WEBRTC_MAC && !defined(WEBRTC_IOS)
|
||||
|
||||
@ -51,6 +51,10 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#endif
|
||||
|
||||
#include "webrtc/base/basictypes.h"
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
#include "webrtc/base/thread_annotations.h"
|
||||
@ -80,6 +84,11 @@ struct ConstantLabel { int value; const char * label; };
|
||||
const char* FindLabel(int value, const ConstantLabel entries[]);
|
||||
std::string ErrorName(int err, const ConstantLabel* err_table);
|
||||
|
||||
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
|
||||
// Returns a UTF8 description from an OS X Status error.
|
||||
std::string DescriptionFromOSStatus(OSStatus err);
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Note that the non-standard LoggingSeverity aliases exist because they are
|
||||
|
||||
22
webrtc/base/logging_mac.mm
Normal file
22
webrtc/base/logging_mac.mm
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2016 The WebRTC Project Authors. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "webrtc/base/logging.h"
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
namespace rtc {
|
||||
std::string DescriptionFromOSStatus(OSStatus err) {
|
||||
NSError* error =
|
||||
[NSError errorWithDomain:NSOSStatusErrorDomain code:err userInfo:nil];
|
||||
return error.description.UTF8String;
|
||||
}
|
||||
} // namespace rtc
|
||||
Loading…
x
Reference in New Issue
Block a user