• R/O
  • HTTP
  • SSH
  • HTTPS

cinnamon: Commit

Cinnamon audio library


Commit MetaInfo

Revision39f718a05ca885d83fd0c5d0aee398c8506cbe28 (tree)
Zeit2019-09-22 09:35:33
AutorAlaskanEmily <emily@alas...>
CommiterAlaskanEmily

Log Message

Fix aucat on not-Windows

Ändern Zusammenfassung

Diff

--- a/src/aucat.c
+++ b/src/aucat.c
@@ -10,6 +10,7 @@
1010 #include "cinnamon.h"
1111
1212 #include <stdio.h>
13+#include <string.h>
1314 #include <stdlib.h>
1415
1516 /*
@@ -30,7 +31,7 @@
3031 #include <Windows.h>
3132 #define AUCAT_SLEEP Sleep
3233
33-#elif defined __linux__
34+#else
3435 /* usleep is missing/deprecated on Linux, use nanosleep instead. */
3536
3637 #include <time.h>
@@ -38,23 +39,12 @@
3839
3940 #define AUCAT_SLEEP(MS) do{\
4041 const unsigned long AUCAT_SLEEP_ms = (MS);\
41- struct AUCAT_SLEEP_ts;\
42- AUCAT_SLEEP_ts.tn_sec = (AUCAT_SLEEP_ms % 1000) * 1000000;\
42+ struct timespec AUCAT_SLEEP_ts;\
43+ AUCAT_SLEEP_ts.tv_nsec = (AUCAT_SLEEP_ms % 1000) * 1000000;\
4344 AUCAT_SLEEP_ts.tv_sec = AUCAT_SLEEP_ms / 1000;\
4445 nanosleep(&AUCAT_SLEEP_ts, NULL);\
4546 } while(0)
4647
47-#else
48-/* On BSD and OS X (and likely other platforms like Solaris and AIX) we can
49- * simply use nanosleep. This requires _BSD_SOURCE on some platforms.
50- */
51-
52-#define _BSD_SOURCE
53-#include <time.h>
54-#include <unistd.h>
55-
56-#define AUCAT_SLEEP(MS) do{ nanosleep((MS) * 1000); }while(0)
57-
5848 #endif
5949
6050 int main(int argc, char **argv){
@@ -141,7 +131,7 @@ int main(int argc, char **argv){
141131 return EXIT_FAILURE;
142132 }
143133
144- while(num_read = fread(buffer, 1, rate, input)){
134+ while((num_read = fread(buffer, 1, rate, input)) != 0){
145135 Cin_LoaderPut(loader, buffer, num_read);
146136 total_read += num_read;
147137 }
@@ -173,4 +163,6 @@ int main(int argc, char **argv){
173163
174164 free(sound);
175165 }
166+
167+ return EXIT_SUCCESS;
176168 }
Show on old repository browser