Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
fixed int=>size_t errors
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Nov 25, 2011
1 parent 98f410b commit ce29a8a
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 37 deletions.
6 changes: 3 additions & 3 deletions src/core/cpuid.d
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public:
return false;
return (features & SYSENTERSYSEXIT_BIT)!=0;
}


/// Is 3DNow prefetch supported?
bool has3dnowPrefetch()
Expand Down Expand Up @@ -359,7 +359,7 @@ void getcacheinfoCPUID2()
16, 16, 16, 24, 24, 24
];
enum { FIRSTDATA2 = 8, FIRSTDATA3 = 28+9 }
for (int i=0; i< ids.length; ++i) {
for (size_t i=0; i< ids.length; ++i) {
if (x==ids[i]) {
int level = i< FIRSTDATA2 ? 0: i<FIRSTDATA3 ? 1 : 2;
if (x==0x49 && family==0xF && model==0x6) level=2;
Expand Down Expand Up @@ -846,7 +846,7 @@ shared static this()
}
numCacheLevels = 1;
// And now fill up all the unused levels with full memory space.
for (int i=1; i< datacache.length; ++i) {
for (size_t i=1; i< datacache.length; ++i) {
if (datacache[i].size==0) {
// Set all remaining levels of cache equal to full address space.
datacache[i].size = uint.max/1024;
Expand Down
8 changes: 4 additions & 4 deletions src/core/demangle.d
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private struct Demangle
}


enum minBufSize = 4000;
enum size_t minBufSize = 4000;


const(char)[] buf = null;
Expand Down Expand Up @@ -176,7 +176,7 @@ private struct Demangle

for( size_t n = 0; n < val.length; n++ )
{
for( auto v = val.ptr - dst.ptr; v + 1 < len; v++ )
for( size_t v = val.ptr - dst.ptr; v + 1 < len; v++ )
{
exch( v, v + 1 );
}
Expand Down Expand Up @@ -1164,7 +1164,7 @@ private struct Demangle
auto n = decodeNumber();
match( '_' );
put( "\"" );
for( auto i = 0; i < n; i++ )
foreach (i; 0..n)
{
auto a = ascii2hex( tok() ); next();
auto b = ascii2hex( tok() ); next();
Expand Down Expand Up @@ -1613,7 +1613,7 @@ unittest
/*
*
*/
string decodeDmdString( const(char)[] ln, ref int p )
string decodeDmdString( const(char)[] ln, ref size_t p )
{
string s;
uint zlen, zpos;
Expand Down
2 changes: 1 addition & 1 deletion src/rt/arrayassign.d
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ extern (C) void[] _d_arrayctor(TypeInfo ti, void[] from, void[] to)

auto element_size = ti.tsize();

int i;
size_t i;
try
{
for (i = 0; i < to.length; i++)
Expand Down
4 changes: 2 additions & 2 deletions src/rt/arrayreal.d
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ in
}
body
{
for (int i = 0; i < a.length; i++)
foreach (i; 0..a.length)
a[i] = b[i] + c[i];
return a;
}
Expand Down Expand Up @@ -124,7 +124,7 @@ in
}
body
{
for (int i = 0; i < a.length; i++)
foreach (i; 0..a.length)
a[i] = b[i] - c[i];
return a;
}
Expand Down
36 changes: 12 additions & 24 deletions src/rt/cast_.d
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,24 @@ Object _d_dynamic_cast(Object o, ClassInfo c)
}

int _d_isbaseof2(ClassInfo oc, ClassInfo c, ref size_t offset)
{ int i;

{
if (oc is c)
return 1;
do
{
if (oc.base is c)
return 1;
for (i = 0; i < oc.interfaces.length; i++)
foreach (i; 0..oc.interfaces.length)
{
ClassInfo ic;

ic = oc.interfaces[i].classinfo;
auto ic = oc.interfaces[i].classinfo;
if (ic is c)
{ offset = oc.interfaces[i].offset;
return 1;
}
}
for (i = 0; i < oc.interfaces.length; i++)
foreach (i; 0..oc.interfaces.length)
{
ClassInfo ic;

ic = oc.interfaces[i].classinfo;
auto ic = oc.interfaces[i].classinfo;
if (_d_isbaseof2(ic, c, offset))
{ offset = oc.interfaces[i].offset;
return 1;
Expand All @@ -122,19 +117,16 @@ int _d_isbaseof2(ClassInfo oc, ClassInfo c, ref size_t offset)
}

int _d_isbaseof(ClassInfo oc, ClassInfo c)
{ int i;

{
if (oc is c)
return 1;
do
{
if (oc.base is c)
return 1;
for (i = 0; i < oc.interfaces.length; i++)
foreach (i; 0..oc.interfaces.length)
{
ClassInfo ic;

ic = oc.interfaces[i].classinfo;
auto ic = oc.interfaces[i].classinfo;
if (ic is c || _d_isbaseof(ic, c))
return 1;
}
Expand All @@ -148,19 +140,15 @@ int _d_isbaseof(ClassInfo oc, ClassInfo c)
*/

void *_d_interface_vtbl(ClassInfo ic, Object o)
{ int i;
ClassInfo oc;

{
//printf("__d_interface_vtbl(o = %p, ic = %p)\n", o, ic);

assert(o);

oc = o.classinfo;
for (i = 0; i < oc.interfaces.length; i++)
auto oc = o.classinfo;
foreach (i; 0..oc.interfaces.length)
{
ClassInfo oic;

oic = oc.interfaces[i].classinfo;
auto oic = oc.interfaces[i].classinfo;
if (oic is ic)
{
return cast(void *)oc.interfaces[i].vtbl;
Expand Down
2 changes: 1 addition & 1 deletion src/rt/cover.d
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ shared static ~this()
uint nno;
uint nyes;

for( int i = 0; i < c.data.length; i++ )
foreach (i; 0..c.data.length)
{
if( i < srclines.length )
{
Expand Down
4 changes: 2 additions & 2 deletions src/rt/deh.d
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ EXCEPTION_DISPOSITION _d_framehandler(
else
{
// Jump to catch block if matching one is found
int ndx,prev_ndx,i;
int ndx,prev_ndx;
DHandlerInfo *phi;
DCatchInfo *pci;
DCatchBlock *pcb;
Expand Down Expand Up @@ -437,7 +437,7 @@ EXCEPTION_DISPOSITION _d_framehandler(
pci = cast(DCatchInfo *)(cast(ubyte *)handlerTable + phi.cioffset);
ncatches = pci.ncatches;

for (i = 0; i < ncatches; i++)
foreach (i; 0..ncatches)
{
pcb = &pci.catch_block[i];
int match = 0;
Expand Down

0 comments on commit ce29a8a

Please sign in to comment.