Client code cleanup

This commit is contained in:
Hackerpilot 2015-01-03 17:00:12 -08:00
parent c8657bcb91
commit 0f2ffbd31c
1 changed files with 2 additions and 2 deletions

View File

@ -141,14 +141,13 @@ int main(string[] args)
stderr.writefln("%s does not exist", args[1]); stderr.writefln("%s does not exist", args[1]);
return 1; return 1;
} }
File f = usingStdin ? stdin : File(args[1]);
ubyte[] sourceCode; ubyte[] sourceCode;
if (usingStdin) if (usingStdin)
{ {
ubyte[4096] buf; ubyte[4096] buf;
while (true) while (true)
{ {
auto b = f.rawRead(buf); auto b = stdin.rawRead(buf);
if (b.length == 0) if (b.length == 0)
break; break;
sourceCode ~= b; sourceCode ~= b;
@ -156,6 +155,7 @@ int main(string[] args)
} }
else else
{ {
File f = File(args[1]);
sourceCode = uninitializedArray!(ubyte[])(to!size_t(f.size)); sourceCode = uninitializedArray!(ubyte[])(to!size_t(f.size));
f.rawRead(sourceCode); f.rawRead(sourceCode);
} }