summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2011-09-19 21:15:56 +0200
committerLars-Dominik Braun <lars@6xq.net>2011-11-09 20:10:03 +0100
commit9fe42759d41067b38d21063b9e239be65db5262b (patch)
treece208a0231e68b6034ba4cf4bb99b74960262de2
parentbeaa342af6966a6acb7780644ff6285c85d5f641 (diff)
downloadpianobar-9fe42759d41067b38d21063b9e239be65db5262b.tar.gz
pianobar-9fe42759d41067b38d21063b9e239be65db5262b.tar.bz2
pianobar-9fe42759d41067b38d21063b9e239be65db5262b.zip
waitress: const correctness
-rw-r--r--src/libwaitress/waitress.c10
-rw-r--r--src/libwaitress/waitress.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/libwaitress/waitress.c b/src/libwaitress/waitress.c
index 5e3fd41..9910059 100644
--- a/src/libwaitress/waitress.c
+++ b/src/libwaitress/waitress.c
@@ -484,7 +484,7 @@ static bool WaitressFormatAuthorization (WaitressHandle_t *waith,
/* get default http port if none was given
*/
-static const char *WaitressDefaultPort (WaitressUrl_t *url) {
+static const char *WaitressDefaultPort (const WaitressUrl_t * const url) {
return url->port == NULL ? "80" : url->port;
}
@@ -514,7 +514,7 @@ static char *WaitressGetline (char * const str) {
/* identity encoding handler
*/
static WaitressHandlerReturn_t WaitressHandleIdentity (WaitressHandle_t *waith,
- char *buf, size_t size) {
+ char *buf, const size_t size) {
waith->request.contentReceived += size;
if (waith->callback (buf, size, waith->data) == WAITRESS_CB_RET_ERR) {
return WAITRESS_HANDLER_ABORTED;
@@ -527,12 +527,12 @@ static WaitressHandlerReturn_t WaitressHandleIdentity (WaitressHandle_t *waith,
* trailing \0.
*/
static WaitressHandlerReturn_t WaitressHandleChunked (WaitressHandle_t *waith,
- char *buf, size_t size) {
+ char *buf, const size_t size) {
char *content = buf, *nextContent;
while (1) {
if (waith->request.chunkSize > 0) {
- size_t remaining = size-(content-buf);
+ const size_t remaining = size-(content-buf);
if (remaining >= waith->request.chunkSize) {
if (WaitressHandleIdentity (waith, content,
@@ -557,7 +557,7 @@ static WaitressHandlerReturn_t WaitressHandleChunked (WaitressHandle_t *waith,
}
if ((nextContent = WaitressGetline (content)) != NULL) {
- long int chunkSize = strtol (content, NULL, 16);
+ const long int chunkSize = strtol (content, NULL, 16);
if (chunkSize == 0) {
return WAITRESS_HANDLER_DONE;
} else if (chunkSize < 0) {
diff --git a/src/libwaitress/waitress.h b/src/libwaitress/waitress.h
index a5aae32..6f43ca2 100644
--- a/src/libwaitress/waitress.h
+++ b/src/libwaitress/waitress.h
@@ -71,7 +71,7 @@ typedef struct {
struct {
size_t contentLength, contentReceived, chunkSize;
/* first argument is WaitressHandle_t, but that's not defined here */
- WaitressHandlerReturn_t (*dataHandler) (void *, char *, size_t);
+ WaitressHandlerReturn_t (*dataHandler) (void *, char *, const size_t);
} request;
} WaitressHandle_t;