Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
utils
SkJSONWriter.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2017 Google Inc.
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
// Make sure that the PRI format string macros are defined
9
#ifndef __STDC_FORMAT_MACROS
10
#define __STDC_FORMAT_MACROS
11
#endif
12
13
#include "
src/utils/SkJSONWriter.h
"
14
15
#include <inttypes.h>
16
#include <stdarg.h>
17
#include <
stdio.h
>
18
19
void
SkJSONWriter::appendS64
(int64_t value) {
20
this->beginValue();
21
this->appendf(
"%"
PRId64,
value
);
22
}
23
24
void
SkJSONWriter::appendU64
(uint64_t value) {
25
this->beginValue();
26
this->appendf(
"%"
PRIu64,
value
);
27
}
28
29
void
SkJSONWriter::appendHexU64
(uint64_t value) {
30
this->beginValue();
31
this->appendf(
"\"0x%"
PRIx64
"\""
,
value
);
32
}
33
34
void
SkJSONWriter::appendf(
const
char
*
fmt
, ...) {
35
const
int
kBufferSize
= 1024;
36
char
buffer
[
kBufferSize
];
37
va_list argp;
38
va_start(argp,
fmt
);
39
#ifdef SK_BUILD_FOR_WIN
40
int
length
= _vsnprintf_s(
buffer
,
kBufferSize
, _TRUNCATE,
fmt
, argp);
41
#else
42
int
length
= vsnprintf(
buffer
,
kBufferSize
,
fmt
, argp);
43
#endif
44
SkASSERT
(
length
>= 0 &&
length
<
kBufferSize
);
45
va_end(argp);
46
this->write(
buffer
,
length
);
47
}
SkASSERT
#define SkASSERT(cond)
Definition
SkAssert.h:116
SkJSONWriter.h
kBufferSize
static const size_t kBufferSize
Definition
SkString.cpp:27
SkJSONWriter::appendU64
void appendU64(uint64_t value)
Definition
SkJSONWriter.cpp:24
SkJSONWriter::appendS64
void appendS64(int64_t value)
Definition
SkJSONWriter.cpp:19
SkJSONWriter::appendHexU64
void appendHexU64(uint64_t value)
Definition
SkJSONWriter.cpp:29
buffer
static const uint8_t buffer[]
Definition
fl_pixel_buffer_texture_test.cc:44
value
uint8_t value
Definition
fl_standard_message_codec.cc:36
length
size_t length
Definition
key_event_handler.cc:41
fmt
static SkString fmt(SkColor4f c)
Definition
p3.cpp:43
stdio.h
Generated on Fri Apr 26 2024 06:17:36 for Flutter Engine by
1.9.8