DFortune

Unix fortune-cookie parser written in D
git clone git://xatko.vsos.ethz.ch/DFortune.git
Log | Files | Refs

commit fdeabfa4ab946086d5ab8547fb2a7f38c200cfaa
parent de950b144e0050dfefd73301b14f256d3d562f71
Author: Dominik Schmidt <das1993@hotmail.com>
Date:   Sun, 18 Oct 2015 17:35:19 +0200

Get rid of c-style array-syntax.

Diffstat:
dfortune.d | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/dfortune.d b/dfortune.d @@ -21,7 +21,7 @@ class Fortune : RandomAccessFinite!(Cookie){ uint flags; char delim; void read(File f){ - ubyte off[getOffset()]; + ubyte[getOffset()] off; auto red=f.rawRead(off); version_=bigEndianToNative!(uint,uint.sizeof)(red[0*uint.sizeof..1*uint.sizeof]); numstr=bigEndianToNative!(uint,uint.sizeof)(red[1*uint.sizeof..2*uint.sizeof]); @@ -81,7 +81,7 @@ class Fortune : RandomAccessFinite!(Cookie){ return cast(uint)content.size; } table.seek(Header.getOffset()+(i+1)*4-1); - ubyte b[uint.sizeof]; + ubyte[uint.sizeof] b; table.rawRead(b); return bigEndianToNative!(uint,uint.sizeof)(b); } @@ -95,17 +95,17 @@ class Fortune : RandomAccessFinite!(Cookie){ return ""; } content.seek(pos); - ubyte buf[]=new ubyte[end-pos]; + ubyte[] buf=new ubyte[end-pos]; content.rawRead(buf); if(src==dst){ return cast(string) buf; } - char str[]; + char[] str; str.reserve(buf.length); const(ubyte)[] derp=buf; while(derp.length>0){ - ubyte bufbuf[4]; + ubyte[4] bufbuf; ubyte written; written=cast(ubyte)dst.encode(src.safeDecode(derp),bufbuf); str~=bufbuf[0..written]; @@ -231,7 +231,7 @@ struct CookieResult{ } } struct Fortunes{ - Fortune fortunes[]; + Fortune[] fortunes; size_t pos,end; void add(Fortune f){