fix (stream): fixed bug that allowed reading nonexistent data
This commit is contained in:
parent
0c084d00c0
commit
d493ebc64f
|
@ -20,8 +20,6 @@ void stream_destruct(stream_T* stream) {
|
||||||
memory_free(stream);
|
memory_free(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "utils/logger.h"
|
|
||||||
|
|
||||||
uint32_t stream_write(stream_T* stream, void* buffer_in, uint32_t n) {
|
uint32_t stream_write(stream_T* stream, void* buffer_in, uint32_t n) {
|
||||||
uint32_t num_top;
|
uint32_t num_top;
|
||||||
uint32_t num_bottom;
|
uint32_t num_bottom;
|
||||||
|
@ -43,6 +41,8 @@ uint32_t stream_write(stream_T* stream, void* buffer_in, uint32_t n) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t stream_read(stream_T* stream, void* buffer_out, uint32_t n) {
|
uint32_t stream_read(stream_T* stream, void* buffer_out, uint32_t n) {
|
||||||
|
if (stream->pos_sender == stream->pos_receiver) return 0;
|
||||||
|
|
||||||
uint32_t num_top;
|
uint32_t num_top;
|
||||||
uint32_t num_bottom;
|
uint32_t num_bottom;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue