diff -uNr dmd-0.176/dmd/src/dmd/constfold.c dmd-0.177/dmd/src/dmd/constfold.c --- dmd-0.176/dmd/src/dmd/constfold.c 2006-12-01 01:38:52.000000000 +0100 +++ dmd-0.177/dmd/src/dmd/constfold.c 2006-12-06 11:38:50.000000000 +0100 @@ -163,46 +163,16 @@ if (tb->isreal()) { real_t value = e1->toReal(); -#if 0 - if (tb->ty == Tfloat32) - { float f = (float)value; - value = f; - } - else if (tb->ty == Tfloat64) - value = (double)value; -#endif return new RealExp(loc, value, type); } if (tb->isimaginary()) { real_t value = e1->toImaginary(); -#if 0 - if (tb->ty == Timaginary32) - value = (float)value; - else if (tb->ty == Timaginary64) - value = (double)value; -#endif + return new RealExp(loc, value, type); } if (tb->iscomplex()) { complex_t value = e1->toComplex(); -#if 0 -#if __DMC__ - if (tb->ty == Tcomplex32) - value = (_Complex float)value; - else if (tb->ty == Tcomplex64) - value = (_Complex double)value; -#else - if (tb->ty == Tcomplex32) - { value.re = (float)value.re; - value.im = (float)value.im; - } - else if (tb->ty == Tcomplex64) - { value.re = (double)value.re; - value.im = (double)value.im; - } -#endif -#endif return new ComplexExp(loc, value, type); } if (tb->isscalar()) diff -uNr dmd-0.176/dmd/src/dmd/declaration.c dmd-0.177/dmd/src/dmd/declaration.c --- dmd-0.176/dmd/src/dmd/declaration.c 2006-11-30 21:13:46.000000000 +0100 +++ dmd-0.177/dmd/src/dmd/declaration.c 2006-12-06 13:18:48.000000000 +0100 @@ -837,6 +837,10 @@ } e1 = new SliceExp(loc, e1, NULL, NULL); } + else if (t->ty == Tstruct) + { + ei->exp = new CastExp(loc, ei->exp, type); + } ei->exp = new AssignExp(loc, e1, ei->exp); ei->exp = ei->exp->semantic(sc); ei->exp->optimize(WANTvalue); diff -uNr dmd-0.176/dmd/src/dmd/expression.c dmd-0.177/dmd/src/dmd/expression.c --- dmd-0.176/dmd/src/dmd/expression.c 2006-11-30 22:17:32.000000000 +0100 +++ dmd-0.177/dmd/src/dmd/expression.c 2006-12-08 01:21:40.000000000 +0100 @@ -13,6 +13,7 @@ #include #include #include +#include #if _WIN32 && __DMC__ extern "C" char * __cdecl __locale_decpoint; @@ -705,7 +706,7 @@ { if (type && type->toBasetype()->ty == Tvoid) { error("expression %s is void and has no value", toChars()); -#ifdef DEBUG +#if 0 dump(0); *(char*)0=0; #endif @@ -1361,17 +1362,55 @@ floatToBuffer(buf, type, value); } +void realToMangleBuffer(OutBuffer *buf, real_t value) +{ + /* Rely on %A to get portable mangling. + * Must munge result to get only identifier characters. + * + * Possible values from %A => mangled result + * NAN => NAN + * -INF => NINF + * INF => INF + * -0X1.1BC18BA997B95P+79 => N11BC18BA997B95P79 + * 0X1.9P+2 => 19P2 + */ + + if (isnan(value)) + buf->writestring("NAN"); // no -NAN bugs + else + { + char buffer[32]; + int n = sprintf(buffer, "%LA", value); + assert(n > 0 && n < sizeof(buffer)); + for (int i = 0; i < n; i++) + { char c = buffer[i]; + + switch (c) + { + case '-': + buf->writeByte('N'); + break; + + case '+': + case 'X': + case '.': + break; + + case '0': + if (i < 2) + break; // skip leading 0X + default: + buf->writeByte(c); + break; + } + } + } +} + void RealExp::toMangleBuffer(OutBuffer *buf) { - unsigned char *p = (unsigned char *)&value; -#ifdef IN_GCC - unsigned char buffer[32]; - value.toBytes(buffer, sizeof(buffer)); - p = buffer; -#endif buf->writeByte('e'); - for (int i = REALSIZE-REALPAD - 1; i >= 0; i--) - buf->printf("%02x", p[i]); + realToMangleBuffer(buf, value); } @@ -1487,18 +1526,10 @@ { buf->writeByte('c'); real_t r = toReal(); - for (int j = 0; j < 2; j++) - { - unsigned char *p = (unsigned char *)&r; -#ifdef IN_GCC - unsigned char buffer[32]; - r.toBytes(buffer, sizeof(buffer)); - p = buffer; -#endif - for (int i = 0; i < REALSIZE-REALPAD; i++) - buf->printf("%02x", p[i]); - r = toImaginary(); - } + realToMangleBuffer(buf, r); + buf->writeByte('c'); // separate the two + r = toImaginary(); + realToMangleBuffer(buf, r); } /******************************** IdentifierExp **************************/ @@ -5495,6 +5526,23 @@ { return e->implicitCastTo(sc, to); } + + Type *tob = to->toBasetype(); + if (tob->ty == Tstruct && !tob->equals(e1->type->toBasetype())) + { + /* Look to replace: + * cast(S)t + * with: + * S(t) + */ + + // Rewrite as to.call(e1) + e = new TypeExp(loc, to); + e = new DotIdExp(loc, e, Id::call); + e = new CallExp(loc, e, e1); + e = e->semantic(sc); + return e; + } } return e1->castTo(sc, to); } @@ -6250,9 +6298,10 @@ BinExp::semantic(sc); e2 = resolveProperties(sc, e2); - assert(e1->type); + t1 = e1->type->toBasetype(); + if (t1->ty == Tfunction) { // Rewrite f=value to f(value) Expression *e; @@ -6262,6 +6311,19 @@ return e; } + /* If it is an assignment from a 'foreign' type, + * check for operator overloading. + */ + if (t1->ty == Tclass || t1->ty == Tstruct) + { + if (!e2->type->implicitConvTo(e1->type)) + { + Expression *e = op_overload(sc); + if (e) + return e; + } + } + e2->rvalue(); if (e1->op == TOKarraylength) diff -uNr dmd-0.176/dmd/src/dmd/expression.h dmd-0.177/dmd/src/dmd/expression.h --- dmd-0.176/dmd/src/dmd/expression.h 2006-12-01 01:33:04.000000000 +0100 +++ dmd-0.177/dmd/src/dmd/expression.h 2006-12-07 02:00:14.000000000 +0100 @@ -931,6 +931,7 @@ AssignExp(Loc loc, Expression *e1, Expression *e2); Expression *semantic(Scope *sc); Expression *checkToBoolean(); + Identifier *opId(); // For operator overloading elem *toElem(IRState *irs); }; diff -uNr dmd-0.176/dmd/src/dmd/func.c dmd-0.177/dmd/src/dmd/func.c --- dmd-0.176/dmd/src/dmd/func.c 2006-12-01 00:33:20.000000000 +0100 +++ dmd-0.177/dmd/src/dmd/func.c 2006-12-07 16:42:16.000000000 +0100 @@ -471,7 +471,8 @@ Argument *arg0 = Argument::getNth(f->parameters, 0); if (arg0->type->ty != Tarray || arg0->type->next->ty != Tarray || - arg0->type->next->next->ty != Tchar) + arg0->type->next->next->ty != Tchar || + (arg0->inout != None && arg0->inout != In)) goto Lmainerr; break; } @@ -488,6 +489,36 @@ error("parameters must be main() or main(char[][] args)"); } } + + if (ident == Id::assign && (sd || cd)) + { // Disallow identity assignment operator. + + // opAssign(...) + if (nparams == 0) + { if (f->varargs == 1) + goto Lassignerr; + } + else + { + Argument *arg0 = Argument::getNth(f->parameters, 0); + Type *t0 = arg0->type->toBasetype(); + Type *tb = sd ? sd->type : cd->type; + if (arg0->type->implicitConvTo(tb) || + (sd && t0->ty == Tpointer && t0->next->implicitConvTo(tb)) + ) + { + if (nparams == 1) + goto Lassignerr; + Argument *arg1 = Argument::getNth(f->parameters, 1); + if (arg1->defaultArg) + goto Lassignerr; + } + } + } + return; + +Lassignerr: + error("identity assignment operator overload is illegal"); } // Do the semantic analysis on the internals of the function. @@ -1554,19 +1585,19 @@ int FuncDeclaration::isMain() { - return ident && strcmp(ident->toChars(), "main") == 0 && + return ident == Id::main && linkage != LINKc && !isMember() && !isNested(); } int FuncDeclaration::isWinMain() { - return ident && strcmp(ident->toChars(), "WinMain") == 0 && + return ident == Id::WinMain && linkage != LINKc && !isMember(); } int FuncDeclaration::isDllMain() { - return ident && strcmp(ident->toChars(), "DllMain") == 0 && + return ident == Id::DllMain && linkage != LINKc && !isMember(); } diff -uNr dmd-0.176/dmd/src/dmd/idgen.c dmd-0.177/dmd/src/dmd/idgen.c --- dmd-0.176/dmd/src/dmd/idgen.c 2006-11-28 01:14:18.000000000 +0100 +++ dmd-0.177/dmd/src/dmd/idgen.c 2006-12-07 02:10:38.000000000 +0100 @@ -159,6 +159,7 @@ { "ushr_r", "opUShr_r" }, { "cat", "opCat" }, { "cat_r", "opCat_r" }, + { "assign", "opAssign" }, { "addass", "opAddAssign" }, { "subass", "opSubAssign" }, { "mulass", "opMulAssign" }, @@ -202,6 +203,9 @@ // Special functions { "alloca" }, + { "main" }, + { "WinMain" }, + { "DllMain" }, }; diff -uNr dmd-0.176/dmd/src/dmd/mangle.c dmd-0.177/dmd/src/dmd/mangle.c --- dmd-0.176/dmd/src/dmd/mangle.c 2006-12-01 00:39:54.000000000 +0100 +++ dmd-0.177/dmd/src/dmd/mangle.c 2006-12-05 16:02:18.000000000 +0100 @@ -61,6 +61,9 @@ buf.prependstring("_D"); L1: //printf("deco = '%s'\n", sthis->type->deco); + FuncDeclaration *fd = sthis->isFuncDeclaration(); + if (fd && (fd->needThis() || fd->isNested())) + buf.writeByte(Type::needThisPrefix()); buf.writestring(sthis->type->deco); id = buf.toChars(); diff -uNr dmd-0.176/dmd/src/dmd/mars.c dmd-0.177/dmd/src/dmd/mars.c --- dmd-0.176/dmd/src/dmd/mars.c 2006-11-26 00:42:30.000000000 +0100 +++ dmd-0.177/dmd/src/dmd/mars.c 2006-12-03 23:41:22.000000000 +0100 @@ -60,7 +60,7 @@ copyright = "Copyright (c) 1999-2006 by Digital Mars"; written = "written by Walter Bright"; - version = "v0.176"; + version = "v0.177"; global.structalign = 8; memset(¶ms, 0, sizeof(Param)); diff -uNr dmd-0.176/dmd/src/dmd/mtype.c dmd-0.177/dmd/src/dmd/mtype.c --- dmd-0.176/dmd/src/dmd/mtype.c 2006-12-01 01:06:12.000000000 +0100 +++ dmd-0.177/dmd/src/dmd/mtype.c 2006-12-08 01:24:32.000000000 +0100 @@ -61,6 +61,9 @@ #define LOGDOTEXP 0 // log ::dotExp() #define LOGDEFAULTINIT 0 // log ::defaultInit() +// Allow implicit conversion of T[] to T* +#define IMPLICIT_ARRAY_TO_PTR global.params.useDeprecated + /* These have default values for 32 bit code, they get * adjusted for 64 bit code. */ @@ -134,6 +137,10 @@ return 0; } +char Type::needThisPrefix() +{ + return 'M'; // name mangling prefix for functions needing 'this' +} void Type::init() { int i; @@ -590,10 +597,14 @@ { if (v->init) { - e = v->init->toExpression(); - if (e->op == TOKassign) - { - e = ((AssignExp *)e)->e2; + if (v->init->isVoidInitializer()) + error(e->loc, "%s.init is void", v->toChars()); + else + { e = v->init->toExpression(); + if (e->op == TOKassign) + { + e = ((AssignExp *)e)->e2; + } } return e; } @@ -1762,7 +1773,9 @@ //printf("TypeSArray::implicitConvTo()\n"); // Allow implicit conversion of static array to pointer or dynamic array - if ((to->ty == Tpointer || to->ty == Tarray) && + if (( + (IMPLICIT_ARRAY_TO_PTR && to->ty == Tpointer) || + to->ty == Tarray) && (to->next->ty == Tvoid || next->equals(to->next) /*|| to->next->isBaseOf(next)*/)) { @@ -1917,10 +1930,13 @@ //printf("TypeDArray::implicitConvTo()\n"); // Allow implicit conversion of array to pointer - if (to->ty == Tpointer && (to->next->ty == Tvoid || next->equals(to->next) /*|| to->next->isBaseOf(next)*/)) + if (IMPLICIT_ARRAY_TO_PTR && + to->ty == Tpointer && + (to->next->ty == Tvoid || next->equals(to->next) /*|| to->next->isBaseOf(next)*/)) { return MATCHconvert; } + if (to->ty == Tarray) { int offset = 0; @@ -3101,9 +3117,9 @@ char *name; name = ident->toChars(); - //len = strlen(name); - //buf->printf("%c%d%s", mangleChar[ty], len, name); - buf->printf("%c%s", mangleChar[ty], name); + len = strlen(name); + buf->printf("%c%d%s", mangleChar[ty], len, name); + //buf->printf("%c%s", mangleChar[ty], name); } void TypeIdentifier::toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs) diff -uNr dmd-0.176/dmd/src/dmd/mtype.h dmd-0.177/dmd/src/dmd/mtype.h --- dmd-0.176/dmd/src/dmd/mtype.h 2006-11-17 00:35:02.000000000 +0100 +++ dmd-0.177/dmd/src/dmd/mtype.h 2006-12-05 15:57:36.000000000 +0100 @@ -194,6 +194,7 @@ int dyncast() { return DYNCAST_TYPE; } // kludge for template.isType() int covariant(Type *t); char *toChars(); + static char needThisPrefix(); static void init(); d_uns64 size(); virtual d_uns64 size(Loc loc); diff -uNr dmd-0.176/dmd/src/dmd/opover.c dmd-0.177/dmd/src/dmd/opover.c --- dmd-0.176/dmd/src/dmd/opover.c 2006-10-28 19:37:42.000000000 +0200 +++ dmd-0.177/dmd/src/dmd/opover.c 2006-12-07 01:59:50.000000000 +0100 @@ -131,6 +131,7 @@ Identifier *CatExp::opId() { return Id::cat; } Identifier *CatExp::opId_r() { return Id::cat_r; } +Identifier * AssignExp::opId() { return Id::assign; } Identifier * AddAssignExp::opId() { return Id::addass; } Identifier * MinAssignExp::opId() { return Id::subass; } Identifier * MulAssignExp::opId() { return Id::mulass; } diff -uNr dmd-0.176/dmd/src/dmd/tocsym.c dmd-0.177/dmd/src/dmd/tocsym.c --- dmd-0.176/dmd/src/dmd/tocsym.c 2006-11-29 00:22:56.000000000 +0100 +++ dmd-0.177/dmd/src/dmd/tocsym.c 2006-12-09 00:12:26.000000000 +0100 @@ -66,12 +66,21 @@ Symbol *s; char *id; char *n; + size_t nlen; //printf("Dsymbol::toSymbolX('%s')\n", prefix); n = mangle(); assert(n); - id = (char *) alloca(1 + strlen(n) + sizeof(size_t) * 3 + strlen(prefix) + strlen(suffix) + 1); - sprintf(id,"D%s%d%s%s", n, strlen(prefix), prefix, suffix); + nlen = strlen(n); + if (nlen > 2 && n[0] == '_' && n[1] == 'D') + { + nlen -= 2; + n += 2; + } + id = (char *) alloca(2 + nlen + sizeof(size_t) * 3 + strlen(prefix) + strlen(suffix) + 1); + sprintf(id,"_D%s%d%s%s", n, strlen(prefix), prefix, suffix); + if (type_mangle(t) == mTYman_c || type_mangle(t) == mTYman_std) + id++; // the C mangling will put the '_' back in s = symbol_name(id, sclass, t); //printf("-Dsymbol::toSymbolX() %s\n", id); return s; diff -uNr dmd-0.176/dmd/src/dmd/toobj.c dmd-0.177/dmd/src/dmd/toobj.c --- dmd-0.176/dmd/src/dmd/toobj.c 2006-11-28 02:35:48.000000000 +0100 +++ dmd-0.177/dmd/src/dmd/toobj.c 2006-12-06 00:50:42.000000000 +0100 @@ -329,6 +329,10 @@ // name[] char *name = ident->toChars(); size_t namelen = strlen(name); + if (!(namelen > 9 && memcmp(name, "TypeInfo_", 9) == 0)) + { name = toPrettyChars(); + namelen = strlen(name); + } dtdword(&dt, namelen); dtabytes(&dt, TYnptr, 0, namelen + 1, name); @@ -725,7 +729,7 @@ dtdword(&dt, 0); // initializer // name[] - char *name = ident->toChars(); + char *name = toPrettyChars(); size_t namelen = strlen(name); dtdword(&dt, namelen); dtabytes(&dt, TYnptr, 0, namelen + 1, name); @@ -806,36 +810,41 @@ if (global.params.symdebug) toDebug(); - // Generate static initializer - toInitializer(); - if (parent && parent->isTemplateInstance()) - sinit->Sclass = SCcomdat; - else - sinit->Sclass = SCglobal; - sinit->Sfl = FLdata; - toDt(&sinit->Sdt); + type->getTypeInfo(NULL); // generate TypeInfo -#if !ELFOBJ - /* ELF comdef's generate multiple - * definition errors for them from the gnu linker. - * Need to figure out how to generate proper comdef's for ELF. - */ - // See if we can convert a comdat to a comdef, - // which saves on exe file space. - if (sinit->Sclass == SCcomdat && - sinit->Sdt && - sinit->Sdt->dt == DT_azeros && - sinit->Sdt->DTnext == NULL) + if (1) { - sinit->Sclass = SCglobal; - sinit->Sdt->dt = DT_common; - } + // Generate static initializer + toInitializer(); + if (parent && parent->isTemplateInstance()) + sinit->Sclass = SCcomdat; + else + sinit->Sclass = SCglobal; + sinit->Sfl = FLdata; + toDt(&sinit->Sdt); + +#if !ELFOBJ + /* ELF comdef's generate multiple + * definition errors for them from the gnu linker. + * Need to figure out how to generate proper comdef's for ELF. + */ + // See if we can convert a comdat to a comdef, + // which saves on exe file space. + if (sinit->Sclass == SCcomdat && + sinit->Sdt && + sinit->Sdt->dt == DT_azeros && + sinit->Sdt->DTnext == NULL) + { + sinit->Sclass = SCglobal; + sinit->Sdt->dt = DT_common; + } #endif #if ELFOBJ // Burton - sinit->Sseg = CDATA; -#endif /* ELFOBJ */ - outdata(sinit); + sinit->Sseg = CDATA; +#endif + outdata(sinit); + } // Put out the members for (i = 0; i < members->dim; i++) @@ -996,6 +1005,8 @@ if (global.params.symdebug) toDebug(); + + type->getTypeInfo(NULL); // generate TypeInfo } /* ================================================================== */ @@ -1006,6 +1017,8 @@ if (global.params.symdebug) toDebug(); + + type->getTypeInfo(NULL); // generate TypeInfo } diff -uNr dmd-0.176/dmd/src/dmd/typinf.c dmd-0.177/dmd/src/dmd/typinf.c --- dmd-0.176/dmd/src/dmd/typinf.c 2006-11-28 00:57:30.000000000 +0100 +++ dmd-0.177/dmd/src/dmd/typinf.c 2006-12-05 21:51:22.000000000 +0100 @@ -360,7 +360,7 @@ /* Put out: * char[] name; - * uint xsize; + * byte[] init; * hash_t function(void*) xtoHash; * int function(void*,void*) xopEquals; * int function(void*,void*) xopCmp; @@ -372,7 +372,12 @@ dtdword(pdt, namelen); dtabytes(pdt, TYnptr, 0, namelen + 1, name); - dtdword(pdt, sd->structsize); // xsize + // byte[] init; + dtdword(pdt, sd->structsize); // init.length + if (sd->zeroInit) + dtdword(pdt, 0); // NULL for 0 initialization + else + dtxoff(pdt, sd->toInitializer(), 0, TYnptr); // init.ptr FuncDeclaration *fd; FuncDeclaration *fdx; diff -uNr dmd-0.176/dmd/src/phobos/etc/c/zlib.d dmd-0.177/dmd/src/phobos/etc/c/zlib.d --- dmd-0.176/dmd/src/phobos/etc/c/zlib.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/etc/c/zlib.d 2006-12-09 01:17:16.000000000 +0100 @@ -231,7 +231,7 @@ int deflateInit(z_streamp strm, int level) { - return deflateInit_(strm, level, ZLIB_VERSION, z_stream.sizeof); + return deflateInit_(strm, level, ZLIB_VERSION.ptr, z_stream.sizeof); } /* Initializes the internal stream state for compression. The fields @@ -356,7 +356,7 @@ int inflateInit(z_streamp strm) { - return inflateInit_(strm, ZLIB_VERSION, z_stream.sizeof); + return inflateInit_(strm, ZLIB_VERSION.ptr, z_stream.sizeof); } /* Initializes the internal stream state for decompression. The fields @@ -501,7 +501,7 @@ int strategy) { return deflateInit2_(strm, level, method, windowBits, memLevel, - strategy, ZLIB_VERSION, z_stream.sizeof); + strategy, ZLIB_VERSION.ptr, z_stream.sizeof); } /* This is another version of deflateInit with more compression options. The @@ -753,7 +753,7 @@ int inflateInit2(z_streamp strm, int windowBits) { - return inflateInit2_(strm, windowBits, ZLIB_VERSION, z_stream.sizeof); + return inflateInit2_(strm, windowBits, ZLIB_VERSION.ptr, z_stream.sizeof); } /* This is another version of inflateInit with an extra parameter. The @@ -858,7 +858,7 @@ int inflateBackInit(z_stream* strm, int windowBits, ubyte* window) { - return inflateBackInit_(strm, windowBits, window, ZLIB_VERSION, z_stream.sizeof); + return inflateBackInit_(strm, windowBits, window, ZLIB_VERSION.ptr, z_stream.sizeof); } /* Initialize the internal stream state for decompression using inflateBack() diff -uNr dmd-0.176/dmd/src/phobos/internal/aaA.d dmd-0.177/dmd/src/phobos/internal/aaA.d --- dmd-0.176/dmd/src/phobos/internal/aaA.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/internal/aaA.d 2006-12-09 01:17:16.000000000 +0100 @@ -1,5 +1,10 @@ //_ aaA.d +/** + * Part of the D programming language runtime library. + * Implementation of associative arrays. + */ + /* * Copyright (C) 2000-2006 by Digital Mars, www.digitalmars.com * Written by Walter Bright @@ -29,7 +34,6 @@ import std.string; import std.outofmemory; -// Implementation of associative array // Auto-rehash and pre-allocate - Dave Fladebo static uint[] prime_list = [ @@ -258,20 +262,16 @@ i = key_hash % aa.a.b.length; auto pe = &aa.a.b[i]; while ((e = *pe) != null) - { int c; - - c = key_hash - e.hash; - if (c == 0) + { + if (key_hash == e.hash) { - c = keyti.compare(pkey, e + 1); + auto c = keyti.compare(pkey, e + 1); if (c == 0) goto Lret; + pe = (c < 0) ? &e.left : &e.right; } - - if (c < 0) - pe = &e.left; else - pe = &e.right; + pe = (key_hash < e.hash) ? &e.left : &e.right; } // Not found, create new elem @@ -314,20 +314,16 @@ size_t i = key_hash % len; auto e = aa.a.b[i]; while (e != null) - { int c; - - c = key_hash - e.hash; - if (c == 0) + { + if (key_hash == e.hash) { - c = keyti.compare(pkey, e + 1); + auto c = keyti.compare(pkey, e + 1); if (c == 0) return cast(void *)(e + 1) + keysize; + e = (c < 0) ? e.left : e.right; } - - if (c < 0) - e = e.left; else - e = e.right; + e = (key_hash < e.hash) ? e.left : e.right; } } return null; // not found, caller will throw exception @@ -365,20 +361,16 @@ size_t i = key_hash % len; auto e = aa.a.b[i]; while (e != null) - { int c; - - c = key_hash - e.hash; - if (c == 0) + { + if (key_hash == e.hash) { - c = keyti.compare(pkey, e + 1); + auto c = keyti.compare(pkey, e + 1); if (c == 0) return cast(void *)(e + 1) + aligntsize(keyti.tsize()); + e = (c < 0) ? e.left : e.right; } - - if (c < 0) - e = e.left; else - e = e.right; + e = (key_hash < e.hash) ? e.left : e.right; } } } @@ -405,12 +397,10 @@ size_t i = key_hash % aa.a.b.length; auto pe = &aa.a.b[i]; while ((e = *pe) != null) // null means not found - { int c; - - c = key_hash - e.hash; - if (c == 0) + { + if (key_hash == e.hash) { - c = keyti.compare(pkey, e + 1); + auto c = keyti.compare(pkey, e + 1); if (c == 0) { if (!e.left && !e.right) @@ -443,12 +433,10 @@ // Should notify GC that e can be free'd now break; } + pe = (c < 0) ? &e.left : &e.right; } - - if (c < 0) - pe = &e.left; else - pe = &e.right; + pe = (key_hash < e.hash) ? &e.left : &e.right; } } } @@ -490,7 +478,7 @@ if (aa.a) { a.length = _aaLen(aa); - a.ptr = new byte[a.length * valuesize]; + a.ptr = (new byte[a.length * valuesize]).ptr; resi = 0; foreach (e; aa.a.b) { @@ -536,20 +524,18 @@ size_t i = key_hash % newb.b.length; auto pe = &newb.b[i]; while ((e = *pe) != null) - { int c; - + { //printf("\te = %p, e.left = %p, e.right = %p\n", e, e.left, e.right); assert(e.left != e); assert(e.right != e); - c = key_hash - e.hash; - if (c == 0) - c = keyti.compare(olde + 1, e + 1); - if (c < 0) - pe = &e.left; - else if (c > 0) - pe = &e.right; + if (key_hash == e.hash) + { + auto c = keyti.compare(olde + 1, e + 1); + assert(c != 0); + pe = (c < 0) ? &e.left : &e.right; + } else - assert(0); + pe = (key_hash < e.hash) ? &e.left : &e.right; } *pe = olde; @@ -638,7 +624,7 @@ Array a; a.length = len; - a.ptr = res; + a.ptr = res.ptr; return *cast(ArrayRet_t*)(&a); } diff -uNr dmd-0.176/dmd/src/phobos/internal/adi.d dmd-0.177/dmd/src/phobos/internal/adi.d --- dmd-0.176/dmd/src/phobos/internal/adi.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/internal/adi.d 2006-12-09 01:17:16.000000000 +0100 @@ -1,5 +1,10 @@ //_ adi.d +/** + * Part of the D programming language runtime library. + * Dynamic array property support routines + */ + /* * Copyright (C) 2000-2006 by Digital Mars, www.digitalmars.com * Written by Walter Bright @@ -23,8 +28,6 @@ * distribution. */ -// Dynamic array property support routines - //debug=adi; // uncomment to turn on debugging printf's import std.stdio; @@ -87,9 +90,9 @@ if (stridelo == stridehi) { - memcpy(tmp, lo, stridelo); + memcpy(tmp.ptr, lo, stridelo); memcpy(lo, hi, stridelo); - memcpy(hi, tmp, stridelo); + memcpy(hi, tmp.ptr, stridelo); lo += stridelo; hi--; continue; @@ -97,11 +100,11 @@ /* Shift the whole array. This is woefully inefficient */ - memcpy(tmp, hi, stridehi); - memcpy(tmplo, lo, stridelo); + memcpy(tmp.ptr, hi, stridehi); + memcpy(tmplo.ptr, lo, stridelo); memmove(lo + stridehi, lo + stridelo , hi - (lo + stridelo)); - memcpy(lo, tmp, stridehi); - memcpy(hi + stridehi - stridelo, tmplo, stridelo); + memcpy(lo, tmp.ptr, stridehi); + memcpy(hi + stridehi - stridelo, tmplo.ptr, stridelo); lo += stridehi; hi = hi - 1 + (stridehi - stridelo); @@ -192,10 +195,10 @@ /* Shift the whole array. This is woefully inefficient */ - memcpy(tmp, hi, stridehi * wchar.sizeof); + memcpy(tmp.ptr, hi, stridehi * wchar.sizeof); memcpy(hi + stridehi - stridelo, lo, stridelo * wchar.sizeof); memmove(lo + stridehi, lo + stridelo , (hi - (lo + stridelo)) * wchar.sizeof); - memcpy(lo, tmp, stridehi * wchar.sizeof); + memcpy(lo, tmp.ptr, stridehi * wchar.sizeof); lo += stridehi; hi = hi - 1 + (stridehi - stridelo); @@ -241,7 +244,7 @@ void* lo = a.ptr; void* hi = a.ptr + (a.length - 1) * szelem; - tmp = buffer; + tmp = buffer.ptr; if (szelem > 16) { //version (Win32) diff -uNr dmd-0.176/dmd/src/phobos/internal/arraycat.d dmd-0.177/dmd/src/phobos/internal/arraycat.d --- dmd-0.176/dmd/src/phobos/internal/arraycat.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/internal/arraycat.d 2006-12-09 01:17:16.000000000 +0100 @@ -1,3 +1,7 @@ +/** + * Part of the D programming language runtime library. + */ + /* * Copyright (C) 2004-2006 by Digital Mars, www.digitalmars.com * Written by Walter Bright @@ -57,7 +61,7 @@ b = *p++; if (b.length) { - memcpy(&a[j], b, b.length * size); + memcpy(&a[j], b.ptr, b.length * size); j += b.length * size; } } diff -uNr dmd-0.176/dmd/src/phobos/internal/gc/gc.d dmd-0.177/dmd/src/phobos/internal/gc/gc.d --- dmd-0.176/dmd/src/phobos/internal/gc/gc.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/internal/gc/gc.d 2006-12-09 01:17:16.000000000 +0100 @@ -795,7 +795,7 @@ px.data = newdata; } px.length = newlength; - memcpy(px.data + length * size, y, y.length * size); + memcpy(px.data + length * size, y.ptr, y.length * size); return *cast(long*)px; } @@ -903,7 +903,7 @@ extern (C) byte[] _d_arrayappendc(inout byte[] x, in size_t size, ...) { - size_t cap = _gc.capacity(x); + size_t cap = _gc.capacity(x.ptr); size_t length = x.length; size_t newlength = length + 1; @@ -918,7 +918,7 @@ cap = newCapacity(newlength, size); assert(cap >= newlength * size); newdata = cast(byte *)_gc.malloc(cap + 1); - memcpy(newdata, x, length * size); + memcpy(newdata, x.ptr, length * size); (cast(void **)(&x))[1] = newdata; } byte *argp = cast(byte *)(&size + 1); @@ -968,8 +968,8 @@ return null; byte* p = cast(byte*)_gc.malloc(len + 1); - memcpy(p, x, xlen); - memcpy(p + xlen, y, ylen); + memcpy(p, x.ptr, xlen); + memcpy(p + xlen, y.ptr, ylen); p[len] = 0; return p[0 .. x.length + y.length]; diff -uNr dmd-0.176/dmd/src/phobos/internal/gc/testgc.d dmd-0.177/dmd/src/phobos/internal/gc/testgc.d --- dmd-0.176/dmd/src/phobos/internal/gc/testgc.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/internal/gc/testgc.d 2006-12-09 01:17:16.000000000 +0100 @@ -328,13 +328,13 @@ int[char[]] X; for(int i = 1; i <= n; i++) { - int len = sprintf(str,"%x",i); + int len = sprintf(str.ptr,"%x",i); X[str[0..len].dup] = i; } int c; for(int i = n; i > 0; i--) { - int len = sprintf(str,"%d",i); + int len = sprintf(str.ptr,"%d",i); if(str[0..len] in X) c++; } diff -uNr dmd-0.176/dmd/src/phobos/internal/object.d dmd-0.177/dmd/src/phobos/internal/object.d --- dmd-0.176/dmd/src/phobos/internal/object.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/internal/object.d 2006-12-09 01:17:16.000000000 +0100 @@ -520,9 +520,9 @@ ubyte* pbuffer; if (sz < buffer.sizeof) - tmp = buffer; + tmp = buffer.ptr; else - tmp = pbuffer = new ubyte[sz]; + tmp = pbuffer = (new ubyte[sz]).ptr; for (size_t u = 0; u < len; u += sz) { size_t o = u * sz; @@ -742,7 +742,7 @@ return this is o || ((s = cast(TypeInfo_Struct)o) !is null && this.name == s.name && - this.xsize == s.xsize); + this.init.length == s.init.length); } hash_t getHash(void *p) @@ -759,7 +759,7 @@ // A sorry hash algorithm. // Should use the one for strings. // BUG: relies on the GC not moving objects - for (size_t i = 0; i < xsize; i++) + for (size_t i = 0; i < init.length; i++) { h = h * 9 + *cast(ubyte*)p; p++; } @@ -778,7 +778,7 @@ c = (*xopEquals)(p1, p2); else // BUG: relies on the GC not moving objects - c = (memcmp(p1, p2, xsize) == 0); + c = (memcmp(p1, p2, init.length) == 0); return c; } @@ -796,7 +796,7 @@ c = (*xopCmp)(p1, p2); else // BUG: relies on the GC not moving objects - c = memcmp(p1, p2, xsize); + c = memcmp(p1, p2, init.length); } else c = -1; @@ -806,11 +806,11 @@ size_t tsize() { - return xsize; + return init.length; } char[] name; - size_t xsize; + byte[] init; // initializer; init.ptr == null if 0 initialize hash_t function(void*) xtoHash; int function(void*,void*) xopEquals; diff -uNr dmd-0.176/dmd/src/phobos/internal/qsort.d dmd-0.177/dmd/src/phobos/internal/qsort.d --- dmd-0.176/dmd/src/phobos/internal/qsort.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/internal/qsort.d 2006-12-09 01:17:16.000000000 +0100 @@ -58,7 +58,7 @@ base = cast(byte *)a.ptr; thresh = _maxspan * width; // init threshold - sp = stack; // init stack pointer + sp = stack.ptr; // init stack pointer limit = base + a.length * width; // pointer past end of array while (1) // repeat until done then return { @@ -120,7 +120,7 @@ i += width; } - if (sp > stack) // if any entries on stack... + if (sp > stack.ptr) // if any entries on stack... { sp -= 2; // pop the base and limit base = sp[0]; diff -uNr dmd-0.176/dmd/src/phobos/internal/switch.d dmd-0.177/dmd/src/phobos/internal/switch.d --- dmd-0.176/dmd/src/phobos/internal/switch.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/internal/switch.d 2006-12-09 01:17:16.000000000 +0100 @@ -58,7 +58,7 @@ { int ci; - ci = memcmp(table[j - 1], table[j], len1); + ci = memcmp(table[j - 1].ptr, table[j].ptr, len1); assert(ci < 0); // ci==0 means a duplicate } } @@ -75,7 +75,7 @@ for (i = 0; i < table.length; i++) { if (table[i].length == ca.length) - { cj = memcmp(table[i], ca, ca.length); + { cj = memcmp(table[i].ptr, ca.ptr, ca.length); assert(cj != 0); } } @@ -88,7 +88,7 @@ assert(i < table.length); if (table[i].length == ca.length) { - cj = memcmp(table[i], ca, ca.length); + cj = memcmp(table[i].ptr, ca.ptr, ca.length); if (cj == 0) { assert(i == result); @@ -140,7 +140,7 @@ c = cast(byte)c1 - cast(byte)pca[0]; if (c == 0) { - c = memcmp(ca, pca, ca.length); + c = memcmp(ca.ptr, pca.ptr, ca.length); if (c == 0) { //printf("found %d\n", mid); return mid; @@ -196,7 +196,7 @@ { int c; - c = memcmp(table[j - 1], table[j], len1 * wchar.sizeof); + c = memcmp(table[j - 1].ptr, table[j].ptr, len1 * wchar.sizeof); assert(c < 0); // c==0 means a duplicate } } @@ -213,7 +213,7 @@ for (i = 0; i < table.length; i++) { if (table[i].length == ca.length) - { c = memcmp(table[i], ca, ca.length * wchar.sizeof); + { c = memcmp(table[i].ptr, ca.ptr, ca.length * wchar.sizeof); assert(c != 0); } } @@ -226,7 +226,7 @@ assert(i < table.length); if (table[i].length == ca.length) { - c = memcmp(table[i], ca, ca.length * wchar.sizeof); + c = memcmp(table[i].ptr, ca.ptr, ca.length * wchar.sizeof); if (c == 0) { assert(i == result); @@ -266,7 +266,7 @@ c = ca.length - pca.length; if (c == 0) { - c = memcmp(ca, pca, ca.length * wchar.sizeof); + c = memcmp(ca.ptr, pca.ptr, ca.length * wchar.sizeof); if (c == 0) { //printf("found %d\n", mid); return mid; @@ -321,7 +321,7 @@ { int c; - c = memcmp(table[j - 1], table[j], len1 * dchar.sizeof); + c = memcmp(table[j - 1].ptr, table[j].ptr, len1 * dchar.sizeof); assert(c < 0); // c==0 means a duplicate } } @@ -338,7 +338,7 @@ for (i = 0; i < table.length; i++) { if (table[i].length == ca.length) - { c = memcmp(table[i], ca, ca.length * dchar.sizeof); + { c = memcmp(table[i].ptr, ca.ptr, ca.length * dchar.sizeof); assert(c != 0); } } @@ -351,7 +351,7 @@ assert(i < table.length); if (table[i].length == ca.length) { - c = memcmp(table[i], ca, ca.length * dchar.sizeof); + c = memcmp(table[i].ptr, ca.ptr, ca.length * dchar.sizeof); if (c == 0) { assert(i == result); @@ -391,7 +391,7 @@ c = ca.length - pca.length; if (c == 0) { - c = memcmp(ca, pca, ca.length * dchar.sizeof); + c = memcmp(ca.ptr, pca.ptr, ca.length * dchar.sizeof); if (c == 0) { //printf("found %d\n", mid); return mid; diff -uNr dmd-0.176/dmd/src/phobos/internal/trace.d dmd-0.177/dmd/src/phobos/internal/trace.d --- dmd-0.176/dmd/src/phobos/internal/trace.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/internal/trace.d 2006-12-09 01:17:16.000000000 +0100 @@ -356,7 +356,7 @@ calls,tl,tr,fl,fr,pl,pr,id); } if (id !is s.Sident) - free(id); + free(id.ptr); } } @@ -428,7 +428,7 @@ trace_merge(); // Report results - fplog = fopen(trace_logfilename,"w"); + fplog = fopen(trace_logfilename.ptr, "w"); //fplog = std.c.stdio.stdout; if (fplog) { nsymbols = 0; @@ -439,7 +439,7 @@ } // Output function link order - fpdef = fopen(trace_deffilename,"w"); + fpdef = fopen(trace_deffilename.ptr, "w"); if (fpdef) { fprintf(fpdef,"\nFUNCTIONS\n"); trace_order(root); @@ -685,7 +685,7 @@ SymPair *sfanin; SymPair **psp; - if (trace_logfilename && (fp = fopen(trace_logfilename,"r")) != null) + if (trace_logfilename && (fp = fopen(trace_logfilename.ptr, "r")) != null) { buf = null; sfanin = null; diff -uNr dmd-0.176/dmd/src/phobos/object.d dmd-0.177/dmd/src/phobos/object.d --- dmd-0.176/dmd/src/phobos/object.d 2006-12-02 22:57:36.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/object.d 2006-12-09 01:17:14.000000000 +0100 @@ -111,7 +111,7 @@ class TypeInfo_Struct : TypeInfo { char[] name; - size_t xsize; + byte[] init; uint function(void*) xtoHash; int function(void*,void*) xopEquals; diff -uNr dmd-0.176/dmd/src/phobos/std/array.d dmd-0.177/dmd/src/phobos/std/array.d --- dmd-0.176/dmd/src/phobos/std/array.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/array.d 2006-12-09 01:17:14.000000000 +0100 @@ -18,7 +18,7 @@ char[] buffer = new char[19 + filename.length + linnum.sizeof * 3 + 1]; int len; - len = sprintf(buffer, "ArrayBoundsError %.*s(%u)", filename, linnum); + len = sprintf(buffer.ptr, "ArrayBoundsError %.*s(%u)", filename, linnum); super(buffer[0..len]); } } diff -uNr dmd-0.176/dmd/src/phobos/std/boxer.d dmd-0.177/dmd/src/phobos/std/boxer.d --- dmd-0.176/dmd/src/phobos/std/boxer.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/boxer.d 2006-12-09 01:17:14.000000000 +0100 @@ -276,7 +276,7 @@ args[0..(char[]).sizeof] = (cast(void*) &format)[0..(char[]).sizeof]; args[(char[]).sizeof..length] = data; - std.format.doFormat(&putc, arguments, args); + std.format.doFormat(&putc, arguments, args.ptr); delete args; return string; @@ -313,7 +313,7 @@ assert (0); } - return cast(bool)type.equals(data, other.data); + return cast(bool)type.equals(data.ptr, other.data.ptr); } /** @@ -368,7 +368,7 @@ assert (0); } - return type.compare(data, other.data); + return type.compare(data.ptr, other.data.ptr); } /** @@ -385,7 +385,7 @@ */ hash_t toHash() { - return type.getHash(data); + return type.getHash(data.ptr); } } @@ -422,7 +422,7 @@ if (size <= result.p_shortData.length) result.p_shortData[0..size] = data[0..size]; else - result.p_longData = data[0..size].dup; + result.p_longData = data[0..size].dup.ptr; return result; } @@ -470,7 +470,7 @@ dataLength += argumentLength(item.data.length); types = new TypeInfo[arguments.length]; - pointer = data = new void[dataLength]; + pointer = data = (new void[dataLength]).ptr; /* Stash both types and data. */ foreach (size_t index, Box item; arguments) @@ -690,7 +690,7 @@ if (typeid(void*) is value.type && *cast(void**) value.data is null) return null; if (typeid(T[]) is value.type) - return *cast(T[]*) value.data; + return (*cast(T[]*) value.data).ptr; throw new UnboxException(value, typeid(T*)); } @@ -705,7 +705,7 @@ if (cast(TypeInfo_Pointer) value.type) return *cast(void**) value.data; if (isArrayTypeInfo(value.type)) - return *cast(void[]*) value.data; + return (*cast(void[]*) value.data).ptr; if (typeid(Object) == value.type) return *cast(Object*) value.data; diff -uNr dmd-0.176/dmd/src/phobos/std/conv.d dmd-0.177/dmd/src/phobos/std/conv.d --- dmd-0.176/dmd/src/phobos/std/conv.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/conv.d 2006-12-09 01:17:14.000000000 +0100 @@ -886,7 +886,7 @@ f = strtof(sz, &endptr); if (getErrno() == ERANGE) goto Lerr; - if (endptr && (endptr == s || *endptr != 0)) + if (endptr && (endptr == s.ptr || *endptr != 0)) goto Lerr; return f; @@ -950,7 +950,7 @@ f = strtod(sz, &endptr); if (getErrno() == ERANGE) goto Lerr; - if (endptr && (endptr == s || *endptr != 0)) + if (endptr && (endptr == s.ptr || *endptr != 0)) goto Lerr; return f; @@ -1016,7 +1016,7 @@ f = strtold(sz, &endptr); if (getErrno() == ERANGE) goto Lerr; - if (endptr && (endptr == s || *endptr != 0)) + if (endptr && (endptr == s.ptr || *endptr != 0)) goto Lerr; return f; diff -uNr dmd-0.176/dmd/src/phobos/std/cover.d dmd-0.177/dmd/src/phobos/std/cover.d --- dmd-0.176/dmd/src/phobos/std/cover.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/cover.d 2006-12-09 01:17:14.000000000 +0100 @@ -143,7 +143,7 @@ } } - FILE *flst = std.c.stdio.fopen(lstfilename, "wb"); + FILE *flst = std.c.stdio.fopen(lstfilename.ptr, "wb"); if (!flst) throw new std.file.FileException(lstfilename, "cannot open for write"); diff -uNr dmd-0.176/dmd/src/phobos/std/cpuid.d dmd-0.177/dmd/src/phobos/std/cpuid.d --- dmd-0.176/dmd/src/phobos/std/cpuid.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/cpuid.d 2006-12-09 01:17:14.000000000 +0100 @@ -220,7 +220,7 @@ */ private void getVendorString() { - char* dst = vendorStr; + char* dst = vendorStr.ptr; // puts the vendor string into dst asm { @@ -236,7 +236,7 @@ private void getProcessorString() { char[48] buffer; - char* dst = buffer; + char* dst = buffer.ptr; // puts the processor string into dst asm { diff -uNr dmd-0.176/dmd/src/phobos/std/date.d dmd-0.177/dmd/src/phobos/std/date.d --- dmd-0.176/dmd/src/phobos/std/date.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/date.d 2006-12-09 01:17:14.000000000 +0100 @@ -504,7 +504,7 @@ //printf("hr = %d, offset = %g, LocalTZA = %g, dst = %g, + = %g\n", hr, offset, LocalTZA, dst, LocalTZA + dst); - len = sprintf(buffer, "%.3s %.3s %02d %02d:%02d:%02d GMT%c%02d%02d %d", + len = sprintf(buffer.ptr, "%.3s %.3s %02d %02d:%02d:%02d GMT%c%02d%02d %d", &daystr[WeekDay(t) * 3], &monstr[MonthFromTime(t) * 3], DateFromTime(t), @@ -534,7 +534,7 @@ if (t == d_time_nan) return "Invalid Date"; - len = sprintf(buffer, "%.3s, %02d %.3s %d %02d:%02d:%02d UTC", + len = sprintf(buffer.ptr, "%.3s, %02d %.3s %d %02d:%02d:%02d UTC", &daystr[WeekDay(t) * 3], DateFromTime(t), &monstr[MonthFromTime(t) * 3], YearFromTime(t), @@ -570,7 +570,7 @@ offset = LocalTZA + dst; t = time + offset; - len = sprintf(buffer, "%.3s %.3s %02d %d", + len = sprintf(buffer.ptr, "%.3s %.3s %02d %d", &daystr[WeekDay(t) * 3], &monstr[MonthFromTime(t) * 3], DateFromTime(t), @@ -620,7 +620,7 @@ //printf("hr = %d, offset = %g, LocalTZA = %g, dst = %g, + = %g\n", hr, offset, LocalTZA, dst, LocalTZA + dst); - len = sprintf(buffer, "%02d:%02d:%02d GMT%c%02d%02d", + len = sprintf(buffer.ptr, "%02d:%02d:%02d GMT%c%02d%02d", HourFromTime(t), MinFromTime(t), SecFromTime(t), sign, hr, mn); diff -uNr dmd-0.176/dmd/src/phobos/std/file.d dmd-0.177/dmd/src/phobos/std/file.d --- dmd-0.176/dmd/src/phobos/std/file.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/file.d 2006-12-09 01:17:14.000000000 +0100 @@ -117,7 +117,7 @@ buf = new byte[size]; - if (ReadFile(h,buf,size,&numread,null) != 1) + if (ReadFile(h,buf.ptr,size,&numread,null) != 1) goto err2; if (numread != size) @@ -161,7 +161,7 @@ if (h == INVALID_HANDLE_VALUE) goto err; - if (WriteFile(h,buffer,buffer.length,&numwritten,null) != 1) + if (WriteFile(h,buffer.ptr,buffer.length,&numwritten,null) != 1) goto err2; if (buffer.length != numwritten) @@ -205,7 +205,7 @@ SetFilePointer(h, 0, null, FILE_END); - if (WriteFile(h,buffer,buffer.length,&numwritten,null) != 1) + if (WriteFile(h,buffer.ptr,buffer.length,&numwritten,null) != 1) goto err2; if (buffer.length != numwritten) @@ -462,7 +462,7 @@ if (!len) goto Lerr; dir = new wchar[len]; - len = GetCurrentDirectoryW(len, dir); + len = GetCurrentDirectoryW(len, dir.ptr); if (!len) goto Lerr; return std.utf.toUTF8(dir[0 .. len]); // leave off terminating 0 @@ -477,7 +477,7 @@ if (!len) goto Lerr; dir = new char[len]; - len = GetCurrentDirectoryA(len, dir); + len = GetCurrentDirectoryA(len, dir.ptr); if (!len) goto Lerr; return dir[0 .. len]; // leave off terminating 0 @@ -507,13 +507,13 @@ size_t wlength; size_t n; - clength = std.string.strlen(fd.cFileName); + clength = std.string.strlen(fd.cFileName.ptr); // Convert cFileName[] to unicode - wlength = MultiByteToWideChar(0,0,fd.cFileName,clength,null,0); + wlength = MultiByteToWideChar(0,0,fd.cFileName.ptr,clength,null,0); if (wlength > wbuf.length) wbuf.length = wlength; - n = MultiByteToWideChar(0,0,fd.cFileName,clength,cast(wchar*)wbuf,wlength); + n = MultiByteToWideChar(0,0,fd.cFileName.ptr,clength,cast(wchar*)wbuf,wlength); assert(n == wlength); // toUTF8() returns a new buffer name = std.path.join(path, std.utf.toUTF8(wbuf[0 .. wlength])); @@ -527,7 +527,7 @@ void init(char[] path, WIN32_FIND_DATAW *fd) { - size_t clength = std.string.wcslen(fd.cFileName); + size_t clength = std.string.wcslen(fd.cFileName.ptr); name = std.path.join(path, std.utf.toUTF8(fd.cFileName[0 .. clength])); size = (cast(ulong)fd.nFileSizeHigh << 32) | fd.nFileSizeLow; creationTime = std.date.FILETIME2d_time(&fd.ftCreationTime); @@ -762,8 +762,8 @@ do { // Skip "." and ".." - if (std.string.wcscmp(fileinfo.cFileName, ".") == 0 || - std.string.wcscmp(fileinfo.cFileName, "..") == 0) + if (std.string.wcscmp(fileinfo.cFileName.ptr, ".") == 0 || + std.string.wcscmp(fileinfo.cFileName.ptr, "..") == 0) continue; de.init(pathname, &fileinfo); @@ -789,8 +789,8 @@ do { // Skip "." and ".." - if (std.string.strcmp(fileinfo.cFileName, ".") == 0 || - std.string.strcmp(fileinfo.cFileName, "..") == 0) + if (std.string.strcmp(fileinfo.cFileName.ptr, ".") == 0 || + std.string.strcmp(fileinfo.cFileName.ptr, "..") == 0) continue; de.init(pathname, &fileinfo); @@ -948,7 +948,7 @@ if (fd == -1) goto err; - numwritten = std.c.linux.linux.write(fd, buffer, buffer.length); + numwritten = std.c.linux.linux.write(fd, buffer.ptr, buffer.length); if (buffer.length != numwritten) goto err2; @@ -979,7 +979,7 @@ if (fd == -1) goto err; - numwritten = std.c.linux.linux.write(fd, buffer, buffer.length); + numwritten = std.c.linux.linux.write(fd, buffer.ptr, buffer.length); if (buffer.length != numwritten) goto err2; @@ -1219,7 +1219,7 @@ ubyte didstat; // done lazy evaluation of stat() void init(char[] path, dirent *fd) - { size_t len = std.string.strlen(fd.d_name); + { size_t len = std.string.strlen(fd.d_name.ptr); name = std.path.join(path, fd.d_name[0 .. len]); d_type = fd.d_type; didstat = 0; @@ -1367,8 +1367,8 @@ while((fdata = readdir(h)) != null) { // Skip "." and ".." - if (!std.string.strcmp(fdata.d_name, ".") || - !std.string.strcmp(fdata.d_name, "..")) + if (!std.string.strcmp(fdata.d_name.ptr, ".") || + !std.string.strcmp(fdata.d_name.ptr, "..")) continue; de.init(pathname, fdata); diff -uNr dmd-0.176/dmd/src/phobos/std/format.d dmd-0.177/dmd/src/phobos/std/format.d --- dmd-0.176/dmd/src/phobos/std/format.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/format.d 2006-12-09 01:17:14.000000000 +0100 @@ -580,7 +580,7 @@ { int n; sl = fbuf.length; - n = snprintf(fbuf, sl, format, field_width, precision, v); + n = snprintf(fbuf.ptr, sl, format.ptr, field_width, precision, v); //printf("format = '%s', n = %d\n", cast(char*)format, n); if (n >= 0 && n < sl) { sl = n; diff -uNr dmd-0.176/dmd/src/phobos/std/loader.d dmd-0.177/dmd/src/phobos/std/loader.d --- dmd-0.176/dmd/src/phobos/std/loader.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/loader.d 2006-12-09 01:17:14.000000000 +0100 @@ -276,7 +276,7 @@ char szFileName[260]; // Need to use a constant here // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getmodulefilename.asp - uint cch = GetModuleFileNameA(cast(HModule_)hModule, szFileName, szFileName.length); + uint cch = GetModuleFileNameA(cast(HModule_)hModule, szFileName.ptr, szFileName.length); if (cch == 0) { @@ -660,7 +660,7 @@ char szFileName[260]; // Need to use a constant here // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getmodulefilename.asp - uint cch = GetModuleFileNameA(cast(HModule_)m_hModule, szFileName, szFileName.length); + uint cch = GetModuleFileNameA(cast(HModule_)m_hModule, szFileName.ptr, szFileName.length); if (cch == 0) throw new ExeModuleException(GetLastError()); diff -uNr dmd-0.176/dmd/src/phobos/std/math2.d dmd-0.177/dmd/src/phobos/std/math2.d --- dmd-0.176/dmd/src/phobos/std/math2.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/math2.d 2006-12-09 01:17:14.000000000 +0100 @@ -909,49 +909,3 @@ assert(feq(atof("0x1a2.3b4P2"), 0x1a2.3b4P2)); } -/************************************* - * Convert float to string - */ - -char[] toString(real x) -{ -// BUG: this code is broken, returning a pointer into the stack - char[1024] buffer; - char* p = buffer; - uint psize = buffer.length; - int count; - while (true) - { - version(Win32) - { - count = _snprintf(p, psize, "%Lg", x); - if (count != -1) - break; - psize *= 2; - p = cast(char*) alloca(psize); - } - else version(linux) - { - count = snprintf(p, psize, "%Lg", x); - if (count == -1) - psize *= 2; - else if (count >= psize) - psize = count + 1; - else - break; - /+ - if (p != buffer) - c.stdlib.free(p); - p = cast(char*) c.stdlib.malloc(psize); - +/ - p = cast(char*) alloca(psize); - } - } - return p[0 .. count]; -} - -unittest -{ - assert(!cmp(toString(123.456), "123.456")); -} - diff -uNr dmd-0.176/dmd/src/phobos/std/md5.d dmd-0.177/dmd/src/phobos/std/md5.d --- dmd-0.176/dmd/src/phobos/std/md5.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/md5.d 2006-12-09 01:17:14.000000000 +0100 @@ -245,11 +245,11 @@ /* Transform as many times as possible. */ if (inputLen >= partLen) { - std.c.string.memcpy(&buffer[index], input, partLen); - transform (buffer); + std.c.string.memcpy(&buffer[index], input.ptr, partLen); + transform (buffer.ptr); for (i = partLen; i + 63 < inputLen; i += 64) - transform ((cast(ubyte[])input)[i .. i + 64]); + transform ((cast(ubyte[])input)[i .. i + 64].ptr); index = 0; } @@ -273,7 +273,7 @@ /* Save number of bits */ cnt[0] = cast(uint)count; cnt[1] = cast(uint)(count >> 32); - Encode (bits, cnt, 8); + Encode (bits.ptr, cnt.ptr, 8); /* Pad out to 56 mod 64. */ index = (cast(uint)count >> 3) & (64 - 1); @@ -284,7 +284,7 @@ update (bits); /* Store state in digest */ - Encode (digest, state, 16); + Encode (digest.ptr, state.ptr, 16); /* Zeroize sensitive information. */ std.c.string.memset (this, 0, MD5_CTX.sizeof); @@ -322,7 +322,7 @@ d = state[3]; uint[16] x; - Decode (x, block, 64); + Decode (x.ptr, block, 64); /* Round 1 */ FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ diff -uNr dmd-0.176/dmd/src/phobos/std/mmfile.d dmd-0.177/dmd/src/phobos/std/mmfile.d --- dmd-0.176/dmd/src/phobos/std/mmfile.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/mmfile.d 2006-12-09 01:17:14.000000000 +0100 @@ -337,7 +337,7 @@ debug (MMFILE) printf("MmFile.flush()\n"); version (Win32) { - FlushViewOfFile(data, data.length); + FlushViewOfFile(data.ptr, data.length); } else version (linux) { @@ -431,7 +431,7 @@ /* Note that under Windows 95, UnmapViewOfFile() seems to return * random values, not TRUE or FALSE. */ - if (data && UnmapViewOfFile(data) == FALSE && + if (data && UnmapViewOfFile(data.ptr) == FALSE && (dwVersion & 0x80000000) == 0) errNo(); } else { diff -uNr dmd-0.176/dmd/src/phobos/std/outbuffer.d dmd-0.177/dmd/src/phobos/std/outbuffer.d --- dmd-0.176/dmd/src/phobos/std/outbuffer.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/outbuffer.d 2006-12-09 01:17:14.000000000 +0100 @@ -245,7 +245,7 @@ int count; f = toStringz(format); - p = buffer; + p = buffer.ptr; psize = buffer.length; for (;;) { diff -uNr dmd-0.176/dmd/src/phobos/std/path.d dmd-0.177/dmd/src/phobos/std/path.d --- dmd-0.176/dmd/src/phobos/std/path.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/path.d 2006-12-09 01:17:14.000000000 +0100 @@ -1163,7 +1163,7 @@ // Obtain info from database. passwd *verify; std.c.stdlib.setErrno(0); - if (getpwnam_r(username, &result, extra_memory, extra_memory_size, + if (getpwnam_r(username.ptr, &result, extra_memory, extra_memory_size, &verify) == 0) { // Failure if verify doesn't point at result. diff -uNr dmd-0.176/dmd/src/phobos/std/regexp.d dmd-0.177/dmd/src/phobos/std/regexp.d --- dmd-0.176/dmd/src/phobos/std/regexp.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/regexp.d 2006-12-09 01:17:14.000000000 +0100 @@ -816,7 +816,7 @@ if (re_nsub > oldre_nsub) { - if (pmatch is &gmatch) + if (pmatch.ptr is &gmatch) pmatch = null; pmatch.length = re_nsub + 1; } @@ -1774,13 +1774,13 @@ for (; count < m; count++) { int s1; - memcpy(psave, pmatch, (re_nsub + 1) * regmatch_t.sizeof); + memcpy(psave, pmatch.ptr, (re_nsub + 1) * regmatch_t.sizeof); s1 = src; if (trymatch(pop + len, program.length)) { src = s1; - memcpy(pmatch, psave, (re_nsub + 1) * regmatch_t.sizeof); + memcpy(pmatch.ptr, psave, (re_nsub + 1) * regmatch_t.sizeof); break; } @@ -1803,7 +1803,7 @@ { int s1; int s2; - memcpy(psave, pmatch, (re_nsub + 1) * regmatch_t.sizeof); + memcpy(psave, pmatch.ptr, (re_nsub + 1) * regmatch_t.sizeof); s1 = src; if (!trymatch(pop, pop + len)) { debug(regexp) printf("\tdoesn't match subexpression\n"); @@ -1826,7 +1826,7 @@ if (trymatch(pop + len, program.length)) { src = s1; // no match - memcpy(pmatch, psave, (re_nsub + 1) * regmatch_t.sizeof); + memcpy(pmatch.ptr, psave, (re_nsub + 1) * regmatch_t.sizeof); break; } } diff -uNr dmd-0.176/dmd/src/phobos/std/socket.d dmd-0.177/dmd/src/phobos/std/socket.d --- dmd-0.176/dmd/src/phobos/std/socket.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/socket.d 2006-12-09 01:17:14.000000000 +0100 @@ -801,7 +801,7 @@ version(Win32) { nbytes = max * socket_t.sizeof; - buf = new byte[nbytes + uint.sizeof]; + buf = (new byte[nbytes + uint.sizeof]).ptr; count = 0; } else version(BsdSockets) @@ -809,7 +809,7 @@ nbytes = max / NFDBITS * socket_t.sizeof; if(max % NFDBITS) nbytes += socket_t.sizeof; - buf = new byte[nbytes]; // new initializes to 0. + buf = (new byte[nbytes]).ptr; // new initializes to 0. } } @@ -1271,7 +1271,7 @@ static char[] hostName() // getter { char[256] result; // Host names are limited to 255 chars. - if(_SOCKET_ERROR == .gethostname(result, result.length)) + if(_SOCKET_ERROR == .gethostname(result.ptr, result.length)) throw new SocketException("Unable to obtain host name", _lasterr()); return std.string.toString(cast(char*)result).dup; } @@ -1309,7 +1309,7 @@ //returns number of bytes actually sent, or -1 on error int send(void[] buf, SocketFlags flags) { - int sent = .send(sock, buf, buf.length, cast(int)flags); + int sent = .send(sock, buf.ptr, buf.length, cast(int)flags); return sent; } @@ -1324,7 +1324,7 @@ */ int sendTo(void[] buf, SocketFlags flags, Address to) { - int sent = .sendto(sock, buf, buf.length, cast(int)flags, to.name(), to.nameLen()); + int sent = .sendto(sock, buf.ptr, buf.length, cast(int)flags, to.name(), to.nameLen()); return sent; } @@ -1339,7 +1339,7 @@ /// ditto int sendTo(void[] buf, SocketFlags flags) { - int sent = .sendto(sock, buf, buf.length, cast(int)flags, null, 0); + int sent = .sendto(sock, buf.ptr, buf.length, cast(int)flags, null, 0); return sent; } @@ -1363,7 +1363,7 @@ { if(!buf.length) //return 0 and don't think the connection closed return 0; - int read = .recv(sock, buf, buf.length, cast(int)flags); + int read = .recv(sock, buf.ptr, buf.length, cast(int)flags); // if(!read) //connection closed return read; } @@ -1387,7 +1387,7 @@ return 0; from = newFamilyObject(); int nameLen = from.nameLen(); - int read = .recvfrom(sock, buf, buf.length, cast(int)flags, from.name(), &nameLen); + int read = .recvfrom(sock, buf.ptr, buf.length, cast(int)flags, from.name(), &nameLen); assert(from.addressFamily() == _family); // if(!read) //connection closed return read; @@ -1407,7 +1407,7 @@ { if(!buf.length) //return 0 and don't think the connection closed return 0; - int read = .recvfrom(sock, buf, buf.length, cast(int)flags, null, null); + int read = .recvfrom(sock, buf.ptr, buf.length, cast(int)flags, null, null); // if(!read) //connection closed return read; } @@ -1426,7 +1426,7 @@ int getOption(SocketOptionLevel level, SocketOption option, void[] result) { int len = result.length; - if(_SOCKET_ERROR == .getsockopt(sock, cast(int)level, cast(int)option, result, &len)) + if(_SOCKET_ERROR == .getsockopt(sock, cast(int)level, cast(int)option, result.ptr, &len)) throw new SocketException("Unable to get socket option", _lasterr()); return len; } @@ -1449,7 +1449,7 @@ // Set a socket option. void setOption(SocketOptionLevel level, SocketOption option, void[] value) { - if(_SOCKET_ERROR == .setsockopt(sock, cast(int)level, cast(int)option, value, value.length)) + if(_SOCKET_ERROR == .setsockopt(sock, cast(int)level, cast(int)option, value.ptr, value.length)) throw new SocketException("Unable to set socket option", _lasterr()); } diff -uNr dmd-0.176/dmd/src/phobos/std/stream.d dmd-0.177/dmd/src/phobos/std/stream.d --- dmd-0.176/dmd/src/phobos/std/stream.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/stream.d 2006-12-09 01:17:14.000000000 +0100 @@ -420,7 +420,7 @@ // reads block of data big enough to fill the given // array, returns actual number of bytes read size_t read(ubyte[] buffer) { - return readBlock(buffer, buffer.length); + return readBlock(buffer.ptr, buffer.length); } // read a single value of desired type, @@ -598,7 +598,7 @@ // ReadException on error char[] readString(size_t length) { char[] result = new char[length]; - readExact(result, length); + readExact(result.ptr, length); return result; } @@ -606,7 +606,7 @@ // ReadException on error wchar[] readStringW(size_t length) { wchar[] result = new wchar[length]; - readExact(result, result.length * wchar.sizeof); + readExact(result.ptr, result.length * wchar.sizeof); return result; } @@ -1045,7 +1045,7 @@ // writes the given array of bytes, returns // actual number of bytes written size_t write(ubyte[] buffer) { - return writeBlock(buffer, buffer.length); + return writeBlock(buffer.ptr, buffer.length); } // write a single value of desired type, @@ -1107,12 +1107,12 @@ // writes a string, throws WriteException on error void writeString(char[] s) { - writeExact(s, s.length); + writeExact(s.ptr, s.length); } // writes a Unicode string, throws WriteException on error void writeStringW(wchar[] s) { - writeExact(s, s.length * wchar.sizeof); + writeExact(s.ptr, s.length * wchar.sizeof); } // writes data to stream using vprintf() syntax, @@ -1121,7 +1121,7 @@ // shamelessly stolen from OutBuffer, // by Walter's permission char[1024] buffer; - char* p = buffer; + char* p = buffer.ptr; char* f = toStringz(format); size_t psize = buffer.length; size_t count; @@ -1196,8 +1196,8 @@ } else { ubyte[128] buf; while (!s.eof()) { - size_t m = s.readBlock(buf, buf.length); - writeExact(buf, m); + size_t m = s.readBlock(buf.ptr, buf.length); + writeExact(buf.ptr, m); } } } @@ -1211,8 +1211,8 @@ ubyte[128] buf; while (count > 0) { size_t n = cast(size_t)(count 1024) - R2 = new char[Rsize]; + R2 = (new char[Rsize]).ptr; else { R2 = cast(char *)alloca(Rsize * char.sizeof); if (!R2) @@ -196,7 +196,7 @@ Rsize = 2 * (Rlen + L * 3); if (Rsize > 1024) - R2 = new char[Rsize]; + R2 = (new char[Rsize]).ptr; else { R2 = cast(char *)alloca(Rsize * char.sizeof); if (!R2) @@ -248,12 +248,12 @@ uint Rsize; // alloc'd size len = string.length; - s = string; + s = string.ptr; // Preallocate result buffer R guaranteed to be large enough for result Rsize = len; if (Rsize > 1024 / dchar.sizeof) - R = new dchar[Rsize]; + R = (new dchar[Rsize]).ptr; else { R = cast(dchar *)alloca(Rsize * dchar.sizeof); if (!R) diff -uNr dmd-0.176/dmd/src/phobos/std/utf.d dmd-0.177/dmd/src/phobos/std/utf.d --- dmd-0.176/dmd/src/phobos/std/utf.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/utf.d 2006-12-09 01:17:14.000000000 +0100 @@ -816,7 +816,7 @@ } } r ~= "\000"; - return r; + return r.ptr; } /** ditto */ diff -uNr dmd-0.176/dmd/src/phobos/std/windows/charset.d dmd-0.177/dmd/src/phobos/std/windows/charset.d --- dmd-0.176/dmd/src/phobos/std/windows/charset.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/windows/charset.d 2006-12-09 01:17:16.000000000 +0100 @@ -68,7 +68,7 @@ sysErrorString(GetLastError())); } - return result; + return result.ptr; } } return std.string.toStringz(s); diff -uNr dmd-0.176/dmd/src/phobos/std/windows/registry.d dmd-0.177/dmd/src/phobos/std/windows/registry.d --- dmd-0.176/dmd/src/phobos/std/windows/registry.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/windows/registry.d 2006-12-09 01:17:16.000000000 +0100 @@ -589,7 +589,7 @@ { cchName = name.length; - res = RegEnumKeyExA(hkey, index, name, cchName, RESERVED, null, null, null); + res = RegEnumKeyExA(hkey, index, name.ptr, cchName, RESERVED, null, null, null); if(ERROR_MORE_DATA != res) { @@ -694,7 +694,7 @@ if(ERROR_MORE_DATA == res) { - data = new byte[cbData]; + data = (new byte[cbData]).ptr; res = RegQueryValueExA( hkey, toStringz(name), RESERVED, type, data , cbData); @@ -752,14 +752,14 @@ { char[] data = new char[256]; DWORD cbData = data.sizeof; - LONG res = RegQueryValueExA( hkey, toStringz(name), RESERVED, type - , data, cbData); + LONG res = RegQueryValueExA( hkey, toStringz(name), RESERVED, type + , data.ptr, cbData); if(ERROR_MORE_DATA == res) { data.length = cbData; - res = RegQueryValueExA(hkey, toStringz(name), RESERVED, type, data, cbData); + res = RegQueryValueExA(hkey, toStringz(name), RESERVED, type, data.ptr, cbData); } else if(ERROR_SUCCESS == res) { @@ -869,13 +869,13 @@ byte[] data = new byte[100]; DWORD cbData = data.sizeof; LONG res = RegQueryValueExA( hkey, toStringz(name), RESERVED, type - , data, cbData); + , data.ptr, cbData); if(ERROR_MORE_DATA == res) { data.length = cbData; - res = RegQueryValueExA(hkey, toStringz(name), RESERVED, type, data, cbData); + res = RegQueryValueExA(hkey, toStringz(name), RESERVED, type, data.ptr, cbData); } if(ERROR_SUCCESS != res) @@ -1312,7 +1312,7 @@ { Reg_SetValueExA_(m_hkey, name, asEXPAND_SZ ? REG_VALUE_TYPE.REG_EXPAND_SZ - : REG_VALUE_TYPE.REG_SZ, value + : REG_VALUE_TYPE.REG_SZ, value.ptr , value.length); } @@ -1349,7 +1349,7 @@ base = 1 + top; } - Reg_SetValueExA_(m_hkey, name, REG_VALUE_TYPE.REG_MULTI_SZ, cs, cs.length); + Reg_SetValueExA_(m_hkey, name, REG_VALUE_TYPE.REG_MULTI_SZ, cs.ptr, cs.length); } /// Sets the named value with the given binary value @@ -1359,7 +1359,7 @@ /// \note If a value corresponding to the requested name is not found, a RegistryException is thrown void setValue(char[] name, byte[] value) { - Reg_SetValueExA_(m_hkey, name, REG_VALUE_TYPE.REG_BINARY, value, value.length); + Reg_SetValueExA_(m_hkey, name, REG_VALUE_TYPE.REG_BINARY, value.ptr, value.length); } /// Deletes the named value @@ -1480,7 +1480,7 @@ DWORD cchRequired = ExpandEnvironmentStringsA(lpSrc, null, 0); char[] newValue = new char[cchRequired]; - if(!ExpandEnvironmentStringsA(lpSrc, newValue, newValue.length)) + if(!ExpandEnvironmentStringsA(lpSrc, newValue.ptr, newValue.length)) { throw new Win32Exception("Failed to expand environment variables"); } @@ -1990,7 +1990,7 @@ assert(ERROR_SUCCESS == res); - res = Reg_EnumValueName_(hkey, index, sName, cchName); + res = Reg_EnumValueName_(hkey, index, sName.ptr, cchName); if(ERROR_SUCCESS != res) { @@ -2027,7 +2027,7 @@ { DWORD cchName = 1 + cchValueMaxLen; - res = Reg_EnumValueName_(hkey, index, sName, cchName); + res = Reg_EnumValueName_(hkey, index, sName.ptr, cchName); if(ERROR_NO_MORE_ITEMS == res) { // Enumeration complete @@ -2117,7 +2117,7 @@ assert(ERROR_SUCCESS == res); - res = Reg_EnumValueName_(hkey, index, sName, cchName); + res = Reg_EnumValueName_(hkey, index, sName.ptr, cchName); if(ERROR_SUCCESS != res) { @@ -2154,7 +2154,7 @@ { DWORD cchName = 1 + cchValueMaxLen; - res = Reg_EnumValueName_(hkey, index, sName, cchName); + res = Reg_EnumValueName_(hkey, index, sName.ptr, cchName); if(ERROR_NO_MORE_ITEMS == res) { // Enumeration complete diff -uNr dmd-0.176/dmd/src/phobos/std/zlib.d dmd-0.177/dmd/src/phobos/std/zlib.d --- dmd-0.176/dmd/src/phobos/std/zlib.d 2006-12-02 22:57:38.000000000 +0100 +++ dmd-0.177/dmd/src/phobos/std/zlib.d 2006-12-09 01:17:14.000000000 +0100 @@ -342,7 +342,7 @@ body { void[] destbuf; - ubyte[512] tmpbuf; + ubyte[512] tmpbuf = void; int err; if (!inited) @@ -352,7 +352,7 @@ * zs.avail_out is set nonzero by deflate in previous compress() */ //tmpbuf = new void[zs.avail_out]; - zs.next_out = tmpbuf; + zs.next_out = tmpbuf.ptr; zs.avail_out = tmpbuf.length; while( (err = deflate(&zs, mode)) != Z_STREAM_END) @@ -364,7 +364,7 @@ else if(zs.avail_out == 0) { destbuf ~= tmpbuf; - zs.next_out = tmpbuf; + zs.next_out = tmpbuf.ptr; zs.avail_out = tmpbuf.length; continue; }