Changeset 4395 for pjproject


Ignore:
Timestamp:
Feb 27, 2013 12:07:30 PM (12 years ago)
Author:
ming
Message:

Re #1593: Backported to 1.x

Location:
pjproject/branches/1.x
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/1.x

  • pjproject/branches/1.x/pjlib/include/pj/pool.h

    r3553 r4395  
    510510 */ 
    511511PJ_IDECL(void*) pj_pool_alloc_from_block(pj_pool_block *block, pj_size_t size); 
    512 PJ_DECL(void*) pj_pool_allocate_find(pj_pool_t *pool, unsigned size); 
     512PJ_DECL(void*) pj_pool_allocate_find(pj_pool_t *pool, pj_size_t size); 
    513513 
    514514 
  • pjproject/branches/1.x/pjlib/include/pj/pool_i.h

    r3553 r4395  
    4848        size = (size + PJ_POOL_ALIGNMENT) & ~(PJ_POOL_ALIGNMENT-1); 
    4949    } 
    50     if ((unsigned)(block->end - block->cur) >= size) { 
     50    if ((pj_size_t)(block->end - block->cur) >= size) { 
    5151        void *ptr = block->cur; 
    5252        block->cur += size; 
  • pjproject/branches/1.x/pjlib/src/pj/pool.c

    r3553 r4395  
    8989 * (depending on whether the pool is allowed to resize). 
    9090 */ 
    91 PJ_DEF(void*) pj_pool_allocate_find(pj_pool_t *pool, unsigned size) 
     91PJ_DEF(void*) pj_pool_allocate_find(pj_pool_t *pool, pj_size_t size) 
    9292{ 
    9393    pj_pool_block *block = pool->block_list.next; 
     
    122122            size + sizeof(pj_pool_block) + PJ_POOL_ALIGNMENT)  
    123123    { 
    124         unsigned count; 
     124        pj_size_t count; 
    125125        count = (size + pool->increment_size + sizeof(pj_pool_block) + 
    126126                 PJ_POOL_ALIGNMENT) /  
  • pjproject/branches/1.x/pjlib/src/pj/pool_caching.c

    r3553 r4395  
    179179 
    180180        /* Update pool manager's free capacity. */ 
    181         cp->capacity -= pj_pool_get_capacity(pool); 
     181        if (cp->capacity > pj_pool_get_capacity(pool)) { 
     182            cp->capacity -= pj_pool_get_capacity(pool); 
     183        } else { 
     184            cp->capacity = 0; 
     185        } 
    182186 
    183187        PJ_LOG(6, (pool->obj_name, "pool reused, size=%u", pool->capacity)); 
     
    200204{ 
    201205    pj_caching_pool *cp = (pj_caching_pool*)pf; 
    202     unsigned pool_capacity; 
     206    pj_size_t pool_capacity; 
    203207    unsigned i; 
    204208 
Note: See TracChangeset for help on using the changeset viewer.