[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-multimedia
Subject:    PATCH: Pass call in artsdsp if no artsd is running
From:       Stefan Schimanski <1Stein () gmx ! de>
Date:       2001-02-02 13:05:04
[Download RAW message or body]

Hi,

this patch passes the io calls if the connection can't be initiated to the 
arts daemon. This will make artsdsp a safer choice because it will work with 
and without a running artsd (i.e. Flash plugins in nsplugin will work in both 
cases).

Schimmi

-- 
I used to think that the brain was the most wonderful organ in my body. Then 
I realized who was telling me this.
["artsdsp.patch" (text/x-c)]

Index: artsdsp.c
===================================================================
RCS file: /home/kde/kdelibs/arts/artsc/artsdsp.c,v
retrieving revision 1.26
diff -u -p -B -w -r1.26 artsdsp.c
--- artsdsp.c	2001/01/02 18:05:37	1.26
+++ artsdsp.c	2001/02/02 12:59:15
@@ -198,20 +198,19 @@ int open (const char *pathname, int flag
   sndfd = orig_open("/dev/null",flags,mode);
   if(sndfd >= 0)
   {
-	if(!arts_init_done)
-	{
+      if(!arts_init_done) {
       int rc = arts_init();
-      if(rc < 0)
-      {
+	  if(rc < 0) {
         artsdspdebug("error on aRts init: %s\n", arts_error_text(rc));
         orig_close(sndfd);
 	    sndfd = -1;
-        return -1;
-	  }
-    }
+	      return orig_open (pathname, flags, mode);
+	  } else
 	arts_init_done = 1;
   }
 
+  }
+
   /* success */
   return sndfd;
 }
@@ -237,7 +236,7 @@ int ioctl (int fd, ioctl_request_t reque
 
   CHECK_INIT();
 
-  if (fd != sndfd)
+  if (fd != sndfd || !arts_init_done )
     return orig_ioctl (fd, request, argp);
   else if (sndfd != -1)
     {
@@ -466,7 +465,7 @@ int close(int fd)
 {
   CHECK_INIT();
 
-  if (fd != sndfd)
+  if (fd != sndfd || !arts_init_done )
     return orig_close (fd);
   else if (sndfd != -1)
     {
@@ -499,7 +498,7 @@ ssize_t write (int fd, const void *buf, 
 {
   CHECK_INIT();
 
-  if(fd != sndfd)
+  if(fd != sndfd || !arts_init_done)
     return orig_write(fd,buf,count);
   else if(sndfd != -1)
   {
@@ -517,7 +516,7 @@ void *mmap(void  *start,  size_t length,
 {
   CHECK_INIT();
 
-  if(fd != sndfd || sndfd == -1)
+  if(fd != sndfd || sndfd == -1 || !arts_init_done)
     return orig_mmap(start,length,prot,flags,fd,offset);
   else
   {
@@ -541,7 +540,7 @@ int munmap(void *start, size_t length)
 {
   CHECK_INIT();
 
-  if(start != mmapemu_obuffer || mmapemu_obuffer == 0)
+  if(start != mmapemu_obuffer || mmapemu_obuffer == 0 || !arts_init_done)
     return orig_munmap(start,length);
 
   artsdspdebug ("aRts: /dev/dsp munmap...\n");

_______________________________________________
Kde-multimedia mailing list
Kde-multimedia@master.kde.org
http://master.kde.org/mailman/listinfo/kde-multimedia


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic