Fix alignment issue on ARM

Signed-off-by: Maxim Osipov <maxim.osipov@gmail.com>
This commit is contained in:
Maxim Osipov 2012-01-14 00:11:45 +00:00 committed by Mariano Alvira
parent 6ee05f4a2d
commit 37faa8ce59

View File

@ -42,9 +42,11 @@ uint8_t*
allocate_buffer(uint16_t size)
{
uint8_t* buffer = NULL;
int rem = 0;
/*To get rid of alignment problems, always allocate even size*/
if (size % 2) {
size++;
rem = size % 4;
if (rem) {
size+=(4-rem);
}
if (buffer_index + size < buffer_size) {
buffer = data_buffer + buffer_index;