From b305081c34828e3a80040c4b34a66167c1c19681 Mon Sep 17 00:00:00 2001 From: Roen Date: Wed, 16 Jan 2019 07:56:33 +0800 Subject: [PATCH 1/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1200fca..3853be4 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Finally, if two elements are now removed then what would be returned is not 3 & ![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Circular_buffer_-_X789ABX.svg/500px-Circular_buffer_-_X789ABX.svg.png) -## interfaces +## Interfaces ``` C typedef struct s_circularBuffer* CircularBuffer; From 217ac6058488a7b10dbddfff1056dc7317213601 Mon Sep 17 00:00:00 2001 From: armatusmiles Date: Fri, 25 Jan 2019 20:47:29 +0700 Subject: [PATCH 2/2] Fix runtime error during push zero size data to buffer with dataSize equals 0 --- CircularBuffer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CircularBuffer.c b/CircularBuffer.c index e97812d..6feb108 100755 --- a/CircularBuffer.c +++ b/CircularBuffer.c @@ -58,6 +58,9 @@ size_t CircularBufferGetDataSize(CircularBuffer cBuf) void CircularBufferPush(CircularBuffer cBuf,void *src, size_t length) { + if(length == 0) + return; + size_t writableLen = length; void *pSrc = src;