[svn r292] Fixed: string switch was broken in several ways.

Fixed: TypeInfo_Typedef.next was incorrect (return base of base instead of just base).
Fixed: ClassInfo offset type info (offTi) had invalid offsets.
This commit is contained in:
Tomas Lindquist Olsen
2008-06-18 21:31:05 +02:00
parent 964f91b5a1
commit ab92e1230b
4 changed files with 28 additions and 25 deletions
+1 -1
View File
@@ -302,7 +302,7 @@ class TypeInfo_Typedef : TypeInfo
size_t tsize() { return base.tsize(); }
void swap(void *p1, void *p2) { return base.swap(p1, p2); }
TypeInfo next() { return base.next(); }
TypeInfo next() { return base; }
uint flags() { return base.flags(); }
void[] init() { return m_init.length ? m_init : base.init(); }
+8 -7
View File
@@ -26,6 +26,7 @@
*/
private import tango.stdc.string;
//private import tango.stdc.stdio;
/******************************************************
* Support for switch statements switching on strings.
@@ -101,11 +102,11 @@ out (result)
}
body
{
//printf("body _d_switch_string(%.*s)\n", ca);
//printf("body _d_switch_string(%.*s)\n", ca.length, ca.ptr);
size_t low;
size_t high;
size_t mid;
size_t c;
ptrdiff_t c;
char[] pca;
low = 0;
@@ -136,7 +137,7 @@ body
{
mid = (low + high) >> 1;
pca = table[mid];
c = ca.length - pca.length;
c = cast(ptrdiff_t)(ca.length - pca.length);
if (c == 0)
{
c = cast(ubyte)c1 - cast(ubyte)pca[0];
@@ -244,7 +245,7 @@ body
size_t low;
size_t high;
size_t mid;
size_t c;
ptrdiff_t c;
wchar[] pca;
low = 0;
@@ -265,7 +266,7 @@ body
{
mid = (low + high) >> 1;
pca = table[mid];
c = ca.length - pca.length;
c = cast(ptrdiff_t)(ca.length - pca.length);
if (c == 0)
{
c = memcmp(ca.ptr, pca.ptr, ca.length * wchar.sizeof);
@@ -369,7 +370,7 @@ body
size_t low;
size_t high;
size_t mid;
size_t c;
ptrdiff_t c;
dchar[] pca;
low = 0;
@@ -390,7 +391,7 @@ body
{
mid = (low + high) >> 1;
pca = table[mid];
c = ca.length - pca.length;
c = cast(ptrdiff_t)(ca.length - pca.length);
if (c == 0)
{
c = memcmp(ca.ptr, pca.ptr, ca.length * dchar.sizeof);