Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/alexmarsev/soxr.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Sykes <rob@rob-Ideapad-S205.(none)>2013-05-28 00:07:14 +0400
committerRob Sykes <rob@rob-Ideapad-S205.(none)>2013-05-28 00:07:14 +0400
commit988f8303c7f30d0db5db3e15bf973e2bdf5c867e (patch)
tree53c48dcf15ffcd9092fd51c5baad2130cc8dbdcb
parente55c47697b0dcb77dd0b11020ffca7f0f2a18975 (diff)
Be more POSIX compliant w.r.t. errno; fixes erroneousl reporting of errors on FreeBSD
-rw-r--r--examples/2-stream.C6
-rw-r--r--examples/3-options-input-fn.c7
-rw-r--r--examples/4-split-channels.c7
-rw-r--r--examples/5-variable-rate.c6
4 files changed, 14 insertions, 12 deletions
diff --git a/examples/2-stream.C b/examples/2-stream.C
index 9d703f6..29c1bf6 100644
--- a/examples/2-stream.C
+++ b/examples/2-stream.C
@@ -72,7 +72,7 @@ int main(int argc, char const * arg[])
soxr_delete(soxr);
free(obuf), free(ibuf);
/* Diagnostics: */
- fprintf(stderr, "%-26s %s; I/O: %s\n", arg[0],
- soxr_strerror(error), errno? strerror(errno) : "no error");
- return error || errno;
+ fprintf(stderr, "%-26s %s; I/O: %s\n", arg[0], soxr_strerror(error),
+ ferror(stdin) || ferror(stdout)? strerror(errno) : "no error");
+ return !!error;
}
diff --git a/examples/3-options-input-fn.c b/examples/3-options-input-fn.c
index bb0bf2d..7acc2d5 100644
--- a/examples/3-options-input-fn.c
+++ b/examples/3-options-input-fn.c
@@ -104,7 +104,8 @@ int main(int n, char const * arg[])
soxr_delete(soxr);
free(obuf), free(ibuf);
/* Diagnostics: */
- fprintf(stderr, "%-26s %s; %lu clips; I/O: %s\n", arg0, soxr_strerror(error),
- (long unsigned)clips, errno? strerror(errno) : "no error");
- return error || errno;
+ fprintf(stderr, "%-26s %s; %lu clips; I/O: %s\n",
+ arg0, soxr_strerror(error), (long unsigned)clips,
+ ferror(stdin) || ferror(stdout)? strerror(errno) : "no error");
+ return !!error;
}
diff --git a/examples/4-split-channels.c b/examples/4-split-channels.c
index a441598..d6448aa 100644
--- a/examples/4-split-channels.c
+++ b/examples/4-split-channels.c
@@ -141,7 +141,8 @@ int main(int n, char const * arg[])
free(obuf), free(ibuf), free(obufs), free(ibufs);
free(obuf_ptrs), free(ibuf_ptrs);
/* Diagnostics: */
- fprintf(stderr, "%-26s %s; %lu clips; I/O: %s\n", arg0, soxr_strerror(error),
- (long unsigned)clips, errno? strerror(errno) : "no error");
- return error || errno;
+ fprintf(stderr, "%-26s %s; %lu clips; I/O: %s\n",
+ arg0, soxr_strerror(error), (long unsigned)clips,
+ ferror(stdin) || ferror(stdout)? strerror(errno) : "no error");
+ return !!error;
}
diff --git a/examples/5-variable-rate.c b/examples/5-variable-rate.c
index a2496c9..dc9efa3 100644
--- a/examples/5-variable-rate.c
+++ b/examples/5-variable-rate.c
@@ -88,7 +88,7 @@ int main(int argc, char *arg[])
soxr_delete(soxr);
}
/* Diagnostics: */
- fprintf(stderr, "%-26s %s; I/O: %s\n", arg[0],
- soxr_strerror(error), errno? strerror(errno) : "no error");
- return error || errno;
+ fprintf(stderr, "%-26s %s; I/O: %s\n", arg[0], soxr_strerror(error),
+ ferror(stdin) || ferror(stdout)? strerror(errno) : "no error");
+ return !!error;
}