diff options
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/buffer.c b/src/buffer.c index a696158..dbd5d2c 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
@@ -81,10 +81,10 @@ int buf_meth_send(lua_State *L, p_buf buf) { | |||
81 | const char *data = luaL_checklstring(L, 2, &size); | 81 | const char *data = luaL_checklstring(L, 2, &size); |
82 | long start = (long) luaL_optnumber(L, 3, 1); | 82 | long start = (long) luaL_optnumber(L, 3, 1); |
83 | long end = (long) luaL_optnumber(L, 4, -1); | 83 | long end = (long) luaL_optnumber(L, 4, -1); |
84 | if (start < 0) start = size+start+1; | 84 | if (start < 0) start = (long) (size+start+1); |
85 | if (end < 0) end = size+end+1; | 85 | if (end < 0) end = (long) (size+end+1); |
86 | if (start < 1) start = 1; | 86 | if (start < 1) start = (long) 1; |
87 | if (end > (long) size) end = size; | 87 | if (end > (long) size) end = (long) size; |
88 | if (start <= end) err = sendraw(buf, data+start-1, end-start+1, &sent); | 88 | if (start <= end) err = sendraw(buf, data+start-1, end-start+1, &sent); |
89 | /* check if there was an error */ | 89 | /* check if there was an error */ |
90 | if (err != IO_DONE) { | 90 | if (err != IO_DONE) { |