diff options
66 files changed, 192 insertions, 180 deletions
diff --git a/artsc/artsc.h b/artsc/artsc.h index 00c536e..fd7de91 100644 --- a/artsc/artsc.h +++ b/artsc/artsc.h @@ -35,7 +35,7 @@ extern "C" { * The aRts plain C API aims at easily writing/porting plain C apps to the * arts sound server. What is provided is streaming functionality, in a * blocking way. So for most apps, you simply remove the few system calls - * that deal with your audio device, and tqreplace them with the appropriate + * that deal with your audio device, and replace them with the appropriate * arts calls. */ diff --git a/artsc/artsdsp.c b/artsc/artsdsp.c index a528f8c..2b6b3ef 100644 --- a/artsc/artsdsp.c +++ b/artsc/artsdsp.c @@ -37,7 +37,9 @@ #include <sys/ioctl.h> #include <sys/stat.h> /* #include <sys/mman.h> */ +#define open ignore_system_open #include <fcntl.h> +#undef open #include <artsc.h> #include <dlfcn.h> @@ -58,10 +60,10 @@ * which points to /dev/null, to ensure compatibility with more weird * operations on streams * - * settings tqcontains what has already been set (speed, bits, channels), and + * settings contains what has already been set (speed, bits, channels), and * is 7 when all of these are true * - * stream tqcontains an aRts stream or 0 + * stream contains an aRts stream or 0 */ static int sndfd = -1; static int settings; @@ -4,7 +4,7 @@ dynamically loaded modules - get rid of all error handling done by assert ; thus, one by one review each assert if it can happen under any circumstances if yes, it needs - to be tqreplaced by some other mechanism + to be replaced by some other mechanism - report errors properly if some component could not be loaded ; right now, it fails within assert(skel) in generated code, which doesn't help users much to debug the problem @@ -128,7 +128,7 @@ can be restored on next login (or per song or something like that) - edit .arts-map files visually -## Optimization (this section tqcontains various optimization ideas) +## Optimization (this section contains various optimization ideas) - use no floats for adressing the fractional part in resampling but integers (that will be MUCH faster) diff --git a/examples/testdhandle.cc b/examples/testdhandle.cc index eb97e6c..564687d 100644 --- a/examples/testdhandle.cc +++ b/examples/testdhandle.cc @@ -58,7 +58,7 @@ int main(int argc, char **argv) " (" << gsl_strerror(info.error()) << ") while loading info.\n"; exit(1); } - cout << "file tqcontains " << info.waveCount() << " waves:\n"; + cout << "file contains " << info.waveCount() << " waves:\n"; for(int i=0; i<info.waveCount(); i++) { GSL::WaveDescription desc= info.waveDescription(i); diff --git a/flow/asyncschedule.h b/flow/asyncschedule.h index fe800be..d4264d0 100644 --- a/flow/asyncschedule.h +++ b/flow/asyncschedule.h @@ -30,7 +30,7 @@ #include <queue> /* - * BC - tqStatus (2002-03-08): ASyncNetSend, ASyncNetReceive, ASyncPort. + * BC - Status (2002-03-08): ASyncNetSend, ASyncNetReceive, ASyncPort. * * None of these classes is considered part of the public API. Do NOT use it * in your apps. These are part of the implementation of libartsflow's diff --git a/flow/audioio.h b/flow/audioio.h index e3182af..7cab165 100644 --- a/flow/audioio.h +++ b/flow/audioio.h @@ -27,7 +27,7 @@ #include <string> #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): AudioIO, AudioIOFactory + * BC - Status (2002-03-08): AudioIO, AudioIOFactory * * Right now, these classes are considered an implementation detail. No binary * compatibility guaranteed, its safe to add virtual methods when required. diff --git a/flow/audiomanager_impl.cc b/flow/audiomanager_impl.cc index 872889b..7a6d83b 100644 --- a/flow/audiomanager_impl.cc +++ b/flow/audiomanager_impl.cc @@ -45,7 +45,7 @@ public: a typedef in between, which makes it magically work. We could also use an explicit instantiation, but this is not allowed on all C++ compilers in this scope. Note also, that we don't need - to tqreplace _all_ occurrences of list<xxx*> below, only the two in the + to replace _all_ occurrences of list<xxx*> below, only the two in the member declaration. What a mess. */ typedef list<AudioManagerClient_impl *> L_AMC; typedef list<AudioManagerAssignable *> L_AMA; diff --git a/flow/audiosubsys.h b/flow/audiosubsys.h index 55c51e1..6db85c9 100644 --- a/flow/audiosubsys.h +++ b/flow/audiosubsys.h @@ -29,7 +29,7 @@ #include "startupmanager.h" /* - * BC - tqStatus (2002-03-08): AudioSubSystem, ASProducer, ASConsumer. + * BC - Status (2002-03-08): AudioSubSystem, ASProducer, ASConsumer. * * These classes are kept binary compatible. You can rely on them. * AudioSubSystem has a private data pointer to do so. Even if ports to diff --git a/flow/bufferqueue.h b/flow/bufferqueue.h index be332c3..5344c4a 100644 --- a/flow/bufferqueue.h +++ b/flow/bufferqueue.h @@ -1,5 +1,5 @@ /* - * BC - tqStatus (2002-03-08): ByteBuffer, BufferQueue + * BC - Status (2002-03-08): ByteBuffer, BufferQueue * * None of these classes is considered part of the public API. Do NOT use it * in your apps. These are part of the implementation of libartsflow's @@ -27,7 +27,7 @@ #include "artsflow.h" /* - * BC - tqStatus (2002-03-08): BusClient, BusManager + * BC - Status (2002-03-08): BusClient, BusManager * * None of these classes is considered part of the public API. Do NOT use it * in your apps. These are part of the implementation of libartsflow's diff --git a/flow/cache.h b/flow/cache.h index 44c0d05..63c2fba 100644 --- a/flow/cache.h +++ b/flow/cache.h @@ -30,7 +30,7 @@ #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): Cache, CachedObject + * BC - Status (2002-03-08): Cache, CachedObject * * At the current point in time, there are NO GUARANTEES, so only use this * in apps part of official KDE releases (such as kdemultimedia apps), which diff --git a/flow/cachedwav.h b/flow/cachedwav.h index d5ad697..52587be 100644 --- a/flow/cachedwav.h +++ b/flow/cachedwav.h @@ -23,15 +23,15 @@ #ifndef CACHEDWAV_H #define CACHEDWAV_H -#include "config.h" #include "arts_export.h" + #ifdef HAVE_LIBAUDIOFILE #include "cache.h" #include <sys/stat.h> #include <unistd.h> /* - * BC - tqStatus (2002-03-08): CachedWav. + * BC - Status (2002-03-08): CachedWav. * * At the current point in time, there are NO GUARANTEES, so only use this * in apps part of official KDE releases (such as kdemultimedia apps), which diff --git a/flow/convert.h b/flow/convert.h index ef3e900..d174fd3 100644 --- a/flow/convert.h +++ b/flow/convert.h @@ -26,7 +26,7 @@ #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): conversion functions + * BC - Status (2002-03-08): conversion functions * * None of them will be removed or changed, so it is safe to use them in * your apps. It is *recommended* (though not necessary) to use the new @@ -48,7 +48,7 @@ namespace Arts { * float for float data between -1 and 1 * * and may be prefixed by 2 to indicate that stereo is done with two seperate - * buffers or i to indicate interleaved stereo (one buffer which tqcontains + * buffers or i to indicate interleaved stereo (one buffer which contains * one sample left, one sample right, one sample left etc.) * * The parameter speed (for interpolations) is *not* the samplingrate, but diff --git a/flow/cpuinfo.h b/flow/cpuinfo.h index d19cc7a..c3fab96 100644 --- a/flow/cpuinfo.h +++ b/flow/cpuinfo.h @@ -24,7 +24,7 @@ #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): CpuInfo + * BC - Status (2002-03-08): CpuInfo * * This class will be kept binary compatible - it just exports the static * CpuInfo::flags() function as only functionality. @@ -2,7 +2,7 @@ #define ARTS_FFT_H /* - * BC - tqStatus (2002-03-08): arts_fft_float + * BC - Status (2002-03-08): arts_fft_float * * This fft interface should be obsoleted in the future in favour of one * exploiting the capabilities of gsl fully. However, it will be kept binary diff --git a/flow/gslschedule.h b/flow/gslschedule.h index 1c8300a..762539c 100644 --- a/flow/gslschedule.h +++ b/flow/gslschedule.h @@ -30,7 +30,7 @@ #include <list> /* - * BC - tqStatus (2002-03-08): Port, AudioPort, MultiPort, StdFlowSystem, + * BC - Status (2002-03-08): Port, AudioPort, MultiPort, StdFlowSystem, * StdScheduleNode * * None of these classes is considered part of the public API. Do NOT use it diff --git a/flow/pipebuffer.h b/flow/pipebuffer.h index 0dae574..0c464bd 100644 --- a/flow/pipebuffer.h +++ b/flow/pipebuffer.h @@ -24,7 +24,7 @@ #define __PIPEBUFFER_H__ /* - * BC - tqStatus (2002-03-08): PipeSegment, PipeBuffer + * BC - Status (2002-03-08): PipeSegment, PipeBuffer * * None of these classes is considered part of the public API. Do NOT use it * in your apps. These are part of the implementation of libartsflow's diff --git a/flow/resample.h b/flow/resample.h index f5b79fd..d1aea9d 100644 --- a/flow/resample.h +++ b/flow/resample.h @@ -27,7 +27,7 @@ #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): Resampler / Refiller. + * BC - Status (2002-03-08): Resampler / Refiller. * * These classes will be kept binary compatible. Resampler has a private * data pointer for this purpose. diff --git a/flow/stdsynthmodule.h b/flow/stdsynthmodule.h index d8efa45..f3541b8 100644 --- a/flow/stdsynthmodule.h +++ b/flow/stdsynthmodule.h @@ -27,7 +27,7 @@ #include "artsflow.h" /* - * BC - tqStatus (2002-03-08): StdSynthModule + * BC - Status (2002-03-08): StdSynthModule * * This class is intended for public use (inheritance) as it supplies a base * for all objects using streams. It will be kept binary compatible. diff --git a/flow/synthschedule.h b/flow/synthschedule.h index ecc9924..11e5daf 100644 --- a/flow/synthschedule.h +++ b/flow/synthschedule.h @@ -23,8 +23,6 @@ #ifndef SYNTHSCHEDULE_H #define SYNTHSCHEDULE_H -#include "config.h" - #ifdef __GNUC__ #warning " * <synthschedule.h> included! *" #warning " * include <gslschedule.h> instead *" diff --git a/flow/virtualports.h b/flow/virtualports.h index 8c4144c..eb4f1fc 100644 --- a/flow/virtualports.h +++ b/flow/virtualports.h @@ -28,7 +28,7 @@ #include <list> /* - * BC - tqStatus (2002-03-08): VPortConnection, VPort. + * BC - Status (2002-03-08): VPortConnection, VPort. * * None of these classes is considered part of the public API. Do NOT use it * in your apps. These are part of the implementation of libartsflow's diff --git a/gmcop/giomanager.h b/gmcop/giomanager.h index 00e5e70..53ac084 100644 --- a/gmcop/giomanager.h +++ b/gmcop/giomanager.h @@ -30,7 +30,7 @@ #include <map> #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): GIOManager + * BC - Status (2002-03-08): GIOManager * * This class will be kept binary compatible (d ptr for extensions). */ diff --git a/mcop/anyref.h b/mcop/anyref.h index 332c5c7..60e1836 100644 --- a/mcop/anyref.h +++ b/mcop/anyref.h @@ -27,7 +27,7 @@ #include <string> #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): AnyRefBase, AnyRef, AnyConstRef + * BC - Status (2002-03-08): AnyRefBase, AnyRef, AnyConstRef * * These classes will be kept binary compatibile. To change it, adding a new * representation is necessary. No private d pointer for this reason. diff --git a/mcop/asyncstream.h b/mcop/asyncstream.h index 6b31ef9..acd27c4 100644 --- a/mcop/asyncstream.h +++ b/mcop/asyncstream.h @@ -28,7 +28,7 @@ #include "datapacket.h" /* - * BC - tqStatus (2002-03-08): GenericAsyncStream, AsyncStream, + * BC - Status (2002-03-08): GenericAsyncStream, AsyncStream, * FloatAsyncStream/ByteAsyncStream * * These classes are to be treated with extreme care, as they are used in diff --git a/mcop/buffer.h b/mcop/buffer.h index 7cfef58..c1cc1b0 100644 --- a/mcop/buffer.h +++ b/mcop/buffer.h @@ -27,7 +27,7 @@ #include <vector> #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): Buffer. + * BC - Status (2002-03-08): Buffer. * * Has to be kept binary compatible. As buffer is speed relevant, currently * there are no private d ptrs, and the idea is to keep this as possible. diff --git a/mcop/common.h b/mcop/common.h index 22783c2..2dbde70 100644 --- a/mcop/common.h +++ b/mcop/common.h @@ -36,7 +36,7 @@ #include "connect.h" /* - * BC - tqStatus (2002-03-08): Read/WriteObject(Seq) + * BC - Status (2002-03-08): Read/WriteObject(Seq) * * Will be kept binary compatible by NOT TOUCHING AT ALL. Do not change this. * (Interaction with generated code). diff --git a/mcop/connect.h b/mcop/connect.h index 721b143..aa9065b 100644 --- a/mcop/connect.h +++ b/mcop/connect.h @@ -22,7 +22,7 @@ #define MCOP_CONNECT_H /* - * BC - tqStatus (2002-03-08): connect / setValue functions + * BC - Status (2002-03-08): connect / setValue functions * * Will be kept as they are (binary compatible). */ diff --git a/mcop/connection.h b/mcop/connection.h index 34cc08b..c68f80d 100644 --- a/mcop/connection.h +++ b/mcop/connection.h @@ -27,7 +27,7 @@ #include "buffer.h" /* - * BC - tqStatus (2002-03-08): Connection. + * BC - Status (2002-03-08): Connection. * * None of these classes is considered part of the public API. However, they * NEED to be kept binary compatible as the DO interact with generated code. diff --git a/mcop/datapacket.h b/mcop/datapacket.h index b68e8de..e62348e 100644 --- a/mcop/datapacket.h +++ b/mcop/datapacket.h @@ -27,7 +27,7 @@ #include "buffer.h" /* - * BC - tqStatus (2002-03-08): GenericDataChannel, DataPacket types + * BC - Status (2002-03-08): GenericDataChannel, DataPacket types * * These classes must be kept binary compatible, as the do interact with * generated code. So you MUST KNOW WHAT YOU ARE DOING, once you start diff --git a/mcop/debug.h b/mcop/debug.h index 0999b7b..6ef83e5 100644 --- a/mcop/debug.h +++ b/mcop/debug.h @@ -31,7 +31,7 @@ #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): Debug. + * BC - Status (2002-03-08): Debug. * * Collection class, no instance, no members. Thus binary compatible (will * be kept). diff --git a/mcop/delayedreturn.h b/mcop/delayedreturn.h index 84373c0..290cfc4 100644 --- a/mcop/delayedreturn.h +++ b/mcop/delayedreturn.h @@ -26,7 +26,7 @@ #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): DelayedReturn + * BC - Status (2002-03-08): DelayedReturn * * This class will be kept binary compatible. It has a private d-pointer for * further extensions. diff --git a/mcop/dispatcher.h b/mcop/dispatcher.h index 683cba1..6a2be82 100644 --- a/mcop/dispatcher.h +++ b/mcop/dispatcher.h @@ -38,7 +38,7 @@ #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): Dispatcher + * BC - Status (2002-03-08): Dispatcher * * This is part of the public API (and interacts with generated code) and * has to be kept binary compatible. diff --git a/mcop/dynamicrequest.h b/mcop/dynamicrequest.h index ff98b95..b1316b0 100644 --- a/mcop/dynamicrequest.h +++ b/mcop/dynamicrequest.h @@ -31,7 +31,7 @@ #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): DynamicRequest + * BC - Status (2002-03-08): DynamicRequest * * Has to be kept binary compatible (use d ptr). */ diff --git a/mcop/dynamicskeleton.h b/mcop/dynamicskeleton.h index d68ced7..7fece5b 100644 --- a/mcop/dynamicskeleton.h +++ b/mcop/dynamicskeleton.h @@ -28,7 +28,7 @@ #include "object.h" /* - * BC - tqStatus (2002-03-08): DynamicSkeletonBase, DynamicSkeleton + * BC - Status (2002-03-08): DynamicSkeletonBase, DynamicSkeleton * * Will be kept binary compatible (using d ptr). */ diff --git a/mcop/extensionloader.h b/mcop/extensionloader.h index 825b17f..034ecf4 100644 --- a/mcop/extensionloader.h +++ b/mcop/extensionloader.h @@ -30,7 +30,7 @@ #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): ExtensionLoader + * BC - Status (2002-03-08): ExtensionLoader * * None of these classes is considered part of the public API. Do NOT use it * in your apps. No binary compatibility guaranteed. (Interactions: diff --git a/mcop/factory.h b/mcop/factory.h index 47ea466..6adab89 100644 --- a/mcop/factory.h +++ b/mcop/factory.h @@ -31,7 +31,7 @@ #include "startupmanager.h" /* - * BC - tqStatus (2002-03-08): Factory + * BC - Status (2002-03-08): Factory * * Will need to remain binary compatible (REGISTER_IMPLEMENTATION), d ptr * provided for convenience, watch out for interactions with generated diff --git a/mcop/flowsystem.h b/mcop/flowsystem.h index 57be7e1..532f1de 100644 --- a/mcop/flowsystem.h +++ b/mcop/flowsystem.h @@ -28,7 +28,7 @@ #include "common.h" /* - * BC - tqStatus (2002-03-08): ScheduleNode, FlowSystem, FlowSystem_impl, + * BC - Status (2002-03-08): ScheduleNode, FlowSystem, FlowSystem_impl, * RemoteScheduleNode * * Heavy interactions with generated and hand-written code, flowsystem binding diff --git a/mcop/idlfilereg.h b/mcop/idlfilereg.h index 61c255a..77b5fa6 100644 --- a/mcop/idlfilereg.h +++ b/mcop/idlfilereg.h @@ -29,7 +29,7 @@ #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): IDLFileReg + * BC - Status (2002-03-08): IDLFileReg * * Will be kept binary compatible by NOT TOUCHING AT ALL. Do not change this. * (Interaction with generated code). Add a new class if you need something diff --git a/mcop/ifacerepo_impl.h b/mcop/ifacerepo_impl.h index 1379ec4..ca22516 100644 --- a/mcop/ifacerepo_impl.h +++ b/mcop/ifacerepo_impl.h @@ -21,7 +21,7 @@ */ /* - * BC - tqStatus (2002-03-08): InterfaceRepo_impl + * BC - Status (2002-03-08): InterfaceRepo_impl * * This is an implementation class, and not kept binary compatible. It's * only here since the REGISTER_IMPLEMENTATION bootstrapping may not yet diff --git a/mcop/iomanager.h b/mcop/iomanager.h index f3afaf7..fc88268 100644 --- a/mcop/iomanager.h +++ b/mcop/iomanager.h @@ -21,7 +21,7 @@ */ /* - * BC - tqStatus (2002-03-08): + * BC - Status (2002-03-08): * BINARY COMPATIBLE: IONotify, TimeNotify, IOManager * NO BC FOR: StdIOManager * diff --git a/mcop/loopback.h b/mcop/loopback.h index 214c903..e16d1cd 100644 --- a/mcop/loopback.h +++ b/mcop/loopback.h @@ -28,7 +28,7 @@ #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): LoopbackConnection + * BC - Status (2002-03-08): LoopbackConnection * * Not part of the public API. Do NOT use it in your apps. No binary * compatibility guaranteed. diff --git a/mcop/mcopconfig.h b/mcop/mcopconfig.h index d75adc3..8fb1e10 100644 --- a/mcop/mcopconfig.h +++ b/mcop/mcopconfig.h @@ -21,7 +21,7 @@ */ /* - * BC - tqStatus (2002-03-08): MCOPConfig + * BC - Status (2002-03-08): MCOPConfig * * Is guaranteed to stay binary compatible. d ptr provided. */ diff --git a/mcop/mcoputils.cc b/mcop/mcoputils.cc index 168f55f..1bfe5df 100644 --- a/mcop/mcoputils.cc +++ b/mcop/mcoputils.cc @@ -79,8 +79,8 @@ if ((result == -1) && (errno == ENOENT)) static char *locate_mcop_dir() { struct passwd *pw_ent; - char kde_tmp_dir[PATH_MAX+1]; - char user_tmp_dir[PATH_MAX+1]; + string kde_tmp_dir; + string user_tmp_dir; int uid = getuid(); const char *home_dir = getenv("HOME"); const char *kde_home = uid ? getenv("KDEHOME") : getenv("KDEROOTHOME"); @@ -96,7 +96,7 @@ static char *locate_mcop_dir() if (!tmp || !tmp[0]) tmp = "/tmp"; - kde_tmp_dir[0] = 0; + kde_tmp_dir = ""; pw_ent = getpwuid(uid); if (!pw_ent) @@ -105,12 +105,7 @@ static char *locate_mcop_dir() return 0; } - strncpy(user_tmp_dir, tmp, PATH_MAX ); - user_tmp_dir[ PATH_MAX ] = '\0'; - strncat(user_tmp_dir, "/ksocket-", PATH_MAX - strlen(user_tmp_dir) ); - user_tmp_dir[ PATH_MAX ] = '\0'; - strncat(user_tmp_dir, pw_ent->pw_name, PATH_MAX - strlen(user_tmp_dir)); - user_tmp_dir[ PATH_MAX ] = '\0'; + user_tmp_dir = string(tmp) + "/ksocket-" + string(pw_ent->pw_name); if (!kde_home || !kde_home[0]) { @@ -127,44 +122,37 @@ static char *locate_mcop_dir() { arts_fatal("Aborting. $HOME not set!"); } - if (strlen(home_dir) > (PATH_MAX-100)) - { - arts_fatal("Aborting. Home directory path too long!"); - } kde_home++; - strncpy(kde_tmp_dir, home_dir, PATH_MAX); - kde_tmp_dir[ PATH_MAX ] = '\0'; + kde_tmp_dir = string(home_dir); } - strncat(kde_tmp_dir, kde_home, PATH_MAX - strlen(kde_tmp_dir)); + kde_tmp_dir += kde_home; /** Strip trailing '/' **/ - if ( kde_tmp_dir[strlen(kde_tmp_dir)-1] == '/') - kde_tmp_dir[strlen(kde_tmp_dir)-1] = 0; + if ( kde_tmp_dir[kde_tmp_dir.length()-1] == '/') + kde_tmp_dir.resize(kde_tmp_dir.length()-1); - result = stat(kde_tmp_dir, &stat_buf); + result = stat(kde_tmp_dir.c_str(), &stat_buf); if (result == -1) { return 0; } - strncat(kde_tmp_dir, kde_prefix, PATH_MAX - strlen(kde_tmp_dir)); - if (gethostname(kde_tmp_dir+strlen(kde_tmp_dir), PATH_MAX - strlen(kde_tmp_dir) - 1) != 0) + kde_tmp_dir += kde_prefix; { - arts_fatal("Aborting. Could not determine hostname or hostname too long."); + char buf[1024]; + if (gethostname(buf, sizeof(buf)-1) != 0) + { + arts_fatal("Aborting. Could not determine hostname or hostname too long."); + } + buf[sizeof(buf)-1] = '\0'; + kde_tmp_dir += buf; } - kde_tmp_dir[sizeof(kde_tmp_dir)-1] = '\0'; - result = lstat(kde_tmp_dir, &stat_buf); + result = lstat(kde_tmp_dir.c_str(), &stat_buf); if ((result == 0) && (S_ISDIR(stat_buf.st_mode))) { /* $KDEHOME/socket-$HOSTNAME is a normal directory. Do nothing. */ - tmp_buf = (char *) malloc(PATH_MAX+1); - if (!tmp_buf) - return 0; - - strncpy(tmp_buf, kde_tmp_dir, PATH_MAX); - tmp_buf[ PATH_MAX ] = '\0'; - + tmp_buf = strdup(kde_tmp_dir.c_str()); return tmp_buf; } @@ -175,26 +163,32 @@ static char *locate_mcop_dir() } if ((result == -1) || (!S_ISLNK(stat_buf.st_mode))) { - arts_warning("Error: \"%s\" is not a link or a directory.\n", kde_tmp_dir); + arts_warning("Error: \"%s\" is not a link or a directory.\n", kde_tmp_dir.c_str()); return 0; } - tmp_buf = (char *) malloc(PATH_MAX+1); - if (!tmp_buf) - return 0; /* kde_tmp_dir is a link. Check whether it points to a valid directory. */ - result = readlink(kde_tmp_dir, tmp_buf, PATH_MAX); - if (result == -1) - { - arts_warning("Error: \"%s\" could not be read.\n", kde_tmp_dir); - free(tmp_buf); - return 0; - } + ssize_t size = 2048; + tmp_buf = NULL; + do { + size *= 2; + tmp_buf = (char *) realloc(tmp_buf, size); + if (!tmp_buf) + return 0; + result = readlink(kde_tmp_dir.c_str(), tmp_buf, size - 1); + if (result == -1) + { + arts_warning("Error: \"%s\" could not be read.\n", kde_tmp_dir.c_str()); + free(tmp_buf); + return 0; + } + } while(result == size - 1); tmp_buf[result] = '\0'; + // printf("Link points to \"%s\"\n", tmp_buf); - if (strncmp(tmp_buf, user_tmp_dir, strlen(user_tmp_dir)) != 0) + if (strncmp(tmp_buf, user_tmp_dir.c_str(), user_tmp_dir.length()) != 0) { - arts_warning("Error: \"%s\" points to \"%s\" instead of \"%s\".\n", kde_tmp_dir, tmp_buf, user_tmp_dir); + arts_warning("Error: \"%s\" points to \"%s\" instead of \"%s\".\n", kde_tmp_dir.c_str(), tmp_buf, user_tmp_dir.c_str()); free(tmp_buf); return 0; } @@ -229,19 +223,19 @@ int create_link(const char *file, const char *tmp_dir) static -int build_link(const char *tmp_prefix, const char *kde_prefix) +int build_link(string tmp_prefix, const char *kde_prefix) { struct passwd *pw_ent; - char kde_tmp_dir[PATH_MAX+1]; - char user_tmp_dir[PATH_MAX+1]; - char tmp_buf[PATH_MAX+1]; + string kde_tmp_dir; + string user_tmp_dir; + char *tmp_buf; int uid = getuid(); const char *home_dir = getenv("HOME"); const char *kde_home = uid ? getenv("KDEHOME") : getenv("KDEROOTHOME"); int result; struct stat stat_buf; - kde_tmp_dir[0] = 0; + kde_tmp_dir = ""; pw_ent = getpwuid(uid); if (!pw_ent) @@ -250,9 +244,7 @@ int build_link(const char *tmp_prefix, const char *kde_prefix) return 1; } - strncpy(user_tmp_dir, tmp_prefix, PATH_MAX); - user_tmp_dir[ PATH_MAX ] = '\0'; - strncat(user_tmp_dir, pw_ent->pw_name, PATH_MAX - strlen(tmp_prefix)); + user_tmp_dir = tmp_prefix + string(pw_ent->pw_name); if (!kde_home || !kde_home[0]) { @@ -270,89 +262,106 @@ int build_link(const char *tmp_prefix, const char *kde_prefix) fprintf(stderr, "Aborting. $HOME not set!"); exit(255); } - if (strlen(home_dir) > (PATH_MAX-100)) - { - fprintf(stderr, "Aborting. Home directory path too long!"); - exit(255); - } kde_home++; - strncpy(kde_tmp_dir, home_dir, PATH_MAX); - kde_tmp_dir[ PATH_MAX ] = '\0'; + kde_tmp_dir = string(home_dir); } - strncat(kde_tmp_dir, kde_home, PATH_MAX - strlen(kde_tmp_dir)); + kde_tmp_dir += kde_home; /** Strip trailing '/' **/ - if ( kde_tmp_dir[strlen(kde_tmp_dir)-1] == '/') - kde_tmp_dir[strlen(kde_tmp_dir)-1] = 0; + if ( kde_tmp_dir[kde_tmp_dir.length()-1] == '/') + kde_tmp_dir.resize(kde_tmp_dir.length()-1); - result = stat(kde_tmp_dir, &stat_buf); + result = stat(kde_tmp_dir.c_str(), &stat_buf); if ((result == -1) && (errno == ENOENT)) { - result = mkdir(kde_tmp_dir, 0700); + result = mkdir(kde_tmp_dir.c_str(), 0700); } if (result == -1) { return 1; } - strncat(kde_tmp_dir, kde_prefix, PATH_MAX - strlen(kde_tmp_dir)); - if (gethostname(kde_tmp_dir+strlen(kde_tmp_dir), PATH_MAX - strlen(kde_tmp_dir) - 1) != 0) + kde_tmp_dir += kde_prefix; { - perror("Aborting. Could not determine hostname: "); - exit(255); + char buf[1024]; + if (gethostname(buf, sizeof(buf)-1) != 0) + { + arts_fatal("Aborting. Could not determine hostname or hostname too long."); + } + buf[sizeof(buf)-1] = '\0'; + kde_tmp_dir += buf; } - kde_tmp_dir[sizeof(kde_tmp_dir)-1] = '\0'; - result = lstat(kde_tmp_dir, &stat_buf); + result = lstat(kde_tmp_dir.c_str(), &stat_buf); if ((result == 0) && (S_ISDIR(stat_buf.st_mode))) { /* $KDEHOME/tmp is a normal directory. Do nothing. */ - printf("Directory \"%s\" already exists.\n", kde_tmp_dir); + printf("Directory \"%s\" already exists.\n", kde_tmp_dir.c_str()); return 0; } if ((result == -1) && (errno == ENOENT)) { - printf("Creating link %s.\n", kde_tmp_dir); - result = create_link(kde_tmp_dir, user_tmp_dir); + printf("Creating link %s.\n", kde_tmp_dir.c_str()); + result = create_link(kde_tmp_dir.c_str(), user_tmp_dir.c_str()); if (result == 0) return 0; /* Success */ - unlink(kde_tmp_dir); - strncat(user_tmp_dir, "XXXXXX", PATH_MAX - strlen(user_tmp_dir)); - mktemp(user_tmp_dir); /* We want a directory, not a file, so using mkstemp makes no sense and is wrong */ - return create_link(kde_tmp_dir, user_tmp_dir); + unlink(kde_tmp_dir.c_str()); + user_tmp_dir += "XXXXXX"; + tmp_buf = strdup(user_tmp_dir.c_str()); + mktemp(tmp_buf); /* We want a directory, not a file, so using mkstemp makes no sense and is wrong */ + result = create_link(kde_tmp_dir.c_str(), tmp_buf); + free(tmp_buf); + return result; } if ((result == -1) || (!S_ISLNK(stat_buf.st_mode))) { - fprintf(stderr, "Error: \"%s\" is not a link or a directory.\n", kde_tmp_dir); + fprintf(stderr, "Error: \"%s\" is not a link or a directory.\n", kde_tmp_dir.c_str()); return 1; } /* kde_tmp_dir is a link. Check whether it points to a valid directory. */ - result = readlink(kde_tmp_dir, tmp_buf, PATH_MAX); - if (result == -1) - { - fprintf(stderr, "Error: \"%s\" could not be read.\n", kde_tmp_dir); - return 1; - } + ssize_t size = 2048; + tmp_buf = NULL; + do { + size *= 2; + tmp_buf = (char *) realloc(tmp_buf, size); + if (!tmp_buf) + return 0; + result = readlink(kde_tmp_dir.c_str(), tmp_buf, size - 1); + if (result == -1) + { + arts_warning("Error: \"%s\" could not be read.\n", kde_tmp_dir.c_str()); + free(tmp_buf); + return 0; + } + } while(result == size - 1); tmp_buf[result] = '\0'; + printf("Link points to \"%s\"\n", tmp_buf); - if (strncmp(tmp_buf, user_tmp_dir, strlen(user_tmp_dir)) != 0) + if (strncmp(tmp_buf, user_tmp_dir.c_str(), user_tmp_dir.length()) != 0) { - fprintf(stderr, "Error: \"%s\" points to \"%s\" instead of \"%s\".\n", kde_tmp_dir, tmp_buf, user_tmp_dir); - unlink(kde_tmp_dir); - printf("Creating link %s.\n", kde_tmp_dir); - result = create_link(kde_tmp_dir, user_tmp_dir); + fprintf(stderr, "Error: \"%s\" points to \"%s\" instead of \"%s\".\n", kde_tmp_dir.c_str(), tmp_buf, user_tmp_dir.c_str()); + free(tmp_buf); + unlink(kde_tmp_dir.c_str()); + printf("Creating link %s.\n", kde_tmp_dir.c_str()); + result = create_link(kde_tmp_dir.c_str(), user_tmp_dir.c_str()); if (result == 0) return 0; /* Success */ - unlink(kde_tmp_dir); - strncat(user_tmp_dir, "XXXXXX", PATH_MAX - strlen(user_tmp_dir)); - mktemp(user_tmp_dir); /* We want a directory, not a file, so using mkstemp makes no sense and is wrong */ - return create_link(kde_tmp_dir, user_tmp_dir); - return 1; + unlink(kde_tmp_dir.c_str()); + user_tmp_dir += "XXXXXX"; + tmp_buf = strdup(user_tmp_dir.c_str()); + mktemp(tmp_buf); /* We want a directory, not a file, so using mkstemp makes no sense and is wrong */ + result = create_link(kde_tmp_dir.c_str(), tmp_buf); + free(tmp_buf); + return result; } result = check_tmp_dir(tmp_buf); + free(tmp_buf); if (result == 0) return 0; /* Success */ - unlink(kde_tmp_dir); - strncat(user_tmp_dir, "XXXXXX", PATH_MAX - strlen(user_tmp_dir)); - mktemp(user_tmp_dir); /* We want a directory, not a file, so using mkstemp makes no sense and is wrong */ - return create_link(kde_tmp_dir, user_tmp_dir); + unlink(kde_tmp_dir.c_str()); + user_tmp_dir += "XXXXXX"; + tmp_buf = strdup(user_tmp_dir.c_str()); + mktemp(tmp_buf); /* We want a directory, not a file, so using mkstemp makes no sense and is wrong */ + result = create_link(kde_tmp_dir.c_str(), tmp_buf); + free(tmp_buf); + return result; } string MCOPUtils::createFilePath(string name) @@ -372,11 +381,7 @@ string MCOPUtils::createFilePath(string name) if (!tmp || !tmp[0]) tmp = "/tmp"; - char tmp_prefix[PATH_MAX+1]; - strcpy(tmp_prefix, tmp); - strcat(tmp_prefix, "/ksocket-"); - - build_link(tmp_prefix, "/socket-"); + build_link(string(tmp) + "/ksocket-", "/socket-"); mcop_dir = locate_mcop_dir(); } if (!mcop_dir) diff --git a/mcop/mcoputils.h b/mcop/mcoputils.h index c0b8224..3645166 100644 --- a/mcop/mcoputils.h +++ b/mcop/mcoputils.h @@ -21,7 +21,7 @@ */ /* - * BC - tqStatus (2002-03-08): MCOPUtils + * BC - Status (2002-03-08): MCOPUtils * * Collection class for all kinds of utility functions. BC, since never * instanciated. @@ -21,7 +21,7 @@ */ /* - * BC - tqStatus (2002-03-08): arts_md5sum + * BC - Status (2002-03-08): arts_md5sum * * No binary compatibility guaranteed (part of Dispatcher's security model). */ diff --git a/mcop/md5auth.h b/mcop/md5auth.h index 3c5f94a..e70141f 100644 --- a/mcop/md5auth.h +++ b/mcop/md5auth.h @@ -21,7 +21,7 @@ */ /* - * BC - tqStatus (2002-03-08): arts_md5_* + * BC - Status (2002-03-08): arts_md5_* * * No guarantees - do not use. */ diff --git a/mcop/namedstore.h b/mcop/namedstore.h index 0d8c29d..89a2b2d 100644 --- a/mcop/namedstore.h +++ b/mcop/namedstore.h @@ -29,7 +29,7 @@ #include "stdio.h" /* - * BC - tqStatus (2002-03-08): NamedStore + * BC - Status (2002-03-08): NamedStore * * None of these classes is considered part of the public API. Do NOT use it * in your apps. These are part of the implementation of object.cc and not diff --git a/mcop/notification.h b/mcop/notification.h index 6c306e5..8b3e4b0 100644 --- a/mcop/notification.h +++ b/mcop/notification.h @@ -29,7 +29,7 @@ namespace Arts { /* - * BC - tqStatus (2002-03-08): Notification, NotificationClient, + * BC - Status (2002-03-08): Notification, NotificationClient, * NotificationManager * * All need to be kept BC, NotificationManager with usual d ptr. diff --git a/mcop/object.h b/mcop/object.h index de46618..dafddf7 100644 --- a/mcop/object.h +++ b/mcop/object.h @@ -34,7 +34,7 @@ #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): Object_base, Object_skel, Object_stub + * BC - Status (2002-03-08): Object_base, Object_skel, Object_stub * * All of them have to be kept binary compatible carefully, due to interaction * with generated code. There are d ptrs in _skel and _stub, NOT TO BE USED diff --git a/mcop/objectmanager.h b/mcop/objectmanager.h index 33d46c7..53aa65a 100644 --- a/mcop/objectmanager.h +++ b/mcop/objectmanager.h @@ -30,7 +30,7 @@ #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): ObjectManager + * BC - Status (2002-03-08): ObjectManager * * Keep binary compatible (since accessible via ::the()), use d ptr when * changing it. diff --git a/mcop/pool.h b/mcop/pool.h index 45a04ce..d3ca05d 100644 --- a/mcop/pool.h +++ b/mcop/pool.h @@ -25,7 +25,7 @@ /* - * BC - tqStatus (2002-03-08): Pool<type> + * BC - Status (2002-03-08): Pool<type> * * Needs to be kept binary compatible by NOT TOUCHING. When you want something * else, write a fresh one (used as part of Arts::Dispatcher, thus changing diff --git a/mcop/reference.h b/mcop/reference.h index ba87ab5..a5bea45 100644 --- a/mcop/reference.h +++ b/mcop/reference.h @@ -19,7 +19,7 @@ */ /* - * BC - tqStatus (2002-03-08): Reference, SubClass, Object, DynamicCast. + * BC - Status (2002-03-08): Reference, SubClass, Object, DynamicCast. * * Part of the public API. Must be kept binary compatible by NOT TOUCHING * AT ALL. Interaction with generated and written code. diff --git a/mcop/referenceclean.h b/mcop/referenceclean.h index 53d3780..2612ffb 100644 --- a/mcop/referenceclean.h +++ b/mcop/referenceclean.h @@ -21,7 +21,7 @@ */ /* - * BC - tqStatus (2002-03-08): ReferenceClean + * BC - Status (2002-03-08): ReferenceClean * * None of these classes is considered part of the public API. Do NOT use it * in your apps. Can be changed arbitrarily even non BC. diff --git a/mcop/socketconnection.h b/mcop/socketconnection.h index d30927f..86c400a 100644 --- a/mcop/socketconnection.h +++ b/mcop/socketconnection.h @@ -21,7 +21,7 @@ */ /* - * BC - tqStatus (2002-03-08): SocketConnection + * BC - Status (2002-03-08): SocketConnection * * None of these classes is considered part of the public API. Do NOT use it * in your apps. No BC guaranteed. diff --git a/mcop/startupmanager.h b/mcop/startupmanager.h index b4089a3..c0644c5 100644 --- a/mcop/startupmanager.h +++ b/mcop/startupmanager.h @@ -28,7 +28,7 @@ #include <list> /* - * BC - tqStatus (2002-03-08): StartupClass, StartupManager. + * BC - Status (2002-03-08): StartupClass, StartupManager. * * The class needs to be kept BC, as the startup system bases on inheritance * and virtual functions. Do not change. diff --git a/mcop/tcpconnection.h b/mcop/tcpconnection.h index e09474a..4fadef6 100644 --- a/mcop/tcpconnection.h +++ b/mcop/tcpconnection.h @@ -21,7 +21,7 @@ */ /* - * BC - tqStatus (2002-03-08): TCPConnection + * BC - Status (2002-03-08): TCPConnection * * Not part of the public API. Do NOT use it in your apps. Binary incompatible * changes allowed. diff --git a/mcop/tcpserver.h b/mcop/tcpserver.h index 59ee44e..4c31540 100644 --- a/mcop/tcpserver.h +++ b/mcop/tcpserver.h @@ -27,7 +27,7 @@ #include "arts_export.h" #include "iomanager.h" /* - * BC - tqStatus (2002-03-08): TCPServer + * BC - Status (2002-03-08): TCPServer * * Not part of the public API. Do NOT use it in your apps. Binary incompatible * changes allowed. diff --git a/mcop/thread.h b/mcop/thread.h index c7ce9ec..d81010d 100644 --- a/mcop/thread.h +++ b/mcop/thread.h @@ -26,7 +26,7 @@ #include "arts_export.h" /* - * BC - tqStatus (2002-03-08): SystemThreads, Thread, Mutex, ThreadCondition, + * BC - Status (2002-03-08): SystemThreads, Thread, Mutex, ThreadCondition, * Semaphore * * These classes are kept binary compatible. As the threading implementation diff --git a/mcop/type.h b/mcop/type.h index 4cdd3f6..a4ca501 100644 --- a/mcop/type.h +++ b/mcop/type.h @@ -27,7 +27,7 @@ #include "buffer.h" /* - * BC - tqStatus (2002-03-08): Type + * BC - Status (2002-03-08): Type * * Keep binary compatible. DO NOT TOUCH, DO NOT CHANGE. */ diff --git a/mcop/unixconnection.h b/mcop/unixconnection.h index c8d2d20..0640670 100644 --- a/mcop/unixconnection.h +++ b/mcop/unixconnection.h @@ -21,7 +21,7 @@ */ /* - * BC - tqStatus (2002-03-08): UnixConnection + * BC - Status (2002-03-08): UnixConnection * * Not part of the public API. Do NOT use it in your apps. Can change, even * binary incompatible. diff --git a/mcop/unixserver.h b/mcop/unixserver.h index 3220e42..fa91fba 100644 --- a/mcop/unixserver.h +++ b/mcop/unixserver.h @@ -21,7 +21,7 @@ */ /* - * BC - tqStatus (2002-03-08): UnixServer + * BC - Status (2002-03-08): UnixServer * * Not part of the public API. Do NOT use it in your apps. Can change, even * binary incompatible. diff --git a/mcop/weakreference.h b/mcop/weakreference.h index a91bc0d..344eacb 100644 --- a/mcop/weakreference.h +++ b/mcop/weakreference.h @@ -21,7 +21,7 @@ */ /* - * BC - tqStatus (2002-03-08): WeakReference(Base) + * BC - Status (2002-03-08): WeakReference(Base) * * Has to be kept binary compatible by not touching it. Add a new class if * you need something else. diff --git a/qtmcop/qiomanager.h b/qtmcop/qiomanager.h index 7c5d655..a1a8b20 100644 --- a/qtmcop/qiomanager.h +++ b/qtmcop/qiomanager.h @@ -21,7 +21,7 @@ */ /* - * BC - tqStatus (2002-03-08): QIOManager. + * BC - Status (2002-03-08): QIOManager. * * QIOManager is kept binary compatible. */ diff --git a/qtmcop/qiomanager_p.h b/qtmcop/qiomanager_p.h index 6048397..b4fea29 100644 --- a/qtmcop/qiomanager_p.h +++ b/qtmcop/qiomanager_p.h @@ -21,7 +21,7 @@ */ /* - * BC - tqStatus (2002-03-08): QIOWatch, QTimeWatch. + * BC - Status (2002-03-08): QIOWatch, QTimeWatch. * * These classes provide implementation details and not meant to be used * in any way. diff --git a/soundserver/artsd.cc b/soundserver/artsd.cc index 6b6a22e..cbe5525 100644 --- a/soundserver/artsd.cc +++ b/soundserver/artsd.cc @@ -296,9 +296,10 @@ int main(int argc, char **argv) if(cfgForceStart && !AudioSubSystem::the()->check()) { - warnNullDevice = "Error while initializing the sound driver:\n"; - warnNullDevice += AudioSubSystem::the()->error(); - warnNullDevice += "\n\nThe sound server will continue, using the null output device."; + //Don't show an error (this looks bad and may confuse users without sound cards), kmix makes it obvious if sound isn't working + //warnNullDevice = "Error while initializing the sound driver:\n"; + //warnNullDevice += AudioSubSystem::the()->error(); + //warnNullDevice += "\n\nThe sound server will continue, using the null output device."; AudioSubSystem::the()->audioIO("null"); } diff --git a/soundserver/artsplay.cc b/soundserver/artsplay.cc index b8dec3d..a694cd3 100644 --- a/soundserver/artsplay.cc +++ b/soundserver/artsplay.cc @@ -42,13 +42,19 @@ static string absolutePath(const string& path) { if(path[0] == '/') return path; - char buffer[PATH_MAX]; - getcwd(buffer,PATH_MAX); + int size = 4096; - if(buffer[strlen(buffer)-1] == '/') - return buffer + path; - else - return string(buffer) + '/' + path; + while (1) { + char buffer[size]; + if (getcwd(buffer,size)) + { + if(buffer[strlen(buffer)-1] == '/') + return buffer + path; + else + return string(buffer) + '/' + path; + } + size *= 2; + } } int main(int argc, char **argv) |