Victor Zverovich
aa2ce7d30d
Don't terminate when fmt::ostream fails to write in the destructor
...
The destructor flushed the buffer and let write errors escape, calling
std::terminate on errors like a full disk. Report the error instead, like
file and buffered_file do on close errors. Also clear the buffer before
writing in flush so that data from a failed write, e.g. in close, is not
written again by the destructor.
2026-11-08 09:16:11 -08:00
Victor Zverovich
1b5222af1b
Clarify ostream capacity comment and strengthen zero buffer test
...
The old test only caught the overflow under ASan.
2026-11-07 16:51:20 -08:00
aizu-m
4daaa87b86
fix heap overflow in fmt::ostream with buffer_size = 0 ( #5011 )
...
output_file(path, buffer_size = 0) allocated a zero-size buffer, but
ostream::grow can only make room by flushing, so a zero capacity is never
increased. push_back then writes past the allocation and leaves size()
above capacity(), after which append computes capacity_ - size_ as
SIZE_MAX and copies the rest of the output out of bounds. If the first
write is an append instead, the count is clamped to 0 and print never
returns.
Allocate at least one byte so a zero buffer size behaves like 1.
2026-11-07 09:14:57 -08:00
Victor Zverovich
46cf422f54
Unify copyright notices
2026-05-31 08:54:06 -07:00
Kağan Can Şit
9396f77fe4
Remove unused header includes in test files ( #4729 )
2026-04-05 18:40:48 -07:00
Victor Zverovich
513f978241
Cleanup os-test
2025-07-04 10:52:59 -07:00
Victor Zverovich
6a3b40524c
Use actual example code and move safe_fopen to os-test
2025-07-04 09:50:55 -07:00
Victor Zverovich
5199e0f885
Fix a flush issue on libstdc++
2025-03-30 10:54:14 -07:00
Victor Zverovich
2f58430573
Move buffering tests to os-test
2025-03-30 09:38:40 -07:00
Victor Zverovich
377cf203e3
Add opt out for built-in types
2024-08-29 11:21:29 -07:00
vgorrX
dfe5b12c08
Update os-test.cc ( #3883 )
...
uniq test file names for the os-test suite (#3878 issue).
2024-03-06 06:37:57 -08:00
Victor Zverovich
50565f9853
Move misplaced join overloads to fmt/ranges.h
2024-01-01 16:28:59 -08:00
Victor Zverovich
c142385033
Improve the pipe API
2024-01-01 15:55:37 -08:00
Victor Zverovich
93a30a0746
unicode_to_utf8 -> to_utf8 since both sides of conversion are Unicode
2023-05-10 16:26:02 -07:00
Vladislav Shchapov
dde8cf3bb7
Unification utf16/utf32 to utf8 conversion
...
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-05-06 08:32:51 -07:00
Froster
b5c2f74f45
change sopen_s to wsopen_s (fmtlib#3234) ( #3293 )
2023-02-16 11:17:55 -08:00
Vladislav Shchapov
662adf4f33
Move formatter<std::error_code> from fmt/os.h to fmt/std.h ( #3125 )
...
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-10-01 17:46:09 -07:00
Victor Zverovich
ce246aaf74
Remove deprecated APIs
2022-05-22 07:10:09 -07:00
Victor Zverovich
729a44e67d
Depreate strtod and remove problematic tests
2021-08-28 09:20:36 -07:00
Victor Zverovich
bba0a9d962
Make flush public
2021-07-30 07:02:49 -07:00
mwinterb
3d53d1539d
Warning removals in test code ( #2399 )
...
* Warning removals in test code.
Mostly 0 to nullptr and adding override to virtual function implementations.
* Fix module-test.
2021-07-09 08:05:02 -07:00
Victor Zverovich
76ee490468
Move wchar/custom char overloads to xchar.h
2021-06-05 22:57:45 -07:00
Victor Zverovich
34b8acaef7
More wchar_t-specific API to wchar.h
2021-05-21 18:24:39 -07:00
Владислав Щапов
0036a1d195
Fix issue #2274 .
2021-05-10 15:57:23 -07:00
Владислав Щапов
2a9b314627
Replace fmt::error_code to std::error_code
2021-05-09 12:26:19 -07:00
Владислав Щапов
4211d86539
Add a formatter specialization for std::error_code.
2021-05-09 06:29:39 -07:00
Victor Zverovich
39f28424ca
Cleanup tests
2021-05-07 21:27:58 -07:00
Victor Zverovich
16f2ef91ab
Replace fmt::system_error with std::system_error
2021-05-07 08:33:39 -07:00
Victor Zverovich
4b885c8633
Replace windows_error with system_error
2021-05-07 06:19:03 -07:00
Victor Zverovich
9c3af11a92
Cleanup tests
2021-05-05 18:31:41 -07:00
Victor Zverovich
ed7c4320f6
Cleanup tests
2021-05-02 09:28:38 -07:00
Victor Zverovich
afe23e7f10
Don't call fileno on NULL file in tests ( #2196 )
2021-03-30 10:41:12 -07:00
vtta
14848875bf
Fix: fmt::ostream cannot be moved while holding buffered data #2197 ( #2198 )
...
* Add a test case: move ostream while holding data
* Fix moving ostream while holding data
Co-authored-by: Junliang HU <jlhu@cse.cuhk.edu.hk>
2021-03-30 08:43:26 -07:00
Daumantas Kavolis
fa43fd1444
Forward arguments to work with views ( #2068 )
2020-12-20 07:14:54 -08:00
Victor Zverovich
119f7dc3d6
Truncate file by default
2020-11-27 08:15:14 -08:00
Victor Zverovich
6cccdc24bc
Fix move constructor ( #1844 )
2020-09-01 08:48:56 -07:00
Victor Zverovich
7c4c5c79d2
Make buffer size configurable
2020-08-01 10:53:58 -07:00
Victor Zverovich
415cd51913
direct_buffered_file -> ostream
2020-07-11 17:29:17 -07:00
Victor Zverovich
e1bfb59619
Fix handling of code units in compile
2020-07-11 09:03:21 -07:00
Victor Zverovich
e4f57bfd7f
Add an overload of write for buffer_appender
2020-07-11 08:20:30 -07:00
Victor Zverovich
60c43e8703
Apply clang-format
2020-07-09 09:06:24 -07:00
Victor Zverovich
f69b6eaabd
Add a simple buffered stream with no sync
2020-06-28 09:55:29 -07:00
Victor Zverovich
8069265373
internal -> detail ( #1538 )
2020-05-10 07:34:30 -07:00
Victor Zverovich
7f723fbcb8
Consistently namespace qualify size_t
2020-05-07 15:59:46 -07:00
Victor Zverovich
73c8437485
Follow naming conventions
2020-04-01 09:30:28 -07:00
Victor Zverovich
8cf4c52068
Apply clang-format
2019-12-21 13:10:45 -08:00
Victor Zverovich
9ea42fb26e
Rename posix-test to os-test
2019-12-15 16:43:40 -08:00