1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-28 21:19:10 +00:00

cpp-ify a lot of files

This commit is contained in:
Nikolas Garofil 2010-02-09 13:11:56 +01:00
parent 66a63d9e87
commit 043b12b15a
19 changed files with 110 additions and 118 deletions

View File

@ -37,8 +37,8 @@ endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/build.h)
set(conky_sources colours.cc combine.cc common.cc conky.cc core.cc
diskio.cc entropy.cc exec.cc fs.cc mail.cc mixer.cc net_stat.cc template.cc
mboxscan.cc read_tcp.cc scroll.cc specials.cc tailhead.cc
temphelper.cc text_object.cc timeinfo.cc top.cc algebra.c prioqueue.c proc.c
user.c)
temphelper.cc text_object.cc timeinfo.cc top.cc algebra.cc prioqueue.c proc.cc
user.cc)
# add timed thread library
add_library(timed-thread timed-thread.cc)
@ -46,28 +46,28 @@ set(conky_libs ${conky_libs} timed-thread)
# Platform specific sources
if(OS_LINUX)
set(linux linux.cc users.cc sony.c i8k.cc)
set(linux linux.cc users.cc sony.cc i8k.cc)
set(optional_sources ${optional_sources} ${linux})
endif(OS_LINUX)
if(OS_FREEBSD)
set(freebsd freebsd.c bsdapm.c)
set(freebsd freebsd.cc bsdapm.cc)
set(optional_sources ${optional_sources} ${freebsd})
endif(OS_FREEBSD)
if(OS_OPENBSD)
set(openbsd openbsd.c bsdapm.c)
set(openbsd openbsd.cc bsdapm.cc)
set(optional_sources ${optional_sources} ${openbsd})
endif(OS_OPENBSD)
# These below are not actually supported. No idea what their status is.
if(OS_SOLARIS)
set(solaris solaris.c)
set(solaris solaris.cc)
set(optional_sources ${optional_sources} ${solaris})
endif(OS_SOLARIS)
if(OS_NETBSD)
set(netbsd netbsd.c)
set(netbsd netbsd.cc)
set(optional_sources ${optional_sources} ${netbsd})
endif(OS_NETBSD)
@ -79,7 +79,7 @@ if(BUILD_AUDACIOUS)
endif(BUILD_AUDACIOUS)
if(BUILD_BMPX)
set(bmpx bmpx.c)
set(bmpx bmpx.cc)
set(optional_sources ${optional_sources} ${bmpx})
endif(BUILD_BMPX)
@ -89,7 +89,7 @@ if(BUILD_IBM)
endif(BUILD_IBM)
if(BUILD_MPD)
set(mpd mpd.cc libmpdclient.c)
set(mpd mpd.cc libmpdclient.cc)
set(optional_sources ${optional_sources} ${mpd})
endif(BUILD_MPD)
@ -99,7 +99,7 @@ if(BUILD_MOC)
endif(BUILD_MOC)
if(BUILD_XMMS2)
set(xmms2 xmms2.c)
set(xmms2 xmms2.cc)
set(optional_sources ${optional_sources} ${xmms2})
endif(BUILD_XMMS2)
@ -111,7 +111,7 @@ if(BUILD_PORT_MONITORS)
endif(BUILD_PORT_MONITORS)
if(BUILD_X11)
set(x11 x11.cc fonts.c)
set(x11 x11.cc fonts.cc)
set(optional_sources ${optional_sources} ${x11})
endif(BUILD_X11)
@ -121,7 +121,7 @@ if(BUILD_HDDTEMP)
endif(BUILD_HDDTEMP)
if(BUILD_EVE)
set(eve eve.c)
set(eve eve.cc)
set(optional_sources ${optional_sources} ${eve})
endif(BUILD_EVE)
@ -131,7 +131,7 @@ if(BUILD_CURL)
endif(BUILD_CURL)
if(BUILD_RSS)
set(rss rss.cc prss.c)
set(rss rss.cc prss.cc)
set(optional_sources ${optional_sources} ${rss})
endif(BUILD_RSS)
@ -156,12 +156,12 @@ if(BUILD_IMLIB2)
endif(BUILD_IMLIB2)
if(BUILD_APCUPSD)
set(apcupsd apcupsd.c)
set(apcupsd apcupsd.cc)
set(optional_sources ${optional_sources} ${apcupsd})
endif(BUILD_APCUPSD)
if(BUILD_ICONV)
set(iconv iconv_tools.c)
set(iconv iconv_tools.cc)
set(optional_sources ${optional_sources} ${iconv})
endif(BUILD_ICONV)

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* Conky, a system monitor, based on torsmo
*
@ -227,16 +227,16 @@ int compare(const char *expr)
char *a, *b;
a = arg_to_string(expr_dup);
b = arg_to_string(expr_dup + idx + 1);
idx = scompare(a, mtype, b);
idx = scompare(a, (enum match_type) mtype, b);
free(a);
free(b);
return idx;
}
case ARG_LONG:
return lcompare(arg_to_long(expr_dup), mtype,
return lcompare(arg_to_long(expr_dup), (enum match_type) mtype,
arg_to_long(expr_dup + idx + 1));
case ARG_DOUBLE:
return dcompare(arg_to_double(expr_dup), mtype,
return dcompare(arg_to_double(expr_dup), (enum match_type) mtype,
arg_to_double(expr_dup + idx + 1));
}
/* not reached */

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* apcupsd.c: conky module for APC UPS daemon monitoring
*

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* Conky, a system monitor, based on torsmo
*

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* Conky, a system monitor, based on torsmo
*

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* Conky, a system monitor, based on torsmo
*

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* Conky, a system monitor, based on torsmo
*
@ -83,7 +83,7 @@ int add_font(const char *data_in)
}
memset(fonts, 0, sizeof(struct font_list));
}
fonts = realloc(fonts, (sizeof(struct font_list) * (font_count + 1)));
fonts = (font_list*) realloc(fonts, (sizeof(struct font_list) * (font_count + 1)));
memset(&fonts[font_count], 0, sizeof(struct font_list));
if (fonts == NULL) {
CRIT_ERR(NULL, NULL, "realloc in add_font");

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* Conky, a system monitor, based on torsmo
*

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* Conky, a system monitor, based on torsmo
*

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* libmpdclient
* (c)2003-2006 by Warren Dukes (warren.dukes@gmail.com)
@ -283,7 +283,7 @@ static char *mpd_sanitizeArg(const char *arg)
/* instead of counting in that loop above,
* just use a bit more memory and halve running time */
ret = malloc(strlen(arg) * 2 + 1);
ret = (char*) malloc(strlen(arg) * 2 + 1);
c = arg;
rc = ret;
@ -300,7 +300,7 @@ static char *mpd_sanitizeArg(const char *arg)
static mpd_ReturnElement *mpd_newReturnElement(const char *name,
const char *value)
{
mpd_ReturnElement *ret = malloc(sizeof(mpd_ReturnElement));
mpd_ReturnElement *ret = (mpd_ReturnElement*) malloc(sizeof(mpd_ReturnElement));
ret->name = strndup(name, text_buffer_size);
ret->value = strndup(value, text_buffer_size);
@ -361,7 +361,7 @@ mpd_Connection *mpd_newConnection(const char *host, int port, float timeout)
int err;
char *rt;
char *output = NULL;
mpd_Connection *connection = malloc(sizeof(mpd_Connection));
mpd_Connection *connection = (mpd_Connection*) malloc(sizeof(mpd_Connection));
struct timeval tv;
fd_set fds;
@ -715,7 +715,7 @@ mpd_Status *mpd_getStatus(mpd_Connection *connection)
mpd_getNextReturnElement(connection);
}
status = malloc(sizeof(mpd_Status));
status = (mpd_Status *) malloc(sizeof(mpd_Status));
status->volume = -1;
status->repeat = 0;
status->random = 0;
@ -846,7 +846,7 @@ mpd_Stats *mpd_getStats(mpd_Connection *connection)
mpd_getNextReturnElement(connection);
}
stats = malloc(sizeof(mpd_Stats));
stats = (mpd_Stats *) malloc(sizeof(mpd_Stats));
stats->numberOfArtists = 0;
stats->numberOfAlbums = 0;
stats->numberOfSongs = 0;
@ -916,7 +916,7 @@ mpd_SearchStats *mpd_getSearchStats(mpd_Connection *connection)
return NULL;
}
stats = malloc(sizeof(mpd_SearchStats));
stats = (mpd_SearchStats *) malloc(sizeof(mpd_SearchStats));
stats->numberOfSongs = 0;
stats->playTime = 0;
@ -1009,7 +1009,7 @@ static void mpd_finishSong(mpd_Song *song)
mpd_Song *mpd_newSong(void)
{
mpd_Song *ret = malloc(sizeof(mpd_Song));
mpd_Song *ret = (mpd_Song *) malloc(sizeof(mpd_Song));
mpd_initSong(ret);
@ -1080,7 +1080,7 @@ static void mpd_finishDirectory(mpd_Directory *directory)
mpd_Directory *mpd_newDirectory(void)
{
mpd_Directory *directory = malloc(sizeof(mpd_Directory));
mpd_Directory *directory = (mpd_Directory *) malloc(sizeof(mpd_Directory));
mpd_initDirectory(directory);
@ -1119,7 +1119,7 @@ static void mpd_finishPlaylistFile(mpd_PlaylistFile *playlist)
mpd_PlaylistFile *mpd_newPlaylistFile(void)
{
mpd_PlaylistFile *playlist = malloc(sizeof(mpd_PlaylistFile));
mpd_PlaylistFile *playlist = (mpd_PlaylistFile *) malloc(sizeof(mpd_PlaylistFile));
mpd_initPlaylistFile(playlist);
@ -1163,7 +1163,7 @@ static void mpd_finishInfoEntity(mpd_InfoEntity *entity)
mpd_InfoEntity *mpd_newInfoEntity(void)
{
mpd_InfoEntity *entity = malloc(sizeof(mpd_InfoEntity));
mpd_InfoEntity *entity = (mpd_InfoEntity *) malloc(sizeof(mpd_InfoEntity));
mpd_initInfoEntity(entity);
@ -1340,7 +1340,7 @@ char *mpd_getNextAlbum(mpd_Connection *connection)
void mpd_sendPlaylistInfoCommand(mpd_Connection *connection, int songPos)
{
int len = strlen("playlistinfo") + 2 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "playlistinfo \"%i\"\n", songPos);
mpd_sendInfoCommand(connection, string);
@ -1350,7 +1350,7 @@ void mpd_sendPlaylistInfoCommand(mpd_Connection *connection, int songPos)
void mpd_sendPlaylistIdCommand(mpd_Connection *connection, int id)
{
int len = strlen("playlistid") + 2 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "playlistid \"%i\"\n", id);
mpd_sendInfoCommand(connection, string);
@ -1360,7 +1360,7 @@ void mpd_sendPlaylistIdCommand(mpd_Connection *connection, int id)
void mpd_sendPlChangesCommand(mpd_Connection *connection, long long playlist)
{
int len = strlen("plchanges") + 2 + LONGLONGLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "plchanges \"%lld\"\n", playlist);
mpd_sendInfoCommand(connection, string);
@ -1371,7 +1371,7 @@ void mpd_sendPlChangesPosIdCommand(mpd_Connection *connection,
long long playlist)
{
int len = strlen("plchangesposid") + 2 + LONGLONGLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "plchangesposid \"%lld\"\n", playlist);
mpd_sendInfoCommand(connection, string);
@ -1382,7 +1382,7 @@ void mpd_sendListallCommand(mpd_Connection *connection, const char *dir)
{
char *sDir = mpd_sanitizeArg(dir);
int len = strlen("listall") + 2 + strlen(sDir) + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "listall \"%s\"\n", sDir);
mpd_sendInfoCommand(connection, string);
@ -1394,7 +1394,7 @@ void mpd_sendListallInfoCommand(mpd_Connection *connection, const char *dir)
{
char *sDir = mpd_sanitizeArg(dir);
int len = strlen("listallinfo") + 2 + strlen(sDir) + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "listallinfo \"%s\"\n", sDir);
mpd_sendInfoCommand(connection, string);
@ -1406,7 +1406,7 @@ void mpd_sendLsInfoCommand(mpd_Connection *connection, const char *dir)
{
char *sDir = mpd_sanitizeArg(dir);
int len = strlen("lsinfo") + 2 + strlen(sDir) + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "lsinfo \"%s\"\n", sDir);
mpd_sendInfoCommand(connection, string);
@ -1455,12 +1455,12 @@ void mpd_sendListCommand(mpd_Connection *connection, int table,
char *sanitArg1 = mpd_sanitizeArg(arg1);
len = strlen("list") + 1 + strlen(sanitArg1) + 2 + strlen(st) + 3;
string = malloc(len);
string = (char*) malloc(len);
snprintf(string, len, "list %s \"%s\"\n", st, sanitArg1);
free(sanitArg1);
} else {
len = strlen("list") + 1 + strlen(st) + 2;
string = malloc(len);
string = (char*) malloc(len);
snprintf(string, len, "list %s\n", st);
}
mpd_sendInfoCommand(connection, string);
@ -1471,7 +1471,7 @@ void mpd_sendAddCommand(mpd_Connection *connection, const char *file)
{
char *sFile = mpd_sanitizeArg(file);
int len = strlen("add") + 2 + strlen(sFile) + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "add \"%s\"\n", sFile);
mpd_executeCommand(connection, string);
@ -1484,7 +1484,7 @@ int mpd_sendAddIdCommand(mpd_Connection *connection, const char *file)
int retval = -1;
char *sFile = mpd_sanitizeArg(file);
int len = strlen("addid") + 2 + strlen(sFile) + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "addid \"%s\"\n", sFile);
mpd_sendInfoCommand(connection, string);
@ -1503,7 +1503,7 @@ int mpd_sendAddIdCommand(mpd_Connection *connection, const char *file)
void mpd_sendDeleteCommand(mpd_Connection *connection, int songPos)
{
int len = strlen("delete") + 2 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "delete \"%i\"\n", songPos);
mpd_sendInfoCommand(connection, string);
@ -1513,7 +1513,7 @@ void mpd_sendDeleteCommand(mpd_Connection *connection, int songPos)
void mpd_sendDeleteIdCommand(mpd_Connection *connection, int id)
{
int len = strlen("deleteid") + 2 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "deleteid \"%i\"\n", id);
mpd_sendInfoCommand(connection, string);
@ -1524,7 +1524,7 @@ void mpd_sendSaveCommand(mpd_Connection *connection, const char *name)
{
char *sName = mpd_sanitizeArg(name);
int len = strlen("save") + 2 + strlen(sName) + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "save \"%s\"\n", sName);
mpd_executeCommand(connection, string);
@ -1536,7 +1536,7 @@ void mpd_sendLoadCommand(mpd_Connection *connection, const char *name)
{
char *sName = mpd_sanitizeArg(name);
int len = strlen("load") + 2 + strlen(sName) + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "load \"%s\"\n", sName);
mpd_executeCommand(connection, string);
@ -1548,7 +1548,7 @@ void mpd_sendRmCommand(mpd_Connection *connection, const char *name)
{
char *sName = mpd_sanitizeArg(name);
int len = strlen("rm") + 2 + strlen(sName) + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "rm \"%s\"\n", sName);
mpd_executeCommand(connection, string);
@ -1562,7 +1562,7 @@ void mpd_sendRenameCommand(mpd_Connection *connection, const char *from,
char *sFrom = mpd_sanitizeArg(from);
char *sTo = mpd_sanitizeArg(to);
int len = strlen("rename") + 2 + strlen(sFrom) + 3 + strlen(sTo) + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "rename \"%s\" \"%s\"\n", sFrom, sTo);
mpd_executeCommand(connection, string);
@ -1584,7 +1584,7 @@ void mpd_sendClearCommand(mpd_Connection *connection)
void mpd_sendPlayCommand(mpd_Connection *connection, int songPos)
{
int len = strlen("play") + 2 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "play \"%i\"\n", songPos);
mpd_sendInfoCommand(connection, string);
@ -1594,7 +1594,7 @@ void mpd_sendPlayCommand(mpd_Connection *connection, int songPos)
void mpd_sendPlayIdCommand(mpd_Connection *connection, int id)
{
int len = strlen("playid") + 2 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "playid \"%i\"\n", id);
mpd_sendInfoCommand(connection, string);
@ -1609,7 +1609,7 @@ void mpd_sendStopCommand(mpd_Connection *connection)
void mpd_sendPauseCommand(mpd_Connection *connection, int pauseMode)
{
int len = strlen("pause") + 2 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "pause \"%i\"\n", pauseMode);
mpd_executeCommand(connection, string);
@ -1624,7 +1624,7 @@ void mpd_sendNextCommand(mpd_Connection *connection)
void mpd_sendMoveCommand(mpd_Connection *connection, int from, int to)
{
int len = strlen("move") + 2 + INTLEN + 3 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "move \"%i\" \"%i\"\n", from, to);
mpd_sendInfoCommand(connection, string);
@ -1634,7 +1634,7 @@ void mpd_sendMoveCommand(mpd_Connection *connection, int from, int to)
void mpd_sendMoveIdCommand(mpd_Connection *connection, int id, int to)
{
int len = strlen("moveid") + 2 + INTLEN + 3 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "moveid \"%i\" \"%i\"\n", id, to);
mpd_sendInfoCommand(connection, string);
@ -1644,7 +1644,7 @@ void mpd_sendMoveIdCommand(mpd_Connection *connection, int id, int to)
void mpd_sendSwapCommand(mpd_Connection *connection, int song1, int song2)
{
int len = strlen("swap") + 2 + INTLEN + 3 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "swap \"%i\" \"%i\"\n", song1, song2);
mpd_sendInfoCommand(connection, string);
@ -1654,7 +1654,7 @@ void mpd_sendSwapCommand(mpd_Connection *connection, int song1, int song2)
void mpd_sendSwapIdCommand(mpd_Connection *connection, int id1, int id2)
{
int len = strlen("swapid") + 2 + INTLEN + 3 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "swapid \"%i\" \"%i\"\n", id1, id2);
mpd_sendInfoCommand(connection, string);
@ -1664,7 +1664,7 @@ void mpd_sendSwapIdCommand(mpd_Connection *connection, int id1, int id2)
void mpd_sendSeekCommand(mpd_Connection *connection, int song, int seek_time)
{
int len = strlen("seek") + 2 + INTLEN + 3 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "seek \"%i\" \"%i\"\n", song, seek_time);
mpd_sendInfoCommand(connection, string);
@ -1674,7 +1674,7 @@ void mpd_sendSeekCommand(mpd_Connection *connection, int song, int seek_time)
void mpd_sendSeekIdCommand(mpd_Connection *connection, int id, int seek_time)
{
int len = strlen("seekid") + 2 + INTLEN + 3 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "seekid \"%i\" \"%i\"\n", id, seek_time);
mpd_sendInfoCommand(connection, string);
@ -1685,7 +1685,7 @@ void mpd_sendUpdateCommand(mpd_Connection *connection, char *path)
{
char *sPath = mpd_sanitizeArg(path);
int len = strlen("update") + 2 + strlen(sPath) + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "update \"%s\"\n", sPath);
mpd_sendInfoCommand(connection, string);
@ -1715,7 +1715,7 @@ void mpd_sendPrevCommand(mpd_Connection *connection)
void mpd_sendRepeatCommand(mpd_Connection *connection, int repeatMode)
{
int len = strlen("repeat") + 2 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "repeat \"%i\"\n", repeatMode);
mpd_executeCommand(connection, string);
@ -1725,7 +1725,7 @@ void mpd_sendRepeatCommand(mpd_Connection *connection, int repeatMode)
void mpd_sendRandomCommand(mpd_Connection *connection, int randomMode)
{
int len = strlen("random") + 2 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "random \"%i\"\n", randomMode);
mpd_executeCommand(connection, string);
@ -1735,7 +1735,7 @@ void mpd_sendRandomCommand(mpd_Connection *connection, int randomMode)
void mpd_sendSetvolCommand(mpd_Connection *connection, int volumeChange)
{
int len = strlen("setvol") + 2 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "setvol \"%i\"\n", volumeChange);
mpd_executeCommand(connection, string);
@ -1745,7 +1745,7 @@ void mpd_sendSetvolCommand(mpd_Connection *connection, int volumeChange)
void mpd_sendVolumeCommand(mpd_Connection *connection, int volumeChange)
{
int len = strlen("volume") + 2 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "volume \"%i\"\n", volumeChange);
mpd_executeCommand(connection, string);
@ -1755,7 +1755,7 @@ void mpd_sendVolumeCommand(mpd_Connection *connection, int volumeChange)
void mpd_sendCrossfadeCommand(mpd_Connection *connection, int seconds)
{
int len = strlen("crossfade") + 2 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "crossfade \"%i\"\n", seconds);
mpd_executeCommand(connection, string);
@ -1766,7 +1766,7 @@ void mpd_sendPasswordCommand(mpd_Connection *connection, const char *pass)
{
char *sPass = mpd_sanitizeArg(pass);
int len = strlen("password") + 2 + strlen(sPass) + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "password \"%s\"\n", sPass);
mpd_executeCommand(connection, string);
@ -1826,7 +1826,7 @@ mpd_OutputEntity *mpd_getNextOutput(mpd_Connection *connection)
return NULL;
}
output = malloc(sizeof(mpd_OutputEntity));
output = (mpd_OutputEntity*) malloc(sizeof(mpd_OutputEntity));
output->id = -10;
output->name = NULL;
output->enabled = 0;
@ -1862,7 +1862,7 @@ mpd_OutputEntity *mpd_getNextOutput(mpd_Connection *connection)
void mpd_sendEnableOutputCommand(mpd_Connection *connection, int outputId)
{
int len = strlen("enableoutput") + 2 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "enableoutput \"%i\"\n", outputId);
mpd_executeCommand(connection, string);
@ -1872,7 +1872,7 @@ void mpd_sendEnableOutputCommand(mpd_Connection *connection, int outputId)
void mpd_sendDisableOutputCommand(mpd_Connection *connection, int outputId)
{
int len = strlen("disableoutput") + 2 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "disableoutput \"%i\"\n", outputId);
mpd_executeCommand(connection, string);
@ -1984,7 +1984,7 @@ void mpd_startFieldSearch(mpd_Connection *connection, int type)
strtype = mpdTagItemKeys[type];
len = 5 + strlen(strtype) + 1;
connection->request = malloc(len);
connection->request = (char*) malloc(len);
snprintf(connection->request, len, "list %c%s", tolower(strtype[0]),
strtype + 1);
@ -2021,7 +2021,7 @@ void mpd_addConstraintSearch(mpd_Connection *connection, int type,
arg = mpd_sanitizeArg(name);
len = strlen(string) + 1 + strlen(strtype) + 2 + strlen(arg) + 2;
connection->request = realloc(connection->request, len);
connection->request = (char*) realloc(connection->request, len);
snprintf(connection->request, len, "%s %c%s \"%s\"", string,
tolower(strtype[0]), strtype + 1, arg);
@ -2040,7 +2040,7 @@ void mpd_commitSearch(mpd_Connection *connection)
}
len = strlen(connection->request) + 2;
connection->request = realloc(connection->request, len);
connection->request = (char*) realloc(connection->request, len);
connection->request[len - 2] = '\n';
connection->request[len - 1] = '\0';
mpd_sendInfoCommand(connection, connection->request);
@ -2058,7 +2058,7 @@ void mpd_sendListPlaylistInfoCommand(mpd_Connection *connection, char *path)
{
char *arg = mpd_sanitizeArg(path);
int len = strlen("listplaylistinfo") + 2 + strlen(arg) + 3;
char *query = malloc(len);
char *query = (char*) malloc(len);
snprintf(query, len, "listplaylistinfo \"%s\"\n", arg);
mpd_sendInfoCommand(connection, query);
@ -2075,7 +2075,7 @@ void mpd_sendListPlaylistCommand(mpd_Connection *connection, char *path)
{
char *arg = mpd_sanitizeArg(path);
int len = strlen("listplaylist") + 2 + strlen(arg) + 3;
char *query = malloc(len);
char *query = (char*) malloc(len);
snprintf(query, len, "listplaylist \"%s\"\n", arg);
mpd_sendInfoCommand(connection, query);
@ -2087,7 +2087,7 @@ void mpd_sendPlaylistClearCommand(mpd_Connection *connection, char *path)
{
char *sPath = mpd_sanitizeArg(path);
int len = strlen("playlistclear") + 2 + strlen(sPath) + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "playlistclear \"%s\"\n", sPath);
mpd_executeCommand(connection, string);
@ -2102,7 +2102,7 @@ void mpd_sendPlaylistAddCommand(mpd_Connection *connection, char *playlist,
char *sPath = mpd_sanitizeArg(path);
int len = strlen("playlistadd") + 2 + strlen(sPlaylist) + 3 +
strlen(sPath) + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "playlistadd \"%s\" \"%s\"\n", sPlaylist, sPath);
mpd_executeCommand(connection, string);
@ -2117,7 +2117,7 @@ void mpd_sendPlaylistMoveCommand(mpd_Connection *connection, char *playlist,
char *sPlaylist = mpd_sanitizeArg(playlist);
int len = strlen("playlistmove") + 2 + strlen(sPlaylist) + 3 + INTLEN +
3 + INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "playlistmove \"%s\" \"%i\" \"%i\"\n", sPlaylist,
from, to);
@ -2132,7 +2132,7 @@ void mpd_sendPlaylistDeleteCommand(mpd_Connection *connection, char *playlist,
char *sPlaylist = mpd_sanitizeArg(playlist);
int len = strlen("playlistdelete") + 2 + strlen(sPlaylist) + 3 +
INTLEN + 3;
char *string = malloc(len);
char *string = (char*) malloc(len);
snprintf(string, len, "playlistdelete \"%s\" \"%i\"\n", sPlaylist, pos);
mpd_executeCommand(connection, string);

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* Conky, a system monitor, based on torsmo
*

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* Conky, a system monitor, based on torsmo
*

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* Conky, a system monitor, based on torsmo
*
@ -45,7 +45,7 @@ char* readfile(char* filename, int* total_read, char showerror) {
file = fopen(filename, "r");
if(file) {
do {
buf = realloc(buf, *total_read + READSIZE + 1);
buf = (char *) realloc(buf, *total_read + READSIZE + 1);
bytes_read = fread(buf + *total_read, 1, READSIZE, file);
*total_read += bytes_read;
buf[*total_read] = 0;
@ -75,7 +75,7 @@ struct ll_string {
};
struct ll_string* addnode(struct ll_string* end, char* string) {
struct ll_string* current = malloc(sizeof(struct ll_string));
struct ll_string* current = (struct ll_string*) malloc(sizeof(struct ll_string));
current->string = strdup(string);
current->next = NULL;
if(end != NULL) end->next = current;

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* Copyright (c) 2007 Mikko Sysikaski <mikko.sysikaski@gmail.com>
* Toni Spets <toni.spets@gmail.com>

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* Conky, a system monitor, based on torsmo
*

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* Conky, a system monitor, based on torsmo
*

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* Conky, a system monitor, based on torsmo
*

View File

@ -31,15 +31,7 @@
#ifndef _USER_H
#define _USER_H
#ifdef __cplusplus
extern "C" {
#endif
void print_gid_name(struct text_object *obj, char *p, int p_max_size);
void print_uid_name(struct text_object *obj, char *p, int p_max_size);
#ifdef __cplusplus
}
#endif
#endif /* _USER_H */

View File

@ -1,5 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=c
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*
* Conky, a system monitor, based on torsmo
*