| 1 | --- lua_bytes.c.orig 2015-11-04 00:33:40.000000000 +0100 |
| 2 | +++ lua_bytes.c 2015-11-04 00:32:44.000000000 +0100 |
| 3 | @@ -116,7 +116,7 @@ |
| 4 | |
| 5 | static int subr_bytes_new(lua_State *L) |
| 6 | { |
| 7 | - int width = luaL_checkint(L, 1); |
| 8 | + int width = luaL_checkinteger(L, 1); |
| 9 | int n = lua_gettop(L); |
| 10 | bytestring_t *bs; |
| 11 | |
| 12 | @@ -259,7 +259,7 @@ |
| 13 | b_index = 0; |
| 14 | else |
| 15 | { |
| 16 | - b_index=luaL_checkint(L,2); |
| 17 | + b_index=luaL_checkinteger(L,2); |
| 18 | if (b_index<0) b_index = 0; |
| 19 | } |
| 20 | |
| 21 | @@ -267,7 +267,7 @@ |
| 22 | e_index = b_index; |
| 23 | else |
| 24 | { |
| 25 | - e_index=luaL_checkint(L,2); |
| 26 | + e_index=luaL_checkinteger(L,2); |
| 27 | if (e_index>=(int)bytestring_get_size(bs)) e_index = bytestring_get_size(bs)-1; |
| 28 | } |
| 29 | |
| 30 | @@ -293,13 +293,13 @@ |
| 31 | unsigned i; |
| 32 | unsigned char c; |
| 33 | |
| 34 | - b_index=(unsigned)luaL_checkint(L,2); |
| 35 | + b_index=(unsigned)luaL_checkinteger(L,2); |
| 36 | |
| 37 | e_index = b_index + lua_gettop(L)-3; |
| 38 | |
| 39 | for (i=b_index;i<=e_index;i++) |
| 40 | { |
| 41 | - c = (unsigned char)luaL_checkint(L,i-b_index+3); |
| 42 | + c = (unsigned char)luaL_checkinteger(L,i-b_index+3); |
| 43 | if (i<bytestring_get_size(bs)) |
| 44 | { |
| 45 | bytestring_set_element(bs,i,c); |
| 46 | @@ -324,8 +324,8 @@ |
| 47 | static int subr_bytes_pad_left(lua_State *L) |
| 48 | { |
| 49 | bytestring_t *bs = bytestring_duplicate(luaL_check_bytestring(L, 1)); |
| 50 | - unsigned pad_length = luaL_checkint(L,2); |
| 51 | - unsigned pad_value = luaL_checkint(L,3); |
| 52 | + unsigned pad_length = luaL_checkinteger(L,2); |
| 53 | + unsigned pad_value = luaL_checkinteger(L,3); |
| 54 | if (bytestring_pad_left(bs,pad_length,pad_value)!=BYTESTRING_OK) |
| 55 | { |
| 56 | bytestring_free(bs); |
| 57 | @@ -340,8 +340,8 @@ |
| 58 | static int subr_bytes_pad_right(lua_State *L) |
| 59 | { |
| 60 | bytestring_t *bs = bytestring_duplicate(luaL_check_bytestring(L, 1)); |
| 61 | - unsigned pad_length = luaL_checkint(L,2); |
| 62 | - unsigned pad_value = luaL_checkint(L,3); |
| 63 | + unsigned pad_length = luaL_checkinteger(L,2); |
| 64 | + unsigned pad_value = luaL_checkinteger(L,3); |
| 65 | if (bytestring_pad_right(bs,pad_length,pad_value)!=BYTESTRING_OK) |
| 66 | { |
| 67 | bytestring_free(bs); |
| 68 | @@ -376,12 +376,12 @@ |
| 69 | static int subr_bytes_sub(lua_State *L) |
| 70 | { |
| 71 | bytestring_t *bs = luaL_check_bytestring(L, 1); |
| 72 | - int start=luaL_checkint(L,2); |
| 73 | + int start=luaL_checkinteger(L,2); |
| 74 | int end=-1; |
| 75 | bytestring_t *ret; |
| 76 | |
| 77 | if (lua_gettop(L)>2) |
| 78 | - end=luaL_checkint(L,3); |
| 79 | + end=luaL_checkinteger(L,3); |
| 80 | if (start<0) |
| 81 | start=bytestring_get_size(bs)+start; |
| 82 | if (end<0) |
| 83 | @@ -431,13 +431,13 @@ |
| 84 | "\tchange bytes.convert(A,B) to bytes.convert(B,A)\n" |
| 85 | "\tThis warning will only appear once."); |
| 86 | } |
| 87 | - width=luaL_checkint(L,1); |
| 88 | + width=luaL_checkinteger(L,1); |
| 89 | bs = luaL_check_bytestring(L, 2); |
| 90 | } |
| 91 | else |
| 92 | { |
| 93 | bs = luaL_check_bytestring(L, 1); |
| 94 | - width=luaL_checkint(L,2); |
| 95 | + width=luaL_checkinteger(L,2); |
| 96 | } |
| 97 | |
| 98 | if (width!=8 && width!=4 && width!=1) |