Changeset 1316 for pjproject


Ignore:
Timestamp:
May 29, 2007 11:33:13 AM (18 years ago)
Author:
bennylp
Message:

Fixed ticket #310: Memory alignment problem in pool_buf (thanks Esbjörn Dominique)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/pool_buf.c

    r1235 r1316  
    8282{ 
    8383    struct creation_param param; 
     84    long align_diff; 
    8485 
    8586    PJ_ASSERT_RETURN(buf && size, NULL); 
     
    8990            return NULL; 
    9091        is_initialized = 1; 
     92    } 
     93 
     94    /* Check and align buffer */ 
     95    align_diff = (long)buf; 
     96    if (align_diff & (PJ_POOL_ALIGNMENT-1)) { 
     97        align_diff &= (PJ_POOL_ALIGNMENT-1); 
     98        buf = (void*) (((char*)buf) + align_diff); 
     99        size -= align_diff; 
    91100    } 
    92101 
Note: See TracChangeset for help on using the changeset viewer.