Compilation repairs

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/dependencies/arts@1212131 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent 7de042bb5b
commit 6637c74227

@ -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.
*/

@ -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)

@ -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);

@ -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

@ -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.

@ -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;

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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.

@ -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.

@ -23,8 +23,6 @@
#ifndef SYNTHSCHEDULE_H
#define SYNTHSCHEDULE_H
#include "config.h"
#ifdef __GNUC__
#warning " * <synthschedule.h> included! *"
#warning " * include <gslschedule.h> instead *"

@ -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

@ -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).
*/

@ -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.

@ -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

@ -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.

@ -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).

@ -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).
*/

@ -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.

@ -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

@ -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).

@ -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.

@ -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.

@ -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).
*/

@ -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).
*/

@ -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:

@ -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

@ -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

@ -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

@ -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

@ -21,7 +21,7 @@
*/
/*
* BC - tqStatus (2002-03-08):
* BC - Status (2002-03-08):
* BINARY COMPATIBLE: IONotify, TimeNotify, IOManager
* NO BC FOR: StdIOManager
*

@ -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.

@ -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.
*/

@ -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;
{
char buf[1024];
if (gethostname(buf, sizeof(buf)-1) != 0)
{
arts_fatal("Aborting. Could not determine hostname or hostname too long.");
}
kde_tmp_dir[sizeof(kde_tmp_dir)-1] = '\0';
buf[sizeof(buf)-1] = '\0';
kde_tmp_dir += buf;
}
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);
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);
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);
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)
{
fprintf(stderr, "Error: \"%s\" could not be read.\n", kde_tmp_dir);
return 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)

@ -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).
*/

@ -21,7 +21,7 @@
*/
/*
* BC - tqStatus (2002-03-08): arts_md5_*
* BC - Status (2002-03-08): arts_md5_*
*
* No guarantees - do not use.
*/

@ -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

@ -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.

@ -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

@ -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.

@ -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

@ -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.

@ -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.

@ -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.

@ -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.

@ -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.

@ -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.

@ -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

@ -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.
*/

@ -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.

@ -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.

@ -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.

@ -21,7 +21,7 @@
*/
/*
* BC - tqStatus (2002-03-08): QIOManager.
* BC - Status (2002-03-08): QIOManager.
*
* QIOManager is kept binary compatible.
*/

@ -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.

@ -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");
}

@ -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;
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)

Loading…
Cancel
Save