Skip to content

Commit

Permalink
Fix for Lua 5.3 (Fixes: #4)
Browse files Browse the repository at this point in the history
This replaces all uses of luaL_checkint with luaL_checkinteger.

Signed-off-by: Uli Schlachter <[email protected]>
  • Loading branch information
psychon committed Jul 14, 2015
1 parent 2f41d09 commit c0b15cd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion obj_path.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ path_each_iter (lua_State *L) {
if (lua_isnoneornil(L, 2))
i = 0;
else {
i = luaL_checkint(L, 2);
i = luaL_checkinteger(L, 2);
luaL_argcheck(L, i >= 0 && i < path->num_data, 2,
"path index out of range");
i += path->data[i].header.length;
Expand Down
8 changes: 4 additions & 4 deletions obj_region.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ region_gc (lua_State *L) {
static int
region_contains_point (lua_State *L) {
cairo_region_t **ud = luaL_checkudata(L, 1, OOCAIRO_MT_NAME_REGION);
int x = luaL_checkint(L, 2);
int y = luaL_checkint(L, 3);
int x = luaL_checkinteger(L, 2);
int y = luaL_checkinteger(L, 3);
lua_pushboolean(L, cairo_region_contains_point(*ud, x, y));
return 1;
}
Expand Down Expand Up @@ -138,8 +138,8 @@ region_is_empty (lua_State *L) {
static int
region_translate (lua_State *L) {
cairo_region_t **ud = luaL_checkudata(L, 1, OOCAIRO_MT_NAME_REGION);
int x = luaL_checkint(L, 2);
int y = luaL_checkint(L, 3);
int x = luaL_checkinteger(L, 2);
int y = luaL_checkinteger(L, 3);
cairo_region_translate(*ud, x, y);
return 0;
}
Expand Down
18 changes: 9 additions & 9 deletions obj_surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ image_surface_create (lua_State *L) {
SurfaceUserdata *surface;

fmt = format_from_lua(L, 1);
width = luaL_checkint(L, 2);
width = luaL_checkinteger(L, 2);
luaL_argcheck(L, width >= 0, 2, "image width cannot be negative");
height = luaL_checkint(L, 3);
height = luaL_checkinteger(L, 3);
luaL_argcheck(L, height >= 0, 3, "image height cannot be negative");

surface = create_surface_userdata(L);
Expand All @@ -47,11 +47,11 @@ image_surface_create_from_data (lua_State *L) {

data = luaL_checklstring(L, 1, &data_len);
fmt = format_from_lua(L, 2);
width = luaL_checkint(L, 3);
width = luaL_checkinteger(L, 3);
luaL_argcheck(L, width >= 0, 3, "image width cannot be negative");
height = luaL_checkint(L, 4);
height = luaL_checkinteger(L, 4);
luaL_argcheck(L, height >= 0, 4, "image height cannot be negative");
stride = luaL_checkint(L, 5);
stride = luaL_checkinteger(L, 5);

/* Check that the stride is big enough for one row of pixels. */
if (fmt == CAIRO_FORMAT_ARGB32 || fmt == CAIRO_FORMAT_RGB24)
Expand Down Expand Up @@ -307,9 +307,9 @@ surface_create_similar (lua_State *L) {
SurfaceUserdata *surface;

content = content_from_lua(L, 2);
width = luaL_checkint(L, 3);
width = luaL_checkinteger(L, 3);
luaL_argcheck(L, width >= 0, 3, "image width cannot be negative");
height = luaL_checkint(L, 4);
height = luaL_checkinteger(L, 4);
luaL_argcheck(L, height >= 0, 4, "image height cannot be negative");

surface = create_surface_userdata(L);
Expand All @@ -327,9 +327,9 @@ surface_create_similar_image (lua_State *L) {
SurfaceUserdata *surface;

format = format_from_lua(L, 2);
width = luaL_checkint(L, 3);
width = luaL_checkinteger(L, 3);
luaL_argcheck(L, width >= 0, 3, "image width cannot be negative");
height = luaL_checkint(L, 4);
height = luaL_checkinteger(L, 4);
luaL_argcheck(L, height >= 0, 4, "image height cannot be negative");

surface = create_surface_userdata(L);
Expand Down
2 changes: 1 addition & 1 deletion oocairo.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ from_lua_rectangle (lua_State *L, cairo_rectangle_int_t *rect, int pos) {
#define DO(t) \
lua_pushstring(L, #t); \
lua_gettable(L, pos); \
rect->t = luaL_checkint(L, -1); \
rect->t = luaL_checkinteger(L, -1); \
lua_pop(L, 1)
DO(x);
DO(y);
Expand Down

1 comment on commit c0b15cd

@blueyed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@psychon
Thanks! 🍒 :)

Please sign in to comment.