Skip to content

Commit

Permalink
some stricter type enforcement
Browse files Browse the repository at this point in the history
  • Loading branch information
poeticAndroid committed Aug 19, 2019
1 parent 3899661 commit 393ca6c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion source/image_loader.d
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ FIBITMAP* pixmapToFibitmap(Pixmap pixmap)
FreeImage_SetTagLength(tag, 1);
FreeImage_SetTagValue(tag, &dismet);
FreeImage_SetMetadata(FIMD_ANIMATION, img, "DisposalMethod", tag);
uint colors = pixmap.palette.length / 3;
uint colors = cast(uint)(pixmap.palette.length / 3);
RGBQUAD* palette = FreeImage_GetPalette(img);
for (uint c = 0; c < colors; c++)
{
Expand Down
2 changes: 1 addition & 1 deletion source/lua_api/fs.d
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void registerFunctions(Program program)
extern (C) int fs_write(lua_State* L) @trusted
{
auto filename = to!string(lua_tostring(L, 1));
uint len;
size_t len;
auto str = lua_tolstring(L, 2, &len);
lua_getglobal(L, "__program");
auto prog = cast(Program*) lua_touserdata(L, -1);
Expand Down
2 changes: 1 addition & 1 deletion source/lua_api/view.d
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void registerFunctions(Program program)
throw new Exception("Invalid viewport!");
prog.activeViewport = prog.viewports[cast(uint) vpID];
}
uint id = countUntil(prog.viewports, prog.activeViewport);
uint id = cast(uint) countUntil(prog.viewports, prog.activeViewport);
if (id < 1)
lua_pushnil(L);
else
Expand Down
4 changes: 2 additions & 2 deletions source/machine.d
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class Machine
*/
int getScreenIndex(Viewport screen)
{
return countUntil(this.screens, screen);
return cast(int) countUntil(this.screens, screen);
}

/**
Expand All @@ -267,7 +267,7 @@ class Machine
while (index < 0)
index += this.screens.length;
if (index >= this.screens.length)
index = this.screens.length - 1;
index = cast(int) this.screens.length - 1;
this.screens = this.screens.remove(i);
this.screens = this.screens[0 .. index] ~ [cast(Screen) screen] ~ this.screens[index .. $];
}
Expand Down
4 changes: 2 additions & 2 deletions source/sample.d
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Sample
uint[] i;
auto f = File(filename, "wb");
f.rawWrite("RIFF");
i = [36 + this.data.length];
i = [36 + cast(uint) this.data.length];
f.rawWrite(i);
f.rawWrite("WAVE");
f.rawWrite("fmt ");
Expand All @@ -102,7 +102,7 @@ class Sample
s = [1, 8];
f.rawWrite(s);
f.rawWrite("data");
i = [this.data.length];
i = [cast(uint) this.data.length];
f.rawWrite(i);
b.length = this.data.length;
for (uint n = 0; n < b.length; n++)
Expand Down
4 changes: 2 additions & 2 deletions source/viewport.d
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Viewport
*/
int getViewportIndex(Viewport vp)
{
return countUntil(this.children, vp);
return cast(int) countUntil(this.children, vp);
}

/**
Expand All @@ -99,7 +99,7 @@ class Viewport
while (index < 0)
index += this.children.length;
if (index >= this.children.length)
index = this.children.length - 1;
index = cast(int) this.children.length - 1;
this.children = this.children.remove(i);
this.children = this.children[0 .. index] ~ vp ~ this.children[index .. $];
}
Expand Down

0 comments on commit 393ca6c

Please sign in to comment.