Exemple #1
0
static bool ResetFieldSize( dialog_node *dlg_node, int new_num )
{
    VFIELD      *fields;

    fields = (VFIELD *)GUIMemRealloc( dlg_node->ui_dlg_info->fields,
                                   ( new_num + 1 ) * sizeof( VFIELD ) );
    if( fields != NULL ) {
        dlg_node->ui_dlg_info->fields = fields;
        memset( &fields[new_num], 0, sizeof( VFIELD ) );
        return( true );
    }
    return( false );
}
Exemple #2
0
/*
 * addToList - add an item to a list of items
 */
static bool addToList( char ***list, int num, char *data, size_t len )
{
    *list = GUIMemRealloc( *list, ( num + 2 ) * sizeof( char * ) );
    if( *list == NULL ) {
        return( false );
    }
    (*list)[num] = GUIMemAlloc( len + 1 );
    if( (*list)[num] == NULL ) {
        return( false );
    }
    (*list)[num + 1] = NULL;
    strcpy( (*list)[num], data );
    return( true );

} /* addToList */
Exemple #3
0
/*
 * addToList - add an item to a list of items
 */
static bool addToList( const char ***list, int num, const char *data, size_t len )
{
    char    *str;

    *list = GUIMemRealloc( *list, ( num + 2 ) * sizeof( char * ) );
    if( *list == NULL ) {
        return( false );
    }
    ++len;
    str = GUIMemAlloc( len );
    if( str == NULL ) {
        return( false );
    }
    memcpy( str, data, len );
    (*list)[num] = str;
    (*list)[num + 1] = NULL;
    return( true );

} /* addToList */
Exemple #4
0
bool GUIAppendHintText( gui_window *wnd, gui_menu_struct *menu, hint_type type )
{
    int                 num;
    gui_hint_struct     *hint;
    int                 new_num;
    gui_hint_struct     *new_hint;

    if( GetStructNum( &wnd->hint, type, &hint, &num ) ) {
        new_num = CountMenus( menu );
        new_hint = (gui_hint_struct *)GUIMemRealloc( hint,
                        ( num + new_num ) * sizeof( gui_hint_struct ) );
        if( new_hint == NULL ) {
            return( FALSE );
        }
        InsertHint( menu, new_hint, &num );
        SetStructNum( &wnd->hint, type, new_hint, num );
        return( TRUE );
    }
    return( FALSE );
}