示例#1
0
static bool WdeAddStyleString( char **text, char *str )
{
    int slen;
    int tlen;

    if( text == NULL || str == NULL ) {
        return( FALSE );
    }

    slen = strlen( str );

    if( *text == NULL ) {
        *text = WRMemAlloc( slen + 1 );
        if( *text != NULL ) {
            strcpy( *text, str );
        }
    } else {
        tlen = strlen( *text );
        tlen += slen + 3 + 1;
        *text = (char *)WRMemRealloc( *text, tlen );
        if( *text != NULL ) {
            strcat( *text, " | " );
            strcat( *text, str );
        }
    }

    return( *text != NULL );
}
示例#2
0
void *MemReAlloc( void *ptr, unsigned size )
{
    void *p;

    p = WRMemRealloc( ptr, size );

    return( p );
}
示例#3
0
void *RcMemRealloc( void *old_ptr, unsigned newsize )
{
#ifdef DEBUG_RCMEM
    return( WRMemRealloc( old_ptr, newsize ) );
#else
    return( realloc( old_ptr, newsize ) );
#endif
}
示例#4
0
bool WREAppendDataToData( BYTE **d1, uint_32 *d1size, BYTE *d2, uint_32 d2size )
{
    if( d1 == NULL || d1size == NULL || d2 == NULL || d2size == 0 ) {
        return( FALSE );
    }

    *d1 = WRMemRealloc( *d1, *d1size + d2size );
    if( *d1 == NULL ) {
        return( FALSE );
    }

    memcpy( *d1 + *d1size, d2, d2size );
    *d1size += d2size;

    return( TRUE );
}
示例#5
0
bool WREAddCursorHotspot( BYTE **cursor, uint_32 *size, CURSORHOTSPOT *hs )
{
    int hs_size;

    hs_size = sizeof( CURSORHOTSPOT );

    if( cursor == NULL || size == NULL ) {
        return( FALSE );
    }

    *cursor = WRMemRealloc( *cursor, *size + hs_size );
    if( *cursor == NULL ) {
        return( FALSE );
    }
    memmove( *cursor + hs_size, *cursor, *size );
    memcpy( *cursor, hs, hs_size );
    *size += hs_size;

    return( TRUE );
}
示例#6
0
bool WRECalcAndAddIconDirectory( BYTE **data, uint_32 *size, WORD type )
{
    ICONHEADER  *ih;
    uint_32     ihsize;

    if( !WRCreateIconHeader( *data, *size, type, &ih, &ihsize ) ) {
        return( FALSE );
    }

    *data = WRMemRealloc( *data, *size + ihsize );
    if( *data == NULL ) {
        return( FALSE );
    }
    memmove( *data + ihsize, *data, *size );
    memcpy( *data, ih, ihsize );
    *size += ihsize;

    WRMemFree( ih );

    return( TRUE );
}
示例#7
0
bool WdeSetFlagText( flag_map *map, flag_style fs, unsigned long flags, char **text )
{
    int         tlen;
    int         new_tlen;
    int         slen;
    int         not_first;

    if( map == NULL || text == NULL ) {
        return( FALSE );
    }

    tlen = 0;
    not_first = 0;
    if( *text != NULL ) {
        tlen = strlen( *text );
        not_first = 1;
    }

    while( map->text ) {
        if( (flags & map->check_mask) == map->flag && (fs & map->style) ) {
            slen = strlen( map->text );
            new_tlen = tlen + 3 * not_first + slen + 1;
            *text = (char *)WRMemRealloc( *text, new_tlen );
            if( not_first == 1 ) {
                strcat( *text, " | " );
                strcat( *text, map->text );
            } else {
                strcpy( *text, map->text );
                not_first = 1;
            }
            tlen = new_tlen;
            flags &= ~map->erase_mask;
        }
        map++;
    }

    return( TRUE );
}
示例#8
0
int WR_EXPORT WRAddBitmapFileHeader( BYTE **data, uint_32 *size )
{
    BITMAPFILEHEADER    *bmfh;
    BITMAPINFO          *bmi;
    BITMAPCOREINFO      *bmci;
    int                 hsize;
    int                 is_core;

    if( data == NULL || size == NULL ) {
        return( FALSE );
    }

    is_core = (*(DWORD *)*data == sizeof( BITMAPCOREHEADER ));

    hsize = sizeof( BITMAPFILEHEADER );
    *data = WRMemRealloc( *data, *size + hsize );
    if( *data == NULL ) {
        return( FALSE );
    }
    memmove( *data + hsize, *data, *size );
    memset( *data, 0, hsize );
    *size += hsize;

    bmfh = (BITMAPFILEHEADER *)*data;
    bmfh->bfType = BITMAP_TYPE;
    bmfh->bfSize = *size;
    bmfh->bfOffBits = hsize;

    if( is_core ) {
        bmci = (BITMAPCOREINFO *)(*data + hsize);
        bmfh->bfOffBits += CORE_INFO_SIZE( bmci->bmciHeader.bcBitCount );
    } else {
        bmi = (BITMAPINFO *)(*data + hsize);
        bmfh->bfOffBits += DIB_INFO_SIZE( bmi->bmiHeader.biBitCount );
    }

    return( TRUE );
}
示例#9
0
void *WdeMemRealloc ( void *old_ptr, size_t newsize )
{
    return ( WRMemRealloc ( old_ptr, newsize ) );
}