diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2022-04-21 14:25:26 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2022-04-21 20:03:08 +0100 |
commit | ae56e2da05e823e63972aff3118a659d7ca7a8b9 (patch) | |
tree | 13932a03f44d3892b2ea8accebe7e55fed6142e0 /libphobos/src/std/base64.d | |
parent | 93dd7f36f2066ec52137178ee52052f293e5e743 (diff) | |
download | gcc-ae56e2da05e823e63972aff3118a659d7ca7a8b9.zip gcc-ae56e2da05e823e63972aff3118a659d7ca7a8b9.tar.gz gcc-ae56e2da05e823e63972aff3118a659d7ca7a8b9.tar.bz2 |
d: Merge upstream dmd eb7bee331, druntime 27834edb, phobos ac296f80c.
D front-end changes:
- Import dmd v2.100.0-beta.1.
- Print deprecation messages for scope violations unless
`-frevert=dip1000' is used.
- Fixed a missed case of switch case fallthrough not being caught by
the compiler.
D runtime changes:
- Import druntime v2.100.0-beta.1.
Phobos changes:
- Import phobos v2.100.0-beta.1.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd eb7bee331.
* dmd/VERSION: Update version to v2.100.0-beta.1.
* d-lang.cc (d_handle_option): Handle OPT_frevert_dip1000.
* lang.opt (frevert=dip1000): New option.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime 27834edb.
* src/MERGE: Merge upstream phobos ac296f80c.
* src/Makefile.am (PHOBOS_DSOURCES): Add std/int128.d.
* src/Makefile.in: Regenerate.
Diffstat (limited to 'libphobos/src/std/base64.d')
-rw-r--r-- | libphobos/src/std/base64.d | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libphobos/src/std/base64.d b/libphobos/src/std/base64.d index 866f700..d971dba 100644 --- a/libphobos/src/std/base64.d +++ b/libphobos/src/std/base64.d @@ -63,7 +63,7 @@ import std.range.primitives : empty, front, isInputRange, isOutputRange, import std.traits : isArray; // Make sure module header code examples work correctly. -@safe unittest +pure @safe unittest { ubyte[] data = [0x14, 0xfb, 0x9c, 0x03, 0xd9, 0x7e]; @@ -82,7 +82,7 @@ import std.traits : isArray; alias Base64 = Base64Impl!('+', '/'); /// -@safe unittest +pure @safe unittest { ubyte[] data = [0x83, 0xd7, 0x30, 0x7a, 0x01, 0x3f]; assert(Base64.encode(data) == "g9cwegE/"); @@ -98,7 +98,7 @@ alias Base64 = Base64Impl!('+', '/'); alias Base64URL = Base64Impl!('-', '_'); /// -@safe unittest +pure @safe unittest { ubyte[] data = [0x83, 0xd7, 0x30, 0x7a, 0x01, 0x3f]; assert(Base64URL.encode(data) == "g9cwegE_"); @@ -114,7 +114,7 @@ alias Base64URL = Base64Impl!('-', '_'); alias Base64URLNoPadding = Base64Impl!('-', '_', Base64.NoPadding); /// -@safe unittest +pure @safe unittest { ubyte[] data = [0x83, 0xd7, 0x30, 0x7b, 0xef]; assert(Base64URLNoPadding.encode(data) == "g9cwe-8"); @@ -180,7 +180,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') * Returns: * The length of a Base64 encoding of an array of the given length. */ - @safe + @safe @nogc pure nothrow size_t encodeLength(in size_t sourceLength) { static if (Padding == NoPadding) @@ -218,8 +218,8 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') * The slice of $(D_PARAM buffer) that contains the encoded string. */ @trusted - pure char[] encode(R1, R2)(in R1 source, return scope R2 buffer) if (isArray!R1 && is(ElementType!R1 : ubyte) && - is(R2 == char[])) + pure char[] encode(R1, R2)(const scope R1 source, return scope R2 buffer) + if (isArray!R1 && is(ElementType!R1 : ubyte) && is(R2 == char[])) in { assert(buffer.length >= encodeLength(source.length), "Insufficient buffer for encoding"); @@ -277,9 +277,9 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') } /// - @safe unittest + @nogc nothrow @safe unittest { - ubyte[] data = [0x83, 0xd7, 0x30, 0x7a, 0x01, 0x3f]; + ubyte[6] data = [0x83, 0xd7, 0x30, 0x7a, 0x01, 0x3f]; char[32] buffer; // much bigger than necessary // Just to be sure... @@ -287,7 +287,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') assert(buffer.length >= encodedLength); // encode() returns a slice to the provided buffer. - auto encoded = Base64.encode(data, buffer[]); + auto encoded = Base64.encode(data[], buffer[]); assert(encoded is buffer[0 .. encodedLength]); assert(encoded == "g9cwegE/"); } |