[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Bug report: lsocket/buffer.c:95 The variable 'sent' is being used without being defined.
- From: Alexander Marinov <alek@...>
- Date: Sun, 19 Jun 2005 11:14:30 -0700 (PDT)
I'm very happy to see Xavante is working : )
But after the first page is displayed I received an exception, because my lsocket.dll is built with full debug information. Without debug info this problem is hidden.
It happens at func. buffer.c:buf_meth_send. Below in comments are displayed the current var values at the time of the exception.
Is it safe to init sent=0?
int buf_meth_send(lua_State *L, p_buf buf) {
/* buf == "GET /doc/xavante.gif HTTP/1.1
Accept: */*
Referer: http://localhost/doc/index.html
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)
Host: localhost
Connection: Keep-Alive
*/
int top = lua_gettop(L);
p_tm tm = tm_markstart(buf->tm);
int err = IO_DONE;
size_t size, sent; // <--- sent uninitialized!
const char *data = luaL_checklstring(L, 2, &size); // size(0), data("")
long start = (long) luaL_optnumber(L, 3, 1); // start(1)
long end = (long) luaL_optnumber(L, 4, -1); // end(0)
if (start < 0) start = (long) (size+start+1);
if (end < 0) end = (long) (size+end+1);
if (start < 1) start = (long) 1;
if (end > (long) size) end = (long) size;
if (start <= end) err = sendraw(buf, data+start-1, end-start+1, &sent); // start(1) <= end(0) -> false, err == IO_DONE
/* check if there was an error */
if (err != IO_DONE) {
lua_pushnil(L);
lua_pushstring(L, buf->io->error(buf->io->ctx, err));
lua_pushnumber(L, sent);
} else {
lua_pushnumber(L, sent); // <--------- sent == 3435973836
lua_pushnil(L);
lua_pushnil(L);
}
_____________________________________________________________
Get your free email at http://www.crazyland.com