[Freeswitch-svn] [commit] r2762 - freeswitch/trunk/src
Freeswitch SVN
anthm at freeswitch.org
Wed Sep 20 10:22:34 EDT 2006
Author: anthm
Date: Wed Sep 20 10:22:32 2006
New Revision: 2762
Modified:
freeswitch/trunk/src/switch_buffer.c
Log:
fix buffer issues
Modified: freeswitch/trunk/src/switch_buffer.c
==============================================================================
--- freeswitch/trunk/src/switch_buffer.c (original)
+++ freeswitch/trunk/src/switch_buffer.c Wed Sep 20 10:22:32 2006
@@ -170,6 +170,7 @@
buffer->front += reading;
buffer->used -= reading;
+
//if (buffer->id == 3) printf("%u o %d = %d\n", buffer->id, (uint32_t)reading, (uint32_t)buffer->used);
return reading;
}
@@ -184,7 +185,7 @@
freespace = buffer->datalen - buffer->used;
- if (buffer->front != buffer->data) {
+ if (buffer->used && buffer->data != buffer->front) {
memmove(buffer->data, buffer->front, buffer->used);
buffer->front = buffer->data;
}
@@ -192,7 +193,6 @@
if (switch_test_flag(buffer, SWITCH_BUFFER_FLAG_DYNAMIC)) {
if (freespace < datalen) {
switch_size_t new_size, new_block_size;
-
new_size = buffer->datalen + datalen;
new_block_size = buffer->datalen + buffer->blocksize;
@@ -203,6 +203,7 @@
if (!(buffer->data = realloc(buffer->data, new_size))) {
return 0;
}
+ buffer->front = buffer->data;
buffer->datalen = new_size;
}
}
More information about the Freeswitch-svn
mailing list