mirror of
https://github.com/dart-lang/sdk
synced 2024-10-07 22:07:04 +00:00
d33e51df3c
It relies on flutter copy of clang distribution, same one that is used to build flutter/engine. It addressed several deprecated warnings from clang compiler for functions like strdup, unlink, etc. It allows few warnings still since they are triggered in third_party sources. Change-Id: Ieb13792c011438d46dbbc0fa030e1b5e4ea14315 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142704 Commit-Queue: Alexander Aprelev <aam@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>
63 lines
1.5 KiB
C++
63 lines
1.5 KiB
C++
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#include "platform/globals.h"
|
|
#if defined(HOST_OS_FUCHSIA)
|
|
|
|
#include <memory>
|
|
|
|
#include "lib/sys/cpp/component_context.h"
|
|
#include "platform/utils.h"
|
|
#include "platform/utils_fuchsia.h"
|
|
|
|
namespace dart {
|
|
|
|
char* Utils::StrNDup(const char* s, intptr_t n) {
|
|
return strndup(s, n);
|
|
}
|
|
|
|
char* Utils::StrDup(const char* s) {
|
|
return strdup(s);
|
|
}
|
|
|
|
intptr_t Utils::StrNLen(const char* s, intptr_t n) {
|
|
return strnlen(s, n);
|
|
}
|
|
|
|
int Utils::SNPrint(char* str, size_t size, const char* format, ...) {
|
|
va_list args;
|
|
va_start(args, format);
|
|
int retval = VSNPrint(str, size, format, args);
|
|
va_end(args);
|
|
return retval;
|
|
}
|
|
|
|
int Utils::VSNPrint(char* str, size_t size, const char* format, va_list args) {
|
|
int retval = vsnprintf(str, size, format, args);
|
|
if (retval < 0) {
|
|
FATAL1("Fatal error in Utils::VSNPrint with format '%s'", format);
|
|
}
|
|
return retval;
|
|
}
|
|
|
|
int Utils::Close(int fildes) {
|
|
return close(fildes);
|
|
}
|
|
size_t Utils::Read(int filedes, void* buf, size_t nbyte) {
|
|
return read(filedes, buf, nbyte);
|
|
}
|
|
int Utils::Unlink(const char* path) {
|
|
return unlink(path);
|
|
}
|
|
|
|
sys::ComponentContext* ComponentContext() {
|
|
static std::unique_ptr<sys::ComponentContext> context =
|
|
sys::ComponentContext::CreateAndServeOutgoingDirectory();
|
|
return context.get();
|
|
}
|
|
|
|
} // namespace dart
|
|
|
|
#endif // defined(HOST_OS_FUCHSIA)
|