[nas] fw: depending on X11

Jon Trulson jon at radscan.com
Wed Oct 12 22:47:17 MDT 2005



 	This was sent to the list by an unsubcribed user, so it was 
bounced - passing it on.  I am curious about the general availability of 
intptr_t on other platforms before appling this patch... Any comments?

 	Also, if libaudio itself does not depend on Xt, then I agree, it 
should not be linked to it.  I seem to recall a patch that added this some 
time ago (1.4?) (by the debian maintainer?).  Should this link be severed?

=-=
[from mi at aldan.algebra.com]

Hello!

It seems, nothing in the libaudio itself requires X11-libraries (libXt)
-- only some of the clients.

I'd like to be able to make an X-less client, which currently requires
linking with the static version of libaudio.a, because the shared
version drags in the dependency on -lXt.

Maybe, libaudio should be split into libaudio and libaudioX or something
-- with just the Xtutil.o going into the later?

Any comments? Thanks!

 	-mi

P.S. To build warning-free on amd64 I needed the attached patch. Most
of the warnings fixed are benign, but not all.
=-=

--ELM1128960107-44081-0_

--- server/dda/voxware/config.c	Fri Jul 12 00:44:16 2002
+++ server/dda/voxware/config.c	Mon Oct 10 10:25:22 2005
@@ -6,4 +6,5 @@

  #include <fcntl.h>
+#include <stdint.h>
  #include "nasconf.h"
  #include "config.h"
@@ -27,5 +28,5 @@
      {
      case CONF_SET_SECTION:
-      num = (int) value;
+      num = (intptr_t) value;

        if (num == INPUTSECTION)
@@ -40,10 +41,10 @@

      case FORCERATE :
-      num = (int) value;
+      num = (intptr_t) value;
        confStat->forceRate = num ;
        break;

      case GAIN :
-      num = (int) value;
+      num = (intptr_t) value;
        /* the default is 50, so if it's just out of range, don't
  	 reset it */
@@ -56,10 +57,10 @@

      case AUTOOPEN :
-      num = (int) value;
+      num = (intptr_t) value;
        confStat->autoOpen = num;
        break;

      case READWRITE :
-      num = (int) value;
+      num = (intptr_t) value;
        if (confStat == &sndStatIn) {
  	confStat->howToOpen = (num ? O_RDWR : O_RDONLY);
@@ -85,5 +86,5 @@

      case WORDSIZE:
-      num = (int) value;
+      num = (intptr_t) value;

        if (num != 8 && num != 16)
@@ -97,5 +98,5 @@

      case FRAGSIZE:
-      num = (int) value;
+      num = (intptr_t) value;

        {
@@ -122,5 +123,5 @@

      case MINFRAGS:
-      num = (int) value;
+      num = (intptr_t) value;

        if (num < 2 || num > 32)
@@ -137,5 +138,5 @@

      case MAXFRAGS:
-      num = (int) value;
+      num = (intptr_t) value;

        if (num < 2 || num > 32)
@@ -152,5 +153,5 @@

      case NUMCHANS:
-      num = (int) value;
+      num = (intptr_t) value;

        if (num != 1 && num != 2)
@@ -164,5 +165,5 @@

      case MAXRATE:
-      num = (int) value;
+      num = (intptr_t) value;

        confStat->maxSampleRate = num;
@@ -170,5 +171,5 @@

      case MINRATE:
-      num = (int) value;
+      num = (intptr_t) value;

        confStat->minSampleRate = num;
@@ -176,5 +177,5 @@

      case MIXERINIT:
-      num = (int) value;
+      num = (intptr_t) value;

        VOXMixerInit = num;
--- server/dia/gram.y	Mon Dec 22 21:00:04 2003
+++ server/dia/gram.y	Mon Oct 10 10:46:03 2005
@@ -4,4 +4,5 @@

  %{
+#include <stdint.h>
  #include <stdio.h>
  #include <stdlib.h>
@@ -15,5 +16,5 @@

  static char	*ptr;
-static int parsebool(char *str);
+static intptr_t parsebool(const char *str);
  extern int yylineno;

@@ -22,5 +23,5 @@
  %union
  {
-    int num;
+    intptr_t num;
      char *ptr;
  };
@@ -239,30 +240,21 @@
  }

-static int parsebool(char *str)
+static intptr_t
+parsebool(const char *str)
  {
-  char *s;
-
-  s = str;
-
-  if (s == NULL)
+  if (str == NULL)
      return(-1);

-  while(*s)
-    {
-      *s = (char)tolower(*s);
-      s++;
-    }
-
-  if (((char *)strstr("false", str) != NULL) ||
-      ((char *)strstr("no", str) != NULL)    ||
-      ((char *)strstr("0", str) != NULL)     ||
-      ((char *)strstr("off", str) != NULL))
+  if (((char *)strcasestr("false", str) != NULL) ||
+      ((char *)strcasestr("no", str) != NULL)    ||
+      ((char *)strcasestr("0", str) != NULL)     ||
+      ((char *)strcasestr("off", str) != NULL))
      {
        return(FALSE);
      }
-  else if (((char *)strstr("true", str) != NULL) ||
-           ((char *)strstr("yes", str) != NULL)  ||
-           ((char *)strstr("1", str) != NULL)    ||
-           ((char *)strstr("on", str) != NULL))
+  else if (((char *)strcasestr("true", str) != NULL) ||
+           ((char *)strcasestr("yes", str) != NULL)  ||
+           ((char *)strcasestr("1", str) != NULL)    ||
+           ((char *)strcasestr("on", str) != NULL))
      {
        return(TRUE);
--- server/dia/lex.l	Tue Jul  9 22:28:41 2002
+++ server/dia/lex.l	Mon Oct 10 10:47:16 2005
@@ -3,4 +3,5 @@

  %{
+#include <stdint.h>
  #include "auservertype.h"
  #include "gram.h"
+++ clients/audio/widgets/Slider.c	Mon Oct 10 11:04:41 2005
@@ -32,4 +32,5 @@
  #include <X11/Xaw/Label.h>
  #include <X11/Xaw/Scrollbar.h>
+#include <stdint.h>
  #include <stdio.h>
  #include "SliderP.h"
@@ -151,5 +152,5 @@
  			     (float) w->slider.value / w->slider.max, -1.0);

-	XtCallCallbacks((Widget) w, XtNcallback, (XtPointer) w->slider.value);
+	XtCallCallbacks((Widget) w, XtNcallback, (XtPointer)(intptr_t)w->slider.value);
      }
  }
@@ -162,5 +163,5 @@
  {
      SliderWidget    sw = (SliderWidget) swp;
-    int             position = (int) positionp;
+    intptr_t        position = (intptr_t) positionp;

      setValue(sw, sw->slider.value + (position > 0 ? -1 : 1), True, False);
--- clients/audio/audemo/audemo.c	Sun Jun 20 15:06:50 2004
+++ clients/audio/audemo/audemo.c	Mon Oct 10 11:12:15 2005
@@ -29,4 +29,5 @@
  #include "config.h"

+#include <stdint.h>
  #include <stdio.h>

@@ -973,5 +973,5 @@

      /* retrieve the address of the globals from the first parameter */
-    globals = (GlobalDataPtr) atoi(params[0]);
+    globals = (GlobalDataPtr)(uintptr_t)strtoull(params[0], NULL, 0);
      saveOk(w, globals, 0);
  }
@@ -1296,5 +1296,5 @@
  {
      GlobalDataPtr   globals = (GlobalDataPtr) globalsp;
-    int             position = (int) positionp;
+    intptr_t        position = (intptr_t) positionp;
      int             newVolume;
      char            buf[50];
@@ -1363,5 +1363,5 @@
  {
      GlobalDataPtr   globals = (GlobalDataPtr) globalsp;
-    int             position = (int) positionp;
+    intptr_t        position = (intptr_t) positionp;
      int             newGain;
      char            buf[50];
@@ -1457,5 +1457,5 @@

      /* pass the address of the globals as an argument to the action */
-    sprintf(tmp, "<Key>Return: ok(%u)", (unsigned int) g);
+    sprintf(tmp, "<Key>Return: ok(%p)", g);
      XtOverrideTranslations(s->file, XtParseTranslationTable(tmp));

--- clients/audio/auedit/auedit.c	Sun Jun 20 15:06:50 2004
+++ clients/audio/auedit/auedit.c	Mon Oct 10 11:16:16 2005
@@ -28,4 +28,5 @@
   */

+#include <stdint.h>
  #include <stdio.h>

@@ -390,5 +390,5 @@
  {
      GlobalDataPtr   g = (GlobalDataPtr) gp;
-    int             p = (int) pp;
+    intptr_t        p = (intptr_t) pp;
      int             n;

@@ -406,5 +406,5 @@
  {
      GlobalDataPtr   g = (GlobalDataPtr) gp;
-    int             p = (int) pp;
+    intptr_t        p = (intptr_t) pp;
      int             n;

@@ -457,5 +457,5 @@
  {
      GlobalDataPtr   g = (GlobalDataPtr) gp;
-    int             gain = (int) gainp;
+    intptr_t        gain = (intptr_t) gainp;
      AuDeviceAttributes da;

@@ -1844,5 +1844,5 @@
  {
      GlobalDataPtr   g = (GlobalDataPtr) gp;
-    int             value = (int) valuep;
+    intptr_t        value = (intptr_t) valuep;
      AuElementParameters *parms;
      ElementListPtr  p = ElementList;
--- clients/audio/auedit/Graph.c	Sun Jun 20 15:01:41 2004
+++ clients/audio/auedit/Graph.c	Mon Oct 10 11:21:15 2005
@@ -29,4 +29,5 @@

  #include "config.h"
+#include <stdint.h>

  #if defined(HAVE_LIMITS_H)
@@ -453,5 +454,5 @@
      {
  	XtCallCallbacks((Widget) w, XtNleftProc,
-			(XtPointer) w->graph.leftMarker);
+			(XtPointer)(intptr_t)w->graph.leftMarker);
  	redraw = TRUE;
      }
@@ -460,5 +461,5 @@
      {
  	XtCallCallbacks((Widget) w, XtNrightProc,
-			(XtPointer) w->graph.rightMarker);
+			(XtPointer)(intptr_t)w->graph.rightMarker);
  	redraw = TRUE;
      }
@@ -540,8 +541,8 @@
      if (w->graph.marker == GraphLeftMarker)
  	XtCallCallbacks((Widget) w, XtNleftProc,
-			(XtPointer) w->graph.leftMarker);
+			(XtPointer)(intptr_t)w->graph.leftMarker);
      else
  	XtCallCallbacks((Widget) w, XtNrightProc,
-			(XtPointer) w->graph.rightMarker);
+			(XtPointer)(intptr_t)w->graph.rightMarker);
  }

--- clients/audio/aupanel/aupanel.c	Thu Apr  7 15:08:14 2005
+++ clients/audio/aupanel/aupanel.c	Mon Oct 10 11:23:01 2005
@@ -29,4 +29,5 @@

  #include <stdio.h>
+#include <stdint.h>
  #include <stdlib.h>
  #ifndef SYSV
@@ -262,5 +263,5 @@
  	return;

-    AuDeviceInputMode(da) = (int) XawToggleGetCurrent(w) == 1
+    AuDeviceInputMode(da) = (intptr_t) XawToggleGetCurrent(w) == 1
  	? AuDeviceInputModeLineIn : AuDeviceInputModeMicrophone;

@@ -326,5 +327,5 @@
      GlobalDataPtr   g = (GlobalDataPtr) gp;
      AuDeviceAttributes *da = &g->da[g->deviceNum];
-    int             value = (int) valuep;
+    intptr_t        value = (intptr_t) valuep;

      AuDeviceGain(da) = AuFixedPointFromSum(value, 0);
--- clients/audio/autool/audiotool.c	Sun Jun 20 19:27:08 2004
+++ clients/audio/autool/audiotool.c	Mon Oct 10 11:24:41 2005
@@ -30,4 +30,5 @@
  #include "config.h"

+#include	<stdint.h>
  #include	<stdio.h>

@@ -37,5 +38,5 @@

  #if defined(HAVE_MALLOC_H)
-# include <malloc.h>
+# include <stdlib.h>
  #endif

@@ -387,5 +388,5 @@
  {
      GlobalDataPtr   globals = (GlobalDataPtr) data;
-    int             position = (int) cd;
+    intptr_t        position = (intptr_t) cd;
      int             newVolume;
      char            buf[50];
--- clients/audio/auwave/auwave.c	Thu Apr  7 15:08:14 2005
+++ clients/audio/auwave/auwave.c	Mon Oct 10 11:26:40 2005
@@ -28,4 +28,5 @@
   */

+#include <stdint.h>
  #include <stdio.h>
  #include <stdlib.h>
@@ -237,5 +238,5 @@
  {
      GlobalDataPtr   g = (GlobalDataPtr) gp;
-    int             value = (int) valuep;
+    intptr_t        value = (intptr_t) valuep;

      AuElementParameters parms;
@@ -259,5 +260,5 @@
  {
      GlobalDataPtr   g = (GlobalDataPtr) gp;
-    int             value = (int) valuep;
+    intptr_t        value = (intptr_t) valuep;
      AuElementParameters parms;
      char            buf[10];
@@ -284,5 +285,5 @@
  {
      GlobalDataPtr   g = (GlobalDataPtr) gp;
-    int             value = (int) valuep;
+    intptr_t        value = (intptr_t) valuep;
      AuDeviceAttributes da;

--- clients/audio/auphone/auphone.c	Sat Jul 20 21:13:30 2002
+++ clients/audio/auphone/auphone.c	Mon Oct 10 11:32:46 2005
@@ -28,4 +28,5 @@
   */

+#include <stdint.h>
  #include <stdio.h>
  #include <stdlib.h>
@@ -218,7 +219,7 @@
                 *busyData;

-static int
+static intptr_t
  fatalError(message, arg)
-char           *message,
+const char     *message,
                 *arg;
  {
@@ -226,5 +227,4 @@
      fprintf(stderr, "\n");
      exit(1);
-    return 0;
  }

@@ -240,5 +240,5 @@
  	g->bufSize = e->num_bytes;

-	if (!(g->buf = (char *) malloc(g->bufSize)))
+	if (!(g->buf = malloc(g->bufSize)))
  	    fatalError("malloc failed");
      }
@@ -252,6 +252,6 @@
  	g->bufSize += e->num_bytes;

-	if (!(g->buf = (char *) realloc(g->buf, g->bufSize)))
-	    fatalError("malloc failed");
+	if (!(g->buf = realloc(g->buf, g->bufSize)))
+	    fatalError("realloc failed");
      }

@@ -918,5 +918,5 @@
  {
      GlobalDataPtr   g = (GlobalDataPtr)gp;
-    int             vol = (int)volp;
+    intptr_t        vol = (intptr_t)volp;
      AuElementParameters parms;

@@ -940,5 +940,5 @@
  {
      GlobalDataPtr   g = (GlobalDataPtr)gp;
-    int             gain = (int)gainp;
+    intptr_t        gain = (intptr_t)gainp;
      ServerPtr       l = &g->local;
      AuDeviceAttributes da;
@@ -1129,5 +1129,5 @@
  	    fatalError("Can't open ring %s", ring);

-	if (!(chunk = (char *) malloc(CHUNK_SIZE)))
+	if (!(chunk = malloc(CHUNK_SIZE)))
  	    fatalError("malloc failed");


--ELM1128960107-44081-0_--



More information about the Nas mailing list