File tree 2 files changed +11
-7
lines changed
2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ inline auto floor_log10_pow2_minus_log10_4_over_3(int e) noexcept -> int {
212
212
return (e * 631305 - 261663 ) >> 21 ;
213
213
}
214
214
215
- FMT_INLINE_VARIABLE constexpr struct {
215
+ FMT_INLINE_VARIABLE constexpr struct div_small_pow10_infos_struct {
216
216
uint32_t divisor;
217
217
int shift_amount;
218
218
} div_small_pow10_infos[] = {{10 , 16 }, {100 , 16 }};
Original file line number Diff line number Diff line change 61
61
62
62
namespace {
63
63
#ifdef _WIN32
64
- // Return type of read and write functions.
65
- using rwresult = int ;
66
-
67
64
// On Windows the count argument to read and write is unsigned, so convert
68
65
// it from size_t preventing integer overflow.
69
66
inline unsigned convert_rwcount (std::size_t count) {
70
67
return count <= UINT_MAX ? static_cast <unsigned >(count) : UINT_MAX;
71
68
}
72
69
#elif FMT_USE_FCNTL
73
- // Return type of read and write functions.
74
- using rwresult = ssize_t ;
75
-
76
70
inline std::size_t convert_rwcount (std::size_t count) { return count; }
77
71
#endif
78
72
} // namespace
@@ -266,6 +260,14 @@ long long file::size() const {
266
260
# endif
267
261
}
268
262
263
+
264
+ // Return type of read and write functions.
265
+ # ifdef _WIN32
266
+ # define rwresult int
267
+ # elif FMT_USE_FCNTL
268
+ # define rwresult ssize_t
269
+ # endif
270
+
269
271
std::size_t file::read (void * buffer, std::size_t count) {
270
272
rwresult result = 0 ;
271
273
FMT_RETRY (result, FMT_POSIX_CALL (read (fd_, buffer, convert_rwcount (count))));
@@ -282,6 +284,8 @@ std::size_t file::write(const void* buffer, std::size_t count) {
282
284
return detail::to_unsigned (result);
283
285
}
284
286
287
+ # undef rwresult
288
+
285
289
file file::dup (int fd) {
286
290
// Don't retry as dup doesn't return EINTR.
287
291
// http://pubs.opengroup.org/onlinepubs/009695399/functions/dup.html
You can’t perform that action at this time.
0 commit comments