Tomas Janousek 340e44
Fix the calls to whatever->open to compile with newer glibc.
Tomas Janousek 340e44
Tomas Janousek 340e44
The glibc upstream has recently defined open as macro to check for incorrect
Tomas Janousek 340e44
usage of the third parameter. This is correct, the POSIX standard says that it
Tomas Janousek 340e44
may be declared in such a way. The attached patch redefines all those
Tomas Janousek 340e44
> whatever->open(...)
Tomas Janousek 340e44
calls to
Tomas Janousek 340e44
> (whatever->open)(...)
Tomas Janousek 340e44
. I also replaced the close calls, since close may be declared as macro too.
Tomas Janousek 340e44
Tomas Janousek 340e44
Signed-off-by: Tomas Janousek <tjanouse@redhat.com>
Tomas Janousek 340e44
Reviewed-by: Stepan Kasal <skasal@redhat.com>
Tomas Janousek 340e44
---
Tomas Janousek 340e44
Tomas Janousek 340e44
--- brltty-3.8/Programs/config.c.openmacro	2007-08-21 14:25:42.000000000 +0200
Tomas Janousek 340e44
+++ brltty-3.8/Programs/config.c	2007-08-21 14:28:07.000000000 +0200
Tomas Janousek 340e44
@@ -1383,13 +1383,13 @@
Tomas Janousek 340e44
 openBrailleDriver (void) {
Tomas Janousek 340e44
   initializeBraille();
Tomas Janousek 340e44
 
Tomas Janousek 340e44
-  if (braille->open(&brl, brailleParameters, brailleDevice)) {
Tomas Janousek 340e44
+  if ((braille->open)(&brl, brailleParameters, brailleDevice)) {
Tomas Janousek 340e44
     if (allocateBrailleBuffer(&brl)) {
Tomas Janousek 340e44
       brailleOpened = 1;
Tomas Janousek 340e44
       return 1;
Tomas Janousek 340e44
     }
Tomas Janousek 340e44
 
Tomas Janousek 340e44
-    braille->close(&brl;;
Tomas Janousek 340e44
+    (braille->close)(&brl;;
Tomas Janousek 340e44
   } else {
Tomas Janousek 340e44
     LogPrint(LOG_DEBUG, "%s: %s -> %s",
Tomas Janousek 340e44
              gettext("braille driver initialization failed"),
Tomas Janousek 340e44
@@ -1403,7 +1403,7 @@
Tomas Janousek 340e44
 closeBrailleDriver (void) {
Tomas Janousek 340e44
   brailleOpened = 0;
Tomas Janousek 340e44
   drainBrailleOutput(&brl, 0);
Tomas Janousek 340e44
-  braille->close(&brl;;
Tomas Janousek 340e44
+  (braille->close)(&brl;;
Tomas Janousek 340e44
 
Tomas Janousek 340e44
   if (brl.isCoreBuffer) {
Tomas Janousek 340e44
     free(brl.buffer);
Tomas Janousek 340e44
@@ -1657,7 +1657,7 @@
Tomas Janousek 340e44
 openSpeechDriver (void) {
Tomas Janousek 340e44
   initializeSpeech();
Tomas Janousek 340e44
 
Tomas Janousek 340e44
-  if (speech->open(speechParameters)) {
Tomas Janousek 340e44
+  if ((speech->open)(speechParameters)) {
Tomas Janousek 340e44
     return 1;
Tomas Janousek 340e44
   } else {
Tomas Janousek 340e44
     LogPrint(LOG_DEBUG, "speech driver initialization failed: %s",
Tomas Janousek 340e44
@@ -1669,7 +1669,7 @@
Tomas Janousek 340e44
 
Tomas Janousek 340e44
 void
Tomas Janousek 340e44
 closeSpeechDriver (void) {
Tomas Janousek 340e44
-  speech->close();
Tomas Janousek 340e44
+  (speech->close)();
Tomas Janousek 340e44
 }
Tomas Janousek 340e44
 
Tomas Janousek 340e44
 static int
Tomas Janousek 340e44
--- brltty-3.8/Programs/tunes.c.openmacro	2007-08-21 14:25:42.000000000 +0200
Tomas Janousek 340e44
+++ brltty-3.8/Programs/tunes.c	2007-08-21 14:28:54.000000000 +0200
Tomas Janousek 340e44
@@ -480,7 +480,7 @@
Tomas Janousek 340e44
    }
Tomas Janousek 340e44
 
Tomas Janousek 340e44
    if (!generator) return 0;
Tomas Janousek 340e44
-   if (noteGenerator) noteGenerator->close();
Tomas Janousek 340e44
+   if (noteGenerator) (noteGenerator->close)();
Tomas Janousek 340e44
    closeTimer = 0;
Tomas Janousek 340e44
    noteGenerator = generator;
Tomas Janousek 340e44
    return 1;
Tomas Janousek 340e44
@@ -490,7 +490,7 @@
Tomas Janousek 340e44
 closeTuneDevice (int force) {
Tomas Janousek 340e44
    if (closeTimer) {
Tomas Janousek 340e44
       if (force) closeTimer = 1;
Tomas Janousek 340e44
-      if (!--closeTimer) noteGenerator->close();
Tomas Janousek 340e44
+      if (!--closeTimer) (noteGenerator->close)();
Tomas Janousek 340e44
    }
Tomas Janousek 340e44
 }
Tomas Janousek 340e44
  
Tomas Janousek 340e44
@@ -499,7 +499,7 @@
Tomas Janousek 340e44
    int tunePlayed = 0;
Tomas Janousek 340e44
    if (prefs.alertTunes && tune->elements) {
Tomas Janousek 340e44
       if (noteGenerator) {
Tomas Janousek 340e44
-	 if (noteGenerator->open(openErrorLevel)) {
Tomas Janousek 340e44
+	 if ((noteGenerator->open)(openErrorLevel)) {
Tomas Janousek 340e44
 	    TuneElement *element = tune->elements;
Tomas Janousek 340e44
 	    tunePlayed = 1;
Tomas Janousek 340e44
 	    closeTimer = 2000 / updateInterval;
Tomas Janousek 340e44
--- brltty-3.8/Programs/brltest.c.openmacro	2007-08-21 14:25:42.000000000 +0200
Tomas Janousek 340e44
+++ brltty-3.8/Programs/brltest.c	2007-08-21 14:27:31.000000000 +0200
Tomas Janousek 340e44
@@ -161,14 +161,14 @@
Tomas Janousek 340e44
       initializeBrailleDisplay(&brl;;
Tomas Janousek 340e44
       brl.dataDirectory = opt_dataDirectory;
Tomas Janousek 340e44
       identifyBrailleDriver(braille, 0);		/* start-up messages */
Tomas Janousek 340e44
-      if (braille->open(&brl, parameterSettings, opt_brailleDevice)) {
Tomas Janousek 340e44
+      if ((braille->open)(&brl, parameterSettings, opt_brailleDevice)) {
Tomas Janousek 340e44
         if (allocateBrailleBuffer(&brl)) {
Tomas Janousek 340e44
 #ifdef ENABLE_LEARN_MODE
Tomas Janousek 340e44
           learnMode(&brl, updateInterval, 10000);
Tomas Janousek 340e44
 #else /* ENABLE_LEARN_MODE */
Tomas Janousek 340e44
           message("braille test", 0);
Tomas Janousek 340e44
 #endif /* ENABLE_LEARN_MODE */
Tomas Janousek 340e44
-          braille->close(&brl;;		/* finish with the display */
Tomas Janousek 340e44
+          (braille->close)(&brl;;		/* finish with the display */
Tomas Janousek 340e44
           status = 0;
Tomas Janousek 340e44
         } else {
Tomas Janousek 340e44
           LogPrint(LOG_ERR, "can't allocate braille buffer.");
Tomas Janousek 340e44
--- brltty-3.8/Programs/spktest.c.openmacro	2007-08-21 14:25:42.000000000 +0200
Tomas Janousek 340e44
+++ brltty-3.8/Programs/spktest.c	2007-08-21 14:28:27.000000000 +0200
Tomas Janousek 340e44
@@ -163,7 +163,7 @@
Tomas Janousek 340e44
 
Tomas Janousek 340e44
     if (chdir(opt_dataDirectory) != -1) {
Tomas Janousek 340e44
       identifySpeechDriver(speech, 0);		/* start-up messages */
Tomas Janousek 340e44
-      if (speech->open(parameterSettings)) {
Tomas Janousek 340e44
+      if ((speech->open)(parameterSettings)) {
Tomas Janousek 340e44
         if (speech->rate) speech->rate(speechRate);
Tomas Janousek 340e44
         if (speech->volume) speech->volume(speechVolume);
Tomas Janousek 340e44
 
Tomas Janousek 340e44
@@ -172,7 +172,7 @@
Tomas Janousek 340e44
         } else {
Tomas Janousek 340e44
           processLines(stdin, sayLine, NULL);
Tomas Janousek 340e44
         }
Tomas Janousek 340e44
-        speech->close();		/* finish with the display */
Tomas Janousek 340e44
+        (speech->close)();		/* finish with the display */
Tomas Janousek 340e44
         status = 0;
Tomas Janousek 340e44
       } else {
Tomas Janousek 340e44
         LogPrint(LOG_ERR, "can't initialize speech driver.");