summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorJohn Anderson <ardour@semiosix.com>2007-03-13 20:05:44 +0000
committerJohn Anderson <ardour@semiosix.com>2007-03-13 20:05:44 +0000
commit29f4d8b52c937b984dfba80cd912a20ee6b526ce (patch)
treed8af3dafcddc15b9401c6a1738f5d22fa020bc21 /libs
parent7f80d6d21b8a1247218a447830bed895193388ca (diff)
no more strerror_r
git-svn-id: svn://localhost/ardour2/trunk@1585 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/surfaces/mackie/surface_port.cc31
1 files changed, 13 insertions, 18 deletions
diff --git a/libs/surfaces/mackie/surface_port.cc b/libs/surfaces/mackie/surface_port.cc
index 8f55754f49..f0cdbdbe98 100644
--- a/libs/surfaces/mackie/surface_port.cc
+++ b/libs/surfaces/mackie/surface_port.cc
@@ -27,13 +27,11 @@
#include "i18n.h"
-#define _XOPEN_SOURCE 600 // force XSI for non-GNU strerror_r()
-
#include <sstream>
+
#include <cstring>
#include <cerrno>
-
using namespace std;
using namespace Mackie;
@@ -51,6 +49,13 @@ SurfacePort::~SurfacePort()
//cout << "~SurfacePort::SurfacePort() finished" << endl;
}
+// wrapper for one day when strerror_r is working properly
+string fetch_errmsg( int error_number )
+{
+ char * msg = strerror( error_number );
+ return msg;
+}
+
MidiByteArray SurfacePort::read()
{
const int max_buf_size = 512;
@@ -88,14 +93,9 @@ MidiByteArray SurfacePort::read()
if ( errno != EAGAIN )
{
ostringstream os;
- os << "Surface: error reading from port: " << port().name() << ": " << errno;
+ os << "Surface: error reading from port: " << port().name();
+ os << ": " << errno << fetch_errmsg( errno );
- char buf[512];
- int result = strerror_r( errno, buf, 512 );
- if (!result) {
- os << " " << buf;
- }
-
cout << os.str() << endl;
inactive_event();
throw MackieControlException( os.str() );
@@ -122,14 +122,9 @@ void SurfacePort::write( const MidiByteArray & mba )
if ( errno != EAGAIN )
{
ostringstream os;
- os << "Surface: couldn't write to port " << port().name() << ": " << errno;
- char buf[512];
- int result = strerror_r( errno, buf, 512 );
-
- if (!result) {
- os << " " << buf;
- }
-
+ os << "Surface: couldn't write to port " << port().name();
+ os << ": " << errno << fetch_errmsg( errno );
+
cout << os.str();
inactive_event();
throw MackieControlException( os.str() );