Permalink
Browse files

fix a handful of C compiler warnings

There are a few fixes in here:
 * read(3) returns a regular ssize_t; don't use Py_ssize_t
 * Request_parse wants a size_t, not an ssize_t
 * server_run takes no arguments, so declare it void
 * tp_newfunc should have type (newfunc) (i.e. takes PyTypeObject* as its first
   parameter, instead of PyObject*)
  • Loading branch information...
1 parent a3ffb68 commit 241b3ed11a8a754e2856b860f1d2ffac7fcd4a2d @eklitzke eklitzke committed Sep 18, 2011
Showing with 5 additions and 5 deletions.
  1. +1 −1 bjoern/filewrapper.c
  2. +3 −3 bjoern/server.c
  3. +1 −1 bjoern/server.h
@@ -47,7 +47,7 @@ PyTypeObject FileWrapper_Type = {
void _init_filewrapper()
{
- FileWrapper_Type.tp_new = FileWrapper_New;
+ FileWrapper_Type.tp_new = (newfunc)FileWrapper_New;
FileWrapper_Type.tp_iter = FileWrapper_Iter;
FileWrapper_Type.tp_getattro = FileWrapper_GetAttrO;
FileWrapper_Type.tp_flags |= Py_TPFLAGS_DEFAULT;
View
@@ -37,7 +37,7 @@ static bool send_chunk(Request*);
static bool do_sendfile(Request*);
static bool handle_nonzero_errno(Request*);
-void server_run(const char* hostaddr, const int port)
+void server_run(void)
{
struct ev_loop* mainloop = ev_default_loop(0);
@@ -131,7 +131,7 @@ ev_io_on_read(struct ev_loop* mainloop, ev_io* watcher, const int events)
Request* request = REQUEST_FROM_WATCHER(watcher);
- Py_ssize_t read_bytes = read(
+ ssize_t read_bytes = read(
request->client_fd,
read_buf,
READ_BUFFER_SIZE
@@ -152,7 +152,7 @@ ev_io_on_read(struct ev_loop* mainloop, ev_io* watcher, const int events)
goto out;
}
- Request_parse(request, read_buf, read_bytes);
+ Request_parse(request, read_buf, (size_t)read_bytes);
if(request->state.error_code) {
DBG_REQ(request, "Parse error");
View
@@ -1,4 +1,4 @@
#include "request.h"
bool server_init(const char* hostaddr, const int port);
-void server_run();
+void server_run(void);

0 comments on commit 241b3ed

Please sign in to comment.