Revision: 42449
          http://brlcad.svn.sourceforge.net/brlcad/?rev=42449&view=rev
Author:   brlcad
Date:     2011-01-19 15:44:45 +0000 (Wed, 19 Jan 2011)

Log Message:
-----------
put db_version() to use, particularly for callers outside of librt since it's a 
private API member that isnt' supposed to be directly accessed.  this sets the 
stage for using dbi_version in other ways.

Modified Paths:
--------------
    brlcad/trunk/src/conv/dbupgrade.c
    brlcad/trunk/src/conv/g4-g5.c
    brlcad/trunk/src/conv/g5-g4.c
    brlcad/trunk/src/gtools/g_diff.c
    brlcad/trunk/src/libged/attr.c
    brlcad/trunk/src/libged/bo.c
    brlcad/trunk/src/libged/bot_smooth.c
    brlcad/trunk/src/libged/clone.c
    brlcad/trunk/src/libged/color.c
    brlcad/trunk/src/libged/concat.c
    brlcad/trunk/src/libged/copy.c
    brlcad/trunk/src/libged/decompose.c
    brlcad/trunk/src/libged/dup.c
    brlcad/trunk/src/libged/hide.c
    brlcad/trunk/src/libged/importFg4Section.c
    brlcad/trunk/src/libged/inside.c
    brlcad/trunk/src/libged/keep.c
    brlcad/trunk/src/libged/move_all.c
    brlcad/trunk/src/libged/prefix.c
    brlcad/trunk/src/libged/put_comb.c
    brlcad/trunk/src/libged/rmap.c
    brlcad/trunk/src/libged/search.c
    brlcad/trunk/src/libged/tops.c
    brlcad/trunk/src/libged/typein.c
    brlcad/trunk/src/libged/unhide.c
    brlcad/trunk/src/libged/version.c
    brlcad/trunk/src/libged/wdb_importFg4Section.c
    brlcad/trunk/src/libged/wdb_obj.c
    brlcad/trunk/src/libged/xpush.c
    brlcad/trunk/src/librt/db5_io.c
    brlcad/trunk/src/librt/db_alloc.c
    brlcad/trunk/src/librt/db_inmem.c
    brlcad/trunk/src/librt/db_io.c
    brlcad/trunk/src/librt/db_lookup.c
    brlcad/trunk/src/librt/db_open.c
    brlcad/trunk/src/librt/db_scan.c
    brlcad/trunk/src/librt/db_walk.c
    brlcad/trunk/src/librt/dir.c
    brlcad/trunk/src/librt/prep.c
    brlcad/trunk/src/librt/primitives/dsp/dsp.c
    brlcad/trunk/src/librt/primitives/generic.c
    brlcad/trunk/src/librt/primitives/nmg/nmg_misc.c
    brlcad/trunk/src/librt/primitives/obj_export.c
    brlcad/trunk/src/librt/primitives/obj_import.c
    brlcad/trunk/src/librt/tree.c
    brlcad/trunk/src/librt/wdb.c
    brlcad/trunk/src/libwdb/bot.c
    brlcad/trunk/src/libwdb/mater.c
    brlcad/trunk/src/mged/clone.c
    brlcad/trunk/src/mged/dir.c
    brlcad/trunk/src/mged/mater.c
    brlcad/trunk/src/mged/mged.c

Modified: brlcad/trunk/src/conv/dbupgrade.c
===================================================================
--- brlcad/trunk/src/conv/dbupgrade.c   2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/conv/dbupgrade.c   2011-01-19 15:44:45 UTC (rev 42449)
@@ -121,17 +121,17 @@
     }
 
     if ( !reverse ) {
-       if ( dbip->dbi_version == 5 ) {
+       if ( db_version(dbip) == 5 ) {
            bu_log( "This database (%s) is already at the current version\n",
                    argv[in_arg] );
            return 5;
        }
-       if ( dbip->dbi_version != 4 ) {
+       if ( db_version(dbip) != 4 ) {
            bu_log( "Input database version not recognized!!!!\n" );
            return 4;
        }
     } else if ( reverse ) {
-       if ( dbip->dbi_version != 5 ) {
+       if ( db_version(dbip) != 5 ) {
            bu_log( "Can only revert from db version 5\n" );
            return 6;
        }
@@ -142,7 +142,7 @@
     if ( db_dirbuild( dbip ) )
        bu_exit(1, "db_dirbuild failed\n" );
 
-    if ( (BU_STR_EQUAL( dbip->dbi_title, "Untitled v4 BRL-CAD Database" )) && 
(dbip->dbi_version == 4) ) {
+    if ( (BU_STR_EQUAL( dbip->dbi_title, "Untitled v4 BRL-CAD Database" )) && 
(db_version(dbip) == 4) ) {
        dbip->dbi_title=bu_strdup( "Untitled BRL-CAD Database" );
     }
     db_update_ident( fp->dbip, dbip->dbi_title, dbip->dbi_local2base );

Modified: brlcad/trunk/src/conv/g4-g5.c
===================================================================
--- brlcad/trunk/src/conv/g4-g5.c       2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/conv/g4-g5.c       2011-01-19 15:44:45 UTC (rev 42449)
@@ -84,7 +84,7 @@
        return 3;
     }
 
-    if ( dbip->dbi_version != 4 ) {
+    if ( db_version(dbip) != 4 ) {
        bu_log( "Input database must be a version 4 datbase!!!!\n" );
        return 4;
     }

Modified: brlcad/trunk/src/conv/g5-g4.c
===================================================================
--- brlcad/trunk/src/conv/g5-g4.c       2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/conv/g5-g4.c       2011-01-19 15:44:45 UTC (rev 42449)
@@ -92,7 +92,7 @@
        return 4;
     }
 
-    if ( dbip->dbi_version != 5 ) {
+    if ( db_version(dbip) != 5 ) {
        bu_log( "Input database must be a version 5 database!!!!\n" );
        return 5;
     }

Modified: brlcad/trunk/src/gtools/g_diff.c
===================================================================
--- brlcad/trunk/src/gtools/g_diff.c    2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/gtools/g_diff.c    2011-01-19 15:44:45 UTC (rev 42449)
@@ -700,7 +700,7 @@
 
     bu_vls_init(&vls);
 
-    if (dbip1->dbi_version > 4) {
+    if (db_version(dbip1) > 4) {
        bu_vls_printf(&vls, "_db1 attr get %s", dp1->d_namep);
        if (Tcl_Eval(interp, bu_vls_addr(&vls)) != TCL_OK) {
            fprintf(stderr, "Cannot get attributes for %s\n", dp1->d_namep);
@@ -717,7 +717,7 @@
        obj1 = Tcl_NewObj();
     }
 
-    if (dbip2->dbi_version > 4) {
+    if (db_version(dbip2) > 4) {
        bu_vls_trunc(&vls, 0);
        bu_vls_printf(&vls, "_db2 attr get %s", dp1->d_namep);
        if (Tcl_Eval(interp, bu_vls_addr(&vls)) != TCL_OK) {
@@ -988,7 +988,7 @@
     mater_hd1 = rt_dup_material_head();
     rt_color_free();
 
-    if (dbip1->dbi_version < 5) {
+    if (db_version(dbip1) < 5) {
        pre_5_vers++;
     }
 
@@ -1026,7 +1026,7 @@
     mater_hd2 = rt_dup_material_head();
     rt_color_free();
 
-    if (dbip2->dbi_version < 5) {
+    if (db_version(dbip2) < 5) {
        pre_5_vers++;
        version2 = 4;
     } else {

Modified: brlcad/trunk/src/libged/attr.c
===================================================================
--- brlcad/trunk/src/libged/attr.c      2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/attr.c      2011-01-19 15:44:45 UTC (rev 42449)
@@ -69,7 +69,7 @@
     }
 
     /* this is only valid for v5 databases */
-    if (gedp->ged_wdbp->dbip->dbi_version < 5) {
+    if (db_version(gedp->ged_wdbp->dbip) < 5) {
        bu_vls_printf(&gedp->ged_result_str, "Attributes are not available for 
this database format.\nPlease upgrade your database format using \"dbupgrade\" 
to enable attributes.");
        return GED_ERROR;
     }

Modified: brlcad/trunk/src/libged/bo.c
===================================================================
--- brlcad/trunk/src/libged/bo.c        2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/bo.c        2011-01-19 15:44:45 UTC (rev 42449)
@@ -62,7 +62,7 @@
     }
 
     /* check that we are using a version 5 database */
-    if (gedp->ged_wdbp->dbip->dbi_version < 5) {
+    if (db_version(gedp->ged_wdbp->dbip) < 5) {
        bu_vls_printf(&gedp->ged_result_str, "This is an older database 
version.\nIt does not support binary objects.Use \"dbupgrade\" to upgrade this 
database to the current version.\n");
        return GED_ERROR;
     }

Modified: brlcad/trunk/src/libged/bot_smooth.c
===================================================================
--- brlcad/trunk/src/libged/bot_smooth.c        2011-01-19 15:11:05 UTC (rev 
42448)
+++ brlcad/trunk/src/libged/bot_smooth.c        2011-01-19 15:44:45 UTC (rev 
42449)
@@ -62,7 +62,7 @@
     }
 
     /* check that we are using a version 5 database */
-    if (gedp->ged_wdbp->dbip->dbi_version < 5) {
+    if (db_version(gedp->ged_wdbp->dbip) < 5) {
        bu_vls_printf(&gedp->ged_result_str, "This is an older database 
version.\nIt does not support BOT surface normals.\nUse \"dbupgrade\" to 
upgrade this database to the current version.\n");
        return GED_ERROR;
     }

Modified: brlcad/trunk/src/libged/clone.c
===================================================================
--- brlcad/trunk/src/libged/clone.c     2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/clone.c     2011-01-19 15:44:45 UTC (rev 42449)
@@ -459,7 +459,7 @@
        return;
     }
 
-    if (dbip->dbi_version < 5)
+    if (db_version(dbip) < 5)
        (void)copy_v4_solid(dbip, proto, (struct ged_clone_state *)state, idx);
     else
        (void)copy_v5_solid(dbip, proto, (struct ged_clone_state *)state, idx);
@@ -670,7 +670,7 @@
        return;
     }
 
-    if (dbip->dbi_version < 5)
+    if (db_version(dbip) < 5)
        (void)copy_v4_comb(dbip, proto, (struct ged_clone_state *)state, idx);
     else
        (void)copy_v5_comb(dbip, proto, (struct ged_clone_state *)state, idx);
@@ -698,7 +698,7 @@
     /* copy the object */
     if (dp->d_flags & DIR_COMB) {
 
-       if (state->gedp->ged_wdbp->dbip->dbi_version < 5) {
+       if (db_version(state->gedp->ged_wdbp->dbip) < 5) {
            /* A v4 method of peeking into a combination */
 
            int errors = 0;

Modified: brlcad/trunk/src/libged/color.c
===================================================================
--- brlcad/trunk/src/libged/color.c     2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/color.c     2011-01-19 15:44:45 UTC (rev 42449)
@@ -106,7 +106,7 @@
        return GED_ERROR;
     }
 
-    if (gedp->ged_wdbp->dbip->dbi_version < 5) {
+    if (db_version(gedp->ged_wdbp->dbip) < 5) {
        /* Zap all the current records, both in core and on disk */
        while (rt_material_head() != MATER_NULL) {
            zot = rt_material_head();
@@ -230,7 +230,7 @@
        }
     }
 
-    if (gedp->ged_wdbp->dbip->dbi_version < 5) {
+    if (db_version(gedp->ged_wdbp->dbip) < 5) {
        /* Delete all color records from the database */
        mp = rt_material_head();
        while (mp != MATER_NULL) {

Modified: brlcad/trunk/src/libged/concat.c
===================================================================
--- brlcad/trunk/src/libged/concat.c    2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/concat.c    2011-01-19 15:44:45 UTC (rev 42449)
@@ -148,9 +148,9 @@
 
     }
 
-    if ( gedp->ged_wdbp->dbip->dbi_version < 5 ) {
+    if ( db_version(gedp->ged_wdbp->dbip) < 5 ) {
        if ( bu_vls_strlen(&cc_data.affix) > _GED_V4_MAXNAME-1) {
-           bu_log("ERROR: affix [%s] is too long for v%d\n", 
bu_vls_addr(&cc_data.affix), gedp->ged_wdbp->dbip->dbi_version);
+           bu_log("ERROR: affix [%s] is too long for v%d\n", 
bu_vls_addr(&cc_data.affix), db_version(gedp->ged_wdbp->dbip));
            bu_vls_free( &cc_data.affix );
            return GED_ERROR;
        }
@@ -164,7 +164,7 @@
        return GED_ERROR;
     }
 
-    if ( newdbp->dbi_version > 4 && gedp->ged_wdbp->dbip->dbi_version < 5 ) {
+    if ( db_version(newdbp) > 4 && db_version(gedp->ged_wdbp->dbip) < 5 ) {
        bu_vls_free( &cc_data.affix );
        bu_vls_printf(&gedp->ged_result_str, "%s: databases are incompatible, 
use dbupgrade on %s first",
                      argv[0], gedp->ged_wdbp->dbip->dbi_filename);
@@ -293,7 +293,7 @@
        }
 
        /* make sure it fits for v4 */
-       if ( cc_data->old_dbip->dbi_version < 5 ) {
+       if ( db_version(cc_data->old_dbip) < 5 ) {
            if (bu_vls_strlen(&new_name) > _GED_V4_MAXNAME) {
                bu_log("ERROR: generated new name [%s] is too long (%d > 
%d)\n", bu_vls_addr(&new_name), bu_vls_strlen(&new_name), _GED_V4_MAXNAME);
            }

Modified: brlcad/trunk/src/libged/copy.c
===================================================================
--- brlcad/trunk/src/libged/copy.c      2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/copy.c      2011-01-19 15:44:45 UTC (rev 42449)
@@ -118,7 +118,7 @@
     bu_free_external(&external);
 
     /* Need to do something extra for _GLOBAL */
-    if (to_gedp->ged_wdbp->dbip->dbi_version > 4 && BU_STR_EQUAL(to, 
DB5_GLOBAL_OBJECT_NAME)) {
+    if (db_version(to_gedp->ged_wdbp->dbip) > 4 && BU_STR_EQUAL(to, 
DB5_GLOBAL_OBJECT_NAME)) {
        struct directory *to_dp;
        struct bu_attribute_value_set avs;
        const char *val;

Modified: brlcad/trunk/src/libged/decompose.c
===================================================================
--- brlcad/trunk/src/libged/decompose.c 2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/decompose.c 2011-01-19 15:44:45 UTC (rev 42449)
@@ -72,7 +72,7 @@
 
     if ( argc > 2 ) {
        prefix = (char *)argv[2];
-       if ( gedp->ged_wdbp->dbip->dbi_version < 5 && strlen(prefix) > NAMESIZE 
) {
+       if ( db_version(gedp->ged_wdbp->dbip) < 5 && strlen(prefix) > NAMESIZE 
) {
            bu_vls_printf(&gedp->ged_result_str, "%s: Prefix %s is too long", 
argv[0], prefix);
            return GED_ERROR;
        }
@@ -152,7 +152,7 @@
                count++;
                bu_vls_strcpy( &solid_name, prefix );
                sprintf( shell_no, "_%d", count );
-               if ( gedp->ged_wdbp->dbip->dbi_version < 5 ) {
+               if ( db_version(gedp->ged_wdbp->dbip) < 5 ) {
                    end_prefix = strlen( prefix );
                    if ( end_prefix + strlen( shell_no ) > NAMESIZE )
                        end_prefix = NAMESIZE - strlen( shell_no );

Modified: brlcad/trunk/src/libged/dup.c
===================================================================
--- brlcad/trunk/src/libged/dup.c       2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/dup.c       2011-01-19 15:44:45 UTC (rev 42449)
@@ -84,7 +84,7 @@
        (void)bu_vls_strcpy(&gedp->ged_wdbp->wdb_prestr, argv[2]);
 
     gedp->ged_wdbp->wdb_num_dups = 0;
-    if ( gedp->ged_wdbp->dbip->dbi_version < 5 ) {
+    if ( db_version(gedp->ged_wdbp->dbip) < 5 ) {
        if ((gedp->ged_wdbp->wdb_ncharadd = 
bu_vls_strlen(&gedp->ged_wdbp->wdb_prestr)) > 12) {
            gedp->ged_wdbp->wdb_ncharadd = 12;
            bu_vls_trunc( &gedp->ged_wdbp->wdb_prestr, 12 );
@@ -120,7 +120,7 @@
     dcs.main_dbip = gedp->ged_wdbp->dbip;
     dcs.wdbp = gedp->ged_wdbp;
     dcs.dup_dirp = dirp0;
-    if ( newdbp->dbi_version < 5 ) {
+    if ( db_version(newdbp) < 5 ) {
        if (db_scan(newdbp, ged_dir_check, 0, (genptr_t)&dcs) < 0) {
            bu_vls_printf(&gedp->ged_result_str, "dup: db_scan failure");
            bu_free((genptr_t)dirp0, "_ged_getspace array");
@@ -182,7 +182,7 @@
 
     /* Add the prefix, if any */
     bu_vls_init( &local );
-    if ( dcsp->main_dbip->dbi_version < 5 ) {
+    if ( db_version(dcsp->main_dbip) < 5 ) {
        if (dcsp->wdbp->wdb_ncharadd > 0) {
            bu_vls_strncpy( &local, bu_vls_addr( &dcsp->wdbp->wdb_prestr ), 
dcsp->wdbp->wdb_ncharadd );
            bu_vls_strcat( &local, name );
@@ -230,7 +230,7 @@
 
     /* Add the prefix, if any */
     bu_vls_init( &local );
-    if ( dcsp->main_dbip->dbi_version < 5 ) {
+    if ( db_version(dcsp->main_dbip) < 5 ) {
        if (dcsp->wdbp->wdb_ncharadd > 0) {
            bu_vls_strncpy( &local, bu_vls_addr( &dcsp->wdbp->wdb_prestr ), 
dcsp->wdbp->wdb_ncharadd );
            bu_vls_strcat( &local, name );

Modified: brlcad/trunk/src/libged/hide.c
===================================================================
--- brlcad/trunk/src/libged/hide.c      2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/hide.c      2011-01-19 15:44:45 UTC (rev 42449)
@@ -59,7 +59,7 @@
 
     dbip = gedp->ged_wdbp->dbip;
 
-    if (dbip->dbi_version < 5) {
+    if (db_version(dbip) < 5) {
        bu_vls_printf(&gedp->ged_result_str, "Database was created with a 
previous release of BRL-CAD.\nSelect \"Tools->Upgrade Database...\" to enable 
support for this feature.");
        return GED_ERROR;
     }

Modified: brlcad/trunk/src/libged/importFg4Section.c
===================================================================
--- brlcad/trunk/src/libged/importFg4Section.c  2011-01-19 15:11:05 UTC (rev 
42448)
+++ brlcad/trunk/src/libged/importFg4Section.c  2011-01-19 15:44:45 UTC (rev 
42449)
@@ -129,7 +129,7 @@
     struct rt_bot_internal *botip;
     int i;
 
-    if ( (num_normals > 0) && (fp->dbip->dbi_version < 5 ) ) {
+    if ( (num_normals > 0) && (db_version(fp->dbip) < 5 ) ) {
        bu_log( "You are using an old database format which does not support 
surface normals for BOT primitives\n" );
        bu_log( "You are attempting to create a BOT primitive named \"%s\" with 
surface normals\n", name );
        bu_log( "The surface normals will not be saved\n" );
@@ -162,7 +162,7 @@
        botip->face_mode = (struct bu_bitv *)NULL;
     }
 
-    if ( (num_normals > 0) && (fp->dbip->dbi_version >= 5 ) ) {
+    if ( (num_normals > 0) && (db_version(fp->dbip) >= 5 ) ) {
        botip->num_normals = num_normals;
        botip->num_face_normals = botip->num_faces;
        botip->normals = (fastf_t *)bu_calloc( botip->num_normals * 3, sizeof( 
fastf_t ), "BOT normals" );

Modified: brlcad/trunk/src/libged/inside.c
===================================================================
--- brlcad/trunk/src/libged/inside.c    2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/inside.c    2011-01-19 15:44:45 UTC (rev 42449)
@@ -955,7 +955,7 @@
        bu_vls_printf(&gedp->ged_result_str, "%s: %s already exists.\n", 
argv[0], argv[arg]);
        return GED_ERROR;
     }
-    if (gedp->ged_wdbp->dbip->dbi_version < 5 && (int)strlen(argv[arg]) > 
NAMESIZE) {
+    if (db_version(gedp->ged_wdbp->dbip) < 5 && (int)strlen(argv[arg]) > 
NAMESIZE) {
        bu_vls_printf(&gedp->ged_result_str, "Database version 4 names are 
limited to %d characters\n", NAMESIZE);
        return GED_ERROR;
     }

Modified: brlcad/trunk/src/libged/keep.c
===================================================================
--- brlcad/trunk/src/libged/keep.c      2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/keep.c      2011-01-19 15:44:45 UTC (rev 42449)
@@ -154,7 +154,7 @@
     new_dbip = db_open(argv[0], "w");
 
     if (new_dbip != DBI_NULL) {
-       if (new_dbip->dbi_version != gedp->ged_wdbp->dbip->dbi_version) {
+       if (db_version(new_dbip) != db_version(gedp->ged_wdbp->dbip)) {
            bu_vls_printf(&gedp->ged_result_str, "%s: File format mismatch 
between '%s' and '%s'\n",
                          cmd, argv[0], gedp->ged_wdbp->dbip->dbi_filename);
            return GED_ERROR;
@@ -171,7 +171,7 @@
        }
     } else {
        /* Create a new database */
-       keepfp = wdb_fopen_v(argv[0], gedp->ged_wdbp->dbip->dbi_version);
+       keepfp = wdb_fopen_v(argv[0], db_version(gedp->ged_wdbp->dbip));
 
        if (keepfp == NULL) {
            perror(argv[0]);

Modified: brlcad/trunk/src/libged/move_all.c
===================================================================
--- brlcad/trunk/src/libged/move_all.c  2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/move_all.c  2011-01-19 15:44:45 UTC (rev 42449)
@@ -281,7 +281,7 @@
        return GED_ERROR;
     }
 
-    if (gedp->ged_wdbp->dbip->dbi_version < 5 && (int)strlen(argv[2]) > 
NAMESIZE) {
+    if (db_version(gedp->ged_wdbp->dbip) < 5 && (int)strlen(argv[2]) > 
NAMESIZE) {
        bu_vls_printf(&gedp->ged_result_str, "ERROR: name length limited to %d 
characters in v4 databases\n", strlen(argv[2]));
        return GED_ERROR;
     }

Modified: brlcad/trunk/src/libged/prefix.c
===================================================================
--- brlcad/trunk/src/libged/prefix.c    2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/prefix.c    2011-01-19 15:44:45 UTC (rev 42449)
@@ -76,7 +76,7 @@
            continue;
        }
 
-       if (gedp->ged_wdbp->dbip->dbi_version < 5 && (int)(strlen(argv[1]) + 
strlen(argv[i])) > NAMESIZE) {
+       if (db_version(gedp->ged_wdbp->dbip) < 5 && (int)(strlen(argv[1]) + 
strlen(argv[i])) > NAMESIZE) {
            bu_vls_printf(&gedp->ged_result_str, "'%s%s' too long, must be %d 
characters or less.\n",
                          argv[1], argv[i], NAMESIZE);
 
@@ -84,7 +84,7 @@
            continue;
        }
 
-       if (gedp->ged_wdbp->dbip->dbi_version < 5) {
+       if (db_version(gedp->ged_wdbp->dbip) < 5) {
            bu_strlcpy(tempstring_v4, argv[1], len);
            bu_strlcat(tempstring_v4, argv[i], len);
            tempstring = tempstring_v4;
@@ -163,7 +163,7 @@
        return;
 
     bu_free( comb_leaf->tr_l.tl_name, "comb_leaf->tr_l.tl_name" );
-    if ( dbip->dbi_version < 5 ) {
+    if ( db_version(dbip) < 5 ) {
        bu_strlcpy( tempstring_v4, prefix, len);
        bu_strlcat( tempstring_v4, obj, len);
        comb_leaf->tr_l.tl_name = bu_strdup( tempstring_v4 );

Modified: brlcad/trunk/src/libged/put_comb.c
===================================================================
--- brlcad/trunk/src/libged/put_comb.c  2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/put_comb.c  2011-01-19 15:44:45 UTC (rev 42449)
@@ -536,7 +536,7 @@
        bu_vls_init(&comb->material);
     }
 
-    if (gedp->ged_wdbp->dbip->dbi_version < 5) {
+    if (db_version(gedp->ged_wdbp->dbip) < 5) {
        new_name = new_name_v4;
        if (dp == DIR_NULL)
            NAMEMOVE(argv[1], new_name_v4);

Modified: brlcad/trunk/src/libged/rmap.c
===================================================================
--- brlcad/trunk/src/libged/rmap.c      2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/rmap.c      2011-01-19 15:44:45 UTC (rev 42449)
@@ -55,7 +55,7 @@
        return GED_ERROR;
     }
 
-    if (gedp->ged_wdbp->dbip->dbi_version < 5) {
+    if (db_version(gedp->ged_wdbp->dbip) < 5) {
        bu_vls_printf(&gedp->ged_result_str, "%s is not available prior to 
version 5 of the .g file format\n", argv[0]);
        return GED_ERROR;
     }

Modified: brlcad/trunk/src/libged/search.c
===================================================================
--- brlcad/trunk/src/libged/search.c    2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/search.c    2011-01-19 15:44:45 UTC (rev 42449)
@@ -186,7 +186,7 @@
        /* entering region */
        if (comb_func)
            comb_func(gedp, dfp, client_data);
-       if (gedp->ged_wdbp->dbip->dbi_version < 5) {
+       if (db_version(gedp->ged_wdbp->dbip) < 5) {
            union record *rp;
            struct directory *mdp;
            /*
@@ -489,7 +489,7 @@
        /* entering region */
        if (comb_func)
            if (comb_func(gedp, dfp, client_data)) return 1;
-       if (gedp->ged_wdbp->dbip->dbi_version < 5) {
+       if (db_version(gedp->ged_wdbp->dbip) < 5) {
            union record *rp;
            struct directory *mdp;
            /*

Modified: brlcad/trunk/src/libged/tops.c
===================================================================
--- brlcad/trunk/src/libged/tops.c      2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/tops.c      2011-01-19 15:44:45 UTC (rev 42449)
@@ -102,7 +102,7 @@
     dirp = _ged_dir_getspace(gedp->ged_wdbp->dbip, 0);
     dirp0 = dirp;
 
-    if (gedp->ged_wdbp->dbip->dbi_version < 5) {
+    if (db_version(gedp->ged_wdbp->dbip) < 5) {
        for (i = 0; i < RT_DBNHASH; i++)
            for (dp = gedp->ged_wdbp->dbip->dbi_Head[i];
                 dp != DIR_NULL;

Modified: brlcad/trunk/src/libged/typein.c
===================================================================
--- brlcad/trunk/src/libged/typein.c    2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/typein.c    2011-01-19 15:44:45 UTC (rev 42449)
@@ -2819,7 +2819,7 @@
        bu_vls_printf(&gedp->ged_result_str, "%s: %s already exists", argv[0], 
argv[1]);
        return GED_ERROR;
     }
-    if (gedp->ged_wdbp->dbip->dbi_version <= 4 && (int)strlen(argv[1]) > 
NAMESIZE) {
+    if (db_version(gedp->ged_wdbp->dbip) <= 4 && (int)strlen(argv[1]) > 
NAMESIZE) {
        bu_vls_printf(&gedp->ged_result_str, "%s: ERROR, v4 names are limited 
to %d characters\n", argv[0], NAMESIZE);
        return GED_ERROR;
     }
@@ -2872,7 +2872,7 @@
        menu = p_vol;
        fn_in = vol_in;
     } else if (BU_STR_EQUAL(argv[2], "hf")) {
-       if (gedp->ged_wdbp->dbip->dbi_version <= 4) {
+       if (db_version(gedp->ged_wdbp->dbip) <= 4) {
            nvals = 19;
            menu = p_hf;
            fn_in = hf_in;
@@ -2886,7 +2886,7 @@
        bu_vls_printf(&gedp->ged_result_str, "%s: the polysolid is deprecated 
and not supported by this command.\nUse the bot primitive.\n", argv[0]);
        return GED_ERROR;
     } else if (BU_STR_EQUAL(argv[2], "dsp")) {
-       if (gedp->ged_wdbp->dbip->dbi_version <= 4) {
+       if (db_version(gedp->ged_wdbp->dbip) <= 4) {
            nvals = 6;
            menu = p_dsp_v4;
            fn_in = dsp_in_v4;
@@ -3025,7 +3025,7 @@
        menu = p_part;
        fn_in = part_in;
     } else if (BU_STR_EQUAL(argv[2], "binunif")) {
-       if (gedp->ged_wdbp->dbip->dbi_version <= 4) {
+       if (db_version(gedp->ged_wdbp->dbip) <= 4) {
            bu_vls_printf(&gedp->ged_result_str,
                          "%s: the binunif primitive is not supported by this 
command when using an old style database",
                          argv[0]);

Modified: brlcad/trunk/src/libged/unhide.c
===================================================================
--- brlcad/trunk/src/libged/unhide.c    2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/unhide.c    2011-01-19 15:44:45 UTC (rev 42449)
@@ -59,7 +59,7 @@
 
     dbip = gedp->ged_wdbp->dbip;
 
-    if ( dbip->dbi_version < 5 ) {
+    if ( db_version(dbip) < 5 ) {
        bu_vls_printf(&gedp->ged_result_str, "Database was created with a 
previous release of BRL-CAD.\nSelect \"Tools->Upgrade Database...\" to enable 
support for this feature.");
        return GED_ERROR;
     }

Modified: brlcad/trunk/src/libged/version.c
===================================================================
--- brlcad/trunk/src/libged/version.c   2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/version.c   2011-01-19 15:44:45 UTC (rev 42449)
@@ -47,7 +47,7 @@
        return GED_ERROR;
     }
 
-    bu_vls_printf(&gedp->ged_result_str, "%d", 
gedp->ged_wdbp->dbip->dbi_version);
+    bu_vls_printf(&gedp->ged_result_str, "%d", 
db_version(gedp->ged_wdbp->dbip));
 
     return GED_OK;
 }

Modified: brlcad/trunk/src/libged/wdb_importFg4Section.c
===================================================================
--- brlcad/trunk/src/libged/wdb_importFg4Section.c      2011-01-19 15:11:05 UTC 
(rev 42448)
+++ brlcad/trunk/src/libged/wdb_importFg4Section.c      2011-01-19 15:44:45 UTC 
(rev 42449)
@@ -120,7 +120,7 @@
     struct rt_bot_internal *botip;
     int i;
 
-    if ((num_normals > 0) && (fp->dbip->dbi_version < 5)) {
+    if ((num_normals > 0) && (db_version(fp->dbip) < 5)) {
        bu_log("You are using an old database format which does not support 
surface normals for BOT primitives\n");
        bu_log("You are attempting to create a BOT primitive named \"%s\" with 
surface normals\n" , name);
        bu_log("The surface normals will not be saved\n");
@@ -150,7 +150,7 @@
        botip->face_mode = (struct bu_bitv *)NULL;
     }
 
-    if ((num_normals > 0) && (fp->dbip->dbi_version >= 5)) {
+    if ((num_normals > 0) && (db_version(fp->dbip) >= 5)) {
        botip->num_normals = num_normals;
        botip->num_face_normals = botip->num_faces;
        botip->normals = (fastf_t *)bu_calloc(botip->num_normals * 3, 
sizeof(fastf_t), "BOT normals");

Modified: brlcad/trunk/src/libged/wdb_obj.c
===================================================================
--- brlcad/trunk/src/libged/wdb_obj.c   2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/wdb_obj.c   2011-01-19 15:44:45 UTC (rev 42449)
@@ -1423,7 +1423,7 @@
     dirp = wdb_dir_getspace(wdbp->dbip, 0);
     dirp0 = dirp;
 
-    if (wdbp->dbip->dbi_version < 5) {
+    if (db_version(wdbp->dbip) < 5) {
        for (i = 0; i < RT_DBNHASH; i++)
            for (dp = wdbp->dbip->dbi_Head[i];
                 dp != DIR_NULL;
@@ -3042,7 +3042,7 @@
        return TCL_ERROR;
     }
 
-    if (wdbp->dbip->dbi_version < 5 && (int)strlen(argv[2]) > NAMESIZE) {
+    if (db_version(wdbp->dbip) < 5 && (int)strlen(argv[2]) > NAMESIZE) {
        struct bu_vls tmp_vls;
 
        bu_vls_init(&tmp_vls);
@@ -3287,7 +3287,7 @@
        }
 
        /* make sure it fits for v4 */
-       if (cc_data->old_dbip->dbi_version < 5) {
+       if (db_version(cc_data->old_dbip) < 5) {
            if (bu_vls_strlen(&new_name) > V4_MAXNAME) {
                bu_log("ERROR: generated new name [%s] is too long (%ld > 
%ld)\n", bu_vls_addr(&new_name), bu_vls_strlen(&new_name), V4_MAXNAME);
            }
@@ -3554,9 +3554,9 @@
 
     }
 
-    if (wdbp->dbip->dbi_version < 5) {
+    if (db_version(wdbp->dbip) < 5) {
        if (bu_vls_strlen(&cc_data.affix) > V4_MAXNAME-1) {
-           bu_log("ERROR: affix [%s] is too long for v%d\n", 
bu_vls_addr(&cc_data.affix), wdbp->dbip->dbi_version);
+           bu_log("ERROR: affix [%s] is too long for v%d\n", 
bu_vls_addr(&cc_data.affix), db_version(wdbp->dbip));
            bu_vls_free(&cc_data.affix);
            return TCL_ERROR;
        }
@@ -3570,7 +3570,7 @@
        return TCL_ERROR;
     }
 
-    if (newdbp->dbi_version > 4 && wdbp->dbip->dbi_version < 5) {
+    if (db_version(newdbp) > 4 && db_version(wdbp->dbip) < 5) {
        bu_vls_free(&cc_data.affix);
        Tcl_AppendResult(interp, argv[0], ": databases are incompatible, use 
dbupgrade on ",
                         wdbp->dbip->dbi_filename, " first",
@@ -3825,7 +3825,7 @@
 
     /* Add the prefix, if any */
     bu_vls_init(&local);
-    if (dcsp->main_dbip->dbi_version < 5) {
+    if (db_version(dcsp->main_dbip) < 5) {
        if (dcsp->wdbp->wdb_ncharadd > 0) {
            bu_vls_strncpy(&local, bu_vls_addr(&dcsp->wdbp->wdb_prestr), 
dcsp->wdbp->wdb_ncharadd);
            bu_vls_strcat(&local, name);
@@ -3874,7 +3874,7 @@
 
     /* Add the prefix, if any */
     bu_vls_init(&local);
-    if (dcsp->main_dbip->dbi_version < 5) {
+    if (db_version(dcsp->main_dbip) < 5) {
        if (dcsp->wdbp->wdb_ncharadd > 0) {
            bu_vls_strncpy(&local, bu_vls_addr(&dcsp->wdbp->wdb_prestr), 
dcsp->wdbp->wdb_ncharadd);
            bu_vls_strcat(&local, name);
@@ -3930,7 +3930,7 @@
        (void)bu_vls_strcpy(&wdbp->wdb_prestr, argv[2]);
 
     wdbp->wdb_num_dups = 0;
-    if (wdbp->dbip->dbi_version < 5) {
+    if (db_version(wdbp->dbip) < 5) {
        if ((wdbp->wdb_ncharadd = bu_vls_strlen(&wdbp->wdb_prestr)) > 12) {
            wdbp->wdb_ncharadd = 12;
            bu_vls_trunc(&wdbp->wdb_prestr, 12);
@@ -3966,7 +3966,7 @@
     dcs.main_dbip = wdbp->dbip;
     dcs.wdbp = wdbp;
     dcs.dup_dirp = dirp0;
-    if (newdbp->dbi_version < 5) {
+    if (db_version(newdbp) < 5) {
        if (db_scan(newdbp, wdb_dir_check, 0, (genptr_t)&dcs) < 0) {
            Tcl_AppendResult(interp, "dup: db_scan failure", (char *)NULL);
            bu_free((genptr_t)dirp0, "wdb_getspace array");
@@ -4801,7 +4801,7 @@
        return TCL_ERROR;
     }
 
-    if (wdbp->dbip->dbi_version < 5) {
+    if (db_version(wdbp->dbip) < 5) {
        bu_vls_init(&vls);
        bu_vls_printf(&vls, "%s is not available prior to version 5 of the .g 
file format\n", argv[0]);
        Tcl_SetResult(interp, bu_vls_addr(&vls), TCL_VOLATILE);
@@ -5311,7 +5311,7 @@
        return TCL_ERROR;
     }
 
-    bu_vls_printf(&vls, "%d", wdbp->dbip->dbi_version);
+    bu_vls_printf(&vls, "%d", db_version(wdbp->dbip));
     Tcl_AppendResult(interp, bu_vls_addr(&vls), (char *)0);
     bu_vls_free(&vls);
 
@@ -6212,7 +6212,7 @@
        /* set xform for this object_use to all zeros */
        MAT_ZERO(use->xform);
        use->used = 0;
-       if (dbip->dbi_version < 5) {
+       if (db_version(dbip) < 5) {
            NAMEMOVE(dp->d_namep, name_v4);
            name_v4[NAMESIZE] = '\0';                /* ensure null termination 
*/
        }
@@ -6224,7 +6224,7 @@
        if (use_no == dp->d_uses-1 && dp->d_uses == dp->d_nref)
            use->dp = dp;
        else {
-           if (dbip->dbi_version < 5) {
+           if (db_version(dbip) < 5) {
                snprintf(&name_v4[suffix_start], NAMESIZE-suffix_start, 
format_v4, j);
                name = name_v4;
            } else {
@@ -6236,7 +6236,7 @@
            /* Insure that new name is unique */
            while (db_lookup(dbip, name, 0) != DIR_NULL) {
                j++;
-               if (dbip->dbi_version < 5) {
+               if (db_version(dbip) < 5) {
                    snprintf(&name_v4[suffix_start], NAMESIZE-suffix_start, 
format_v4, j);
                    name = name_v4;
                } else {
@@ -6847,7 +6847,7 @@
 
 
     if (new_dbip != DBI_NULL) {
-       if (new_dbip->dbi_version != wdbp->dbip->dbi_version) {
+       if (db_version(new_dbip) != db_version(wdbp->dbip)) {
            Tcl_AppendResult(interp,
                             "keep: File format mismatch between '",
                             argv[1], "' and '",
@@ -6869,7 +6869,7 @@
        }
     } else {
        /* Create a new database */
-       keepfp = wdb_fopen_v(argv[1], wdbp->dbip->dbi_version);
+       keepfp = wdb_fopen_v(argv[1], db_version(wdbp->dbip));
 
        if (keepfp == NULL) {
            perror(argv[1]);
@@ -7328,7 +7328,7 @@
     dbip = wdbp->dbip;
 
     RT_CK_DBI(dbip);
-    if (dbip->dbi_version < 5) {
+    if (db_version(dbip) < 5) {
        Tcl_AppendResult(interp,
                         "Database was created with a previous release of 
BRL-CAD.\nSelect \"Tools->Upgrade Database...\" to enable support for this 
feature.",
                         (char *)NULL);
@@ -7440,7 +7440,7 @@
     dbip = wdbp->dbip;
 
     RT_CK_DBI(dbip);
-    if (dbip->dbi_version < 5) {
+    if (db_version(dbip) < 5) {
        Tcl_AppendResult(interp,
                         "Database was created with a previous release of 
BRL-CAD.\nSelect \"Tools->Upgrade Database...\" to enable support for this 
feature.",
                         (char *)NULL);
@@ -7546,7 +7546,7 @@
     struct bu_attribute_value_pair *avpp;
 
     /* this is only valid for v5 databases */
-    if (wdbp->dbip->dbi_version < 5) {
+    if (db_version(wdbp->dbip) < 5) {
        Tcl_AppendResult(interp, "Attributes are not available for this 
database format.\nPlease upgrade your database format using \"dbupgrade\" to 
enable attributes.", (char *)NULL);
        return TCL_ERROR;
     }
@@ -8405,7 +8405,7 @@
     int id;
 
     /* check that we are using a version 5 database */
-    if (wdbp->dbip->dbi_version < 5) {
+    if (db_version(wdbp->dbip) < 5) {
        Tcl_AppendResult(interp, "This is an older database version.\n",
                         "It does not support BOT surface normals.\n",
                         "Use \"dbupgrade\" to upgrade this database to the 
current version.\n",
@@ -8548,7 +8548,7 @@
     char *cname;
 
     /* check that we are using a version 5 database */
-    if (wdbp->dbip->dbi_version < 5) {
+    if (db_version(wdbp->dbip) < 5) {
        Tcl_AppendResult(interp, "This is an older database version.\n",
                         "It does not support binary objects.\n",
                         "Use \"dbupgrade\" to upgrade this database to the 
current version.\n",

Modified: brlcad/trunk/src/libged/xpush.c
===================================================================
--- brlcad/trunk/src/libged/xpush.c     2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libged/xpush.c     2011-01-19 15:44:45 UTC (rev 42449)
@@ -153,7 +153,7 @@
        /* set xform for this object_use to all zeros */
        MAT_ZERO(use->xform);
        use->used = 0;
-       if (dbip->dbi_version < 5) {
+       if (db_version(dbip) < 5) {
            NAMEMOVE(dp->d_namep, name_v4);
            name_v4[NAMESIZE] = '\0';                /* ensure null termination 
*/
        }
@@ -165,7 +165,7 @@
        if (use_no == dp->d_uses-1 && dp->d_uses == dp->d_nref)
            use->dp = dp;
        else {
-           if (dbip->dbi_version < 5) {
+           if (db_version(dbip) < 5) {
                snprintf(&name_v4[suffix_start], NAMESIZE-suffix_start, 
format_v4, j);
                name = name_v4;
            } else {
@@ -177,7 +177,7 @@
            /* Insure that new name is unique */
            while (db_lookup(dbip, name, 0) != DIR_NULL) {
                j++;
-               if (dbip->dbi_version < 5) {
+               if (db_version(dbip) < 5) {
                    snprintf(&name_v4[suffix_start], NAMESIZE-suffix_start, 
format_v4, j);
                    name = name_v4;
                } else {

Modified: brlcad/trunk/src/librt/db5_io.c
===================================================================
--- brlcad/trunk/src/librt/db5_io.c     2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/librt/db5_io.c     2011-01-19 15:44:45 UTC (rev 42449)
@@ -1166,7 +1166,7 @@
 
     RT_CK_DBI(dbip);
 
-    if (dbip->dbi_version < 5)
+    if (db_version(dbip) < 5)
        return 0;       /* not an error, just no attributes */
 
     RT_CK_DIR(dp);

Modified: brlcad/trunk/src/librt/db_alloc.c
===================================================================
--- brlcad/trunk/src/librt/db_alloc.c   2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/librt/db_alloc.c   2011-01-19 15:44:45 UTC (rev 42449)
@@ -152,10 +152,10 @@
        return 0;
     }
 
-    if (dbip->dbi_version == 4) {
+    if (db_version(dbip) == 4) {
        i = db_zapper(dbip, dp, 0);
        rt_memfree(&(dbip->dbi_freep), (unsigned)dp->d_len, 
dp->d_addr/(sizeof(union record)));
-    } else if (dbip->dbi_version == 5) {
+    } else if (db_version(dbip) == 5) {
        i = db5_write_free(dbip, dp, dp->d_len);
        rt_memfree(&(dbip->dbi_freep), dp->d_len, dp->d_addr);
     } else {

Modified: brlcad/trunk/src/librt/db_inmem.c
===================================================================
--- brlcad/trunk/src/librt/db_inmem.c   2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/librt/db_inmem.c   2011-01-19 15:44:45 UTC (rev 42449)
@@ -158,7 +158,7 @@
     if (dp->d_flags & RT_DIR_INMEM)
        bu_free(dp->d_un.ptr, "db_inmem() ext ptr");
     dp->d_un.ptr = ext->ext_buf;
-    if (dbip->dbi_version < 5) {
+    if (db_version(dbip) < 5) {
        /* DB_MINREC granule size */
        dp->d_len = ext->ext_nbytes / 128;
     } else {

Modified: brlcad/trunk/src/librt/db_io.c
===================================================================
--- brlcad/trunk/src/librt/db_io.c      2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/librt/db_io.c      2011-01-19 15:44:45 UTC (rev 42449)
@@ -116,7 +116,7 @@
     RT_CK_DBI(dbip);
     RT_CK_DIR(dp);
 
-    if (dbip->dbi_version >= 5) {
+    if (db_version(dbip) >= 5) {
        /* can't get an mrec on a v5 */
        return (union record *)NULL;
     }
@@ -320,7 +320,7 @@
        return -1;              /* was dummy DB entry */
 
     BU_INIT_EXTERNAL(ep);
-    if (dbip->dbi_version <= 4)
+    if (db_version(dbip) <= 4)
        ep->ext_nbytes = dp->d_len * sizeof(union record);
     else
        ep->ext_nbytes = dp->d_len;
@@ -378,10 +378,10 @@
        return -1;
     }
 
-    if (dbip->dbi_version == 5)
+    if (db_version(dbip) == 5)
        return db_put_external5(ep, dp, dbip);
 
-    if (dbip->dbi_version <= 4) {
+    if (db_version(dbip) <= 4) {
        size_t ngran;
 
        ngran = (ep->ext_nbytes+sizeof(union record)-1)/sizeof(union record);

Modified: brlcad/trunk/src/librt/db_lookup.c
===================================================================
--- brlcad/trunk/src/librt/db_lookup.c  2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/librt/db_lookup.c  2011-01-19 15:44:45 UTC (rev 42449)
@@ -287,14 +287,14 @@
        /* if this is a version 4 database and the offending char is beyond 
NAMESIZE
         * then it is not really a problem
         */
-       if (dbip->dbi_version < 5 && (tmp_ptr - name) < NAMESIZE) {
+       if (db_version(dbip) < 5 && (tmp_ptr - name) < NAMESIZE) {
            bu_log("db_diradd() object named '%s' is illegal, ignored\n", name);
            return DIR_NULL;
        }
     }
 
     bu_vls_init(&local);
-    if (dbip->dbi_version < 5) {
+    if (db_version(dbip) < 5) {
        bu_vls_strncpy(&local, name, NAMESIZE);
     } else {
        /* must provide a valid minor type */
@@ -323,7 +323,7 @@
     dp->d_animate = NULL;
     dp->d_nref = 0;
     dp->d_uses = 0;
-    if (dbip->dbi_version > 4) {
+    if (db_version(dbip) > 4) {
        dp->d_major_type = DB5_MAJORTYPE_BRLCAD;
        dp->d_minor_type = *(unsigned char *)ptr;
     }

Modified: brlcad/trunk/src/librt/db_open.c
===================================================================
--- brlcad/trunk/src/librt/db_open.c    2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/librt/db_open.c    2011-01-19 15:44:45 UTC (rev 42449)
@@ -424,8 +424,8 @@
     RT_CK_WDB(wdbp);
 
     /* just in case since we don't actually handle it below */
-    if (dbip->dbi_version != wdbp->dbip->dbi_version) {
-       bu_log("Internal Error: dumping a v%d database into a v%d database is 
untested\n", dbip->dbi_version, wdbp->dbip->dbi_version);
+    if (db_version(dbip) != db_version(wdbp->dbip)) {
+       bu_log("Internal Error: dumping a v%d database into a v%d database is 
untested\n", db_version(dbip), db_version(wdbp->dbip));
        return -1;
     }
 

Modified: brlcad/trunk/src/librt/db_scan.c
===================================================================
--- brlcad/trunk/src/librt/db_scan.c    2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/librt/db_scan.c    2011-01-19 15:44:45 UTC (rev 42449)
@@ -364,7 +364,7 @@
        bu_log("db_update_ident( x%x, '%s', %g )\n", dbip, new_title, local2mm);
 
     /* make sure dbip is a valid version */
-    if ( dbip->dbi_version <= 0 ) {
+    if ( db_version(dbip) <= 0 ) {
        bu_log("Invalid geometry database write request encountered.\n"
               "Converting to READ-ONLY mode.\n");
        dbip->dbi_read_only = 1;
@@ -372,7 +372,7 @@
     }
 
     /* assume it's a v5 */
-    if ( dbip->dbi_version > 4 )
+    if ( db_version(dbip) > 4 )
        return db5_update_ident( dbip, new_title, local2mm );
 
     RT_DIR_SET_NAMEP(&dir, ident);

Modified: brlcad/trunk/src/librt/db_walk.c
===================================================================
--- brlcad/trunk/src/librt/db_walk.c    2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/librt/db_walk.c    2011-01-19 15:44:45 UTC (rev 42449)
@@ -104,7 +104,7 @@
        /* entering region */
        if ( dtp->comb_enter_func )
            dtp->comb_enter_func( dtp->dbip, dp, dtp->client_data );
-       if ( dtp->dbip->dbi_version < 5 ) {
+       if ( db_version(dtp->dbip) < 5 ) {
            register union record   *rp;
            register struct directory *mdp;
            /*
@@ -223,7 +223,7 @@
     }
 
     if ( dp->d_flags & DIR_COMB )  {
-       if ( dbip->dbi_version < 5 ) {
+       if ( db_version(dbip) < 5 ) {
            register union record       *rp;
            register struct directory *mdp;
            /*

Modified: brlcad/trunk/src/librt/dir.c
===================================================================
--- brlcad/trunk/src/librt/dir.c        2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/librt/dir.c        2011-01-19 15:44:45 UTC (rev 42449)
@@ -99,7 +99,7 @@
     BU_INIT_EXTERNAL(&ext);
     RT_INIT_DB_INTERNAL(ip);
 
-    if ( dbip->dbi_version > 4 )
+    if ( db_version(dbip) > 4 )
        return  rt_db_get_internal5( ip, dp, dbip, mat, resp );
 
     if ( db_get_external( &ext, dp, dbip ) < 0 )
@@ -159,7 +159,7 @@
     BU_INIT_EXTERNAL(&ext);
     RT_CK_DB_INTERNAL( ip );
 
-    if ( dbip->dbi_version > 4 )
+    if ( db_version(dbip) > 4 )
        return  rt_db_put_internal5( dp, dbip, ip, resp,
                                     DB5_MAJORTYPE_BRLCAD );
 

Modified: brlcad/trunk/src/librt/prep.c
===================================================================
--- brlcad/trunk/src/librt/prep.c       2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/librt/prep.c       2011-01-19 15:44:45 UTC (rev 42449)
@@ -1229,7 +1229,7 @@
     RT_CHECK_RTI(rtip);
     RT_CK_DBI(rtip->rti_dbip);
 
-    if (rtip->rti_dbip->dbi_version < 5)
+    if (db_version(rtip->rti_dbip) < 5)
        return 0;
 
     while (attrs[attr_count])

Modified: brlcad/trunk/src/librt/primitives/dsp/dsp.c
===================================================================
--- brlcad/trunk/src/librt/primitives/dsp/dsp.c 2011-01-19 15:11:05 UTC (rev 
42448)
+++ brlcad/trunk/src/librt/primitives/dsp/dsp.c 2011-01-19 15:44:45 UTC (rev 
42449)
@@ -654,9 +654,9 @@
     BU_CK_VLS(&vls);
 
     bu_vls_printf(&vls, "\n---------db version: %d----------\n",
-                 stp->st_rtip->rti_dbip->dbi_version);
+                 db_version(stp->st_rtip->rti_dbip));
 
-    switch (stp->st_rtip->rti_dbip->dbi_version) {
+    switch (db_version(stp->st_rtip->rti_dbip)) {
        case 4:
            BU_CK_VLS(&vls);
            dsp_print_v4(&vls, &(dsp->dsp_i));
@@ -4525,7 +4525,7 @@
 
     RT_DSP_CK_MAGIC(dsp_ip);
 
-    switch (db_ip->dbi_version) {
+    switch (db_version(db_ip)) {
        case 4:
            dsp_print_v4(&vls, dsp_ip);
            break;

Modified: brlcad/trunk/src/librt/primitives/generic.c
===================================================================
--- brlcad/trunk/src/librt/primitives/generic.c 2011-01-19 15:11:05 UTC (rev 
42448)
+++ brlcad/trunk/src/librt/primitives/generic.c 2011-01-19 15:44:45 UTC (rev 
42449)
@@ -70,7 +70,7 @@
     id = ip->idb_type;
     BU_INIT_EXTERNAL(&ext);
     /* Scale change on export is 1.0 -- no change */
-    switch (dbip->dbi_version) {
+    switch (db_version(dbip)) {
        case 4:
            if (rt_functab[id].ft_export4(&ext, ip, 1.0, dbip, resp) < 0) {
                bu_log("rt_generic_xform():  %s export failure\n",

Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_misc.c
===================================================================
--- brlcad/trunk/src/librt/primitives/nmg/nmg_misc.c    2011-01-19 15:11:05 UTC 
(rev 42448)
+++ brlcad/trunk/src/librt/primitives/nmg/nmg_misc.c    2011-01-19 15:44:45 UTC 
(rev 42449)
@@ -4623,7 +4623,7 @@
     intern.idb_meth = &rt_functab[ID_NMG];
     intern.idb_ptr = (genptr_t)m;
 
-    if (fp->dbip->dbi_version <= 4) {
+    if (db_version(fp->dbip) <= 4) {
        BU_INIT_EXTERNAL(&ext);
        ret = intern.idb_meth->ft_export4(&ext, &intern, 1.0, fp->dbip, 
&rt_uniresource);
        if (ret < 0) {

Modified: brlcad/trunk/src/librt/primitives/obj_export.c
===================================================================
--- brlcad/trunk/src/librt/primitives/obj_export.c      2011-01-19 15:11:05 UTC 
(rev 42448)
+++ brlcad/trunk/src/librt/primitives/obj_export.c      2011-01-19 15:44:45 UTC 
(rev 42449)
@@ -47,7 +47,7 @@
     if (!ft)
        return -3;
 
-    if (dbip->dbi_version < 5) {
+    if (db_version(dbip) < 5) {
        export = ft->ft_export4;
     } else {
        export = ft->ft_export5;

Modified: brlcad/trunk/src/librt/primitives/obj_import.c
===================================================================
--- brlcad/trunk/src/librt/primitives/obj_import.c      2011-01-19 15:11:05 UTC 
(rev 42448)
+++ brlcad/trunk/src/librt/primitives/obj_import.c      2011-01-19 15:44:45 UTC 
(rev 42449)
@@ -47,7 +47,7 @@
     if (!ft)
        return -3;
 
-    if (dbip->dbi_version < 5) {
+    if (db_version(dbip) < 5) {
        import = ft->ft_import4;
     } else {
        import = ft->ft_import5;

Modified: brlcad/trunk/src/librt/tree.c
===================================================================
--- brlcad/trunk/src/librt/tree.c       2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/librt/tree.c       2011-01-19 15:44:45 UTC (rev 42449)
@@ -804,7 +804,7 @@
        tree_state.ts_resp = NULL;      /* sanity.  Needs to be updated */
 
        if (attrs) {
-           if (rtip->rti_dbip->dbi_version < 5) {
+           if (db_version(rtip->rti_dbip) < 5) {
                bu_log("WARNING: requesting attributes from an old database 
version (ignored)\n");
                bu_avs_init_empty(&tree_state.ts_attrs);
            } else {

Modified: brlcad/trunk/src/librt/wdb.c
===================================================================
--- brlcad/trunk/src/librt/wdb.c        2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/librt/wdb.c        2011-01-19 15:44:45 UTC (rev 42449)
@@ -162,9 +162,9 @@
     BU_CK_EXTERNAL(ep);
 
     /* Stash name into external representation */
-    if (wdbp->dbip->dbi_version <= 4) {
+    if (db_version(wdbp->dbip) <= 4) {
        db_wrap_v4_external(ep, name);
-    } else if (wdbp->dbip->dbi_version == 5) {
+    } else if (db_version(wdbp->dbip) == 5) {
        if (db_wrap_v5_external(ep, name) < 0) {
            bu_log("wdb_export_external(%s): db_wrap_v5_external error\n",
                   name);
@@ -172,7 +172,7 @@
        }
     } else {
        bu_log("wdb_export_external(%s): version %d unsupported\n",
-              name, wdbp->dbip->dbi_version);
+              name, db_version(wdbp->dbip));
        return -4;
     }
 
@@ -286,7 +286,7 @@
     RT_CK_WDB(wdbp);
     RT_CK_DB_INTERNAL(ip);
 
-    if (wdbp->dbip->dbi_version <= 4) {
+    if (db_version(wdbp->dbip) <= 4) {
        BU_INIT_EXTERNAL(&ext);
 
        ret = -1;

Modified: brlcad/trunk/src/libwdb/bot.c
===================================================================
--- brlcad/trunk/src/libwdb/bot.c       2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libwdb/bot.c       2011-01-19 15:44:45 UTC (rev 42449)
@@ -67,7 +67,7 @@
     struct rt_bot_internal *bot;
     size_t i;
 
-    if ((num_normals > 0) && (fp->dbip->dbi_version < 5)) {
+    if ((num_normals > 0) && (db_version(fp->dbip) < 5)) {
        bu_log("You are using an old database format which does not support 
surface normals for BOT primitives\n");
        bu_log("You are attempting to create a BOT primitive named \"%s\" with 
surface normals\n", name);
        bu_log("The surface normals will not be saved\n");
@@ -97,7 +97,7 @@
        bot->face_mode = (struct bu_bitv *)NULL;
     }
 
-    if ((num_normals > 0) && (fp->dbip->dbi_version >= 5)) {
+    if ((num_normals > 0) && (db_version(fp->dbip) >= 5)) {
        bot->num_normals = num_normals;
        bot->num_face_normals = bot->num_faces;
        bot->normals = (fastf_t *)bu_calloc(bot->num_normals * 3, 
sizeof(fastf_t), "BOT normals");

Modified: brlcad/trunk/src/libwdb/mater.c
===================================================================
--- brlcad/trunk/src/libwdb/mater.c     2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/libwdb/mater.c     2011-01-19 15:44:45 UTC (rev 42449)
@@ -46,7 +46,7 @@
 mk_write_color_table(struct rt_wdb *ofp)
 {
     RT_CK_WDB(ofp);
-    if (ofp->dbip->dbi_version <= 4) {
+    if (db_version(ofp->dbip) <= 4) {
        const struct mater *mp;
 
        BU_ASSERT_LONG(mk_version, ==, 4);

Modified: brlcad/trunk/src/mged/clone.c
===================================================================
--- brlcad/trunk/src/mged/clone.c       2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/mged/clone.c       2011-01-19 15:44:45 UTC (rev 42449)
@@ -470,7 +470,7 @@
        return;
     }
 
-    if (_dbip->dbi_version < 5)
+    if (db_version(_dbip) < 5)
        (void)copy_v4_solid(_dbip, proto, (struct clone_state *)state, idx);
     else
        (void)copy_v5_solid(_dbip, proto, (struct clone_state *)state, idx);
@@ -682,7 +682,7 @@
        return;
     }
 
-    if (_dbip->dbi_version < 5)
+    if (db_version(_dbip) < 5)
        (void)copy_v4_comb(_dbip, proto, (struct clone_state *)state, idx);
     else
        (void)copy_v5_comb(_dbip, proto, (struct clone_state *)state, idx);
@@ -711,7 +711,7 @@
     /* copy the object */
     if (dp->d_flags & DIR_COMB) {
 
-       if (_dbip->dbi_version < 5) {
+       if (db_version(_dbip) < 5) {
            /* A v4 method of peeking into a combination */
 
            int errors = 0;

Modified: brlcad/trunk/src/mged/dir.c
===================================================================
--- brlcad/trunk/src/mged/dir.c 2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/mged/dir.c 2011-01-19 15:44:45 UTC (rev 42449)
@@ -83,7 +83,7 @@
        return;
 
     bu_free(comb_leaf->tr_l.tl_name, "comb_leaf->tr_l.tl_name");
-    if (dbi->dbi_version < 5) {
+    if (db_version(dbi) < 5) {
        bu_strlcpy(tempstring_v4, prefix, len);
        bu_strlcat(tempstring_v4, obj, len);
        comb_leaf->tr_l.tl_name = bu_strdup(tempstring_v4);
@@ -137,7 +137,7 @@
            continue;
        }
 
-       if (dbip->dbi_version < 5 && (int)(strlen(argv[1]) + strlen(argv[i])) > 
NAMESIZE) {
+       if (db_version(dbip) < 5 && (int)(strlen(argv[1]) + strlen(argv[i])) > 
NAMESIZE) {
            struct bu_vls tmp_vls;
 
            bu_vls_init(&tmp_vls);
@@ -150,7 +150,7 @@
            continue;
        }
 
-       if (dbip->dbi_version < 5) {
+       if (db_version(dbip) < 5) {
            bu_strlcpy(tempstring_v4, argv[1], len);
            bu_strlcat(tempstring_v4, argv[i], len);
            tempstring = tempstring_v4;

Modified: brlcad/trunk/src/mged/mater.c
===================================================================
--- brlcad/trunk/src/mged/mater.c       2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/mged/mater.c       2011-01-19 15:44:45 UTC (rev 42449)
@@ -63,7 +63,7 @@
     if (dbip->dbi_read_only)
        return;
 
-    if (dbip->dbi_version >= 5) {
+    if (db_version(dbip) >= 5) {
        bu_log("color_putrec does not work on db5 or later databases");
        return;
     }

Modified: brlcad/trunk/src/mged/mged.c
===================================================================
--- brlcad/trunk/src/mged/mged.c        2011-01-19 15:11:05 UTC (rev 42448)
+++ brlcad/trunk/src/mged/mged.c        2011-01-19 15:44:45 UTC (rev 42449)
@@ -2852,7 +2852,7 @@
      * We have an old database version AND we're not in the process of
      * creating a new database.
      */
-    if (dbip->dbi_version != 5 && !created_new_db) {
+    if (db_version(dbip) != 5 && !created_new_db) {
        if (db_upgrade) {
            if (db_warn)
                bu_vls_printf(&msg, "Warning:\n\tDatabase version is 
old.\n\tConverting to the new format.\n");


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to