Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
utils_android.cc
Go to the documentation of this file.
1// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#include "platform/globals.h"
6#if defined(DART_HOST_OS_ANDROID)
7
8#include "platform/utils.h"
10
11namespace dart {
12
13char* Utils::StrNDup(const char* s, intptr_t n) {
14 return strndup(s, n);
15}
16
17char* Utils::StrDup(const char* s) {
18 return strdup(s);
19}
20
21intptr_t Utils::StrNLen(const char* s, intptr_t n) {
22 return strnlen(s, n);
23}
24
25int Utils::SNPrint(char* str, size_t size, const char* format, ...) {
26 va_list args;
28 int retval = VSNPrint(str, size, format, args);
29 va_end(args);
30 return retval;
31}
32
33int Utils::VSNPrint(char* str, size_t size, const char* format, va_list args) {
34 int retval = vsnprintf(str, size, format, args);
35 if (retval < 0) {
36 FATAL("Fatal error in Utils::VSNPrint with format '%s'", format);
37 }
38 return retval;
39}
40
41int Utils::Close(int fildes) {
42 return close(fildes);
43}
44size_t Utils::Read(int filedes, void* buf, size_t nbyte) {
45 return read(filedes, buf, nbyte);
46}
47int Utils::Unlink(const char* path) {
48 return unlink(path);
49}
50
51} // namespace dart
52
53#endif // defined(DART_HOST_OS_ANDROID)
static bool read(SkStream *stream, void *buffer, size_t amount)
static int SNPrint(char *str, size_t size, const char *format,...) PRINTF_ATTRIBUTE(3
static char * StrDup(const char *s)
static int static int VSNPrint(char *str, size_t size, const char *format, va_list args)
static size_t Read(int filedes, void *buf, size_t nbyte)
static intptr_t StrNLen(const char *s, intptr_t n)
static int Close(int fildes)
static int Unlink(const char *path)
static char * StrNDup(const char *s, intptr_t n)
struct MyStruct s
#define FATAL(error)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint32_t uint32_t * format
va_start(args, format)
va_end(args)
char * strdup(const char *str1)