project_parameters_t * load_selected_predefined_projection_parameters(int is_source, int projection, datum_type_t *datum, spheroid_type_t *spheroid) { GtkWidget * predefined_projection_option_menu; GtkWidget * menu; GtkWidget * selected_item; gchar filename[256]; gchar * path; gchar * path_and_filename; project_parameters_t * ret; projection_type_t type; char *err=NULL; predefined_projection_option_menu = is_source ? get_widget_checked("source_predefined_projection_option_menu") : get_widget_checked("target_predefined_projection_option_menu"); menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(predefined_projection_option_menu)); selected_item = gtk_menu_get_active(GTK_MENU(menu)); sprintf(filename, "%s.proj", (char *)g_object_get_data( G_OBJECT(selected_item), "file")); if (out_of_sync(filename, projection)) return NULL; path = projection_directory(projection); path_and_filename = (gchar *) g_malloc(sizeof(gchar *) * (strlen(path) + strlen(filename) + 5)); sprintf(path_and_filename, "%s/%s", path, filename); ret = (project_parameters_t *) g_malloc(sizeof(project_parameters_t)); if (!parse_proj_args_file(path_and_filename, ret, &type, datum, spheroid, &err)) { message_box(err); free(err); return NULL; } g_free(path); g_free(path_and_filename); return ret; }
int main(int argc, char *argv[]) { /* * Add a bunch of tables so that some of the metadata ends up on * other pages and a good number of tables are available after * salvage completes. */ TABLE_INFO table_data[] = { { "file:aaa-file.SS", "key_format=S,value_format=S", false }, { "file:bbb-file.rS", "key_format=r,value_format=S", false }, { "lsm:ccc-lsm.SS", "key_format=S,value_format=S", false }, { "table:ddd-table.SS", "key_format=S,value_format=S", false }, { "table:eee-table.rS", "key_format=r,value_format=S", false }, { "file:fff-file.SS", "key_format=S,value_format=S", false }, { "file:ggg-file.rS", "key_format=r,value_format=S", false }, { "lsm:hhh-lsm.SS", "key_format=S,value_format=S", false }, { "table:iii-table.SS", "key_format=S,value_format=S", false }, { "table:jjj-table.rS", "key_format=r,value_format=S", false }, { CORRUPT, "key_format=S,value_format=S", false }, { NULL, NULL, false } }; TABLE_INFO *t; TEST_OPTS *opts, _opts; int ret; char buf[1024]; opts = &_opts; memset(opts, 0, sizeof(*opts)); testutil_check(testutil_parse_opts(argc, argv, opts)); /* * Set a global. We use this everywhere. */ home = opts->home; testutil_make_work_dir(home); testutil_check( wiredtiger_open(home, &event_handler, "create", &opts->conn)); testutil_check(opts->conn->open_session( opts->conn, NULL, NULL, &wt_session)); /* * Create a bunch of different tables. */ for (t = table_data; t->name != NULL; t++) create_data(t); /* * Take some checkpoints and add more data for out of sync testing. */ make_database_copies(table_data); testutil_check(opts->conn->close(opts->conn, NULL)); opts->conn = NULL; /* * Make copy of original directory. */ copy_database(SAVE); /* * Damage/corrupt WiredTiger.wt. */ printf("corrupt metadata\n"); corrupt_metadata(); testutil_check(__wt_snprintf(buf, sizeof(buf), "cp -p %s/WiredTiger.wt ./%s.SAVE/WiredTiger.wt.CORRUPT", home, home)); printf("copy: %s\n", buf); if ((ret = system(buf)) < 0) testutil_die(ret, "system: %s", buf); run_all_verification(NULL, &table_data[0]); out_of_sync(&table_data[0]); /* * We need to set up the string before we clean up * the structure. Then after the clean up we will * run this command. */ testutil_check(__wt_snprintf(buf, sizeof(buf), "rm -rf core* %s*", home)); testutil_cleanup(opts); /* * We've created a lot of extra directories and possibly some core * files from child process aborts. Manually clean them up. */ printf("cleanup and remove: %s\n", buf); if ((ret = system(buf)) < 0) testutil_die(ret, "system: %s", buf); return (EXIT_SUCCESS); }