Merge pull request #5272 from JackStouffer/dscanner

Fix dscanner sugesstions in several files
merged-on-behalf-of: Jack Stouffer <jack@jackstouffer.com>
This commit is contained in:
The Dlang Bot 2017-03-15 05:57:06 +01:00 committed by GitHub
commit b941605356
3 changed files with 12 additions and 12 deletions

View file

@ -476,7 +476,7 @@ if (isCurlConn!Conn)
import std.stdio : File;
auto f = File(loadFromPath, "rb");
conn.onSend = buf => f.rawRead(buf).length;
auto sz = f.size;
immutable sz = f.size;
if (sz != ulong.max)
conn.contentLength = sz;
conn.perform();
@ -2264,7 +2264,7 @@ decodeString(Char = char)(const(ubyte)[] data,
size_t charsDecoded = 0;
while (data.length && charsDecoded < maxChars)
{
dchar dc = scheme.safeDecode(data);
immutable dchar dc = scheme.safeDecode(data);
if (dc == INVALID_SEQUENCE)
{
return typeof(return)(size_t.max, cast(Char[]) null);
@ -2310,7 +2310,7 @@ private bool decodeLineInto(Terminator, Char = char)(ref const(ubyte)[] basesrc,
4 : basesrc.length + src.length;
basesrc.length = len;
dchar dc = scheme.safeDecode(basesrc);
immutable dchar dc = scheme.safeDecode(basesrc);
if (dc == INVALID_SEQUENCE)
{
enforce!CurlException(len != 4, "Invalid code sequence");

View file

@ -65,7 +65,7 @@ private immutable ubyte[128] uri_flags = // indexed by character
return uflags;
})();
private string URI_Encode(dstring string, uint unescapedSet)
private string URI_Encode(dstring str, uint unescapedSet)
{
import core.exception : OutOfMemoryError;
import core.stdc.stdlib : alloca;
@ -81,7 +81,7 @@ private string URI_Encode(dstring string, uint unescapedSet)
uint Rlen;
uint Rsize; // alloc'd size
auto len = string.length;
immutable len = str.length;
R = buffer.ptr;
Rsize = buffer.length;
@ -89,7 +89,7 @@ private string URI_Encode(dstring string, uint unescapedSet)
for (k = 0; k != len; k++)
{
C = string[k];
C = str[k];
// if (C in unescapedSet)
if (C < uri_flags.length && uri_flags[C] & unescapedSet)
{
@ -209,7 +209,7 @@ if (isSomeChar!Char)
dchar* R;
uint Rlen;
auto len = uri.length;
immutable len = uri.length;
auto s = uri.ptr;
// Preallocate result buffer R guaranteed to be large enough for result
@ -290,7 +290,7 @@ if (isSomeChar!Char)
if (C < uri_flags.length && uri_flags[C] & reservedSet)
{
// R ~= s[start .. k + 1];
int width = (k + 1) - start;
immutable width = (k + 1) - start;
for (int ii = 0; ii < width; ii++)
R[Rlen + ii] = s[start + ii];
Rlen += width;

View file

@ -528,7 +528,7 @@ public struct UUID
{
//variant is stored in octet 7
//which is index 8, since indexes count backwards
auto octet7 = data[8]; //octet 7 is array index 8
immutable octet7 = data[8]; //octet 7 is array index 8
if ((octet7 & 0x80) == 0x00) //0b0xxxxxxx
return Variant.ncs;
@ -589,7 +589,7 @@ public struct UUID
{
//version is stored in octet 9
//which is index 6, since indexes count backwards
auto octet9 = data[6];
immutable octet9 = data[6];
if ((octet9 & 0xF0) == 0x10)
return Version.timeBased;
else if ((octet9 & 0xF0) == 0x20)
@ -643,7 +643,7 @@ public struct UUID
*/
@safe pure nothrow @nogc void swap(ref UUID rhs)
{
auto bck = data;
immutable bck = data;
data = rhs.data;
rhs.data = bck;
}
@ -1378,7 +1378,7 @@ if (isInputRange!Range
parseLoop: while (!uuidRange.empty)
{
dchar character = uuidRange.front;
immutable character = uuidRange.front;
if (character == '-')
{