ref: b5302fee81f0b1c46520c96ec7fa7b2d7e2289f2
parent: ccef38fb998fc1d0c627ed4fb3cef2b5a83bf3ee
author: Alex Mayfield <alexmax2742@gmail.com>
date: Sun Feb 12 19:52:13 EST 2017
Missing header, tidy up code
--- a/midiproc/buffer.c
+++ b/midiproc/buffer.c
@@ -17,6 +17,8 @@
#include "buffer.h"
+#include <stdlib.h>
+
//
// Create a new buffer.
//
@@ -33,7 +35,7 @@
//
// Free a buffer.
//
-void DeleteBuffer(buffer_t* buf)
+void DeleteBuffer(buffer_t *buf)
{
free(buf);
}
@@ -54,6 +56,7 @@
{
if (len <= 0)
{
+ // Do nothing, successfully.
return true;
}
@@ -90,6 +93,7 @@
{
if (len <= 0)
{
+ // Do nothing.
return;
}
@@ -96,6 +100,7 @@
ptrdiff_t max_shift = buf->data_end - buf->data;
if (len >= max_shift)
{
+ // If the operation would clear the buffer, just zero everything.
Buffer_Clear(buf);
}
else