ref: 37ea28a4550342e8f3bd811888b7f6a021487d55
parent: 9f9d647297e57fd31f576ef41315266d6a27f94b
author: Alex Mayfield <alexmax2742@gmail.com>
date: Sun Feb 26 12:24:04 EST 2017
Fix GCC warnings
--- a/midiproc/buffer.c
+++ b/midiproc/buffer.c
@@ -56,6 +56,8 @@
//
boolean Buffer_Push(buffer_t *buf, const void *data, int len)
{
+ ptrdiff_t space_begin, space_end;
+
if (len <= 0)
{
// Do nothing, successfully.
@@ -62,8 +64,8 @@
return true;
}
- ptrdiff_t space_begin = buf->data - buf->buffer;
- ptrdiff_t space_end = buf->buffer_end - buf->data_end;
+ space_begin = buf->data - buf->buffer;
+ space_end = buf->buffer_end - buf->data_end;
if (len > space_end)
{
@@ -93,6 +95,8 @@
//
void Buffer_Shift(buffer_t *buf, int len)
{
+ ptrdiff_t max_shift;
+
if (len <= 0)
{
// Do nothing.
@@ -99,7 +103,7 @@
return;
}
- ptrdiff_t max_shift = buf->data_end - buf->data;
+ max_shift = buf->data_end - buf->data;
if (len >= max_shift)
{
// If the operation would clear the buffer, just zero everything.
--- a/midiproc/main.c
+++ b/midiproc/main.c
@@ -41,7 +41,6 @@
static HANDLE midi_process_in; // Standard In.
static HANDLE midi_process_out; // Standard Out.
-static buffer_t *midi_buffer; // Data from client.
// Currently playing music track.
static Mix_Music *music = NULL;
@@ -154,6 +153,9 @@
static boolean MidiPipe_RegisterSong(buffer_reader_t *reader)
{
+ unsigned int i;
+ CHAR buffer[2];
+
char *filename = Reader_ReadString(reader);
if (filename == NULL)
{
@@ -164,8 +166,7 @@
// FIXME: We should probably have a function for writing Int16's into
// buffers, as opposed to simply winging it.
- unsigned int i = NET_MIDIPIPE_PACKET_TYPE_REGISTER_SONG_ACK;
- CHAR buffer[2];
+ i = NET_MIDIPIPE_PACKET_TYPE_REGISTER_SONG_ACK;
buffer[0] = (i >> 8) & 0xff;
buffer[1] = i & 0xff;
@@ -247,6 +248,7 @@
//
boolean ParseMessage(buffer_t *buf)
{
+ int bytes_read;
uint16_t command;
buffer_reader_t *reader = NewReader(buf);
@@ -264,7 +266,7 @@
// We parsed a complete message! We can now safely shift
// the prior message off the front of the buffer.
- int bytes_read = Reader_BytesRead(reader);
+ bytes_read = Reader_BytesRead(reader);
DeleteReader(reader);
Buffer_Shift(buf, bytes_read);
--- a/src/i_midipipe.c
+++ b/src/i_midipipe.c
@@ -18,6 +18,9 @@
#if _WIN32
+#include <stdlib.h>
+#include <sys/stat.h>
+
#define WIN32_LEAN_AND_MEAN
#include <windows.h>