File WSoundServer-0.4.0-noPropList.patch of Package wsndsrv
--- wsoundserver-0.4.0.orig/configure.in
+++ wsoundserver-0.4.0/configure.in
@@ -5,14 +5,12 @@
AM_INIT_AUTOMAKE(WSoundServer, 0.4.0)
-AM_PROG_LIBTOOL
-
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
-AC_PROG_RANLIB
+AM_PROG_LIBTOOL
dnl Checks for libraries.
@@ -60,47 +58,19 @@
AC_SUBST(X_LIBRARY_PATH)
-dnl Check for libPropList
-dnl =====================
-LIBPL=""
-
-WS_CHECK_LIB(PropList, PLGetString, $X_EXTRA_LIBS)
-if test "x$ac_cv_lib_PropList_PLGetString" = xyes; then
- WS_CHECK_HEADER(proplist.h)
- if test "x$ac_cv_header_proplist_h" = xyes; then
- LIBPL="-lPropList"
+dnl Check for libWUtil
+dnl ==================
+LIBWUTIL=""
+
+WS_CHECK_LIB(WUtil, WMGetFromPLString, $X_EXTRA_LIBS)
+if test "x$ac_cv_lib_WUtil_WMGetFromPLString" = xyes; then
+ WS_CHECK_HEADER(WINGs/WUtil.h)
+ if test "x$ac_cv_header_WINGs_WUtil_h" = xyes; then
+ LIBWUTIL="-lWUtil"
fi
fi
-if test "x$LIBPL" = "x"; then
- echo
- echo "ERROR!!! libPropList is not installed, or could not be found."
- echo " WSoundServer requires libPropList to build."
- echo " Please read INSTALL to find where you can find libPropList,"
- echo " and install it first."
- echo " If you already have it installed, try using the"
- if test "x$ac_cv_lib_PropList_PLGetString" != xyes; then
- echo " --with-libs-from flag to tell configure where the library"
- echo " is installed and"
- fi
- echo " --with-incs-from flag to tell configure where the header"
- echo " files are installed"
- exit 1
-fi
-
-
-AC_SUBST(LIBPL)
-
-
-dnl Use gsdd ?
-dnl ==========
-AC_ARG_ENABLE(gsdd,
- [ --enable-gsdd enable using gsdd ],, enable_gsdd=no)
-
-if test "$enable_gsdd" = yes; then
- AC_DEFINE(HAVE_GSDD)
-fi
-
+AC_SUBST(LIBWUTIL)
dnl Check for libdockapp
@@ -306,9 +276,9 @@
prefix="$prefix"
exec_prefix=\$prefix
-SCFLAGS="-I\$prefix/include $inc_search_path $ESD_CFLAGS $AUDIOFILE_CFLAGS -D$driver" $GSDD_CFLAGS
+SCFLAGS="-I\$prefix/include $inc_search_path $ESD_CFLAGS $AUDIOFILE_CFLAGS -D$driver"
SLFLAGS="-L\$exec_prefix/lib $lib_search_path"
-SLIBS="-lwsound $XLIBS $LIBPL $AUDIOFILE_LIBS $ESD_LIBS"
+SLIBS="-lwsound $XLIBS $LIBWUTIL $AUDIOFILE_LIBS $ESD_LIBS"
usage="Usage: get-wsound-flags #lp#--cflags#rp# #lp#--ldflags#rp# #lp#--libs#rp#"
--- wsoundserver-0.4.0.orig/wslib/Makefile.am
+++ wsoundserver-0.4.0/wslib/Makefile.am
@@ -40,7 +40,7 @@
LIBLIST = libwsound.la libwsoundeffect.la -L../wseffectlib/ @LIBRARY_SEARCH_PATH@ @XLIBS@
-libwsound_la_LIBADD =
+libwsound_la_LIBADD = @LIBWUTIL@
CLEANFILES =
--- wsoundserver-0.4.0.orig/wslib/application.c
+++ wsoundserver-0.4.0/wslib/application.c
@@ -60,20 +60,13 @@
if (!WMSoundDBLoaded) {
SLoadConfig();
WMSoundDBLoaded = True;
-
-#if defined (HAVE_GSDD)
- PLRegister(WMSoundDB, SSyncConfig);
-#endif
}
}
void
SShutdownApplication(void) {
if (WMSoundDBLoaded) {
-#if defined (HAVE_GSDD)
- PLUnregister(WMSoundDB);
-#endif
- PLRelease(WMSoundDB);
+ WMReleasePropList(WMSoundDB);
WMSoundDBLoaded = False;
}
}
--- wsoundserver-0.4.0.orig/wslib/config.c
+++ wsoundserver-0.4.0/wslib/config.c
@@ -37,14 +37,14 @@
#include <limits.h>
#include "wsound.h"
-#include <WUtil.h>
+#include <WINGs/WUtil.h>
#include <assert.h>
int makeLocalConfiguration(void);
-proplist_t loadLocalConfiguration(void);
+WMPropList *loadLocalConfiguration(void);
extern char *getLocalConfigurationPath (void);
extern char *getGlobalConfigurationPath (void);
extern void wAbort(void);
@@ -75,20 +75,12 @@
}
-void
-SSyncConfig(void)
-{
- PLDeepSynchronize(WMSoundDB);
-}
-
-
int makeLocalConfiguration(void)
{
char *globalPath = getGlobalConfigurationPath();
char *localPath = getLocalConfigurationPath();
int errorcode = -1;
- proplist_t gdb;
- proplist_t filename = PLMakeString(localPath);
+ WMPropList *gdb;
#ifdef DEBUG
fprintf(stderr, " >> Duplicating global domain\n");
@@ -98,18 +90,17 @@
}
else {
/* Load Global Domain file */
- gdb = PLGetProplistWithPath(globalPath);
+ gdb = WMReadPropListFromFile(globalPath);
if (gdb) {
- if (! PLIsDictionary(gdb)) {
- PLRelease(gdb);
+ if (! WMIsPLDictionary(gdb)) {
+ WMReleasePropList(gdb);
gdb = NULL;
SErrorCode = SERR_LOADGCONFIG;
}
else {
- WMSoundDB = PLSetFilename(gdb, filename); /* Apparently we must not free gdb */
WMSoundDBLoaded = True;
- PLSave(WMSoundDB, YES);
+ WMWritePropListToFile(WMSoundDB, localPath, True);
errorcode = 0;
}
}
@@ -118,7 +109,6 @@
}
}
- PLRelease(filename);
if (globalPath)
free(globalPath);
if (localPath)
@@ -129,16 +119,16 @@
-proplist_t
+WMPropList *
loadLocalConfiguration(void)
{
- proplist_t db = NULL;
+ WMPropList *db = NULL;
char *localPath = getLocalConfigurationPath();
- db = PLGetProplistWithPath(localPath);
+ db = WMReadPropListFromFile(localPath);
if (db) {
- if (!PLIsDictionary(db)) {
- PLRelease(db);
+ if (!WMIsPLDictionary(db)) {
+ WMReleasePropList(db);
db = NULL;
SErrorCode = SERR_LOADLCONFIG;
--- wsoundserver-0.4.0.orig/wslib/misc.c
+++ wsoundserver-0.4.0/wslib/misc.c
@@ -171,8 +171,8 @@
char*
SGetSoundFile(char *file)
{
- proplist_t array = NULL, val = NULL;
- int nr_elem = 0, i = 0;
+ WMPropList *array = NULL, *val = NULL;
+ int nr_elem = 0, i = 0;
char *exppath = NULL;
char *strbuffer = NULL;
@@ -200,11 +200,11 @@
sfatal ("SoundPath entry is missing from the WMSound Domain File");
wAbort();
}
- nr_elem = PLGetNumberOfElements(array);
+ nr_elem = WMGetPropListItemCount(array);
while (i < nr_elem) {
- val = PLGetArrayElement(array, i); /* Do NOT Free */
- exppath = sexpandpath(PLGetString(val));
+ val = WMGetFromPLArray(array, i); /* Do NOT Free */
+ exppath = sexpandpath(WMGetFromPLString(val));
if (!exppath) {
SErrorCode = SERR_NOFILE;
return NULL;
@@ -237,7 +237,7 @@
char*
SGetSoundSetFile(char *sndsetfile)
{
- proplist_t array, val;
+ WMPropList *array, *val;
int nr_elem = 0, i = 0;
char *strpath, *strbuffer;
@@ -255,11 +255,11 @@
wAbort();
}
- nr_elem = PLGetNumberOfElements(array);
+ nr_elem = WMGetPropListItemCount(array);
while (i < nr_elem) {
- val = PLGetArrayElement(array, i); /* Do NOT Free */
- strpath = sexpandpath(PLGetString(val));
+ val = WMGetFromPLArray(array, i); /* Do NOT Free */
+ strpath = sexpandpath(WMGetFromPLString(val));
if (!strpath)
return NULL;
strbuffer = (char *) malloc(MAXPATHLEN*sizeof(char));
--- wsoundserver-0.4.0.orig/wslib/plfunctions.c
+++ wsoundserver-0.4.0/wslib/plfunctions.c
@@ -33,90 +33,90 @@
#include "wsound.h"
-extern proplist_t WMSoundDB;
+extern WMPropList *WMSoundDB;
-proplist_t
+WMPropList *
SGetObjectForKey(char *defaultName)
{
- proplist_t object = NULL;
- proplist_t key = PLMakeString(defaultName);
+ WMPropList *object = NULL;
+ WMPropList *key = WMCreatePLString(defaultName);
- object = PLGetDictionaryEntry(WMSoundDB, key);
+ object = WMGetFromPLDictionary(WMSoundDB, key);
- PLRelease(key);
+ WMReleasePropList(key);
return object;
}
void
-SSetObjectForKey(proplist_t object, char *defaultName)
+SSetObjectForKey(WMPropList *object, char *defaultName)
{
- proplist_t key = PLMakeString(defaultName);
+ WMPropList *key = WMCreatePLString(defaultName);
- PLInsertDictionaryEntry(WMSoundDB, key, object);
- PLRelease(key);
+ WMPutInPLDictionary(WMSoundDB, key, object);
+ WMReleasePropList(key);
}
void
SRemoveObjectForKey(char *defaultName)
{
- proplist_t key = PLMakeString(defaultName);
+ WMPropList *key = WMCreatePLString(defaultName);
- PLRemoveDictionaryEntry(WMSoundDB, key);
+ WMRemoveFromPLDictionary(WMSoundDB, key);
- PLRelease(key);
+ WMReleasePropList(key);
}
char*
SGetStringForKey(char *defaultName)
{
- proplist_t val;
+ WMPropList *val;
val = SGetObjectForKey(defaultName);
if (!val)
return NULL;
- if (!PLIsString(val))
+ if (!WMIsPLString(val))
return NULL;
- return PLGetString(val);
+ return WMGetFromPLString(val);
}
-proplist_t
+WMPropList *
SGetArrayForKey(char *defaultName)
{
- proplist_t val;
+ WMPropList *val;
val = SGetObjectForKey(defaultName);
if (!val)
return NULL;
- if (!PLIsArray(val))
+ if (!WMIsPLArray(val))
return NULL;
return val;
}
-proplist_t
+WMPropList *
SGetDictionaryForKey(char *defaultName)
{
- proplist_t val;
+ WMPropList *val;
val = SGetObjectForKey(defaultName);
if (!val)
return NULL;
- if (!PLIsDictionary(val))
+ if (!WMIsPLDictionary(val))
return NULL;
return val;
@@ -126,7 +126,7 @@
int
SGetIntegerForKey(char *defaultName)
{
- proplist_t val;
+ WMPropList *val;
char *str;
int value;
@@ -135,10 +135,10 @@
if (!val)
return 0;
- if (!PLIsString(val))
+ if (!WMIsPLString(val))
return 0;
- str = PLGetString(val);
+ str = WMGetFromPLString(val);
if (!str)
return 0;
@@ -176,14 +176,14 @@
void
SSetIntegerForKey(int value, char *defaultName)
{
- proplist_t object;
+ WMPropList *object;
char buffer[128];
sprintf(buffer, "%i", value);
- object = PLMakeString(buffer);
+ object = WMCreatePLString(buffer);
SSetObjectForKey(object, defaultName);
- PLRelease(object);
+ WMReleasePropList(object);
}
@@ -191,23 +191,23 @@
void
SSetStringForKey(char *value, char *defaultName)
{
- proplist_t object;
+ WMPropList *object;
- object = PLMakeString(value);
+ object = WMCreatePLString(value);
SSetObjectForKey(object, defaultName);
- PLRelease(object);
+ WMReleasePropList(object);
}
void
SSetBoolForKey(Bool value, char *defaultName)
{
- static proplist_t yes = NULL, no = NULL;
+ static WMPropList *yes = NULL, *no = NULL;
if (!yes) {
- yes = PLMakeString("YES");
- no = PLMakeString("NO");
+ yes = WMCreatePLString("YES");
+ no = WMCreatePLString("NO");
}
SSetObjectForKey(value ? yes : no, defaultName);
--- wsoundserver-0.4.0.orig/wslib/sound.c
+++ wsoundserver-0.4.0/wslib/sound.c
@@ -39,11 +39,12 @@
#include <assert.h>
+extern char *getLocalConfigurationPath(void);
char *WSoundLibVersion="0.2";
int SErrorCode=SERR_NONE;
-proplist_t WMSoundDB = NULL;
+WMPropList *WMSoundDB = NULL;
Bool WMSoundDBLoaded = False;
float volume = 1.0;
@@ -77,8 +78,10 @@
}
}
else {
+ char *localPath = getLocalConfigurationPath();
SSetStringForKey(file, S_USERDEF);
- PLSave(WMSoundDB, YES);
+ WMWritePropListToFile(WMSoundDB, localPath, True);
+ free(localPath);
SSendSound();
}
@@ -129,10 +132,6 @@
{
char *sound_file;
int errorcode;
-
-#ifndef HAVE_GSDD
- SSyncConfig();
-#endif
sound_file = SGetSoundFileFromKey(SMapEventID(wsEventID));
--- wsoundserver-0.4.0.orig/wslib/audio_voxware.c
+++ wsoundserver-0.4.0/wslib/audio_voxware.c
@@ -415,20 +415,9 @@
}
curFrame = 0;
- while (curFrame < afInfo->FrameCount) {
- if ((blkFrames = (afInfo->FrameCount - curFrame)) > blockSize) {
- blkFrames = blockSize;
- }
+ while ((blkFrames = afReadFrames(afInfo->FileHandle, AF_DEFAULT_TRACK, buffer, sizeof(buffer)))) {
+ curFrame += blkFrames;
- if (afReadFrames(afInfo->FileHandle, AF_DEFAULT_TRACK, buffer, blkFrames) < 1) {
-#ifdef DEBUG
- fprintf(stderr, " >> frames written %ld\n", curFrame);
-#endif
- free(buffer);
- SErrorCode = SERR_READ;
- return -1;
- }
-
/* XXX LibAudioFile internally translates everything to signed
integer if your audio hardware doesn't support that
(like my GUS MAX) we need to convert it back to unsigned
@@ -513,21 +502,10 @@
SErrorCode = SERR_NOMEMORY;
return -1;
}
-
- curFrame = 0;
- while (curFrame < afInfo->FrameCount) {
- if ((blkFrames = (afInfo->FrameCount - curFrame)) > blockSize) {
- blkFrames = blockSize;
- }
- if (afReadFrames(afInfo->FileHandle, AF_DEFAULT_TRACK, buffer, blkFrames) < 1) {
-#ifdef DEBUG
- fprintf(stderr, " >> frames written %ld\n", curFrame);
-#endif
- free(buffer);
- SErrorCode = SERR_READ;
- return -1;
- }
+ curFrame = 0;
+ while ((blkFrames = afReadFrames(afInfo->FileHandle, AF_DEFAULT_TRACK, buffer, sizeof(buffer)))) {
+ curFrame += blkFrames;
/* Adjust Volume */
if (SGetVolume() < 1.0) {
--- wsoundserver-0.4.0.orig/wslib/wsound.h
+++ wsoundserver-0.4.0/wslib/wsound.h
@@ -55,7 +55,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-#include <proplist.h>
+#include <WINGs/WUtil.h>
#include <audiofile.h>
#if defined (DRIVER_VOXWARE)
@@ -220,19 +220,19 @@
/* Global variables */
extern int SErrorCode;
-extern proplist_t WMSoundDB;
+extern WMPropList *WMSoundDB;
extern Bool WMSoundDBLoaded;
extern Display *dpy;
extern Window wsoundserver;
extern Atom _XA_WINDOWMAKER_EVENT;
/* TODO HIDE THESE FUNCTIONS ... DO NOT use Outside of API */
-extern proplist_t SGetObjectForKey (char *defaultName);
-extern void SSetObjectForKey (proplist_t object, char *defaultName);
+extern WMPropList *SGetObjectForKey (char *defaultName);
+extern void SSetObjectForKey (WMPropList *object, char *defaultName);
extern void SRemoveObjectForKey (char *defaultName);
extern char *SGetStringForKey (char *defaultName);
-extern proplist_t SGetArrayForKey (char *defaultName);
-extern proplist_t SGetDictionaryForKey (char *defaultName);
+extern WMPropList *SGetArrayForKey (char *defaultName);
+extern WMPropList *SGetDictionaryForKey (char *defaultName);
extern void SSetStringForKey (char *value, char *defaultName);
--- wsoundserver-0.4.0.orig/src/Makefile.am
+++ wsoundserver-0.4.0/src/Makefile.am
@@ -22,7 +22,7 @@
wsoundserver_LDADD = \
$(top_builddir)/wslib/libwsound.la\
@LIBRARY_SEARCH_PATH@ \
- @LIBPL@ \
@XLIBS@ \
+ @LIBWUTIL@ \
@LIBDA@
--- wsoundserver-0.4.0.orig/util/Makefile.am
+++ wsoundserver-0.4.0/util/Makefile.am
@@ -19,8 +19,8 @@
wsoundplay_LDADD = \
$(top_builddir)/wslib/libwsound.la \
@LIBRARY_SEARCH_PATH@ \
- @LIBPL@ \
- @XLIBS@
+ @XLIBS@ \
+ @LIBWUTIL@
wsoundplay_SOURCES = wsoundplay.c
@@ -28,8 +28,8 @@
getsoundset_LDADD = \
$(top_builddir)/wslib/libwsound.la \
@LIBRARY_SEARCH_PATH@ \
- @LIBPL@ \
- @XLIBS@
+ @XLIBS@ \
+ @LIBWUTIL@
getsoundset_SOURCES = getsoundset.c
@@ -37,8 +37,8 @@
setsoundset_LDADD = \
$(top_builddir)/wslib/libwsound.la \
@LIBRARY_SEARCH_PATH@ \
- @LIBPL@ \
- @XLIBS@
+ @XLIBS@ \
+ @LIBWUTIL@
setsoundset_SOURCES = setsoundset.c
--- wsoundserver-0.4.0.orig/util/getsoundset.c
+++ wsoundserver-0.4.0/util/getsoundset.c
@@ -57,7 +57,7 @@
int
main(int argc, char **argv) {
- proplist_t soundset, key, val;
+ WMPropList *soundset, *key, *val;
char *sndsetfile = NULL;
int i;
@@ -73,25 +73,23 @@
sndsetfile = argv[1];
}
- soundset = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
+ soundset = WMCreatePLDictionary(NULL, NULL, NULL);
for (i = 0; eventkeys[i] != NULL; i++) {
- key = PLMakeString(eventkeys[i]);
- val = PLGetDictionaryEntry(WMSoundDB, key);
+ key = WMCreatePLString(eventkeys[i]);
+ val = WMGetFromPLDictionary(WMSoundDB, key);
if (val)
- PLInsertDictionaryEntry(soundset, key, val);
- PLRelease(key);
- PLRelease(val);
+ WMPutInPLDictionary(soundset, key, val);
+ WMReleasePropList(key);
+ WMReleasePropList(val);
}
- if (sndsetfile) {
- PLSetFilename(soundset, PLMakeString(sndsetfile));
- PLSave(soundset, YES);
- }
+ if (sndsetfile)
+ WMWritePropListToFile(soundset, sndsetfile, True);
else
- puts(PLGetDescriptionIndent(soundset, 0));
+ puts(WMGetPropListDescription(soundset, 0));
- PLRelease(soundset);
+ WMReleasePropList(soundset);
SShutdownApplication();
return 0;
--- wsoundserver-0.4.0.orig/util/setsoundset.c
+++ wsoundserver-0.4.0/util/setsoundset.c
@@ -37,7 +37,7 @@
int
main(int argc, char **argv) {
- proplist_t soundset;
+ WMPropList *soundset;
char *path = NULL;
ProgName = argv[0];
@@ -54,17 +54,17 @@
exit(1);
}
- soundset = PLGetProplistWithPath(path);
- free(path);
+ soundset = WMReadPropListFromFile(path);
if (!soundset) {
- PLRelease(WMSoundDB);
+ WMReleasePropList(WMSoundDB);
swarning("could not load soundset");
exit(1);
}
- PLMergeDictionaries(WMSoundDB, soundset);
- PLSave(WMSoundDB, YES);
- PLRelease(soundset);
+ WMMergePLDictionaries(WMSoundDB, soundset, False);
+ WMWritePropListToFile(WMSoundDB, path, True);
+ free(path);
+ WMReleasePropList(soundset);
SShutdownApplication();
return 0;