From 3ebedcc203a63630ce61aa7929958ba7f25cf31f Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 8 Jul 2008 14:17:39 +0200 Subject: piano: Delete const.h and put constants where they belong --- libpiano/src/const.h | 36 ------------------------------------ libpiano/src/http.c | 2 +- libpiano/src/main.c | 31 +++++++++++++++++++------------ 3 files changed, 20 insertions(+), 49 deletions(-) delete mode 100644 libpiano/src/const.h (limited to 'libpiano') diff --git a/libpiano/src/const.h b/libpiano/src/const.h deleted file mode 100644 index 5ffe1a4..0000000 --- a/libpiano/src/const.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright (c) 2008 Lars-Dominik Braun - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -#ifndef _CONST_H -#define _CONST_H - -/* constants */ - -#define PIANO_PROTOCOL_VERSION "20" -#define PIANO_RPC_URL "http://www.pandora.com/radio/xmlrpc/v" \ - PIANO_PROTOCOL_VERSION "?" -#define PIANO_SECURE_RPC_URL "https://www.pandora.com/radio/xmlrpc/v" \ - PIANO_PROTOCOL_VERSION "?" -#define PIANO_URL_BUFFER_SIZE 1024 -#define PIANO_HTTP_BUFFER_SIZE 100000 - -#endif /* _CONST_H */ diff --git a/libpiano/src/http.c b/libpiano/src/http.c index 52b2f2b..c480ff8 100644 --- a/libpiano/src/http.c +++ b/libpiano/src/http.c @@ -24,9 +24,9 @@ THE SOFTWARE. #include #include -#include "const.h" #include "http.h" +#define PIANO_HTTP_BUFFER_SIZE 100000 /* FIXME: curl has a receive limit, use it! */ /* callback for curl, writes data to buffer diff --git a/libpiano/src/main.c b/libpiano/src/main.c index dcfa70f..5ac5964 100644 --- a/libpiano/src/main.c +++ b/libpiano/src/main.c @@ -25,7 +25,6 @@ THE SOFTWARE. #include #include -#include "const.h" #include "main.h" #include "piano.h" #include "http.h" @@ -33,6 +32,14 @@ THE SOFTWARE. #include "crypt.h" #include "config.h" +#define PIANO_PROTOCOL_VERSION "20" +#define PIANO_RPC_URL "http://www.pandora.com/radio/xmlrpc/v" \ + PIANO_PROTOCOL_VERSION "?" +#define PIANO_SECURE_RPC_URL "https://www.pandora.com/radio/xmlrpc/v" \ + PIANO_PROTOCOL_VERSION "?" +#define PIANO_URL_BUFFER_SIZE 1024 +#define PIANO_SEND_BUFFER_SIZE 10000 + /* prototypes */ PianoReturn_t PianoAddFeedback (PianoHandle_t *, char *, char *, char *, char *, char *, PianoSongRating_t); @@ -180,7 +187,7 @@ PianoReturn_t PianoConnect (PianoHandle_t *ph, char *user, char *password, char *requestStr = PianoEncryptString ("" "misc.sync" ""); - char *retStr, requestStrPlain[10000]; + char *retStr, requestStrPlain[PIANO_SEND_BUFFER_SIZE]; PianoReturn_t ret; /* sync (is the return value used by pandora? for now: ignore result) */ @@ -222,7 +229,7 @@ PianoReturn_t PianoConnect (PianoHandle_t *ph, char *user, char *password, * @param piano handle filled with some authentication data by PianoConnect */ PianoReturn_t PianoGetStations (PianoHandle_t *ph) { - char xmlSendBuf[10000], url[PIANO_URL_BUFFER_SIZE]; + char xmlSendBuf[PIANO_SEND_BUFFER_SIZE], url[PIANO_URL_BUFFER_SIZE]; char *requestStr, *retStr; PianoReturn_t ret; @@ -252,7 +259,7 @@ PianoReturn_t PianoGetStations (PianoHandle_t *ph) { * @param station id */ PianoReturn_t PianoGetPlaylist (PianoHandle_t *ph, char *stationId) { - char xmlSendBuf[10000], url[PIANO_URL_BUFFER_SIZE]; + char xmlSendBuf[PIANO_SEND_BUFFER_SIZE], url[PIANO_URL_BUFFER_SIZE]; char *requestStr, *retStr; PianoReturn_t ret; @@ -340,7 +347,7 @@ PianoReturn_t PianoMoveSong (PianoHandle_t *ph, PianoStation_t *stationFrom, PianoReturn_t PianoAddFeedback (PianoHandle_t *ph, char *stationId, char *songMusicId, char *songMatchingSeed, char *songUserSeed, char *songFocusTraitId, PianoSongRating_t rating) { - char xmlSendBuf[10000], url[PIANO_URL_BUFFER_SIZE]; + char xmlSendBuf[PIANO_SEND_BUFFER_SIZE], url[PIANO_URL_BUFFER_SIZE]; char *requestStr, *retStr; PianoReturn_t ret = PIANO_RET_ERR; @@ -392,7 +399,7 @@ PianoReturn_t PianoAddFeedback (PianoHandle_t *ph, char *stationId, */ PianoReturn_t PianoRenameStation (PianoHandle_t *ph, PianoStation_t *station, char *newName) { - char xmlSendBuf[10000], url[PIANO_URL_BUFFER_SIZE]; + char xmlSendBuf[PIANO_SEND_BUFFER_SIZE], url[PIANO_URL_BUFFER_SIZE]; char *requestStr, *retStr, *urlencodedNewName, *xmlencodedNewName; PianoReturn_t ret = PIANO_RET_ERR; @@ -434,7 +441,7 @@ PianoReturn_t PianoRenameStation (PianoHandle_t *ph, PianoStation_t *station, * @param station you want to delete */ PianoReturn_t PianoDeleteStation (PianoHandle_t *ph, PianoStation_t *station) { - char xmlSendBuf[10000], url[PIANO_URL_BUFFER_SIZE]; + char xmlSendBuf[PIANO_SEND_BUFFER_SIZE], url[PIANO_URL_BUFFER_SIZE]; char *requestStr, *retStr; PianoReturn_t ret = PIANO_RET_ERR; @@ -489,7 +496,7 @@ PianoReturn_t PianoDeleteStation (PianoHandle_t *ph, PianoStation_t *station) { */ PianoReturn_t PianoSearchMusic (PianoHandle_t *ph, char *searchStr, PianoSearchResult_t *searchResult) { - char xmlSendBuf[10000], url[PIANO_URL_BUFFER_SIZE]; + char xmlSendBuf[PIANO_SEND_BUFFER_SIZE], url[PIANO_URL_BUFFER_SIZE]; char *requestStr, *retStr, *xmlencodedSearchStr, *urlencodedSearchStr; PianoReturn_t ret; @@ -530,7 +537,7 @@ PianoReturn_t PianoSearchMusic (PianoHandle_t *ph, char *searchStr, */ PianoReturn_t PianoCreateStation (PianoHandle_t *ph, char *type, char *id) { - char xmlSendBuf[10000], url[PIANO_URL_BUFFER_SIZE]; + char xmlSendBuf[PIANO_SEND_BUFFER_SIZE], url[PIANO_URL_BUFFER_SIZE]; char *requestStr, *retStr; PianoReturn_t ret; @@ -569,7 +576,7 @@ PianoReturn_t PianoCreateStation (PianoHandle_t *ph, char *type, */ PianoReturn_t PianoStationAddMusic (PianoHandle_t *ph, PianoStation_t *station, char *musicId) { - char xmlSendBuf[10000], url[PIANO_URL_BUFFER_SIZE]; + char xmlSendBuf[PIANO_SEND_BUFFER_SIZE], url[PIANO_URL_BUFFER_SIZE]; char *requestStr, *retStr; PianoReturn_t ret; @@ -604,7 +611,7 @@ PianoReturn_t PianoStationAddMusic (PianoHandle_t *ph, * @return _OK or error */ PianoReturn_t PianoSongTired (PianoHandle_t *ph, PianoSong_t *song) { - char xmlSendBuf[10000], url[PIANO_URL_BUFFER_SIZE]; + char xmlSendBuf[PIANO_SEND_BUFFER_SIZE], url[PIANO_URL_BUFFER_SIZE]; char *requestStr, *retStr; PianoReturn_t ret; @@ -637,7 +644,7 @@ PianoReturn_t PianoSongTired (PianoHandle_t *ph, PianoSong_t *song) { * @return _OK or error */ PianoReturn_t PianoSetQuickmix (PianoHandle_t *ph) { - char xmlSendBuf[10000], valueBuf[1000], urlArgBuf[1000], + char xmlSendBuf[PIANO_SEND_BUFFER_SIZE], valueBuf[1000], urlArgBuf[1000], url[PIANO_URL_BUFFER_SIZE]; char *requestStr, *retStr; PianoReturn_t ret; -- cgit v1.2.3