]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/core-error.c
remap: Change remapping function argument type from void to int16_t / float as approp...
[pulseaudio] / src / pulsecore / core-error.c
index 3d6c2c3be628cd6f144626a7a541507814ec494a..a1aee0e87f038e3856639fcc6a6daf9de4ad7002 100644 (file)
@@ -6,7 +6,7 @@
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published
-  by the Free Software Foundation; either version 2 of the License,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -32,8 +32,6 @@
 #include <pulse/utf8.h>
 #include <pulse/xmalloc.h>
 
-#include <pulsecore/core-util.h>
-#include <pulsecore/native-common.h>
 #include <pulsecore/thread.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/log.h>
@@ -47,6 +45,9 @@ const char* pa_cstrerror(int errnum) {
     char *translated, *t;
     char errbuf[128];
 
+    if (errnum < 0)
+        errnum = -errnum;
+
     if ((t = PA_STATIC_TLS_GET(cstrerror)))
         pa_xfree(t);
 
@@ -62,8 +63,9 @@ const char* pa_cstrerror(int errnum) {
     original = strerror(errnum);
 #endif
 
-    if (!original) {
-        pa_snprintf(errbuf, sizeof(errbuf), "Unknown error %i", errnum);
+    /* The second condition is a Windows-ism */
+    if (!original || !strcasecmp(original, "Unknown error")) {
+        pa_snprintf(errbuf, sizeof(errbuf), "Unknown error %d", errnum);
         original = errbuf;
     }