Changeset 6811

Show
Ignore:
Timestamp:
09/09/10 13:03:26 (17 months ago)
Author:
westram
Message:
  • report more information about broken configurations
  • GBT_commit_rename_session did NEVER report error (since [2])
    • added __ATTR__USERESULT
  • forward error in AWTC_pars_names (and abort complete rename)
  • this fixes the bug with noticable broken configs after merge/rename
    • cause of bug: the config parser used inside ABRDB is much more picky than the one used in NTREE (needs to be DRYed)
    • no idea when this bug was introduced (maybe by introduction of GBT_config_parser in [3824]) and why it popped up now
Location:
trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/ARBDB/ad_config.cxx

    r6421 r6811  
    195195        } 
    196196 
    197         switch (item->type) { 
    198             case CI_CLOSE_GROUP: 
    199                 pos += 2; 
    200                 break; 
    201  
    202             case CI_UNKNOWN: 
    203                 error = GBS_global_string_copy("Unknown flag '%c'", label); 
    204                 break; 
    205  
    206             default: { 
    207                 const char *start_of_name = str+pos+2; 
    208                 const char *behind_name   = strchr(start_of_name, '\1'); 
    209  
    210                 if (!behind_name) behind_name = strchr(start_of_name, '\0'); // eos 
    211                 gb_assert(behind_name); 
    212  
    213                 item->name = (char*)GB_calloc(1, behind_name-start_of_name+1); 
    214                 memcpy(item->name, start_of_name, behind_name-start_of_name); 
    215                 pos       = behind_name-str; 
    216                 break; 
     197        if (item->type == CI_CLOSE_GROUP) { 
     198            pos += 2; 
     199        } 
     200        else { 
     201            const char *start_of_name = str+pos+2; 
     202            const char *behind_name   = strchr(start_of_name, '\1'); 
     203 
     204            if (!behind_name) behind_name = strchr(start_of_name, '\0'); // eos 
     205            gb_assert(behind_name); 
     206 
     207            char *data = GB_strpartdup(start_of_name, behind_name-1); 
     208            if (item->type == CI_UNKNOWN) { 
     209                error = GBS_global_string_copy("Unknown flag '%c' (followed by '%s')", label, data); 
     210                free(data); 
     211            } 
     212            else { 
     213                item->name = data; 
     214                pos        = behind_name-str; 
    217215            } 
    218216        } 
  • trunk/ARBDB/ad_t_prot.h

    r6646 r6811  
    7979GB_ERROR GBT_rename_species(const char *oldname, const char *newname, bool ignore_protection); 
    8080GB_ERROR GBT_abort_rename_session(void); 
    81 GB_ERROR GBT_commit_rename_session(int (*show_status)(double gauge), int (*show_status_text)(const char *)); 
     81GB_ERROR GBT_commit_rename_session(int (*show_status)(double gauge), int (*show_status_text)(const char *)) __ATTR__USERESULT; 
    8282 
    8383/* adseqcompr.cxx */ 
  • trunk/ARBDB/adname.cxx

    r6656 r6811  
    159159 
    160160GB_ERROR GBT_commit_rename_session(int (*show_status)(double gauge), int (*show_status_text)(const char *)) { 
     161    // goes to header: __ATTR__USERESULT 
    161162    GB_ERROR error = 0; 
    162163 
     
    228229 
    229230                        if (!error) freeset(*configStrPtr, GBS_strclose(strstruct)); 
     231                        else { 
     232                            error = GBS_global_string("Failed to parse configuration '%s' (Reason: %s)", config_names[count], error); 
     233                        } 
    230234 
    231235                        GBT_free_config_item(item); 
     
    233237                    } 
    234238 
    235                     if (!error && need_save) error = GBT_save_configuration_data(config, NameSession.gb_main, config_names[count]); 
     239                    if (!error && need_save) { 
     240                        error = GBT_save_configuration_data(config, NameSession.gb_main, config_names[count]); 
     241                    } 
    236242                } 
    237243                if (show_status) show_status((double)(count+1)/config_count); 
     
    262268    gbt_free_rename_session_data(); 
    263269 
    264     error = GB_pop_transaction(NameSession.gb_main); 
     270    error = GB_end_transaction(NameSession.gb_main, error); 
    265271    return error; 
    266272} 
  • trunk/SL/AW_NAME/AW_rename.cxx

    r6714 r6811  
    538538            } 
    539539            else { 
    540                 GBT_commit_rename_session(aw_status, aw_status); 
     540                err = GBT_commit_rename_session(aw_status, aw_status); 
    541541            } 
    542542