Commit graph

79 commits

Author SHA1 Message Date
Nick Treleaven
4552211174
Fix Bugzilla 20870 - std.outbuffer.printf is trusted (#9037) 2024-07-31 20:05:48 +08:00
Carsten Schlote
ad93dd0305 Fixed linter issue on style 2022-04-29 17:26:56 +02:00
Carsten Schlote
f434dc3cae Add custom fill value to std.outbuffer.OutBuffer class
Extend the fill, alignSize, align{2,4} methods of `std.outbuffer.OutBuffer` to specify value to write
when filling (up to an alignment).

For flash device images it is desirable to use 0xff as the fill value,
because 0xff is the value of the unprogrammed flash memory cell. Padding
with 0 requires to programm the flash cell from 0xff to 0x00, which
increases wear and tear on the flash memory device. Usually there is some
larger block at the end if the flash memory image, which must be padded
up to the size of the flash device (usuallay a power of two). Instead
of padding with 0x00 the PR allows to fill with 0xff instead.

There might also be other use-cases, where it might be reasonable to fill
the alignment gaps with some other value than 0x00, e.g. when debugging
and viewing output data in a hex editor. It is easier to spot gaps, when
the padded spaces contain a custom value like 0x55 or 0xaa.

A new fill method was added, which allows filling with a user-defined value
instead of the 0 as in the previous implementation.
2022-04-29 12:57:10 +02:00
Dennis Korpel
ba92563a0d Fix issue 22939 - bad error message: Error: no property msg for type string 2022-03-29 18:51:30 +00:00
Brandon Mitchell
68c9430f19 Add compile-time checked variants of writef and writefln to std.outbuffer. 2021-08-09 14:21:54 -07:00
berni44
6f2a0934a7 Adapt imports of std.format to new structure of std.format. 2021-03-19 13:22:00 +01:00
Alexandru Militaru
bb62aaca3d Replaced version (unittest) with version (StdUnittest) to avoid unnecessary overhead when compiling with -unittest 2020-01-19 14:05:17 +02:00
Sebastian Wilzbach
b56db9a061 Use selective top-level module imports in std.{functional,getopt,math,net,outbuffer} 2019-05-23 13:20:04 +02:00
Iain Buclaw
12854834f6 Fix tests that fail on version (BigEndian) 2019-04-21 01:52:05 +03:00
Walter Bright
33cceac7ac switch Digital Mars copyright to D Language Foundation 2018-09-05 13:49:46 -07:00
Walter Bright
2c01a81b7a outbuffer: add scope 2018-06-08 19:48:05 -07:00
Sebastian Wilzbach
c324714fde Remove a few cases of underscore escaping 2018-06-04 13:05:01 +02:00
Sebastian Wilzbach
42894784dd Markdownify Phobos
$(D word) -> `word`
2018-04-02 22:32:47 +02:00
Sebastian Wilzbach
df6365092a Replace body keyword with its replacement: do
Automatic replacement with

    sed -i "s/^\([ ]*\)body/\1do/" -i **/*.d
2017-11-20 15:33:52 +01:00
Sebastian Wilzbach
d7e0de242e Cleanup std.outbuffer: remove unnecessary slicing + make unittest documented 2017-07-12 10:22:52 +02:00
RazvanN7
09ab8e96e3 Fix Issue 16062 - Add 'clear' method to OutBuffer (std.outbuffer) 2017-07-12 10:48:21 +03:00
Sebastian Wilzbach
61717ecc7d Sort imports 2017-06-12 07:54:38 +02:00
Sebastian Wilzbach
c36f95280c Remove quickIndex for modules with booktables or only one symbol 2017-03-01 03:59:22 +01:00
Sebastian Wilzbach
805c720595 Unify Phobos by ensuring there's always a space after cast(...)
Command:

sed -E 's/([^"])cast\(([^)]*?)\)([[:alnum:]])/\1cast(\2) \3/g' -i **/*.d
2017-02-21 16:40:20 +01:00
kinke
961445a303 Fix std.outbuffer.[v]printf() for Visual Studio 2015+
MS conforms to the standard beginning with VS 2015, i.e., if the buffer is too small,
vsnprintf() returns the number of required characters (excl. terminating null). VS 2013
and earlier always returned -1 in that case.
So just use the generic (previous POSIX) version, it's compatible with older VS anyway.

Already unittested in line 380 ("hello world 6" vs. "hello world 62665").
2017-02-07 23:30:23 +01:00
Jack Stouffer
56d3a150f8 Removed commented out code 2016-09-16 11:12:29 +01:00
Jack Stouffer
bc969d22db Remove package several global imports from std.outbuffer 2016-09-16 11:06:13 +01:00
Walter Bright
19d30c6d4b outbuffer.d: add overflow checks 2016-08-11 03:29:38 -07:00
Atila Neves
4034b6a8fb Add @safe to std.outbuffer unittests 2016-06-29 18:47:07 +02:00
Sebastian Wilzbach
ec47ac4224 Remove the WEB macro in favor of HTTP
replacement: sed 's/\$(WEB/\$(HTTP/g' -i **/*.d
2016-06-16 00:14:51 +02:00
anonymous
764caefa36 XREF -> REF (sed)
Done by:

(find . -type f -name "*.d" -print0; \
    find . -type f -name "*.dd" -print0) | \
xargs -0 sed -i -r \
    's/\$\(XREF\s+([^(),]*),\s*([^(),]*)\)/$(REF \2, std,\1)/g'
2016-05-27 21:32:46 +02:00
Sebastian Wilzbach
18b8abf60a remove the deprecated wiki macros 2016-05-27 05:52:23 +02:00
Vladimir Panteleev
86cf380007 HTML fixes 2015-10-24 06:19:23 +00:00
Rainer Schuetze
13cb3dede1 std.outbuffer: remove call into GC by using appropriate type for data, tweak pre-allocation 2015-07-29 22:41:09 +02:00
Robert burner Schadek
851266d37f outbuffer: alias syntax update 2015-05-28 18:55:05 +02:00
Martin
1082c0c5e7 Don't use MS-specific _vsnprintf, use standard vsnprintf instead.
There's an alias in druntime and in MS stdio.h anyway.
2015-05-21 23:47:18 +02:00
Walter Bright
955800a4b5 add writef and writefln to std.outbuffer 2015-02-16 18:00:20 -08:00
Daniel Murphy
1d2a706f4a Stop using va_argsave now that va_start works correctly without it 2015-01-27 16:17:24 +11:00
Daniel Murphy
4c737a672f Revert "Merge pull request #2905 from 9rnsr/revert_pull2902"
This reverts commit 80f463a1e2, reversing
changes made to 588c76c19b.
2015-01-26 04:42:37 +11:00
k-hara
5417836f10 Revert "Merge pull request #2902 from yebblies/typeofva_argsave"
This reverts commit f07a77d106, reversing
changes made to 4bd949406a.

It's breaking std.outbuffer unittest in Win64 platform.
2015-01-25 06:47:08 +09:00
Daniel Murphy
c19ceb8506 Use presence of __va_argsave to determine if __va_argsave hack is needed 2015-01-25 01:34:32 +11:00
Andrei Alexandrescu
a13cee766d Ensure each module has a description at the top. 2015-01-11 14:14:29 -08:00
Walter Bright
e8bc463337 add annotations to std.outbuffer 2015-01-05 12:58:59 -08:00
Martin Nowak
c855945f46 Merge pull request #2614 from Geod24/fix-license-doc
[DDOC] Usage of WEB macro for License everywhere
2014-10-17 00:16:49 +02:00
Geod24
0fb95b8c27 Usage of WEB macro for License everywhere 2014-10-15 11:30:42 +02:00
Joakim
093d636de4 Deprecate std.c.* and move all remaining declarations to core.stdc.* 2014-10-14 09:26:21 -05:00
Denis Shelomovskij
ff144b0ae0 Replace most toStringz/toUTF16z/toUTFz usages with tempCString* ones.
Only non-trivial cases left when a refactoring is required to use a temporary buffer.
Also add `nothrow`/`@nogc` attributes.
2014-08-23 17:23:13 +04:00
Walter Bright
263ac2b092 OutBuffer is now an OutputRange 2014-03-20 18:19:59 -07:00
Walter Bright
e16b2c81e5 fix Issue 10644 - Win64: wrong code when passing arguments through ... 2013-07-19 14:17:32 -07:00
Hackerpilot
13a6e6ac5c Converted C-style array declarations to D-style 2013-07-03 00:06:32 +00:00
k-hara
28dedee456 Issue 7444 - Require [] for array copies too 2012-11-20 17:55:21 +09:00
jmdavis
27469366a7 Fix modules which incorrectly use std.string's public imports.
Now, they should be correctly importing for the functions publicly
imported by std.string so that if those public imports are ever removed,
they won't break.
2012-09-30 03:29:37 -07:00
Walter Bright
18f7d60f0d Win64 fixes 2012-09-11 19:39:15 -07:00
k-hara
119f7f7424 Revert all const qualifier of class member functions that inherited from Object.
This change is necessary to avoid breaking existing codes which inherit them in user code.
2012-07-31 10:05:59 +09:00
k-hara
d6ffbd1328 Add const attribute more strictly 2012-07-11 01:02:59 +09:00