Revision: 77690
          http://sourceforge.net/p/brlcad/code/77690
Author:   starseeker
Date:     2020-11-04 22:01:09 +0000 (Wed, 04 Nov 2020)
Log Message:
-----------
Merge from trunk - r77660 through r77689

Modified Paths:
--------------
    brlcad/branches/extbuild/NEWS
    brlcad/branches/extbuild/include/rt/db_internal.h
    brlcad/branches/extbuild/misc/repoconv/github_ci_actions.yml
    brlcad/branches/extbuild/src/libbn/axis.c
    brlcad/branches/extbuild/src/libbn/mat.c
    brlcad/branches/extbuild/src/libged/search/search.c
    brlcad/branches/extbuild/src/librt/db5_io.c
    brlcad/branches/extbuild/src/librt/dir.c

Property Changed:
----------------
    brlcad/branches/extbuild/
    brlcad/branches/extbuild/NEWS
    brlcad/branches/extbuild/include/

Index: brlcad/branches/extbuild
===================================================================
--- brlcad/branches/extbuild    2020-11-04 21:33:31 UTC (rev 77689)
+++ brlcad/branches/extbuild    2020-11-04 22:01:09 UTC (rev 77690)

Property changes on: brlcad/branches/extbuild
___________________________________________________________________
Modified: svn:mergeinfo
## -11,4 +11,4 ##
 /brlcad/branches/osg:62110-62113
 /brlcad/branches/prep-cache:68236-68933
 /brlcad/branches/tcltk86:68300-75257
-/brlcad/trunk:77547-77659
\ No newline at end of property
+/brlcad/trunk:77547-77689
\ No newline at end of property
Modified: brlcad/branches/extbuild/NEWS
===================================================================
--- brlcad/branches/extbuild/NEWS       2020-11-04 21:33:31 UTC (rev 77689)
+++ brlcad/branches/extbuild/NEWS       2020-11-04 22:01:09 UTC (rev 77690)
@@ -13,6 +13,7 @@
 --- 2020-xx-xx  Release 7.32.2                                     ---
 ----------------------------------------------------------------------
 
+* fixed MGED search command crash on empty database - Sean Morrison
 * improved performance calculating BoT bounding boxes - Vikram Atreya
 * fixed MGED crash closing multiple rt views on Windows - Cliff Yapp
 * fixed 'n' key binding override with MGED key forwarding - Cliff Yapp


Property changes on: brlcad/branches/extbuild/NEWS
___________________________________________________________________
Modified: svn:mergeinfo
## -9,4 +9,4 ##
 /brlcad/branches/osg/NEWS:62110-62113
 /brlcad/branches/prep-cache/NEWS:68236-68933
 /brlcad/branches/tcltk86/NEWS:68300-75257
-/brlcad/trunk/NEWS:77547-77657
\ No newline at end of property
+/brlcad/trunk/NEWS:77547-77657,77660-77689
\ No newline at end of property
Index: brlcad/branches/extbuild/include
===================================================================
--- brlcad/branches/extbuild/include    2020-11-04 21:33:31 UTC (rev 77689)
+++ brlcad/branches/extbuild/include    2020-11-04 22:01:09 UTC (rev 77690)

Property changes on: brlcad/branches/extbuild/include
___________________________________________________________________
Modified: svn:mergeinfo
## -9,4 +9,5 ##
 /brlcad/branches/opencl/include:65867-66137
 /brlcad/branches/osg/include:62110-62113
 /brlcad/branches/prep-cache/include:68236-68933
-/brlcad/branches/tcltk86/include:68300-75257
\ No newline at end of property
+/brlcad/branches/tcltk86/include:68300-75257
+/brlcad/trunk/include:77660-77689
\ No newline at end of property
Modified: brlcad/branches/extbuild/include/rt/db_internal.h
===================================================================
--- brlcad/branches/extbuild/include/rt/db_internal.h   2020-11-04 21:33:31 UTC 
(rev 77689)
+++ brlcad/branches/extbuild/include/rt/db_internal.h   2020-11-04 22:01:09 UTC 
(rev 77690)
@@ -64,7 +64,9 @@
 
 /**
  * Get an object from the database, and convert it into its internal
- * representation.
+ * (i.e., unserialized in-memory) representation.  Applies the
+ * provided matrix transform only to the in-memory internal being
+ * returned.
  *
  * Returns -
  * <0 On error

Modified: brlcad/branches/extbuild/misc/repoconv/github_ci_actions.yml
===================================================================
--- brlcad/branches/extbuild/misc/repoconv/github_ci_actions.yml        
2020-11-04 21:33:31 UTC (rev 77689)
+++ brlcad/branches/extbuild/misc/repoconv/github_ci_actions.yml        
2020-11-04 22:01:09 UTC (rev 77690)
@@ -1,28 +1,6 @@
+# For information about available platforms for testing, see:
 #
-#  This logic defines cross platform build testing for BRL-CAD using
-#  Github's "Actions" mechanism.
-#
-#  We define a setup similar to https://github.com/cristianadam/HelloWorld/
-#
-#  Github has a time limit on these tests, and we also don't want to stress the
-#  system too heavily (particularly if we want to run them per-commit.)   For
-#  testing purposes we're currently using distcheck, but for eventual
-#  production use we need to change our build targets to something more
-#  streamlined.  It is probably also worth disabling step and gdal based
-#  features for the standard tests, as those compilation pieces are quite
-#  expensive - they should probably be regulated to something like a once-a-day
-#  test.
-#
-#  TODO - figure out how to schedule chron based jobs as well as the per
-#  commit tests below, so we can define rarer but progressively more
-#  comprehensive and heaver test runs.
-#
-#  TODO - figure out if we can generate actual release binaries from the
-#  artifacts of these builds.  When we do, we'll want to also incorporate
-#  some sort of periodic cleanup so we don't burn too much storage space
-#  with each build - see, for example:
-#  
https://poweruser.blog/storage-housekeeping-on-github-actions-e2997b5b23d1?gi=f134f9f8b336
-#
+# 
https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners
 
 name: BRL-CAD
 
@@ -29,206 +7,108 @@
 on: [push]
 
 jobs:
-  build:
-    #
-    #  Define a matrix of the operating system and compiler combinations
-    #  we want to build against.
-    #
-    #  Note that for Windows the vcvars64.bat script is important - that
-    #  is what sets up environment variables to make sure we get the 64
-    #  bit version of the compiler and libraries.  See:
-    #  https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line
-    #
-    name: ${{ matrix.config.name }}
-    runs-on: ${{ matrix.config.os }}
+  windows:
+    name: Windows Latest MSVC
+    runs-on: windows-latest
     strategy:
       fail-fast: true
-      matrix:
-        config:
-        - {
-            name: "Windows Latest MSVC", artifact: "Windows-MSVC.tar.xz",
-            os: windows-latest,
-            cc: "cl", cxx: "cl",
-            environment_script: "C:/Program Files (x86)/Microsoft Visual 
Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
-          }
-        - {
-            name: "Ubuntu Latest GCC", artifact: "Linux.tar.xz",
-            os: ubuntu-20.04,
-            cc: "gcc", cxx: "g++"
-          }
-        - {
-            name: "macOS Latest Clang", artifact: "macOS.tar.xz",
-            os: macos-latest,
-            cc: "clang", cxx: "clang++"
-          }
+    steps:
+      - name: Setup - CMake
+        uses: lukka/get-cmake@latest
 
-    #
-    #  For each platform, we need to checkout the git repository,
-    #  and run CMake.
-    #
-    #  The logic below uses the approach demonstrated by Cristian Adam
-    #  which takes CMake's scripting mode (-P) and passes in from stdin
-    #  a script that incorporates values defined in the YAML environment.
-    #
-    #  Windows in particular needs the environment set up for compilation,
-    #  so the script recognizes when it is in that environment and
-    #  operates accordingly.
-    #
+      - name: Setup - Ninja
+        uses: seanmiddleditch/gha-setup-ninja@master
+
+      - name: Checkout
+        uses: actions/checkout@v2
+
+      - name: Add github workspace to path
+        # https://github.community/t/deprecated-add-path/136621
+        run: echo "$ENV{GITHUB_WORKSPACE}" | Out-File -Append -FilePath 
$env:GITHUB_PATH -Encoding utf8
+
+      - name: Add msbuild to PATH
+        uses: microsoft/[email protected]
+
+      - name: Add cl.exe to PATH
+        uses: ilammy/msvc-dev-cmd@v1
+
+      - name: Configure
+        run: |
+          cmake -S . -B build -G Ninja -D CMAKE_C_COMPILER="cl.exe" -D 
CMAKE_CXX_COMPILER="cl.exe" -D ENABLE_ALL=ON -D CMAKE_BUILD_TYPE=Release
+          powershell Write-VolumeCache C
+          powershell Write-VolumeCache D
+
+      - name: Build
+        run: cmake --build build --config Release --target package
+
+      - name: Upload Package
+        uses: actions/upload-artifact@v2
+        with:
+          name: BRLCAD_Windows
+          path: ${{ github.workspace }}/build/BRL-CAD*exe
+
+  linux:
+    name: Ubuntu Latest GCC
+    runs-on: ubuntu-20.04
+    strategy:
+      fail-fast: true
     steps:
-    - uses: actions/checkout@v2
-    - uses: lukka/get-cmake@latest
-    - uses: seanmiddleditch/gha-setup-ninja@master
+      - name: Setup - CMake
+        uses: lukka/get-cmake@latest
 
-    - name: Configure
-      shell: cmake -P {0}
-      run: |
-        if ("${{ runner.os }}" STREQUAL "Windows")
-          # Try Write-VolumeCache for Windows
-          execute_process(COMMAND powershell Write-VolumeCache C)
-          execute_process(COMMAND powershell Write-VolumeCache D)
-        else ()
-          # On platforms where we have it, make sure the files are in place 
with a sync
-          execute_process(COMMAND sync)
-        endif ()
-        set(ENV{CC} ${{ matrix.config.cc }})
-        set(ENV{CXX} ${{ matrix.config.cxx }})
+      - name: Setup - Ninja
+        uses: seanmiddleditch/gha-setup-ninja@master
 
-          if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ 
matrix.config.environment_script }}" STREQUAL "x")
-          execute_process(
-          COMMAND "${{ matrix.config.environment_script }}" && set
-          OUTPUT_FILE environment_script_output.txt
-          )
-          file(STRINGS environment_script_output.txt output_lines)
-          foreach(line IN LISTS output_lines)
-            if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
-              set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
-            endif()
-          endforeach()
-        endif()
+      - name: Checkout
+        uses: actions/checkout@v2
 
-        set(path_separator ":")
-        if ("${{ runner.os }}" STREQUAL "Windows")
-          set(path_separator ";")
-        endif()
-        set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}")
+      - name: Configure
+        run: |
+          export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
+          cmake -S . -G Ninja -B build -D ENABLE_ALL=ON -D 
CMAKE_BUILD_TYPE=Release
 
-        execute_process(
-          COMMAND cmake
-            -S .
-            -G Ninja
-            -B build
-            -D ENABLE_ALL=ON
-            -D CMAKE_BUILD_TYPE=Release
-            -D CMAKE_VERBOSE_DISTCHECK=ON
-            -D BRLCAD_ENABLE_GDAL=OFF
-            -D BRLCAD_ENABLE_STEP=OFF
-            -D BRLCAD_EXTRADOCS=OFF
-            -D BUILD_STATIC_LIBS=OFF
-           RESULT_VARIABLE result
-        )
-        if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ 
matrix.config.environment_script }}" STREQUAL "x")
-          # Try Write-VolumeCache for Windows
-          execute_process(COMMAND powershell Write-VolumeCache C)
-          execute_process(COMMAND powershell Write-VolumeCache D)
-        else()
-          # On platforms where we have it, make sure the files are in place 
with a sync
-          execute_process(COMMAND sync)
-        endif()
-        if (NOT result EQUAL 0)
-          message(FATAL_ERROR "Bad exit status")
-        endif()
+      - name: Build
+        run: |
+          export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
+          cmake --build build --config Release --target package
 
-    #
-    #  As with the configure stage, the build uses CMake's scripting mode (-P)
-    #  and passes a script in on stdin.
-    #
-    #  Windows needs the environment set up for compilation - paths for the
-    #  compilation are not set up by default in command line environments,
-    #  unlike most Unix-like systems.  Accordingly the script recognizes when
-    #  it is on Windows and executes the necessary setup code.
-    #
-    - name: Build
-      shell: cmake -P {0}
-      run: |
-        if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ 
matrix.config.environment_script }}" STREQUAL "x")
-          file(STRINGS environment_script_output.txt output_lines)
-          foreach(line IN LISTS output_lines)
-            if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
-              set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
-            endif()
-          endforeach()
-        endif()
+      - name: Upload Package
+        uses: actions/upload-artifact@v2
+        with:
+          name: BRLCAD_Linux
+          path: ${{ github.workspace }}/build/BRL-CAD*gz
 
-        set(path_separator ":")
-        if ("${{ runner.os }}" STREQUAL "Windows")
-          set(path_separator ";")
-        endif()
-        set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}")
+  osx:
+    name: macOS Latest Clang
+    runs-on: macos-latest
+    strategy:
+      fail-fast: true
+    steps:
+      - name: Setup - CMake
+        uses: lukka/get-cmake@latest
 
-        if ("${{ runner.os }}" STREQUAL "Windows")
-           set(BCNT 0)
-           set(result 1)
-           while(result AND ${BCNT} LESS 4)
-             execute_process(COMMAND cmake --build build --config Release 
--target all RESULT_VARIABLE result)
-             if (NOT ${result})
-               execute_process(COMMAND powershell Write-VolumeCache C)
-               execute_process(COMMAND powershell Write-VolumeCache D)
-               execute_process(COMMAND cmake --build build --config Release 
--target check RESULT_VARIABLE result)
-             endif()
-             if (NOT ${result})
-               execute_process(COMMAND powershell Write-VolumeCache C)
-               execute_process(COMMAND powershell Write-VolumeCache D)
-               execute_process(COMMAND cmake --build build --config Release 
--target package RESULT_VARIABLE result)
-             endif()
-             math(EXPR BCNT "${BCNT}+1")
-           endwhile()
-           execute_process(COMMAND powershell Write-VolumeCache C)
-           execute_process(COMMAND powershell Write-VolumeCache D)
-        else ("${{ runner.os }}" STREQUAL "Windows")
-           set(BCNT 0)
-           set(result 1)
-           while(result AND ${BCNT} LESS 4)
-             execute_process(COMMAND cmake --build build --config Release 
--target all RESULT_VARIABLE result)
-             if (NOT ${result})
-               execute_process(COMMAND sync)
-               execute_process(COMMAND cmake --build build --config Release 
--target check RESULT_VARIABLE result)
-             endif()
-             if (NOT ${result})
-               execute_process(COMMAND sync)
-               execute_process(COMMAND cmake --build build --config Release 
--target package RESULT_VARIABLE result)
-             endif()
-             math(EXPR BCNT "${BCNT}+1")
-           endwhile()
-           execute_process(COMMAND sync)
-        endif ("${{ runner.os }}" STREQUAL "Windows")
-        if (NOT result EQUAL 0)
-          message(FATAL_ERROR "Bad exit status")
-        endif()
+      - name: Setup - Ninja
+        uses: seanmiddleditch/gha-setup-ninja@master
 
-    - name: Package
-      shell: cmake -P {0}
-      run: |
-        file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}" gw_path)
-        message("gw_path: ${gw_path}")
-        # https://cmake.org/pipermail/cmake/2007-July/015471.html
-        file(MAKE_DIRECTORY "${gw_path}/package")
-        file(GLOB pkgs_zip "${gw_path}/build/BRL-CAD*zip")
-        file(GLOB pkgs_gz "${gw_path}/build/BRL-CAD*gz")
-        file(GLOB pkgs_exe "${gw_path}/build/BRL-CAD*exe")
-        set(pkgs ${pkgs_zip} ${pkgs_gz} ${pkgs_exe})
-        foreach(praw ${pkgs})
-           string(REPLACE "\\" "/" p ${praw})
-           get_filename_component(proot ${p} NAME)
-           file(RENAME "${p}" "${gw_path}/package/${proot}")
-           if (NOT EXISTS "${gw_path}/package/${proot}")
-              message(FATAL_ERROR "RENAME of ${p} FAILED!")
-           else (NOT EXISTS "${gw_path}/package/${proot}")
-              message("staged ${gw_path}/package/${proot}")
-           endif (NOT EXISTS "${gw_path}/package/${proot}")
-        endforeach()
+      - name: Checkout
+        uses: actions/checkout@v2
 
-    - uses: actions/upload-artifact@v2
-      with:
-        name: BRL-CAD_${{ runner.os }}
-        path: ${{ github.workspace }}/package/*
+      - name: Configure
+        run: |
+          export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
+          export CC=clang
+          export CXX=clang++
+          cmake -S . -G Ninja -B build -D ENABLE_ALL=ON -D 
CMAKE_BUILD_TYPE=Release
 
+      - name: Build
+        run: |
+          export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
+          cmake --build build --config Release --target package
+
+      - name: Upload Package
+        uses: actions/upload-artifact@v2
+        with:
+          name: BRLCAD_OSX
+          path: ${{ github.workspace }}/build/BRL-CAD*gz
+
+

Modified: brlcad/branches/extbuild/src/libbn/axis.c
===================================================================
--- brlcad/branches/extbuild/src/libbn/axis.c   2020-11-04 21:33:31 UTC (rev 
77689)
+++ brlcad/branches/extbuild/src/libbn/axis.c   2020-11-04 22:01:09 UTC (rev 
77690)
@@ -39,8 +39,8 @@
 void
 tp_3axis(FILE *fp,             /**< output file */
         char *string,          /**< label for axis */
-        fastf_t *origin,       /**< simple 3d point */
-        fastf_t *rot,          /**< rotation angle */
+        point_t origin,        /**< simple 3d point */
+        mat_t rot,             /**< rotation angle */
         double length,         /**< length of axis */
         int ccw,               /**< 0=clockwise, !0=counter clockwise (ccw) */
         int ndigits,           /**< # digits wide */

Modified: brlcad/branches/extbuild/src/libbn/mat.c
===================================================================
--- brlcad/branches/extbuild/src/libbn/mat.c    2020-11-04 21:33:31 UTC (rev 
77689)
+++ brlcad/branches/extbuild/src/libbn/mat.c    2020-11-04 22:01:09 UTC (rev 
77690)
@@ -121,7 +121,7 @@
 
 
 void
-bn_mat_mul(register mat_t o, register const mat_t a, register const mat_t b)
+bn_mat_mul(mat_t o, const mat_t a, const mat_t b)
 {
     o[ 0] = a[ 0] * b[ 0] + a[ 1] * b[ 4] + a[ 2] * b[ 8] + a[ 3] * b[12];
     o[ 1] = a[ 0] * b[ 1] + a[ 1] * b[ 5] + a[ 2] * b[ 9] + a[ 3] * b[13];
@@ -146,7 +146,7 @@
 
 
 void
-bn_mat_mul2(register const mat_t i, register mat_t o)
+bn_mat_mul2(const mat_t i, mat_t o)
 {
     mat_t temp;
 
@@ -182,10 +182,7 @@
 
 
 void
-bn_matXvec(
-    register vect_t ov,
-    register const mat_t im,
-    register const vect_t iv)
+bn_matXvec(hvect_t ov, const mat_t im, const hvect_t iv)
 {
     register int eo = 0;       /* Position in output vector */
     register int em = 0;       /* Position in input matrix */
@@ -204,7 +201,7 @@
 
 
 void
-bn_mat_inv(register mat_t output, const mat_t input)
+bn_mat_inv(mat_t output, const mat_t input)
 {
     if (bn_mat_inverse(output, input) == 0) {
 
@@ -219,7 +216,7 @@
 
 
 int
-bn_mat_inverse(register mat_t output, const mat_t input)
+bn_mat_inverse(mat_t output, const mat_t input)
 {
     register int i, j; /* Indices */
     int k;             /* Indices */
@@ -307,7 +304,7 @@
 
 
 void
-bn_vtoh_move(register vect_t h, register const vect_t v)
+bn_vtoh_move(vect_t h, const vect_t v)
 {
     VMOVE(h, v);
     h[W] = 1.0;
@@ -315,7 +312,7 @@
 
 
 void
-bn_htov_move(register vect_t v, register const vect_t h)
+bn_htov_move(vect_t v, const vect_t h)
 {
     register fastf_t inv;
 
@@ -333,7 +330,7 @@
 
 
 void
-bn_mat_trn(mat_t om, register const mat_t im)
+bn_mat_trn(mat_t om, const mat_t im)
 {
     MAT_TRANSPOSE(om, im);
 }
@@ -340,7 +337,7 @@
 
 
 void
-bn_mat_ae(register fastf_t *m, double azimuth, double elev)
+bn_mat_ae(mat_t m, double azimuth, double elev)
 {
     double sin_az, sin_el;
     double cos_az, cos_el;
@@ -394,8 +391,8 @@
     fastf_t *az,
     fastf_t *el,
     fastf_t *twist,
-    fastf_t *vec_ae,
-    fastf_t *vec_twist,
+    vect_t vec_ae,
+    vect_t vec_twist,
     fastf_t accuracy)
 {
     vect_t zero_twist, ninety_twist;
@@ -458,11 +455,7 @@
 
 
 void
-bn_mat_angles(
-    register fastf_t *mat,
-    double alpha_in,
-    double beta_in,
-    double ggamma_in)
+bn_mat_angles(mat_t mat, double alpha_in, double beta_in, double ggamma_in)
 {
     double alpha, beta, ggamma;
     double calpha, cbeta, cgamma;
@@ -568,8 +561,8 @@
 bn_eigen2x2(
     fastf_t *val1,
     fastf_t *val2,
-    fastf_t *vec1,
-    fastf_t *vec2,
+    vect_t vec1,
+    vect_t vec2,
     fastf_t a,
     fastf_t b,
     fastf_t c)
@@ -723,7 +716,7 @@
 
 
 void
-bn_mat_xrot(fastf_t *m, double sinx, double cosx)
+bn_mat_xrot(mat_t m, double sinx, double cosx)
 {
     m[0] = 1.0;
     m[1] = 0.0;
@@ -746,7 +739,7 @@
 
 
 void
-bn_mat_yrot(fastf_t *m, double siny, double cosy)
+bn_mat_yrot(mat_t m, double siny, double cosy)
 {
     m[0] = cosy;
     m[1] = 0.0;
@@ -769,7 +762,7 @@
 
 
 void
-bn_mat_zrot(fastf_t *m, double sinz, double cosz)
+bn_mat_zrot(mat_t m, double sinz, double cosz)
 {
     m[0] = cosz;
     m[1] = -sinz;
@@ -847,7 +840,7 @@
 
 
 void
-bn_vec_ortho(register vect_t out, register const vect_t in)
+bn_vec_ortho(vect_t out, const vect_t in)
 {
     register int j, k;
     register fastf_t f;

Modified: brlcad/branches/extbuild/src/libged/search/search.c
===================================================================
--- brlcad/branches/extbuild/src/libged/search/search.c 2020-11-04 21:33:31 UTC 
(rev 77689)
+++ brlcad/branches/extbuild/src/libged/search/search.c 2020-11-04 22:01:09 UTC 
(rev 77690)
@@ -74,7 +74,7 @@
 
 struct ged_search {
     struct directory **paths;
-    int path_cnt;
+    size_t path_cnt;
     int search_type;
 };
 
@@ -119,25 +119,24 @@
 HIDDEN void
 _ged_free_search_set(struct bu_ptbl *search_set)
 {
-    int i;
+    size_t i;
 
     if (!search_set)
        return;
 
-    for (i = (int)BU_PTBL_LEN(search_set) - 1; i >= 0; i--) {
+    for (i = 0; i < BU_PTBL_LEN(search_set); i++) {
        struct ged_search *search = (struct ged_search 
*)BU_PTBL_GET(search_set, i);
 
-       if (search && search->paths)
-           bu_free(search->paths, "free search paths");
-
-       if (search)
+       if (search) {
+           if (search->paths) {
+               bu_free(search->paths, "free search paths");
+           }
            bu_free(search, "free search");
+       }
     }
 
-    if (search_set) {
-       bu_ptbl_free(search_set);
-       bu_free(search_set, "free search container");
-    }
+    bu_ptbl_free(search_set);
+    bu_free(search_set, "free search container");
 }
 
 
@@ -171,7 +170,10 @@
     (*flat_only) = 0;
     (*is_specific) = 0;
     (*is_local) = 0;
-    if (!orig || !normalized) return 0;
+
+    if (!orig || !normalized)
+       return 0;
+
     if (BU_STR_EQUAL(orig, "/")) {
        return 1;
     }
@@ -183,6 +185,7 @@
        (*flat_only) = 1;
        return 1;
     }
+
     bu_vls_sprintf(normalized, "%s", orig);
     if (bu_vls_addr(normalized)[0] == '|') {
        (*is_flat) = 1;
@@ -195,11 +198,14 @@
        (*is_local) = 1;
        return 1;
     }
+
     (*is_local) = _path_scrub(normalized);
-    if (!bu_vls_strlen(normalized)) return 0;
+    if (!bu_vls_strlen(normalized))
+       return 0;
     if (BU_STR_EQUAL(bu_vls_addr(normalized), "/")) {
        return 1;
     }
+
     /* We've handled the toplevel special cases - now the only question
      * is is the path valid */
     (*is_specific) = 1;
@@ -215,20 +221,25 @@
 HIDDEN int
 _ged_search_localized_obj_list(struct ged *gedp, struct directory *path, 
struct directory ***path_list, struct db_search_context *ctx)
 {
-    int path_cnt;
-    int j;
+    size_t path_cnt;
+    size_t j;
     const char *comb_str = "-name *";
     struct bu_ptbl *tmp_search;
+
     BU_ALLOC(tmp_search, struct bu_ptbl);
+
     (void)db_search(tmp_search, DB_SEARCH_RETURN_UNIQ_DP, comb_str, 1, &path, 
gedp->ged_wdbp->dbip, ctx);
-    path_cnt = (int)BU_PTBL_LEN(tmp_search);
+    path_cnt = BU_PTBL_LEN(tmp_search);
     (*path_list) = (struct directory **)bu_malloc(sizeof(char *) * 
(path_cnt+1), "object path array");
+
     for (j = 0; j < path_cnt; j++) {
        (*path_list)[j] = (struct directory *)BU_PTBL_GET(tmp_search, j);
     }
+
     (*path_list)[path_cnt] = RT_DIR_NULL;
     bu_ptbl_free(tmp_search);
     bu_free(tmp_search, "Free search table container");
+
     return path_cnt;
 }
 
@@ -236,7 +247,9 @@
 int
 ged_search_core(struct ged *gedp, int argc, const char *argv_orig[])
 {
-    int i, c, optcnt;
+    size_t i;
+    int c;
+    int optcnt;
     int aflag = 0; /* flag controlling whether hidden objects are examined */
     int wflag = 0; /* flag controlling whether to fail quietly or not */
     int flags = 0;
@@ -263,7 +276,7 @@
      * (do db_lookup on things to see if they are paths, recognize
      * toplevel path specifiers, etc. */
     optcnt = 0;
-    for (i = 1; i < argc; i++) {
+    for (i = 1; i < (size_t)argc; i++) {
        if ((argv_orig[i][0] == '-') && (strlen(argv_orig[i]) == 2)) {
            optcnt++;
        } else {
@@ -329,16 +342,22 @@
     /* If any specific paths are specified before the plan, we need to identify
      * them and construct search structs. */
     while (!plan_found) {
+
        if (!argv[plan_argv]) {
            /* OK, no plan - will use default behavior */
            plan_found = 1;
+
        } else {
+
            if (!(_ged_plan_item(argv[plan_argv]))) {
                /* We seem to have a path - figure out what type of search it 
specifies */
                int is_specific, is_local, is_flat, flat_only;
                struct ged_search *new_search;
-               int search_path_type = _ged_search_characterize_path(gedp, 
argv[plan_argv], &argvls, &is_specific, &is_local, &is_flat, &flat_only);
+               int search_path_type;
+
+               search_path_type = _ged_search_characterize_path(gedp, 
argv[plan_argv], &argvls, &is_specific, &is_local, &is_flat, &flat_only);
                path_found = 1;
+
                if (search_path_type) {
                    BU_ALLOC(new_search, struct ged_search);
                } else {
@@ -349,16 +368,22 @@
                    } else {
                        bu_vls_trunc(gedp->ged_result_str, 0);
                    }
+
                    bu_vls_free(&argvls);
                    bu_argv_free(argc, argv);
                    _ged_free_search_set(search_set);
                    return (wflag) ? GED_OK : GED_ERROR;
                }
+
                if (!is_specific) {
-                   if (!is_flat && !aflag && !flat_only) new_search->path_cnt 
= db_ls(gedp->ged_wdbp->dbip, DB_LS_TOPS, NULL, &(new_search->paths));
-                   if (!is_flat && aflag && !flat_only) new_search->path_cnt = 
db_ls(gedp->ged_wdbp->dbip, DB_LS_TOPS | DB_LS_HIDDEN, NULL, 
&(new_search->paths));
-                   if (is_flat && !aflag && !flat_only) new_search->path_cnt = 
db_ls(gedp->ged_wdbp->dbip, 0, NULL, &(new_search->paths));
-                   if (is_flat && aflag && !flat_only) new_search->path_cnt = 
db_ls(gedp->ged_wdbp->dbip, DB_LS_HIDDEN, NULL, &(new_search->paths));
+                   if (!is_flat && !aflag && !flat_only)
+                       new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, 
DB_LS_TOPS, NULL, &(new_search->paths));
+                   if (!is_flat && aflag && !flat_only)
+                       new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, 
DB_LS_TOPS | DB_LS_HIDDEN, NULL, &(new_search->paths));
+                   if (is_flat && !aflag && !flat_only)
+                       new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, 0, 
NULL, &(new_search->paths));
+                   if (is_flat && aflag && !flat_only)
+                       new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, 
DB_LS_HIDDEN, NULL, &(new_search->paths));
                } else {
                    /* _ged_search_characterize_path verified that the 
db_lookup will succeed */
                    struct directory *local_dp = 
db_lookup(gedp->ged_wdbp->dbip, bu_vls_addr(&argvls), LOOKUP_QUIET);
@@ -371,18 +396,27 @@
                        new_search->path_cnt = 1;
                    }
                }
+
                new_search->search_type = is_local;
-               if (flat_only) new_search->search_type = 2;
+               if (flat_only)
+                   new_search->search_type = 2;
                bu_ptbl_ins(search_set, (long *)new_search);
                plan_argv++;
+
            } else {
                plan_found = 1;
+
                if (!path_found) {
                    /* We have a plan but not path - in that case, do a 
non-full-path tops search */
                    struct ged_search *new_search;
+
                    BU_ALLOC(new_search, struct ged_search);
-                   if (!aflag) new_search->path_cnt = 
db_ls(gedp->ged_wdbp->dbip, DB_LS_TOPS, NULL, &(new_search->paths));
-                   if (aflag) new_search->path_cnt = 
db_ls(gedp->ged_wdbp->dbip, DB_LS_TOPS | DB_LS_HIDDEN, NULL, 
&(new_search->paths));
+
+                   if (!aflag)
+                       new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, 
DB_LS_TOPS, NULL, &(new_search->paths));
+                   if (aflag)
+                       new_search->path_cnt = db_ls(gedp->ged_wdbp->dbip, 
DB_LS_TOPS | DB_LS_HIDDEN, NULL, &(new_search->paths));
+
                    new_search->search_type = 1;
                    bu_ptbl_ins(search_set, (long *)new_search);
                }
@@ -410,9 +444,11 @@
     }
 
     /* Check if all of our searches are local or not */
-    for (i = (int)BU_PTBL_LEN(search_set) - 1; i >= 0; i--) {
+    for (i = 0; i < BU_PTBL_LEN(search_set); i++) {
        struct ged_search *search = (struct ged_search 
*)BU_PTBL_GET(search_set, i);
-       if (search->search_type != 1) all_local = 0;
+       if (search && search->search_type != 1) {
+           all_local = 0;
+       }
     }
 
     /* If all searches are local, use all supplied paths in the search to
@@ -419,13 +455,22 @@
      * return one unique list of objects.  If one or more paths are non-local,
      * each path is treated as its own search */
     if (all_local) {
+       size_t len;
        struct bu_ptbl *uniq_db_objs;
+
        BU_ALLOC(uniq_db_objs, struct bu_ptbl);
        BU_PTBL_INIT(uniq_db_objs);
-       for (i = (int)BU_PTBL_LEN(search_set) - 1; i >= 0; i--) {
-           int path_cnt = 0;
-           struct ged_search *search = (struct ged_search 
*)BU_PTBL_GET(search_set, i);
-           struct directory *curr_path = search->paths[path_cnt];
+
+       for (i = 0; i < BU_PTBL_LEN(search_set); i++) {
+           size_t path_cnt = 0;
+           struct ged_search *search;
+           struct directory *curr_path;
+
+           search = (struct ged_search *)BU_PTBL_GET(search_set, i);
+           if (!search || !search->paths)
+               continue;
+           curr_path = search->paths[path_cnt];
+
            while (path_cnt < search->path_cnt) {
                flags |= DB_SEARCH_RETURN_UNIQ_DP;
                (void)db_search(uniq_db_objs, flags, 
bu_vls_addr(&search_string), 1, &curr_path, gedp->ged_wdbp->dbip, ctx);
@@ -433,19 +478,27 @@
                curr_path = search->paths[path_cnt];
            }
        }
+
        /* For this return, we want a list of all unique leaf objects */
        bu_sort((void *)BU_PTBL_BASEADDR(uniq_db_objs), 
BU_PTBL_LEN(uniq_db_objs), sizeof(struct directory *), dp_name_compare, NULL);
-       for (i = (int)BU_PTBL_LEN(uniq_db_objs) - 1; i >= 0; i--) {
-           struct directory *uniq_dp = (struct directory 
*)BU_PTBL_GET(uniq_db_objs, i);
+
+       len = BU_PTBL_LEN(uniq_db_objs);
+       while (len > 0) {
+           struct directory *uniq_dp = (struct directory 
*)BU_PTBL_GET(uniq_db_objs, len-1);
            bu_vls_printf(gedp->ged_result_str, "%s\n", uniq_dp->d_namep);
+           len--;
        }
+
        bu_ptbl_free(uniq_db_objs);
        bu_free(uniq_db_objs, "free unique object container");
+
     } else {
+
        /* Search types are either mixed or all full path, so use the standard 
calls and print
         * the full output of each search */
 
        struct fp_cmp_vls *sdata;
+
        BU_GET(sdata, struct fp_cmp_vls);
        BU_GET(sdata->left, struct bu_vls);
        BU_GET(sdata->right, struct bu_vls);
@@ -454,17 +507,21 @@
        sdata->dbip = gedp->ged_wdbp->dbip;
        sdata->print_verbose_info = print_verbose_info;
 
-       for (i = 0; i < (int)BU_PTBL_LEN(search_set); i++) {
-           int path_cnt = 0;
-           int j;
+       for (i = 0; i < BU_PTBL_LEN(search_set); i++) {
+           size_t j;
+           size_t path_cnt = 0;
+           size_t sr_len;
            struct ged_search *search = (struct ged_search 
*)BU_PTBL_GET(search_set, i);
+
            if (search && (search->path_cnt > 0 || search->search_type == 2)) {
                if (search->search_type == 2) {
-                   int k;
+                   size_t k;
                    struct bu_ptbl *search_results;
+
                    flags |= DB_SEARCH_FLAT;
                    BU_ALLOC(search_results, struct bu_ptbl);
                    bu_ptbl_init(search_results, 8, "initialize search result 
table");
+
                    for (k = 0; k < RT_DBNHASH; k++) {
                        struct directory *dp;
                        for (dp = gedp->ged_wdbp->dbip->dbi_Head[k]; dp != 
RT_DIR_NULL; dp = dp->d_forw) {
@@ -473,34 +530,47 @@
                            }
                        }
                    }
-                   if (BU_PTBL_LEN(search_results) > 0) {
-                       bu_sort((void *)BU_PTBL_BASEADDR(search_results), 
BU_PTBL_LEN(search_results), sizeof(struct directory *), dp_name_compare, NULL);
-                       for (j = (int)BU_PTBL_LEN(search_results) - 1; j >= 0; 
j--) {
-                           struct directory *uniq_dp = (struct directory 
*)BU_PTBL_GET(search_results, j);
+
+                   sr_len = j = BU_PTBL_LEN(search_results);
+                   if (sr_len > 0) {
+                       bu_sort((void *)BU_PTBL_BASEADDR(search_results), 
sr_len, sizeof(struct directory *), dp_name_compare, NULL);
+
+                       while (j > 0) {
+                           struct directory *uniq_dp = (struct directory 
*)BU_PTBL_GET(search_results, j-1);
                            bu_vls_printf(gedp->ged_result_str, "%s\n", 
uniq_dp->d_namep);
+                           j--;
                        }
                    }
+
                    /* Make sure to clear the flag in case of subsequent 
searches of different types */
+
                    flags = flags & ~(DB_SEARCH_FLAT);
                    db_search_free(search_results);
                    bu_free(search_results, "free search container");
                } else {
                    struct directory *curr_path = search->paths[path_cnt];
+
                    while (path_cnt < search->path_cnt) {
                        struct bu_ptbl *search_results;
                        struct bu_vls fullpath_string = BU_VLS_INIT_ZERO;
+
                        BU_ALLOC(search_results, struct bu_ptbl);
                        bu_ptbl_init(search_results, 8, "initialize search 
result table");
+
                        switch (search->search_type) {
                            case 0:
                                (void)db_search(search_results, flags, 
bu_vls_addr(&search_string), 1, &curr_path, gedp->ged_wdbp->dbip, ctx);
-                               if (BU_PTBL_LEN(search_results) > 0) {
-                                   bu_sort((void 
*)BU_PTBL_BASEADDR(search_results), BU_PTBL_LEN(search_results), sizeof(struct 
directory *), fp_name_compare, (void *)sdata);
-                                   for (j = (int)BU_PTBL_LEN(search_results) - 
1; j >= 0; j--) {
-                                       struct db_full_path *dfptr = (struct 
db_full_path *)BU_PTBL_GET(search_results, j);
+
+                               sr_len = j = BU_PTBL_LEN(search_results);
+                               if (sr_len > 0) {
+                                   bu_sort((void 
*)BU_PTBL_BASEADDR(search_results), sr_len, sizeof(struct directory *), 
fp_name_compare, (void *)sdata);
+
+                                   while (j > 0) {
+                                       struct db_full_path *dfptr = (struct 
db_full_path *)BU_PTBL_GET(search_results, j-1);
                                        bu_vls_trunc(&fullpath_string, 0);
                                        db_fullpath_to_vls(&fullpath_string, 
dfptr, gedp->ged_wdbp->dbip, print_verbose_info);
                                        bu_vls_printf(gedp->ged_result_str, 
"%s\n", bu_vls_addr(&fullpath_string));
+                                       j--;
                                    }
                                }
                                break;
@@ -507,10 +577,16 @@
                            case 1:
                                flags |= DB_SEARCH_RETURN_UNIQ_DP;
                                (void)db_search(search_results, flags, 
bu_vls_addr(&search_string), 1, &curr_path, gedp->ged_wdbp->dbip, ctx);
-                               bu_sort((void 
*)BU_PTBL_BASEADDR(search_results), BU_PTBL_LEN(search_results), sizeof(struct 
directory *), dp_name_compare, NULL);
-                               for (j = (int)BU_PTBL_LEN(search_results) - 1; 
j >= 0; j--) {
-                                   struct directory *uniq_dp = (struct 
directory *)BU_PTBL_GET(search_results, j);
-                                   bu_vls_printf(gedp->ged_result_str, "%s\n", 
uniq_dp->d_namep);
+                               sr_len = j = BU_PTBL_LEN(search_results);
+
+                               if (sr_len > 0) {
+                                   bu_sort((void 
*)BU_PTBL_BASEADDR(search_results), sr_len, sizeof(struct directory *), 
dp_name_compare, NULL);
+
+                                   while (j > 0) {
+                                       struct directory *uniq_dp = (struct 
directory *)BU_PTBL_GET(search_results, j-1);
+                                       bu_vls_printf(gedp->ged_result_str, 
"%s\n", uniq_dp->d_namep);
+                                       j--;
+                                   }
                                }
                                break;
                            default:

Modified: brlcad/branches/extbuild/src/librt/db5_io.c
===================================================================
--- brlcad/branches/extbuild/src/librt/db5_io.c 2020-11-04 21:33:31 UTC (rev 
77689)
+++ brlcad/branches/extbuild/src/librt/db5_io.c 2020-11-04 22:01:09 UTC (rev 
77690)
@@ -53,31 +53,40 @@
 {
     const struct db5_ondisk_header *odp = (const struct db5_ondisk_header *)hp;
 
-    if (odp->db5h_magic1 != DB5HDR_MAGIC1) return 0;
-    if (hp[7] != DB5HDR_MAGIC2) return 0;
+    if (odp->db5h_magic1 != DB5HDR_MAGIC1)
+       return 0;
+    if (hp[7] != DB5HDR_MAGIC2)
+       return 0;
 
     /* hflags */
     if ((odp->db5h_hflags & DB5HDR_HFLAGS_DLI_MASK) != 
DB5HDR_HFLAGS_DLI_HEADER_OBJECT)
        return 0;
-    if ((odp->db5h_hflags & DB5HDR_HFLAGS_NAME_PRESENT)) return 0;
-    if (((odp->db5h_hflags & DB5HDR_HFLAGS_OBJECT_WIDTH_MASK) >> 
DB5HDR_HFLAGS_OBJECT_WIDTH_SHIFT)
-       != DB5HDR_WIDTHCODE_8BIT) return 0;
+    if ((odp->db5h_hflags & DB5HDR_HFLAGS_NAME_PRESENT))
+       return 0;
+    if (((odp->db5h_hflags & DB5HDR_HFLAGS_OBJECT_WIDTH_MASK) >> 
DB5HDR_HFLAGS_OBJECT_WIDTH_SHIFT) != DB5HDR_WIDTHCODE_8BIT)
+       return 0;
 
     /* aflags */
-    if ((odp->db5h_aflags & DB5HDR_AFLAGS_ZZZ_MASK) != DB5_ZZZ_UNCOMPRESSED) 
return 0;
-    if (odp->db5h_aflags & DB5HDR_AFLAGS_PRESENT) return 0;
-    if (((odp->db5h_aflags & DB5HDR_AFLAGS_WIDTH_MASK) >> 
DB5HDR_AFLAGS_WIDTH_SHIFT)
-       != DB5HDR_WIDTHCODE_8BIT) return 0;
+    if ((odp->db5h_aflags & DB5HDR_AFLAGS_ZZZ_MASK) != DB5_ZZZ_UNCOMPRESSED)
+       return 0;
+    if (odp->db5h_aflags & DB5HDR_AFLAGS_PRESENT)
+       return 0;
+    if (((odp->db5h_aflags & DB5HDR_AFLAGS_WIDTH_MASK) >> 
DB5HDR_AFLAGS_WIDTH_SHIFT) != DB5HDR_WIDTHCODE_8BIT)
+       return 0;
 
     /* bflags */
-    if ((odp->db5h_bflags & DB5HDR_BFLAGS_ZZZ_MASK) != DB5_ZZZ_UNCOMPRESSED) 
return 0;
-    if (odp->db5h_bflags & DB5HDR_BFLAGS_PRESENT) return 0;
-    if (((odp->db5h_bflags & DB5HDR_BFLAGS_WIDTH_MASK) >> 
DB5HDR_BFLAGS_WIDTH_SHIFT)
-       != DB5HDR_WIDTHCODE_8BIT) return 0;
+    if ((odp->db5h_bflags & DB5HDR_BFLAGS_ZZZ_MASK) != DB5_ZZZ_UNCOMPRESSED)
+       return 0;
+    if (odp->db5h_bflags & DB5HDR_BFLAGS_PRESENT)
+       return 0;
+    if (((odp->db5h_bflags & DB5HDR_BFLAGS_WIDTH_MASK) >> 
DB5HDR_BFLAGS_WIDTH_SHIFT) != DB5HDR_WIDTHCODE_8BIT)
+       return 0;
 
     /* major and minor type */
-    if (odp->db5h_major_type != DB5_MAJORTYPE_RESERVED) return 0;
-    if (odp->db5h_minor_type != 0) return 0;
+    if (odp->db5h_major_type != DB5_MAJORTYPE_RESERVED)
+       return 0;
+    if (odp->db5h_minor_type != 0)
+       return 0;
 
     /* Check length, known to be 8-bit.  Header len=1 8-byte chunk. */
     if (hp[6] != 1)
@@ -86,12 +95,16 @@
     return 1;          /* valid */
 }
 
+
 int
 db5_select_length_encoding(size_t len)
 {
-    if (len <= 255) return DB5HDR_WIDTHCODE_8BIT;
-    if (len <= 65535) return DB5HDR_WIDTHCODE_16BIT;
-    if (len < 0x7ffffffe) return DB5HDR_WIDTHCODE_32BIT;
+    if (len <= 255)
+       return DB5HDR_WIDTHCODE_8BIT;
+    if (len <= 65535)
+       return DB5HDR_WIDTHCODE_16BIT;
+    if (len < 0x7ffffffe)
+       return DB5HDR_WIDTHCODE_32BIT;
     return DB5HDR_WIDTHCODE_64BIT;
 }
 
@@ -121,6 +134,7 @@
     return 0;
 }
 
+
 size_t
 db5_decode_signed(size_t *lenp, const unsigned char *cp, int format)
 {
@@ -215,22 +229,15 @@
     rip->major_type = cp[4];
     rip->minor_type = cp[5];
 
-    if (RT_G_DEBUG&RT_DEBUG_DB) bu_log("crack_disk_header()\n\
-       h_dli=%d, h_object_width=%d, h_name_present=%d, h_name_width=%d, \n\
-       a_width=%d, a_present=%d, a_zzz=%d, \n\
-       b_width=%d, b_present=%d, b_zzz=%d, major=%d, minor=%d\n",
-                                   rip->h_dli,
-                                   rip->h_object_width,
-                                   rip->h_name_present,
-                                   rip->h_name_width,
-                                   rip->a_width,
-                                   rip->a_present,
-                                   rip->a_zzz,
-                                   rip->b_width,
-                                   rip->b_present,
-                                   rip->b_zzz,
-                                   rip->major_type,
-                                   rip->minor_type);
+    if (RT_G_DEBUG&RT_DEBUG_DB) {
+       bu_log("crack_disk_header()\n"
+              "\th_dli=%d, h_object_width=%d, h_name_present=%d, 
h_name_width=%d,\n"
+              "\ta_width=%d, a_present=%d, a_zzz=%d,\n"
+              "\tb_width=%d, b_present=%d, b_zzz=%d, major=%d, minor=%d\n",
+              rip->h_dli, rip->h_object_width, rip->h_name_present, 
rip->h_name_width,
+              rip->a_width, rip->a_present, rip->a_zzz,
+              rip->b_width, rip->b_present, rip->b_zzz, rip->major_type, 
rip->minor_type);
+    }
 
     return 0;
 }
@@ -241,7 +248,8 @@
 {
     const unsigned char *cp = ip;
 
-    if (crack_disk_header(rip, cp) < 0) return NULL;
+    if (crack_disk_header(rip, cp) < 0)
+       return NULL;
     cp += sizeof(struct db5_ondisk_header);
 
     cp += db5_decode_length(&rip->object_length, cp, rip->h_object_width);
@@ -248,8 +256,7 @@
     rip->object_length <<= 3;  /* cvt 8-byte chunks to byte count */
 
     if ((size_t)rip->object_length < sizeof(struct db5_ondisk_header)) {
-       bu_log("db5_get_raw_internal_ptr(): object_length=%ld is too short, 
database possibly corrupted\n",
-              rip->object_length);
+       bu_log("db5_get_raw_internal_ptr(): object_length=%ld is too short, 
database possibly corrupted\n", rip->object_length);
        return NULL;
     }
 
@@ -265,8 +272,7 @@
 
     /* Grab name, if present */
     if (rip->h_name_present) {
-       cp += db5_decode_length(&rip->name.ext_nbytes,
-                               cp, rip->h_name_width);
+       cp += db5_decode_length(&rip->name.ext_nbytes, cp, rip->h_name_width);
        rip->name.ext_buf = (uint8_t *)cp;      /* discard const */
        cp += rip->name.ext_nbytes;
     }
@@ -273,8 +279,7 @@
 
     /* Point to attributes, if present */
     if (rip->a_present) {
-       cp += db5_decode_length(&rip->attributes.ext_nbytes,
-                               cp, rip->a_width);
+       cp += db5_decode_length(&rip->attributes.ext_nbytes, cp, rip->a_width);
        rip->attributes.ext_buf = (uint8_t *)cp;        /* discard const */
 #if defined(USE_BINARY_ATTRIBUTES)
        rip->attributes.widcode = rip->a_width;
@@ -284,8 +289,7 @@
 
     /* Point to body, if present */
     if (rip->b_present) {
-       cp += db5_decode_length(&rip->body.ext_nbytes,
-                               cp, rip->b_width);
+       cp += db5_decode_length(&rip->body.ext_nbytes, cp, rip->b_width);
        rip->body.ext_buf = (uint8_t *)cp;      /* discard const */
        cp += rip->body.ext_nbytes;
     }
@@ -295,6 +299,7 @@
     return ip + rip->object_length;
 }
 
+
 int
 db5_get_raw_internal_fp(struct db5_raw_internal *rip, FILE *fp)
 {
@@ -307,7 +312,8 @@
     unsigned char *cp;
 
     if (fread((unsigned char *)&header, sizeof header, 1, fp) != 1) {
-       if (feof(fp)) return -1;
+       if (feof(fp))
+           return -1;
        bu_log("db5_get_raw_internal_fp(): fread header error\n");
        return -2;
     }
@@ -380,8 +386,7 @@
 
     /* Grab name, if present */
     if (rip->h_name_present) {
-       cp += db5_decode_length(&rip->name.ext_nbytes,
-                               cp, rip->h_name_width);
+       cp += db5_decode_length(&rip->name.ext_nbytes, cp, rip->h_name_width);
        rip->name.ext_buf = (uint8_t *)cp;      /* discard const */
        cp += rip->name.ext_nbytes;
     }
@@ -388,8 +393,7 @@
 
     /* Point to attributes, if present */
     if (rip->a_present) {
-       cp += db5_decode_length(&rip->attributes.ext_nbytes,
-                               cp, rip->a_width);
+       cp += db5_decode_length(&rip->attributes.ext_nbytes, cp, rip->a_width);
        rip->attributes.ext_buf = (uint8_t *)cp;        /* discard const */
 #if defined(USE_BINARY_ATTRIBUTES)
        rip->attributes.widcode = rip->a_width;
@@ -399,8 +403,7 @@
 
     /* Point to body, if present */
     if (rip->b_present) {
-       cp += db5_decode_length(&rip->body.ext_nbytes,
-                               cp, rip->b_width);
+       cp += db5_decode_length(&rip->body.ext_nbytes, cp, rip->b_width);
        rip->body.ext_buf = (uint8_t *)cp;      /* discard const */
        cp += rip->body.ext_nbytes;
     }
@@ -408,6 +411,7 @@
     return 0;          /* success */
 }
 
+
 void
 db5_export_object3(
     struct bu_external *out,
@@ -560,6 +564,7 @@
     BU_ASSERT(out->ext_nbytes >= 8);
 }
 
+
 void
 db5_make_free_object_hdr(struct bu_external *ep, size_t length)
 {
@@ -589,6 +594,7 @@
     db5_encode_length(cp, length>>3, h_width);
 }
 
+
 void
 db5_make_free_object(struct bu_external *ep, size_t length)
 {
@@ -620,6 +626,7 @@
     *cp = DB5HDR_MAGIC2;
 }
 
+
 int
 rt_db_cvt_to_external5(
     struct bu_external *ext,
@@ -690,6 +697,7 @@
     return 0;          /* OK */
 }
 
+
 int
 db_wrap_v5_external(struct bu_external *ep, const char *name)
 {
@@ -732,6 +740,7 @@
     return 0;
 }
 
+
 int
 db_put_external5(struct bu_external *ep, struct directory *dp, struct db_i 
*dbip)
 {
@@ -740,7 +749,7 @@
     BU_CK_EXTERNAL(ep);
 
     if (RT_G_DEBUG&RT_DEBUG_DB) bu_log("db_put_external5(%s) ep=%p, dbip=%p, 
dp=%p\n",
-                                   dp->d_namep, (void *)ep, (void *)dbip, 
(void *)dp);
+                                      dp->d_namep, (void *)ep, (void *)dbip, 
(void *)dp);
 
     if (dbip->dbi_read_only) {
        bu_log("db_put_external5(%s):  READ-ONLY file\n",
@@ -777,6 +786,7 @@
     return 0;
 }
 
+
 int
 rt_db_put_internal5(
     struct directory *dp,
@@ -874,7 +884,8 @@
     if ((raw.major_type == DB5_MAJORTYPE_BRLCAD)
        ||(raw.major_type == DB5_MAJORTYPE_BINARY_UNIF)) {
        /* As a convenience to older ft_import routines */
-       if (mat == NULL) mat = bn_mat_identity;
+       if (mat == NULL)
+           mat = bn_mat_identity;
     } else {
        bu_log("rt_db_external5_to_internal5(%s):  unable to import non-BRL-CAD 
object, major=%d minor=%d\n",
               name, raw.major_type, raw.minor_type);
@@ -946,6 +957,7 @@
     return id;                 /* OK */
 }
 
+
 int
 rt_db_get_internal5(
     struct rt_db_internal *ip,
@@ -981,6 +993,7 @@
     rt_vls_color_map(ostr);
 }
 
+
 void
 db5_import_color_table(char *cp)
 {
@@ -994,6 +1007,7 @@
     }
 }
 
+
 int
 db5_put_color_table(struct db_i *dbip)
 {
@@ -1012,6 +1026,7 @@
     return ret;
 }
 
+
 int
 db5_get_attributes(const struct db_i *dbip, struct bu_attribute_value_set 
*avs, const struct directory *dp)
 {
@@ -1046,6 +1061,7 @@
     return 0;
 }
 
+
 /** @} */
 /*
  * Local Variables:

Modified: brlcad/branches/extbuild/src/librt/dir.c
===================================================================
--- brlcad/branches/extbuild/src/librt/dir.c    2020-11-04 21:33:31 UTC (rev 
77689)
+++ brlcad/branches/extbuild/src/librt/dir.c    2020-11-04 22:01:09 UTC (rev 
77690)
@@ -139,7 +139,8 @@
        id = ID_COMBINATION;
     } else {
        /* As a convenience to older ft_import4 routines */
-       if (mat == NULL) mat = bn_mat_identity;
+       if (mat == NULL)
+           mat = bn_mat_identity;
        id = rt_id_solid(&ext);
     }
 
@@ -173,6 +174,7 @@
     return id;                 /* OK */
 }
 
+
 int
 rt_db_put_internal(
     struct directory *dp,
@@ -214,6 +216,7 @@
     return 0;                  /* OK */
 }
 
+
 int
 rt_fwrite_internal(
     FILE *fp,
@@ -247,9 +250,9 @@
        bu_free_external(&ext);
        return -3;
     }
+
     bu_free_external(&ext);
     return 0;
-
 }
 
 
@@ -277,6 +280,7 @@
     RT_DB_INTERNAL_INIT(ip);
 }
 
+
 int
 rt_db_lookup_internal (
     struct db_i *dbip,

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



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to