Skip to content

Commit 16b900b

Browse files
authored
Prefer C++ standard headers to their C counterpart (flutter#21091)
We currently use a mix of C standard includes (e.g. limits.h) and their C++ variants (e.g. climits). This migrates to a consistent style for all cases where the C++ variants are acceptable, but leaves the C equivalents in place where they are required, such as in the embedder API and other headers that may be used from C.
1 parent 85a7afa commit 16b900b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+100
-104
lines changed

common/settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#define FLUTTER_COMMON_SETTINGS_H_
77

88
#include <fcntl.h>
9-
#include <stdint.h>
109

1110
#include <chrono>
11+
#include <cstdint>
1212
#include <memory>
1313
#include <string>
1414
#include <vector>

examples/glfw/FlutterEmbedderGLFW.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#include <assert.h>
65
#include <embedder.h>
76
#include <glfw3.h>
87

8+
#include <cassert>
99
#include <chrono>
1010
#include <iostream>
1111

flow/layers/layer_tree.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
#ifndef FLUTTER_FLOW_LAYERS_LAYER_TREE_H_
66
#define FLUTTER_FLOW_LAYERS_LAYER_TREE_H_
77

8-
#include <stdint.h>
9-
8+
#include <cstdint>
109
#include <memory>
1110

1211
#include "flutter/flow/compositor_context.h"

flow/matrix_decomposition_unittests.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#include "flutter/fml/build_config.h"
6-
7-
#if defined(OS_WIN)
85
#define _USE_MATH_DEFINES
9-
#endif
6+
107
#include <cmath>
118

129
#include "flutter/flow/matrix_decomposition.h"

fml/command_line.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
#ifndef LIB_FML_COMMAND_LINE_H_
3737
#define LIB_FML_COMMAND_LINE_H_
3838

39-
#include <stddef.h>
40-
39+
#include <cstddef>
4140
#include <initializer_list>
4241
#include <string>
4342
#include <string_view>

fml/log_settings.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
#include "flutter/fml/log_settings.h"
66

77
#include <fcntl.h>
8-
#include <string.h>
98

109
#include <algorithm>
10+
#include <cstring>
1111
#include <iostream>
1212

1313
#include "flutter/fml/logging.h"

fml/platform/android/scoped_java_ref.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
#define FLUTTER_FML_PLATFORM_ANDROID_SCOPED_JAVA_REF_H_
77

88
#include <jni.h>
9-
#include <stddef.h>
9+
10+
#include <cstddef>
1011

1112
#include "flutter/fml/macros.h"
1213

fml/platform/posix/paths_posix.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
#include "flutter/fml/paths.h"
66

7-
#include <limits.h>
87
#include <unistd.h>
98

9+
#include <climits>
10+
1011
#include "flutter/fml/logging.h"
1112

1213
namespace fml {

fml/platform/posix/posix_wrappers_posix.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include "flutter/fml/posix_wrappers.h"
66

7-
#include <string.h>
7+
#include <cstring>
88

99
namespace fml {
1010

fml/platform/win/file_win.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
#include <Fileapi.h>
88
#include <Shlwapi.h>
99
#include <fcntl.h>
10-
#include <limits.h>
1110

1211
#include <algorithm>
12+
#include <climits>
13+
#include <cstring>
1314
#include <sstream>
1415

1516
#include "flutter/fml/build_config.h"

0 commit comments

Comments
 (0)