summaryrefslogtreecommitdiff
path: root/libwardrobe
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@gmail.com>2008-07-23 15:47:28 +0200
committerLars-Dominik Braun <PromyLOPh@gmail.com>2008-07-23 15:47:28 +0200
commit5afcd41752602f8c76faab8042a46e6b8c66bbb6 (patch)
tree39870e8e903490896b3f617e28b321ac78b4c83a /libwardrobe
parent95df994be69a49a6e40a105fa349a553dd03a766 (diff)
downloadpianobar-5afcd41752602f8c76faab8042a46e6b8c66bbb6.tar.gz
pianobar-5afcd41752602f8c76faab8042a46e6b8c66bbb6.tar.bz2
pianobar-5afcd41752602f8c76faab8042a46e6b8c66bbb6.zip
Be correct, use "const"
Diffstat (limited to 'libwardrobe')
-rw-r--r--libwardrobe/src/main.c32
-rw-r--r--libwardrobe/src/wardrobe.h4
2 files changed, 20 insertions, 16 deletions
diff --git a/libwardrobe/src/main.c b/libwardrobe/src/main.c
index 0a8a14e..1d8abb7 100644
--- a/libwardrobe/src/main.c
+++ b/libwardrobe/src/main.c
@@ -63,7 +63,7 @@ size_t WardrobeCurlRetToVar (void *ptr, size_t size, size_t nmemb,
* @param put received data here, memory is allocated by this function
* @return nothing yet
*/
-void WardrobeHttpGet (CURL *ch, char *url, char **retData) {
+void WardrobeHttpGet (CURL *ch, const char *url, char **retData) {
/* Let's hope nothing will be bigger than this... */
char curlRet[WARDROBE_HTTP_BUFFER_SIZE];
@@ -85,7 +85,8 @@ void WardrobeHttpGet (CURL *ch, char *url, char **retData) {
* @param put received data here, memory is allocated by this function
* @return nothing yet
*/
-void WardrobeHttpPost (CURL *ch, char *url, char *postData, char **retData) {
+void WardrobeHttpPost (CURL *ch, const char *url, const char *postData,
+ char **retData) {
/* Let's hope nothing will be bigger than this... */
char curlRet[WARDROBE_HTTP_BUFFER_SIZE];
@@ -206,7 +207,7 @@ WardrobeReturn_t WardrobeHandshake (WardrobeHandle_t *wh) {
* @return _OK or error
*/
WardrobeReturn_t WardrobeSendSong (WardrobeHandle_t *wh,
- WardrobeSong_t *ws) {
+ const WardrobeSong_t *ws) {
char postContent[10000];
char *urlencArtist, *urlencTitle, *urlencAlbum, *ret;
WardrobeReturn_t fRet = WARDROBE_RET_ERR;
@@ -242,7 +243,7 @@ WardrobeReturn_t WardrobeSendSong (WardrobeHandle_t *wh,
* @return _OK or error
*/
WardrobeReturn_t WardrobeSubmit (WardrobeHandle_t *wh,
- WardrobeSong_t *ws) {
+ const WardrobeSong_t *ws) {
size_t i;
WardrobeReturn_t fRet = WARDROBE_RET_ERR;
@@ -262,37 +263,40 @@ WardrobeReturn_t WardrobeSubmit (WardrobeHandle_t *wh,
return fRet;
}
-/* return dynamic allocated error string, don't forget to free it
+/* error string
* @param error int
* @return human readable error string or NULL on error
*/
-char *WardrobeErrorToString (WardrobeReturn_t ret) {
+const char *WardrobeErrorToString (WardrobeReturn_t ret) {
switch (ret) {
case WARDROBE_RET_ERR:
- return strdup ("Unknown error.\n");
+ return "Unknown error.";
break;
case WARDROBE_RET_OK:
- return strdup ("Everything's fine :)\n");
+ return "Everything's fine :)";
break;
case WARDROBE_RET_CLIENT_BANNED:
- return strdup ("Client banned. Try to update your software.\n");
+ return "Client banned. Try to update your software.";
break;
case WARDROBE_RET_BADAUTH:
- return strdup ("Wrong username or password.\n");
+ return "Wrong username or password.";
break;
case WARDROBE_RET_BADTIME:
- return strdup ("System time wrong. Check your system time and "
- "correct it.\n");
+ return "System time wrong. Check your system time and "
+ "correct it.";
break;
case WARDROBE_RET_BADSESSION:
- return strdup ("Bad session. Try to login again.\n");
+ return "Bad session. Try to login again.";
+ break;
+
+ default:
+ return "Unknown Error.";
break;
}
- return NULL;
}
diff --git a/libwardrobe/src/wardrobe.h b/libwardrobe/src/wardrobe.h
index 5662139..2e0fd14 100644
--- a/libwardrobe/src/wardrobe.h
+++ b/libwardrobe/src/wardrobe.h
@@ -49,5 +49,5 @@ void WardrobeSongInit (WardrobeSong_t *ws);
void WardrobeSongDestroy (WardrobeSong_t *ws);
void WardrobeDestroy (WardrobeHandle_t *wh);
WardrobeReturn_t WardrobeSubmit (WardrobeHandle_t *wh,
- WardrobeSong_t *ws);
-char *WardrobeErrorToString (WardrobeReturn_t ret);
+ const WardrobeSong_t *ws);
+const char *WardrobeErrorToString (WardrobeReturn_t ret);