mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 21:51:40 +03:00
detab and remove trailing whitespaces
This commit is contained in:
parent
799fdf81ad
commit
e7b3d834d7
15 changed files with 58 additions and 58 deletions
|
@ -938,7 +938,7 @@ unittest
|
|||
|
||||
S5 s51;
|
||||
static assert(__traits(compiles, move(s51, s51)),
|
||||
"issue 13990, cannot move opaque class reference");
|
||||
"issue 13990, cannot move opaque class reference");
|
||||
}
|
||||
|
||||
/// Ditto
|
||||
|
@ -1047,7 +1047,7 @@ unittest
|
|||
|
||||
S5 s51;
|
||||
static assert(__traits(compiles, s51 = move(s51)),
|
||||
"issue 13990, cannot move opaque class reference");
|
||||
"issue 13990, cannot move opaque class reference");
|
||||
}
|
||||
|
||||
unittest//Issue 6217
|
||||
|
|
|
@ -660,34 +660,34 @@ unittest
|
|||
+/
|
||||
T sqAbs(T)(Complex!T z) @safe pure nothrow @nogc
|
||||
{
|
||||
return z.re*z.re + z.im*z.im;
|
||||
return z.re*z.re + z.im*z.im;
|
||||
}
|
||||
|
||||
unittest
|
||||
{
|
||||
import std.math;
|
||||
assert (sqAbs(complex(0.0)) == 0.0);
|
||||
assert (sqAbs(complex(1.0)) == 1.0);
|
||||
assert (sqAbs(complex(0.0, 1.0)) == 1.0);
|
||||
assert (approxEqual(sqAbs(complex(1.0L, -2.0L)), 5.0L));
|
||||
assert (approxEqual(sqAbs(complex(-3.0L, 1.0L)), 10.0L));
|
||||
assert (approxEqual(sqAbs(complex(1.0f,-1.0f)), 2.0f));
|
||||
assert (sqAbs(complex(0.0)) == 0.0);
|
||||
assert (sqAbs(complex(1.0)) == 1.0);
|
||||
assert (sqAbs(complex(0.0, 1.0)) == 1.0);
|
||||
assert (approxEqual(sqAbs(complex(1.0L, -2.0L)), 5.0L));
|
||||
assert (approxEqual(sqAbs(complex(-3.0L, 1.0L)), 10.0L));
|
||||
assert (approxEqual(sqAbs(complex(1.0f,-1.0f)), 2.0f));
|
||||
}
|
||||
|
||||
/// ditto
|
||||
T sqAbs(T)(T x) @safe pure nothrow @nogc
|
||||
if (isFloatingPoint!T)
|
||||
if (isFloatingPoint!T)
|
||||
{
|
||||
return x*x;
|
||||
return x*x;
|
||||
}
|
||||
|
||||
unittest
|
||||
{
|
||||
import std.math;
|
||||
assert (sqAbs(0.0) == 0.0);
|
||||
assert (sqAbs(-1.0) == 1.0);
|
||||
assert (approxEqual(sqAbs(-3.0L), 9.0L));
|
||||
assert (approxEqual(sqAbs(-5.0f), 25.0f));
|
||||
assert (sqAbs(0.0) == 0.0);
|
||||
assert (sqAbs(-1.0) == 1.0);
|
||||
assert (approxEqual(sqAbs(-3.0L), 9.0L));
|
||||
assert (approxEqual(sqAbs(-5.0f), 25.0f));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1353,7 +1353,7 @@ bool isValid(E)(const(E)[] s)
|
|||
unittest
|
||||
{
|
||||
assert( isValid("\u20AC100"));
|
||||
assert(!isValid(cast(char[3])[167, 133, 175]));
|
||||
assert(!isValid(cast(char[3])[167, 133, 175]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1467,7 +1467,7 @@ body
|
|||
unittest
|
||||
{
|
||||
assert(firstSequence("\u20AC1000") == "\u20AC".length);
|
||||
assert(firstSequence("hel") == "h".length);
|
||||
assert(firstSequence("hel") == "h".length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1498,7 +1498,7 @@ body
|
|||
unittest
|
||||
{
|
||||
assert(lastSequence("1000\u20AC") == "\u20AC".length);
|
||||
assert(lastSequence("hellö") == "ö".length);
|
||||
assert(lastSequence("hellö") == "ö".length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -106,8 +106,8 @@ explicit $(D LogLevel) and conditional logging functions and methods.
|
|||
|
||||
$(H4 Thread Local Redirection)
|
||||
Calls to the free standing log functions are not directly forwarded to the
|
||||
global $(D Logger) $(D sharedLog). Actually, a thread local $(D Logger) of
|
||||
type $(D StdForwardLogger) process the log call and then, by default, forward
|
||||
global $(D Logger) $(D sharedLog). Actually, a thread local $(D Logger) of
|
||||
type $(D StdForwardLogger) process the log call and then, by default, forward
|
||||
the created $(D Logger.LogEntry) to the $(D sharedLog) $(D Logger).
|
||||
The thread local $(D Logger) is accessable by the $(D stdThreadLocalLog)
|
||||
property. This property allows to assign user defined $(D Logger). The default
|
||||
|
|
|
@ -274,7 +274,7 @@ private uint _ctfeMatchUnary(string fun, string name)
|
|||
if (!__ctfe) assert(false);
|
||||
import std.stdio;
|
||||
fun._ctfeSkipOp();
|
||||
for (;;)
|
||||
for (;;)
|
||||
{
|
||||
immutable h = fun._ctfeSkipName(name) + fun._ctfeSkipInteger();
|
||||
if (h == 0)
|
||||
|
@ -321,7 +321,7 @@ private uint _ctfeMatchBinary(string fun, string name1, string name2)
|
|||
{
|
||||
if (!__ctfe) assert(false);
|
||||
fun._ctfeSkipOp();
|
||||
for (;;)
|
||||
for (;;)
|
||||
{
|
||||
immutable h = fun._ctfeSkipName(name1) + fun._ctfeSkipName(name2) + fun._ctfeSkipInteger();
|
||||
if (h == 0)
|
||||
|
|
|
@ -1434,8 +1434,8 @@ immutable real [7] Bn_n = [
|
|||
* digamma(x) = d/dx logGamma(x)
|
||||
*
|
||||
* References:
|
||||
* 1. Abramowitz, M., and Stegun, I. A. (1970).
|
||||
* Handbook of mathematical functions. Dover, New York,
|
||||
* 1. Abramowitz, M., and Stegun, I. A. (1970).
|
||||
* Handbook of mathematical functions. Dover, New York,
|
||||
* pages 258-259, equations 6.3.6 and 6.3.18.
|
||||
*/
|
||||
real digamma(real x)
|
||||
|
@ -1530,8 +1530,8 @@ unittest {
|
|||
* logmdigamma(x) = log(x) - digamma(x)
|
||||
*
|
||||
* References:
|
||||
* 1. Abramowitz, M., and Stegun, I. A. (1970).
|
||||
* Handbook of mathematical functions. Dover, New York,
|
||||
* 1. Abramowitz, M., and Stegun, I. A. (1970).
|
||||
* Handbook of mathematical functions. Dover, New York,
|
||||
* pages 258-259, equations 6.3.6 and 6.3.18.
|
||||
*/
|
||||
real logmdigamma(real x)
|
||||
|
|
|
@ -354,7 +354,7 @@ unittest
|
|||
}
|
||||
|
||||
// const
|
||||
unittest
|
||||
unittest
|
||||
{
|
||||
char[10] tmpbuf = void;
|
||||
auto textbuf = ScopeBuffer!char(tmpbuf);
|
||||
|
|
|
@ -178,7 +178,7 @@ propagated properly from the base range(s) R to the higher order range
|
|||
H. Useful in combination with DummyRange for testing several higher
|
||||
order ranges.
|
||||
*/
|
||||
template propagatesRangeType(H, R...)
|
||||
template propagatesRangeType(H, R...)
|
||||
{
|
||||
static if(allSatisfy!(isRandomAccessRange, R))
|
||||
enum bool propagatesRangeType = isRandomAccessRange!H;
|
||||
|
@ -190,7 +190,7 @@ template propagatesRangeType(H, R...)
|
|||
enum bool propagatesRangeType = isInputRange!H;
|
||||
}
|
||||
|
||||
template propagatesLength(H, R...)
|
||||
template propagatesLength(H, R...)
|
||||
{
|
||||
static if(allSatisfy!(hasLength, R))
|
||||
enum bool propagatesLength = hasLength!H;
|
||||
|
|
|
@ -6247,7 +6247,7 @@ body
|
|||
r *= x;
|
||||
r += A[i];
|
||||
}
|
||||
return r;
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -328,7 +328,7 @@ class MmFile
|
|||
else
|
||||
{
|
||||
fd = -1;
|
||||
version(linux) import core.sys.linux.sys.mman : MAP_ANON;
|
||||
version(linux) import core.sys.linux.sys.mman : MAP_ANON;
|
||||
flags |= MAP_ANON;
|
||||
}
|
||||
this.size = size;
|
||||
|
|
|
@ -23,7 +23,7 @@ SMTP) )
|
|||
)
|
||||
|
||||
Note:
|
||||
You may need to link to the $(B curl) library, e.g. by adding $(D "libs": ["curl"])
|
||||
You may need to link to the $(B curl) library, e.g. by adding $(D "libs": ["curl"])
|
||||
to your $(B dub.json) file if you are using $(LINK2 http://code.dlang.org, DUB).
|
||||
|
||||
Windows x86 note:
|
||||
|
@ -2688,19 +2688,19 @@ struct HTTP
|
|||
* Specify data to post when not using the onSend callback, with
|
||||
* user-specified Content-Type.
|
||||
* Params:
|
||||
* data = Data to post.
|
||||
* contentType = MIME type of the data, for example, "text/plain" or
|
||||
* "application/octet-stream". See also:
|
||||
* data = Data to post.
|
||||
* contentType = MIME type of the data, for example, "text/plain" or
|
||||
* "application/octet-stream". See also:
|
||||
* $(LINK2 http://en.wikipedia.org/wiki/Internet_media_type,
|
||||
* Internet media type) on Wikipedia.
|
||||
*-----
|
||||
* -----
|
||||
* import std.net.curl;
|
||||
* auto http = HTTP("http://onlineform.example.com");
|
||||
* auto data = "app=login&username=bob&password=s00perS3kret";
|
||||
* http.setPostData(data, "application/x-www-form-urlencoded");
|
||||
* http.onReceive = (ubyte[] data) { return data.length; };
|
||||
* http.perform();
|
||||
*-----
|
||||
* -----
|
||||
*/
|
||||
void setPostData(const(void)[] data, string contentType)
|
||||
{
|
||||
|
|
|
@ -4572,7 +4572,7 @@ version(unittest)
|
|||
{
|
||||
struct __S_12733
|
||||
{
|
||||
invariant() { assert(checksum == 1234567890); }
|
||||
invariant() { assert(checksum == 1234567890); }
|
||||
this(ulong u){n = u;}
|
||||
void opAssign(__S_12733 s){this.n = s.n;}
|
||||
ulong n;
|
||||
|
@ -4585,6 +4585,6 @@ version(unittest)
|
|||
unittest
|
||||
{
|
||||
immutable ulong[] data = [ 2UL^^59-1, 2UL^^59-1, 2UL^^59-1, 112_272_537_195_293UL ];
|
||||
|
||||
|
||||
auto result = taskPool.amap!__genPair_12733(data);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//Written in the D programming language
|
||||
/*
|
||||
Implementation of Thompson NFA std.regex engine.
|
||||
Key point is evaluation of all possible threads (state) at each step
|
||||
Key point is evaluation of all possible threads (state) at each step
|
||||
in a breadth-first manner, thereby geting some nice properties:
|
||||
- looking at each character only once
|
||||
- merging of equivalent threads, that gives matching process linear time complexity
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Written in the D programming language.
|
||||
|
||||
/**
|
||||
String handling functions. Note that many typical string functions are found in
|
||||
String handling functions. Note that many typical string functions are found in
|
||||
$(D std.algorithm) because all D strings are bidirectional ranges.
|
||||
|
||||
$(SCRIPT inhibitQuickIndex = 1;)
|
||||
|
|
34
std/zip.d
34
std/zip.d
|
@ -288,10 +288,10 @@ final class ZipArchive
|
|||
/// Read Only: number of ArchiveMembers in the directory.
|
||||
@property uint numEntries() { return _numEntries; }
|
||||
@property uint totalEntries() { return _totalEntries; } /// ditto
|
||||
|
||||
|
||||
/// True when the archive is in Zip64 format.
|
||||
@property bool isZip64() { return _isZip64; }
|
||||
|
||||
|
||||
/// Set this to true to force building a Zip64 archive.
|
||||
@property void isZip64(bool value) { _isZip64 = value; }
|
||||
/**
|
||||
|
@ -392,7 +392,7 @@ final class ZipArchive
|
|||
+ directorySize + 46 + de.name.length + de.extra.length + de.comment.length
|
||||
+ 22 + comment.length + eocd64LocLength + eocd64Length > uint.max)
|
||||
throw new ZipException("zip files bigger than 4 GB are unsupported");
|
||||
|
||||
|
||||
archiveSize += 30 + de.name.length +
|
||||
de.extra.length +
|
||||
de.compressedSize;
|
||||
|
@ -406,7 +406,7 @@ final class ZipArchive
|
|||
uint dataSize = archiveSize + directorySize + 22 + cast(uint)comment.length;
|
||||
if (isZip64)
|
||||
dataSize += eocd64LocLength + eocd64Length;
|
||||
|
||||
|
||||
_data = new ubyte[dataSize];
|
||||
|
||||
// Populate the data[]
|
||||
|
@ -484,7 +484,7 @@ final class ZipArchive
|
|||
putUlong (i + 40, directorySize);
|
||||
putUlong (i + 48, directoryOffset);
|
||||
i += eocd64Length;
|
||||
|
||||
|
||||
// Write zip64 end of central directory record locator
|
||||
_data[i .. i + 4] = cast(ubyte[])"PK\x06\x07";
|
||||
putUint (i + 4, diskNumber);
|
||||
|
@ -492,7 +492,7 @@ final class ZipArchive
|
|||
putUint (i + 16, 1);
|
||||
i += eocd64LocLength;
|
||||
}
|
||||
|
||||
|
||||
// Write end record
|
||||
endrecOffset = i;
|
||||
_data[i .. i + 4] = cast(ubyte[])"PK\x05\x06";
|
||||
|
@ -540,7 +540,7 @@ final class ZipArchive
|
|||
|
||||
if (data.length > uint.max - 2)
|
||||
throw new ZipException("zip files bigger than 4 GB are unsupported");
|
||||
|
||||
|
||||
// Find 'end record index' by searching backwards for signature
|
||||
iend = (data.length > 66000 ? to!uint(data.length - 66000) : 0);
|
||||
for (i = to!uint(data.length) - 22; 1; i--)
|
||||
|
@ -556,14 +556,14 @@ final class ZipArchive
|
|||
continue;
|
||||
comment = cast(string)(_data[i + 22 .. i + 22 + endcommentlength]);
|
||||
endrecOffset = i;
|
||||
|
||||
|
||||
uint k = i - eocd64LocLength;
|
||||
if (k < i && _data[k .. k + 4] == cast(ubyte[])"PK\x06\x07")
|
||||
{
|
||||
_isZip64 = true;
|
||||
i = k;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -575,33 +575,33 @@ final class ZipArchive
|
|||
ulong eocdOffset = getUlong(i + 8);
|
||||
if (eocdOffset + eocd64Length > _data.length)
|
||||
throw new ZipException("corrupted directory");
|
||||
|
||||
|
||||
i = to!uint(eocdOffset);
|
||||
if (_data[i .. i + 4] != cast(ubyte[])"PK\x06\x06")
|
||||
throw new ZipException("invalid Zip EOCD64 signature");
|
||||
|
||||
|
||||
ulong eocd64Size = getUlong(i + 4);
|
||||
if (eocd64Size + i - 12 > data.length)
|
||||
throw new ZipException("invalid Zip EOCD64 size");
|
||||
|
||||
|
||||
_diskNumber = getUint(i + 16);
|
||||
_diskStartDir = getUint(i + 20);
|
||||
|
||||
|
||||
ulong numEntriesUlong = getUlong(i + 24);
|
||||
ulong totalEntriesUlong = getUlong(i + 32);
|
||||
ulong directorySizeUlong = getUlong(i + 40);
|
||||
ulong directoryOffsetUlong = getUlong(i + 48);
|
||||
|
||||
|
||||
if (numEntriesUlong > uint.max)
|
||||
throw new ZipException("supposedly more than 4294967296 files in archive");
|
||||
|
||||
|
||||
if (numEntriesUlong != totalEntriesUlong)
|
||||
throw new ZipException("multiple disk zips not supported");
|
||||
|
||||
if (directorySizeUlong > i || directoryOffsetUlong > i
|
||||
|| directorySizeUlong + directoryOffsetUlong > i)
|
||||
throw new ZipException("corrupted directory");
|
||||
|
||||
|
||||
_numEntries = to!uint(numEntriesUlong);
|
||||
_totalEntries = to!uint(totalEntriesUlong);
|
||||
directorySize = to!uint(directorySizeUlong);
|
||||
|
@ -814,7 +814,7 @@ unittest
|
|||
auto zip3 = new ZipArchive(data1);
|
||||
zip3.build();
|
||||
assert(zip3.directory["foo"].compressedSize == am1.compressedSize);
|
||||
|
||||
|
||||
// Test if packing and unpacking produces the original data
|
||||
import std.random : uniform, MinstdRand0;
|
||||
import std.stdio, std.conv;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue