gbowne1 / gbowne1/XOpenPlayer

Minor fix to util.c and please protect that blank line at the bottom

Open
#8 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```

Something is wrong with your editor. Has to be. It is good policy for
cross platform code to leave a blank line at the top and bottom of
every source file. Also nice that a function does a return :

diff --git a/src/main.c b/src/main.c
index 74dc9a9..4ff85f6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -160,3 +160,4 @@ int main(void) {
log_event("Application terminated successfully.");
return 0;
}
+
diff --git a/src/player.c b/src/player.c
index cea87a0..c27fdd1 100644
--- a/src/player.c
+++ b/src/player.c
@@ -429,3 +429,4 @@ void handle_resize(int new_width, int new_height) {

/* You could later add layout recalculations here if needed */
}
+
diff --git a/src/playlist.c b/src/playlist.c
index 9d60d2d..2ab252a 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -1,3 +1,19 @@
+
+/*********************************************************************
+ * The Open Group Base Specifications Issue 6
+ * IEEE Std 1003.1, 2004 Edition
+ *
+ * An XSI-conforming application should ensure that the feature
+ * test macro _XOPEN_SOURCE is defined with the value 600 before
+ * inclusion of any header. This is needed to enable the
+ * functionality described in The _POSIX_C_SOURCE Feature Test
+ * Macro and in addition to enable the XSI extension.
+ *
+ *********************************************************************/
+#if ! defined (_XOPEN_SOURCE)
+#define _XOPEN_SOURCE 600
+#endif
+
#include "playlist.h"
#include "player.h"
#include
@@ -150,3 +166,4 @@ static void handle_playlist_error(const char* message) {
fprintf(stderr, "Error: %s\n", message);
player_state.track_count = 0;
}
+
diff --git a/src/util.c b/src/util.c
index 5b6459b..046c0bb 100644
--- a/src/util.c
+++ b/src/util.c
@@ -44,6 +44,7 @@ uint32_t swap_endian32(uint32_t value) {

uint16_t swap_endian16(uint16_t value) {
uint16_t ret = (value >> 8) | (value << 8);
+ return ret;
}

float clamp(float value, float min, float max) {
@@ -51,3 +52,4 @@ float clamp(float value, float min, float max) {
float r1 = (value < min) ? min : r0;
return r1;
}
+
diff --git a/src/wav.c b/src/wav.c
index d932566..cb9df95 100644
--- a/src/wav.c
+++ b/src/wav.c
@@ -53,3 +53,4 @@ void play_wav(const char *filename) {
free(pcm_data);
fclose(file);
}
+

Looks good now :

callisto$ make clean
rm -f src/main.o src/player.o src/util.o src/wav.o XOpenPlayer
callisto$ make
/usr/bin/cc -o src/main.o -c src/main.c -std=iso9899:1999 -pedantic -pedantic-errors -g -O0 -fno-fast-math -fno-builtin -fno-unsafe-math-optimizations -I./include -I/usr/local/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_XOPEN_SOURCE=600
/usr/bin/cc -o src/player.o -c src/player.c -std=iso9899:1999 -pedantic -pedantic-errors -g -O0 -fno-fast-math -fno-builtin -fno-unsafe-math-optimizations -I./include -I/usr/local/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_XOPEN_SOURCE=600
/usr/bin/cc -o src/util.o -c src/util.c -std=iso9899:1999 -pedantic -pedantic-errors -g -O0 -fno-fast-math -fno-builtin -fno-unsafe-math-optimizations -I./include -I/usr/local/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_XOPEN_SOURCE=600
/usr/bin/cc -o src/wav.o -c src/wav.c -std=iso9899:1999 -pedantic -pedantic-errors -g -O0 -fno-fast-math -fno-builtin -fno-unsafe-math-optimizations -I./include -I/usr/local/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_XOPEN_SOURCE=600
/usr/bin/cc -o XOpenPlayer src/main.o src/player.o src/util.o src/wav.o -std=iso9899:1999 -pedantic -pedantic-errors -g -O0 -fno-fast-math -fno-builtin -fno-unsafe-math-optimizations -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_XOPEN_SOURCE=600 -L/usr/local/lib -lX11 -lm
callisto$

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.