From 12bcba8b89ad503cbdfb8261c5c26b9f87860345 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 29 Aug 2008 09:01:53 +0200 Subject: pass constant pointers And again, convert arguments to const. --- src/audio.c | 2 +- src/audio.h | 2 +- src/audioOutput.c | 2 +- src/audioOutput.h | 4 ++-- src/ls.c | 6 +++--- src/ls.h | 4 ++-- src/tagTracker.c | 2 +- src/tagTracker.h | 2 +- src/tree.c | 6 +++--- src/tree.h | 3 ++- 10 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/audio.c b/src/audio.c index 34b74e6e1..409761177 100644 --- a/src/audio.c +++ b/src/audio.c @@ -419,7 +419,7 @@ void closeAudioDevice(void) audioOpened = 0; } -void sendMetadataToAudioDevice(MpdTag * tag) +void sendMetadataToAudioDevice(const MpdTag * tag) { unsigned int i; diff --git a/src/audio.h b/src/audio.h index c9dea54d2..0032cff22 100644 --- a/src/audio.h +++ b/src/audio.h @@ -55,7 +55,7 @@ int isAudioDeviceOpen(void); int isCurrentAudioFormat(const AudioFormat * audioFormat); -void sendMetadataToAudioDevice(MpdTag * tag); +void sendMetadataToAudioDevice(const MpdTag * tag); /* these functions are called in the main parent process while the child process is busy playing to the audio */ diff --git a/src/audioOutput.c b/src/audioOutput.c index 24779a04d..f165979d0 100644 --- a/src/audioOutput.c +++ b/src/audioOutput.c @@ -244,7 +244,7 @@ void finishAudioOutput(AudioOutput * audioOutput) free(audioOutput->convBuffer); } -void sendMetadataToAudioOutput(AudioOutput * audioOutput, MpdTag * tag) +void sendMetadataToAudioOutput(AudioOutput * audioOutput, const MpdTag * tag) { if (!audioOutput->sendMetdataFunc) return; diff --git a/src/audioOutput.h b/src/audioOutput.h index 71c1e4b14..f82eedfba 100644 --- a/src/audioOutput.h +++ b/src/audioOutput.h @@ -50,7 +50,7 @@ typedef void (*AudioOutputDropBufferedAudioFunc) (AudioOutput * audioOutput); typedef void (*AudioOutputCloseDeviceFunc) (AudioOutput * audioOutput); typedef void (*AudioOutputSendMetadataFunc) (AudioOutput * audioOutput, - MpdTag * tag); + const MpdTag * tag); struct _AudioOutput { int open; @@ -104,7 +104,7 @@ void dropBufferedAudioOutput(AudioOutput * audioOutput); void closeAudioOutput(AudioOutput * audioOutput); void finishAudioOutput(AudioOutput * audioOutput); int keepAudioOutputAlive(AudioOutput * audioOutput, int ms); -void sendMetadataToAudioOutput(AudioOutput * audioOutput, MpdTag * tag); +void sendMetadataToAudioOutput(AudioOutput * audioOutput, const MpdTag * tag); void printAllOutputPluginTypes(FILE * fp); diff --git a/src/ls.c b/src/ls.c index a9a2388fc..4a49e240d 100644 --- a/src/ls.c +++ b/src/ls.c @@ -42,10 +42,10 @@ int printRemoteUrlHandlers(int fd) return 0; } -int isValidRemoteUtf8Url(char *utf8url) +int isValidRemoteUtf8Url(const char *utf8url) { int ret = 0; - char *temp; + const char *temp; switch (isRemoteUrl(utf8url)) { case 1: @@ -82,7 +82,7 @@ int isValidRemoteUtf8Url(char *utf8url) return ret; } -int isRemoteUrl(char *url) +int isRemoteUrl(const char *url) { int count = 0; const char **urlPrefixes = remoteUrlPrefixes; diff --git a/src/ls.h b/src/ls.h index bb8b113f3..af414e88a 100644 --- a/src/ls.h +++ b/src/ls.h @@ -25,9 +25,9 @@ int lsPlaylists(int fd, const char *utf8path); const char *getSuffix(const char *utf8file); -int isValidRemoteUtf8Url(char *utf8url); +int isValidRemoteUtf8Url(const char *utf8url); -int isRemoteUrl(char *url); +int isRemoteUrl(const char *url); int myStat(const char *utf8file, struct stat *st); diff --git a/src/tagTracker.c b/src/tagTracker.c index c44ce8199..b75c42d7c 100644 --- a/src/tagTracker.c +++ b/src/tagTracker.c @@ -106,7 +106,7 @@ void resetVisitedFlagsInTagTracker(int type) } } -void visitInTagTracker(int type, char *str) +void visitInTagTracker(int type, const char *str) { TreeIterator iter; diff --git a/src/tagTracker.h b/src/tagTracker.h index 17958f3af..84506426e 100644 --- a/src/tagTracker.h +++ b/src/tagTracker.h @@ -29,7 +29,7 @@ void printMemorySavedByTagTracker(void); void resetVisitedFlagsInTagTracker(int type); -void visitInTagTracker(int type, char *str); +void visitInTagTracker(int type, const char *str); void printVisitedInTagTracker(int fd, int type); diff --git a/src/tree.c b/src/tree.c index 8b577c853..c6412f310 100644 --- a/src/tree.c +++ b/src/tree.c @@ -71,7 +71,7 @@ _ClearKeyData(TreeKeyData * keyData) static int -_FindPosition(Tree * tree, TreeNode * node, void * key, int * pos) +_FindPosition(Tree * tree, TreeNode * node, const void * key, int * pos) { #ifdef USE_BINARY_SEARCH int low = 0; @@ -113,7 +113,7 @@ _FindPosition(Tree * tree, TreeNode * node, void * key, int * pos) static int -_Find(TreeIterator * iter, void * key) +_Find(TreeIterator * iter, const void * key) { while (1) { @@ -680,7 +680,7 @@ RemoveFromTreeByIterator(Tree * tree, TreeIterator * iter) } int -FindInTree(Tree * tree, void * key, TreeIterator * iter) +FindInTree(Tree * tree, const void * key, TreeIterator * iter) { TreeIterator i; diff --git a/src/tree.h b/src/tree.h index 4d30e0106..ef397bbd4 100644 --- a/src/tree.h +++ b/src/tree.h @@ -57,6 +57,7 @@ int InsertInTree(Tree * tree, void * key, void * data); int RemoveFromTreeByKey(Tree * tree, void * key); void RemoveFromTreeByIterator(Tree * tree, TreeIterator * iter); -int FindInTree(Tree * tree, void * key, TreeIterator * iter /* can be NULL */); +int FindInTree(Tree * tree, const void * key, + TreeIterator * iter /* can be NULL */); #endif -- cgit v1.2.3