aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command.c144
-rw-r--r--src/command.h2
-rw-r--r--src/inputPlugins/audiofile_plugin.c2
-rw-r--r--src/interface.c4
-rw-r--r--src/permission.c16
-rw-r--r--src/permission.h4
-rw-r--r--src/tag.c10
-rw-r--r--src/utf8.c40
-rw-r--r--src/utf8.h6
9 files changed, 120 insertions, 108 deletions
diff --git a/src/command.c b/src/command.c
index c4fecb2ff..98e8dae97 100644
--- a/src/command.c
+++ b/src/command.c
@@ -106,9 +106,10 @@
typedef struct _CommandEntry CommandEntry;
-typedef int (* CommandHandlerFunction)(FILE *, unsigned int *, int, char **);
-typedef int (* CommandListHandlerFunction)(FILE *, unsigned int *, int, char **,
- ListNode *, CommandEntry *);
+typedef int (* CommandHandlerFunction)(FILE *, int *, int, char **);
+typedef int (* CommandListHandlerFunction)
+ (FILE *, int *, int, char **,ListNode *, CommandEntry *);
+
/* if min: -1 don't check args *
* if max: -1 no max args */
@@ -116,7 +117,7 @@ struct _CommandEntry {
char * cmd;
int min;
int max;
- unsigned int reqPermission;
+ int reqPermission;
CommandHandlerFunction handler;
CommandListHandlerFunction listHandler;
};
@@ -139,9 +140,12 @@ CommandEntry * newCommandEntry(void) {
return cmd;
}
-static void addCommand(char * name, unsigned int reqPermission, int minargs,
- int maxargs, CommandHandlerFunction handler_func,
- CommandListHandlerFunction listHandler_func)
+static void addCommand(char * name,
+ int reqPermission,
+ int minargs,
+ int maxargs,
+ CommandHandlerFunction handler_func,
+ CommandListHandlerFunction listHandler_func)
{
CommandEntry * cmd = newCommandEntry();
cmd->cmd = name;
@@ -154,13 +158,13 @@ static void addCommand(char * name, unsigned int reqPermission, int minargs,
insertInList(commandList, cmd->cmd, cmd);
}
-static int handleUrlHandlers(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleUrlHandlers(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
return printRemoteUrlHandlers(fp);
}
-static int handlePlay(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handlePlay(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int song = -1;
@@ -177,7 +181,7 @@ static int handlePlay(FILE * fp, unsigned int * permission, int argArrayLength,
return playPlaylist(fp,song,0);
}
-static int handlePlayId(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handlePlayId(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int id = -1;
@@ -194,13 +198,13 @@ static int handlePlayId(FILE * fp, unsigned int * permission, int argArrayLength
return playPlaylistById(fp, id, 0);
}
-static int handleStop(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleStop(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
return stopPlaylist(fp);
}
-static int handleCurrentSong(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleCurrentSong(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int song = getPlaylistCurrentSong();
@@ -211,7 +215,7 @@ static int handleCurrentSong(FILE * fp, unsigned int * permission, int argArrayL
else return 0;
}
-static int handlePause(FILE * fp, unsigned int * permission,
+static int handlePause(FILE * fp, int * permission,
int argArrayLength, char ** argArray)
{
if(argArrayLength==2) {
@@ -226,7 +230,7 @@ static int handlePause(FILE * fp, unsigned int * permission,
return playerPause(fp);
}
-static int commandStatus(FILE * fp, unsigned int * permission, int argArrayLength,
+static int commandStatus(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
char * state = NULL;
@@ -280,19 +284,19 @@ static int commandStatus(FILE * fp, unsigned int * permission, int argArrayLengt
return 0;
}
-static int handleKill(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleKill(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
return COMMAND_RETURN_KILL;
}
-static int handleClose(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleClose(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
return COMMAND_RETURN_CLOSE;
}
-static int handleAdd(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleAdd(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
char * path = argArray[1];
@@ -302,13 +306,13 @@ static int handleAdd(FILE * fp, unsigned int * permission, int argArrayLength,
return addAllIn(fp,path);
}
-static int handleAddId(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleAddId(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
return addToPlaylist(fp, argArray[1], 1);
}
-static int handleDelete(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleDelete(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int song;
@@ -323,7 +327,7 @@ static int handleDelete(FILE * fp, unsigned int * permission, int argArrayLength
return deleteFromPlaylist(fp,song);
}
-static int handleDeleteId(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleDeleteId(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int id;
@@ -338,49 +342,49 @@ static int handleDeleteId(FILE * fp, unsigned int * permission, int argArrayLeng
return deleteFromPlaylistById(fp, id);
}
-static int handlePlaylist(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handlePlaylist(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
return showPlaylist(fp);
}
-static int handleShuffle(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleShuffle(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
return shufflePlaylist(fp);
}
-static int handleClear(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleClear(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
return clearPlaylist(fp);
}
-static int handleSave(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleSave(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
return savePlaylist(fp,argArray[1]);
}
-static int handleLoad(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleLoad(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
return loadPlaylist(fp,argArray[1]);
}
-static int handleListPlaylist(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleListPlaylist(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
return PlaylistInfo(fp,argArray[1],0);
}
-static int handleListPlaylistInfo(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleListPlaylistInfo(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
return PlaylistInfo(fp,argArray[1], 1);
}
-static int handleLsInfo(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleLsInfo(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
if(argArrayLength==1) {
@@ -393,13 +397,13 @@ static int handleLsInfo(FILE * fp, unsigned int * permission, int argArrayLength
}
}
-static int handleRm(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleRm(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
return deletePlaylist(fp,argArray[1]);
}
-static int handlePlaylistChanges(FILE * fp, unsigned int * permission,
+static int handlePlaylistChanges(FILE * fp, int * permission,
int argArrayLength, char ** argArray)
{
unsigned long version;
@@ -414,7 +418,7 @@ static int handlePlaylistChanges(FILE * fp, unsigned int * permission,
return playlistChanges(fp, version);
}
-static int handlePlaylistChangesPosId(FILE * fp, unsigned int * permission,
+static int handlePlaylistChangesPosId(FILE * fp, int * permission,
int argArrayLength, char ** argArray)
{
unsigned long version;
@@ -429,7 +433,7 @@ static int handlePlaylistChangesPosId(FILE * fp, unsigned int * permission,
return playlistChangesPosId(fp, version);
}
-static int handlePlaylistInfo(FILE * fp, unsigned int * permission,
+static int handlePlaylistInfo(FILE * fp, int * permission,
int argArrayLength, char ** argArray)
{
int song = -1;
@@ -446,7 +450,7 @@ static int handlePlaylistInfo(FILE * fp, unsigned int * permission,
return playlistInfo(fp,song);
}
-static int handlePlaylistId(FILE * fp, unsigned int * permission,
+static int handlePlaylistId(FILE * fp, int * permission,
int argArrayLength, char ** argArray)
{
int id = -1;
@@ -463,7 +467,7 @@ static int handlePlaylistId(FILE * fp, unsigned int * permission,
return playlistId(fp, id);
}
-static int handleFind(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleFind(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int ret;
@@ -484,7 +488,7 @@ static int handleFind(FILE * fp, unsigned int * permission, int argArrayLength,
return ret;
}
-static int handleSearch(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleSearch(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int ret;
@@ -505,8 +509,12 @@ static int handleSearch(FILE * fp, unsigned int * permission, int argArrayLength
return ret;
}
-static int listHandleUpdate(FILE * fp, unsigned int * permission, int argArrayLength,
- char ** argArray, ListNode * commandNode, CommandEntry * cmd)
+static int listHandleUpdate(FILE * fp,
+ int * permission,
+ int argArrayLength,
+ char ** argArray,
+ ListNode * commandNode,
+ CommandEntry * cmd)
{
static List * pathList = NULL;
CommandEntry * nextCmd = NULL;
@@ -519,7 +527,7 @@ static int listHandleUpdate(FILE * fp, unsigned int * permission, int argArrayLe
if(nextNode) {
nextCmd = getCommandEntryFromString((void *)nextNode->data,
- permission);
+ permission);
}
if(cmd!=nextCmd) {
@@ -532,7 +540,7 @@ static int listHandleUpdate(FILE * fp, unsigned int * permission, int argArrayLe
return 0;
}
-static int handleUpdate(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleUpdate(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
if(argArrayLength==2) {
@@ -546,19 +554,19 @@ static int handleUpdate(FILE * fp, unsigned int * permission, int argArrayLength
return updateInit(fp,NULL);
}
-static int handleNext(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleNext(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
return nextSongInPlaylist(fp);
}
-static int handlePrevious(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handlePrevious(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
return previousSongInPlaylist(fp);
}
-static int handleListAll(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleListAll(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
char * directory = NULL;
@@ -567,7 +575,7 @@ static int handleListAll(FILE * fp, unsigned int * permission, int argArrayLengt
return printAllIn(fp,directory);
}
-static int handleVolume(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleVolume(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int change;
@@ -581,7 +589,7 @@ static int handleVolume(FILE * fp, unsigned int * permission, int argArrayLength
return changeVolumeLevel(fp,change,1);
}
-static int handleSetVol(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleSetVol(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int level;
@@ -595,7 +603,7 @@ static int handleSetVol(FILE * fp, unsigned int * permission, int argArrayLength
return changeVolumeLevel(fp,level,0);
}
-static int handleRepeat(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleRepeat(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int status;
@@ -609,7 +617,7 @@ static int handleRepeat(FILE * fp, unsigned int * permission, int argArrayLength
return setPlaylistRepeatStatus(fp,status);
}
-static int handleRandom(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleRandom(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int status;
@@ -623,20 +631,20 @@ static int handleRandom(FILE * fp, unsigned int * permission, int argArrayLength
return setPlaylistRandomStatus(fp,status);
}
-static int handleStats(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleStats(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
return printStats(fp);
}
-static int handleClearError(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleClearError(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
clearPlayerError();
return 0;
}
-static int handleList(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleList(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int numConditionals = 0;
@@ -680,7 +688,7 @@ static int handleList(FILE * fp, unsigned int * permission, int argArrayLength,
return ret;
}
-static int handleMove(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleMove(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int from;
@@ -702,7 +710,7 @@ static int handleMove(FILE * fp, unsigned int * permission, int argArrayLength,
return moveSongInPlaylist(fp,from,to);
}
-static int handleMoveId(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleMoveId(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int id;
@@ -724,7 +732,7 @@ static int handleMoveId(FILE * fp, unsigned int * permission, int argArrayLength
return moveSongInPlaylistById(fp, id, to);
}
-static int handleSwap(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleSwap(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int song1;
@@ -746,7 +754,7 @@ static int handleSwap(FILE * fp, unsigned int * permission, int argArrayLength,
return swapSongsInPlaylist(fp,song1,song2);
}
-static int handleSwapId(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleSwapId(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int id1;
@@ -768,7 +776,7 @@ static int handleSwapId(FILE * fp, unsigned int * permission, int argArrayLength
return swapSongsInPlaylistById(fp, id1, id2);
}
-static int handleSeek(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleSeek(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int song;
@@ -790,7 +798,7 @@ static int handleSeek(FILE * fp, unsigned int * permission, int argArrayLength,
return seekSongInPlaylist(fp,song,time);
}
-static int handleSeekId(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleSeekId(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int id;
@@ -812,7 +820,7 @@ static int handleSeekId(FILE * fp, unsigned int * permission, int argArrayLength
return seekSongInPlaylistById(fp, id, time);
}
-static int handleListAllInfo(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleListAllInfo(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
char * directory = NULL;
@@ -821,13 +829,13 @@ static int handleListAllInfo(FILE * fp, unsigned int * permission, int argArrayL
return printInfoForAllIn(fp,directory);
}
-static int handlePing(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handlePing(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
return 0;
}
-static int handlePassword(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handlePassword(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
if(getPermissionFromPassword(argArray[1],permission)<0) {
@@ -838,7 +846,7 @@ static int handlePassword(FILE * fp, unsigned int * permission, int argArrayLeng
return 0;
}
-static int handleCrossfade(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleCrossfade(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int time;
@@ -856,7 +864,7 @@ static int handleCrossfade(FILE * fp, unsigned int * permission, int argArrayLen
return 0;
}
-static int handleEnableDevice(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleEnableDevice(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
int device;
@@ -872,7 +880,7 @@ static int handleEnableDevice(FILE * fp, unsigned int * permission, int argArray
return enableAudioDevice(fp, device);
}
-static int handleDisableDevice(FILE * fp, unsigned int * permission,
+static int handleDisableDevice(FILE * fp, int * permission,
int argArrayLength, char ** argArray)
{
int device;
@@ -888,7 +896,7 @@ static int handleDisableDevice(FILE * fp, unsigned int * permission,
return disableAudioDevice(fp, device);
}
-static int handleDevices(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleDevices(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
printAudioDevices(fp);
@@ -897,7 +905,7 @@ static int handleDevices(FILE * fp, unsigned int * permission, int argArrayLengt
}
/* don't be fooled, this is the command handler for "commands" command */
-static int handleCommands(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleCommands(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
ListNode * node = commandList->firstNode;
@@ -915,7 +923,7 @@ static int handleCommands(FILE * fp, unsigned int * permission, int argArrayLeng
return 0;
}
-static int handleNotcommands(FILE * fp, unsigned int * permission, int argArrayLength,
+static int handleNotcommands(FILE * fp, int * permission, int argArrayLength,
char ** argArray)
{
ListNode * node = commandList->firstNode;
@@ -1000,7 +1008,7 @@ void finishCommands(void) {
}
static int checkArgcAndPermission(CommandEntry * cmd, FILE *fp,
- unsigned int permission, int argc, char** argArray)
+ int permission, int argc, char** argArray)
{
int min = cmd->min + 1;
int max = cmd->max + 1;
@@ -1044,7 +1052,7 @@ static int checkArgcAndPermission(CommandEntry * cmd, FILE *fp,
}
static CommandEntry * getCommandEntryAndCheckArgcAndPermission(FILE * fp,
- unsigned int * permission, int argArrayLength, char ** argArray)
+ int * permission, int argArrayLength, char ** argArray)
{
static char unknown[] = "";
CommandEntry * cmd;
@@ -1086,7 +1094,7 @@ static CommandEntry * getCommandEntryFromString(char * string, int * permission)
return cmd;
}
-static int processCommandInternal(FILE * fp, unsigned int * permission,
+static int processCommandInternal(FILE * fp, int * permission,
char * commandString,
ListNode * commandNode)
{
@@ -1147,6 +1155,6 @@ int processListOfCommands(FILE * fp, int * permission, int * expired,
return ret;
}
-int processCommand(FILE * fp, unsigned int * permission, char * commandString) {
+int processCommand(FILE * fp, int * permission, char * commandString) {
return processCommandInternal(fp,permission,commandString,NULL);
}
diff --git a/src/command.h b/src/command.h
index 2f025f3b1..410c25197 100644
--- a/src/command.h
+++ b/src/command.h
@@ -38,7 +38,7 @@ extern int command_listNum;
int processListOfCommands(FILE * fp, int * permission, int * expired,
int listOK, List * list);
-int processCommand(FILE * fp, unsigned int * permission, char * commandString);
+int processCommand(FILE * fp, int * permission, char * commandString);
void initCommands();
diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c
index 86a54c690..2284b4f01 100644
--- a/src/inputPlugins/audiofile_plugin.c
+++ b/src/inputPlugins/audiofile_plugin.c
@@ -93,7 +93,7 @@ static int audiofile_decode(OutputBuffer * cb, DecoderControl * dc, char * path)
dc->state = DECODE_STATE_DECODE;
{
int ret, eof = 0, current = 0;
- unsigned char chunk[CHUNK_SIZE];
+ char chunk[CHUNK_SIZE];
while(!eof) {
if(dc->seek) {
diff --git a/src/interface.c b/src/interface.c
index c7efbe032..40d1876b3 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -68,7 +68,7 @@ typedef struct _Interface {
int fd; /* file descriptor */
FILE * fp; /* file pointer */
int open; /* open/used */
- unsigned int permission;
+ int permission;
time_t lastTime;
List * commandList; /* for when in list mode */
int commandListOK; /* print OK after each command execution */
@@ -116,7 +116,7 @@ static void openInterface(Interface * interface, int fd) {
#ifdef SO_SNDBUF
{
int getSize;
- int sockOptLen = sizeof(int);
+ unsigned int sockOptLen = sizeof(int);
if(getsockopt(interface->fd,SOL_SOCKET,SO_SNDBUF,
(char *)&getSize,&sockOptLen) < 0)
diff --git a/src/permission.c b/src/permission.c
index 6fa6441de..836ad3056 100644
--- a/src/permission.c
+++ b/src/permission.c
@@ -34,10 +34,10 @@
static List * permission_passwords;
-static unsigned int permission_default;
+static int permission_default;
-static unsigned int parsePermissions(char * string) {
- unsigned int permission = 0;
+static int parsePermissions(char * string) {
+ int permission = 0;
char * temp;
char * tok;
@@ -72,7 +72,7 @@ void initPermissions(void) {
char * temp;
char * cp2;
char * password;
- unsigned int * permission;
+ int * permission;
ConfigParam * param;
permission_passwords = makeList(free, 1);
@@ -104,7 +104,7 @@ void initPermissions(void) {
password = temp;
- permission = malloc(sizeof(unsigned int));
+ permission = malloc(sizeof(int));
*permission = parsePermissions(strtok_r(NULL,"",&cp2));
insertInList(permission_passwords,password,permission);
@@ -118,11 +118,11 @@ void initPermissions(void) {
sortList(permission_passwords);
}
-int getPermissionFromPassword(char * password, unsigned int * permission) {
+int getPermissionFromPassword(char * password, int * permission) {
void * foundPermission;
if(findInList(permission_passwords,password,&foundPermission)) {
- *permission = *((unsigned int *)foundPermission);
+ *permission = *((int *)foundPermission);
return 0;
}
@@ -133,6 +133,6 @@ void finishPermissions(void) {
freeList(permission_passwords);
}
-unsigned int getDefaultPermissions(void) {
+int getDefaultPermissions(void) {
return permission_default;
}
diff --git a/src/permission.h b/src/permission.h
index 7fec6f53e..ca1835281 100644
--- a/src/permission.h
+++ b/src/permission.h
@@ -28,10 +28,10 @@
void initPermissions();
-int getPermissionFromPassword(char * password, unsigned int * permission);
+int getPermissionFromPassword(char * password, int * permission);
void finishPermissions();
-unsigned int getDefaultPermissions();
+int getDefaultPermissions();
#endif
diff --git a/src/tag.c b/src/tag.c
index e8f976646..5ae982e44 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -347,13 +347,13 @@ MpdTag * apeDup(char * file) {
MpdTag * ret = NULL;
FILE * fp = NULL;
int tagCount;
- unsigned char * buffer = NULL;
- unsigned char * p;
+ char * buffer = NULL;
+ char * p;
int tagLen;
int size;
unsigned long flags;
int i;
- unsigned char * key;
+ char * key;
struct {
unsigned char id[8];
@@ -411,10 +411,10 @@ MpdTag * apeDup(char * file) {
tagCount = readLEuint32(footer.tagCount);
p = buffer;
while(tagCount-- && tagLen > 10) {
- size = readLEuint32(p);
+ size = readLEuint32((unsigned char *)p);
p += 4;
tagLen -= 4;
- flags = readLEuint32(p);
+ flags = readLEuint32((unsigned char *)p);
p += 4;
tagLen -= 4;
diff --git a/src/utf8.c b/src/utf8.c
index c0b7d694a..3c2f3716e 100644
--- a/src/utf8.c
+++ b/src/utf8.c
@@ -22,30 +22,31 @@
#include <string.h>
#include <stdlib.h>
-static unsigned char * latin1ToUtf8(unsigned char c) {
+static char * latin1ToUtf8(char c) {
static unsigned char utf8[3];
+ unsigned char uc = c;
memset(utf8,0,3);
- if(c < 128) utf8[0] = c;
- else if(c<192) {
+ if(uc < 128) utf8[0] = uc;
+ else if(uc<192) {
utf8[0] = 194;
- utf8[1] = c;
+ utf8[1] = uc;
}
else {
utf8[0] = 195;
- utf8[1] = c-64;
+ utf8[1] = uc-64;
}
- return utf8;
+ return (char *)utf8;
}
-unsigned char * latin1StrToUtf8Dup(unsigned char * latin1) {
+char * latin1StrToUtf8Dup(char * latin1) {
/* utf8 should have at most two char's per latin1 char */
int len = strlen(latin1)*2+1;
- unsigned char * ret = malloc(len);
- unsigned char * cp = ret;
- unsigned char * utf8;
+ char * ret = malloc(len);
+ char * cp = ret;
+ char * utf8;
memset(ret,0,len);
@@ -63,21 +64,24 @@ unsigned char * latin1StrToUtf8Dup(unsigned char * latin1) {
return realloc(ret,len+1);
}
-static unsigned char utf8ToLatin1(unsigned char * utf8) {
+static char utf8ToLatin1(char * inUtf8) {
unsigned char c = 0;
+ unsigned char * utf8 = (unsigned char *)inUtf8;
if(utf8[0]<128) return utf8[0];
else if(utf8[0]==195) c+=64;
else if(utf8[0]!=194) return '?';
- return c+utf8[1];
+ return (char)(c+utf8[1]);
}
-static int validateUtf8Char(unsigned char * utf8Char) {
+static int validateUtf8Char(char * inUtf8Char) {
+ unsigned char * utf8Char = (unsigned char *)inUtf8Char;
+
if(utf8Char[0]<0x80) return 1;
if(utf8Char[0]>=0xC0 && utf8Char[0]<=0xFD) {
int count = 1;
- unsigned char t = 1 << 5;
+ char t = 1 << 5;
int i;
while(count < 6 && (t & utf8Char[0])) {
t = (t >> 1);
@@ -92,7 +96,7 @@ static int validateUtf8Char(unsigned char * utf8Char) {
else return 0;
}
-int validUtf8String(unsigned char * string) {
+int validUtf8String(char * string) {
int ret;
while(*string) {
@@ -104,11 +108,11 @@ int validUtf8String(unsigned char * string) {
return 1;
}
-unsigned char * utf8StrToLatin1Dup(unsigned char * utf8) {
+char * utf8StrToLatin1Dup(char * utf8) {
/* utf8 should have at most two char's per latin1 char */
int len = strlen(utf8)+1;
- unsigned char * ret = malloc(len);
- unsigned char * cp = ret;
+ char * ret = malloc(len);
+ char * cp = ret;
int count;
memset(ret,0,len);
diff --git a/src/utf8.h b/src/utf8.h
index abc843e9d..b5e2f4727 100644
--- a/src/utf8.h
+++ b/src/utf8.h
@@ -19,10 +19,10 @@
#ifndef UTF_8_H
#define UTF_8_H
-unsigned char * latin1StrToUtf8Dup(unsigned char * latin1);
+char * latin1StrToUtf8Dup(char * latin1);
-unsigned char * utf8StrToLatin1Dup(unsigned char * utf8);
+char * utf8StrToLatin1Dup(char * utf8);
-int validUtf8String(unsigned char * string);
+int validUtf8String(char * string);
#endif