phobos 0.105

This commit is contained in:
Brad Roberts 2007-09-10 04:17:05 +00:00
parent 4cc9398402
commit 17fe123175
5 changed files with 15 additions and 8 deletions

View file

@ -207,7 +207,7 @@ extern (C) long _adDupBit(Array a)
size = (a.length + 31) / 32; size = (a.length + 31) / 32;
r.ptr = cast(void *) new uint[size]; r.ptr = cast(void *) new uint[size];
r.length = a.length; r.length = a.length;
memcpy(r.ptr, a.ptr, size); memcpy(r.ptr, a.ptr, size * uint.sizeof);
return *cast(long*)(&r); return *cast(long*)(&r);
} }

View file

@ -405,7 +405,7 @@ long _d_arrayappend(Array *px, byte[] y, uint size)
px.data = newdata; px.data = newdata;
} }
px.length = newlength; px.length = newlength;
px.data[length * size .. newlength * size] = y[]; memcpy(px.data + length * size, y, y.length * size);
return *cast(long*)px; return *cast(long*)px;
} }

View file

@ -16,9 +16,9 @@ class ArrayBoundsError : Error
this.filename = filename; this.filename = filename;
char[] buffer = new char[19 + filename.length + linnum.sizeof * 3 + 1]; char[] buffer = new char[19 + filename.length + linnum.sizeof * 3 + 1];
int length; int len;
length = sprintf(buffer, "ArrayBoundsError %.*s(%u)", filename, linnum); len = sprintf(buffer, "ArrayBoundsError %.*s(%u)", filename, linnum);
super(buffer[0..length]); super(buffer[0..len]);
} }
} }

View file

@ -93,7 +93,7 @@ version(Windows)
alias HMODULE HModule_; alias HMODULE HModule_;
} }
} }
else version(Linux) else version(linux)
{ {
extern(C) extern(C)
{ {
@ -282,7 +282,7 @@ version(Windows)
return szFileName[0 .. cch].dup; return szFileName[0 .. cch].dup;
} }
} }
else version(Linux) else version(linux)
{ {
private class ExeModuleInfo private class ExeModuleInfo
{ {

View file

@ -1,7 +1,9 @@
module std.switcherr; module std.switcherr;
class SwitchError : Object import std.stdio;
class SwitchError : Error
{ {
private: private:
@ -12,8 +14,13 @@ class SwitchError : Object
{ {
this.linnum = linnum; this.linnum = linnum;
this.filename = filename; this.filename = filename;
char[] buffer = new char[17 + filename.length + linnum.sizeof * 3 + 1];
int len = sprintf(buffer, "Switch Default %.*s(%u)", filename, linnum);
super(buffer[0..len]);
} }
public: public:
/*************************************** /***************************************