diff --git a/.github/workflows/autotools.yml b/.github/workflows/autotools.yml index 0105e7bb43..8b8c473060 100644 --- a/.github/workflows/autotools.yml +++ b/.github/workflows/autotools.yml @@ -48,3 +48,9 @@ jobs: uses: ./.github/workflows/intel-auto.yml with: build_mode: "production" + + call-release-auto-nvhpc: + name: "Autotools nvhpc Workflows" + uses: ./.github/workflows/nvhpc-auto.yml + with: + build_mode: "production" diff --git a/.github/workflows/cmake-ctest.yml b/.github/workflows/cmake-ctest.yml index f4f110e7f6..001396014f 100644 --- a/.github/workflows/cmake-ctest.yml +++ b/.github/workflows/cmake-ctest.yml @@ -302,7 +302,7 @@ jobs: CXX: ${{ steps.setup-fortran.outputs.cxx }} run: | cd "${{ runner.workspace }}/hdf4/hdfsrc" - cmake --workflow --preset=${{ inputs.preset_name }}-win-Intel --fresh + cmake --workflow --preset=${{ inputs.preset_name }}-Intel --fresh shell: pwsh - name: Publish binary (Windows_intel) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 4a0c234e1e..04331642b6 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -71,3 +71,9 @@ jobs: uses: ./.github/workflows/intel-cmake.yml with: build_mode: "Release" + + call-release-cmake-nvhpc: + name: "CMake nvhpc Workflows" + uses: ./.github/workflows/nvhpc-cmake.yml + with: + build_mode: "Release" diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index a77715b851..e6880f72ef 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -12,6 +12,26 @@ permissions: # A workflow run is made up of one or more jobs that can run sequentially or # in parallel. jobs: + get-old-names: + runs-on: ubuntu-latest + outputs: + hdf4-name: ${{ steps.gethdf4base.outputs.HDF4_NAME_BASE }} + + steps: + - uses: actions/checkout@v4.1.1 + + - name: Get hdf4 release base name + uses: dsaltares/fetch-gh-release-asset@master + with: + version: 'tags/snapshot' + file: 'last-file.txt' + + - name: Read base-name file + id: gethdf4base + run: echo "HDF4_NAME_BASE=$(cat last-file.txt)" >> $GITHUB_OUTPUT + + - run: echo "hdf4 base name is ${{ steps.gethdf4base.outputs.HDF4_NAME_BASE }}." + call-workflow-tarball: uses: ./.github/workflows/tarball.yml with: @@ -52,3 +72,15 @@ jobs: use_environ: snapshots if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} + call-workflow-remove: +# needs: [get-old-names, call-workflow-tarball, call-workflow-ctest, call-workflow-abi, call-workflow-release] + needs: [get-old-names, call-workflow-tarball, call-workflow-ctest, call-workflow-release] + permissions: + contents: write # In order to allow file deletion + uses: ./.github/workflows/remove-files.yml + with: + file_base: ${{ needs.get-old-names.outputs.hdf4-name }} + use_tag: snapshot + use_environ: snapshots + if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} + diff --git a/.github/workflows/hdfeos2.yml b/.github/workflows/hdfeos2.yml index d9951a3a31..62ef9aadfa 100644 --- a/.github/workflows/hdfeos2.yml +++ b/.github/workflows/hdfeos2.yml @@ -7,7 +7,7 @@ jobs: name: Build hdfeos runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.1.1 - name: Install Autotools Dependencies (Linux) run: | diff --git a/.github/workflows/intel-cmake.yml b/.github/workflows/intel-cmake.yml index a13f3f47d0..8c3068c1b6 100644 --- a/.github/workflows/intel-cmake.yml +++ b/.github/workflows/intel-cmake.yml @@ -1,6 +1,5 @@ name: hdf4 dev CMake icx CI -# Controls when the action will run. Triggers the workflow on a call on: workflow_call: inputs: @@ -122,5 +121,5 @@ jobs: CC: ${{ steps.setup-fortran.outputs.cc }} CXX: ${{ steps.setup-fortran.outputs.cxx }} run: | - ctest . --parallel 2 -C ${{ inputs.build_mode }} -V -E "HDP-dumpv|h4ex_GR_create|h4ex_GR_write|h4ex_VG_add" + ctest . --parallel 2 -C ${{ inputs.build_mode }} -V working-directory: ${{ runner.workspace }}/build diff --git a/.github/workflows/j.yml b/.github/workflows/j.yml index 99dbae2baf..9b089b09a5 100644 --- a/.github/workflows/j.yml +++ b/.github/workflows/j.yml @@ -37,7 +37,7 @@ jobs: whoami env | sort sudo pkg_add git - git clone https://github.com/hyoklee/hdf4-1 hdf4 + git clone https://github.com/hyoklee/hdf4 cd hdf4 sudo pkg_add cmake sudo pkg_add jpeg diff --git a/.github/workflows/lin-auto-aocc-f.yml b/.github/workflows/lin-auto-aocc-f.yml index 0dc3929d05..6422fece6c 100644 --- a/.github/workflows/lin-auto-aocc-f.yml +++ b/.github/workflows/lin-auto-aocc-f.yml @@ -39,19 +39,19 @@ jobs: tar -xvf aocc-compiler-4.1.0.tar cd aocc-compiler-4.1.0 bash install.sh - source /home/runner/work/hdf4-1/hdf4-1/setenv_AOCC.sh + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh which clang which flang clang -v - name: Install HDF4 run: | - source /home/runner/work/hdf4-1/hdf4-1/setenv_AOCC.sh + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh which clang - export LD_LIBRARY_PATH=/home/runner/work/hdf4-1/hdf4-1/aocc-compiler-4.1.0/lib:/usr/local/lib - export LD_RUN_PATH=/home/runner/work/hdf4-1/hdf4-1/aocc-compiler-4.1.0/lib:/usr/local/lib + export LD_LIBRARY_PATH=/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/lib:/usr/local/lib + export LD_RUN_PATH=/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/lib:/usr/local/lib export PATH=/usr/local/bin:$PATH ./autogen.sh - ./configure --prefix=/tmp --enable-fortran --enable-shared CC=clang F77=flang LDFLAGS="-L/home/runner/work/hdf4-1/hdf4-1/aocc-compiler-4.1.0/lib" + ./configure --prefix=/tmp --enable-fortran --enable-shared CC=clang F77=flang LDFLAGS="-L/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/lib" make -j make check -j make install diff --git a/.github/workflows/lin-auto-aocc.yml b/.github/workflows/lin-auto-aocc.yml index 823091193d..bbbbc7a140 100644 --- a/.github/workflows/lin-auto-aocc.yml +++ b/.github/workflows/lin-auto-aocc.yml @@ -39,19 +39,19 @@ jobs: tar -xvf aocc-compiler-4.1.0.tar cd aocc-compiler-4.1.0 bash install.sh - source /home/runner/work/hdf4-1/hdf4-1/setenv_AOCC.sh + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh which clang which flang clang -v - name: Install HDF4 run: | - source /home/runner/work/hdf4-1/hdf4-1/setenv_AOCC.sh + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh which clang - export LD_LIBRARY_PATH=/home/runner/work/hdf4-1/hdf4-1/aocc-compiler-4.1.0/lib:/usr/local/lib - export LD_RUN_PATH=/home/runner/work/hdf4-1/hdf4-1/aocc-compiler-4.1.0/lib:/usr/local/lib + export LD_LIBRARY_PATH=/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/lib:/usr/local/lib + export LD_RUN_PATH=/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/lib:/usr/local/lib export PATH=/usr/local/bin:$PATH ./autogen.sh - ./configure --prefix=/tmp --enable-shared CC=clang LDFLAGS="-L/home/runner/work/hdf4-1/hdf4-1/aocc-compiler-4.1.0/lib" + ./configure --prefix=/tmp --enable-shared CC=clang LDFLAGS="-L/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/lib" make -j make check -j make install diff --git a/.github/workflows/lin-auto-gcc_arm64.yml b/.github/workflows/lin-auto-gcc_arm64.yml index b7f994f03a..0413712663 100644 --- a/.github/workflows/lin-auto-gcc_arm64.yml +++ b/.github/workflows/lin-auto-gcc_arm64.yml @@ -15,43 +15,24 @@ jobs: uses: actions/checkout@v4 - name: Build and Test run: | - echo $PWD - echo $PATH wget -q https://musl.cc/aarch64-linux-musl-cross.tgz tar -xzf aarch64-linux-musl-cross.tgz ./aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc --version sudo cp -r ./aarch64-linux-musl-cross/aarch64-linux-musl/lib/* /lib/ - git clone https://github.com/alisw/libtirpc - cd libtirpc - mkdir -p src/sys - cd src/sys - wget https://raw.githubusercontent.com/openbsd/src/master/sys/sys/queue.h - wget https://raw.githubusercontent.com/openbsd/src/master/sys/sys/_null.h - cd ../.. - chmod u+x ./autogen.sh - ./autogen.sh - ./configure CC=/home/runner/work/hdf4-1/hdf4-1/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc AR=/home/runner/work/hdf4-1/hdf4-1/aarch64-linux-musl-cross/bin/aarch64-linux-musl-ar --disable-gssapi --host=aarch64-linux-musl --prefix=/home/runner/work/hdf4-1/hdf4-1/aarch64-linux-musl-cross - make - sudo make install - cd .. wget -q https://gamma.hdfgroup.org/ftp/pub/outgoing/h4map/src/h4map.tar.gz tar -xzf h4map.tar.gz cd h4map/jpeg-6b - ./configure CC=/home/runner/work/hdf4-1/hdf4-1/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc AR=/home/runner/work/hdf4-1/hdf4-1/aarch64-linux-musl-cross/bin/aarch64-linux-musl-ar --prefix=/home/runner/work/hdf4-1/hdf4-1/aarch64-linux-musl-cross + ./configure CC=/home/runner/work/hdf4/hdf4/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc AR=/home/runner/work/hdf4/hdf4/aarch64-linux-musl-cross/bin/aarch64-linux-musl-ar --prefix=/home/runner/work/hdf4/hdf4/aarch64-linux-musl-cross make sudo make install-lib cd ../.. - pwd - ls git clone https://github.com/madler/zlib cd zlib - CC=/home/runner/work/hdf4-1/hdf4-1/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc AR=/home/runner/work/hdf4-1/hdf4-1/aarch64-linux-musl-cross/bin/aarch64-linux-musl-ar ./configure --prefix=/home/runner/work/hdf4-1/hdf4-1/aarch64-linux-musl-cross + CC=/home/runner/work/hdf4/hdf4/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc AR=/home/runner/work/hdf4/hdf4/aarch64-linux-musl-cross/bin/aarch64-linux-musl-ar ./configure --prefix=/home/runner/work/hdf4/hdf4/aarch64-linux-musl-cross --static make sudo make install cd .. - pwd - ls autoreconf -fvi - ./configure CC=/home/runner/work/hdf4-1/hdf4-1/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc CXX=/home/runner/work/hdf4-1/hdf4-1/aarch64-linux-musl-cross/bin/aarch64-linux-musl-g++ AR=/home/runner/work/hdf4-1/hdf4-1/aarch64-linux-musl-cross/bin/aarch64-linux-musl-ar CFLAGS="-I/home/runner/work/hdf4-1/hdf4-1/aarch64-linux-musl-cross/include/tirpc/" LDFLAGS="-L/home/runner/work/hdf4-1/hdf4-1/aarch64-linux-musl-cross/lib/ -ltirpc" --host=aarch64-linux-musl --disable-netcdf --disable-fortran --prefix=/home/runner/work/hdf4-1/hdf4-1/aarch64-linux-musl-cross --with-jpeg=/home/runner/work/hdf4-1/hdf4-1/aarch64-linux-musl-cross --with-zlib=/home/runner/work/hdf4-1/hdf4-1/aarch64-linux-musl-cross + ./configure CC=/home/runner/work/hdf4/hdf4/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc CXX=/home/runner/work/hdf4/hdf4/aarch64-linux-musl-cross/bin/aarch64-linux-musl-g++ AR=/home/runner/work/hdf4/hdf4/aarch64-linux-musl-cross/bin/aarch64-linux-musl-ar LDFLAGS="-L/home/runner/work/hdf4/hdf4/aarch64-linux-musl-cross/lib/" --host=aarch64-linux-musl --disable-netcdf --disable-fortran --prefix=/home/runner/work/hdf4/hdf4/aarch64-linux-musl-cross --with-jpeg=/home/runner/work/hdf4/hdf4/aarch64-linux-musl-cross --with-zlib=/home/runner/work/hdf4/hdf4/aarch64-linux-musl-cross make make check diff --git a/.github/workflows/main-auto.yml b/.github/workflows/main-auto.yml index 94e65aaaa7..1ca6ec81dc 100644 --- a/.github/workflows/main-auto.yml +++ b/.github/workflows/main-auto.yml @@ -50,7 +50,7 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Get Sources - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.1 # AUTOTOOLS CONFIGURE - name: Autotools Configure diff --git a/.github/workflows/main-cmake-mingw.yml b/.github/workflows/main-cmake-mingw.yml index 1c55852cd5..f7fcc1fce8 100644 --- a/.github/workflows/main-cmake-mingw.yml +++ b/.github/workflows/main-cmake-mingw.yml @@ -52,7 +52,7 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Get Sources - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.1 # # CMAKE CONFIGURE diff --git a/.github/workflows/main-cmake.yml b/.github/workflows/main-cmake.yml index 81b59b9c3d..b6b5a65309 100644 --- a/.github/workflows/main-cmake.yml +++ b/.github/workflows/main-cmake.yml @@ -225,4 +225,3 @@ jobs: path: ${{ runner.workspace }}/build/HDF-*-Darwin.tar.gz if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` if: ${{ (matrix.os == 'macos-13') && (inputs.netcdf == 'true') && (inputs.shared == 'true') }} - diff --git a/.github/workflows/msys2-cmake.yml b/.github/workflows/msys2-cmake.yml index c4b4157738..82e6ae3f71 100644 --- a/.github/workflows/msys2-cmake.yml +++ b/.github/workflows/msys2-cmake.yml @@ -66,5 +66,5 @@ jobs: # RUN TESTS - name: CMake Run Tests run: | - ctest . --parallel 2 -C ${{ inputs.build_mode }} -V -E "HDP-dumpv|h4ex_GR_create|h4ex_GR_write|h4ex_VG_add" + ctest . --parallel 2 -C ${{ inputs.build_mode }} -V working-directory: ${{ runner.workspace }}/build diff --git a/.github/workflows/netcdf.yml b/.github/workflows/netcdf.yml new file mode 100644 index 0000000000..adb6a0d1cb --- /dev/null +++ b/.github/workflows/netcdf.yml @@ -0,0 +1,67 @@ +name: netCDF dev + +on: + workflow_dispatch: + push: + pull_request: + branches: [ master ] + paths-ignore: + - '.github/CODEOWNERS' + - 'release_notes/**' + - 'COPYING' + - '**.md' + +permissions: + contents: read + +# Using concurrency to cancel any in-progress job or run +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Install System dependencies + run: | + sudo apt update + sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev doxygen openssl libtool libtool-bin + - name: Checkout HDF4 + uses: actions/checkout@v4.1.1 + - name: Install HDF4 + run: | + ./autogen.sh + ./configure --prefix=/usr/local --disable-netcdf --disable-netcdf-tools --enable-shared --with-szlib + make -j + sudo make install -j + + - name: Checkout HDF5 + uses: actions/checkout@v4.1.1 + with: + repository: HDFGroup/hdf5 + path: hdf5 + - name: Install HDF5 + run: | + cd hdf5 + ./autogen.sh + ./configure --prefix=/usr/local --disable-tests --disable-static --enable-shared --enable-hl --with-szlib + make -j + sudo make install -j + + - name: Checkout netCDF + uses: actions/checkout@v4.1.1 + with: + repository: unidata/netcdf-c + path: netcdf-c + - name: Test netCDF + run: | + cd netcdf-c + autoreconf -if + CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./configure --enable-hdf5 --enable-hdf4 --enable-hdf4-file-tests --enable-dap --disable-dap-remote-tests --enable-external-server-tests + cat config.log + cat libnetcdf.settings + CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} make -j + CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} make check TESTS="" -j + LD_LIBRARY_PATH="/home/runner/work/hdf4/hdf4/netcdf-c/liblib/.libs:/usr/local/lib:${LD_LIBRARY_PATH}" + CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} make check -j diff --git a/.github/workflows/nvhpc-auto.yml b/.github/workflows/nvhpc-auto.yml new file mode 100644 index 0000000000..803eab9042 --- /dev/null +++ b/.github/workflows/nvhpc-auto.yml @@ -0,0 +1,82 @@ +name: hdf4 dev autotools nvhpc + +on: + workflow_call: + inputs: + build_mode: + description: "release vs. debug build" + required: true + type: string + +permissions: + contents: read + +jobs: + nvhpc_build_and_test: + name: "nvhpc ${{ inputs.build_mode }}" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install autoconf automake libtool libtool-bin libaec-dev + + - name: Install NVHPC + shell: bash + run: | + curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg + echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list + sudo apt-get update -y + sudo apt-get install -y nvhpc-23-9 + echo "NVHPCSDK=/opt/nvidia/hpc_sdk" >> $GITHUB_ENV + echo "OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvc" >> $GITHUB_ENV + echo "OMPI_FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvfortran" >> $GITHUB_ENV + echo "CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvc" >> $GITHUB_ENV + echo "FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvfortran" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/lib" >> $GITHUB_ENV + echo "DESTDIR=/tmp" >> $GITHUB_ENV + + - name: Autotools Configure + shell: bash + run: | + export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH + sh ./autogen.sh + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + $GITHUB_WORKSPACE/configure \ + FCFLAGS="-fPIC -fortranlibs" \ + --enable-build-mode=${{ inputs.build_mode }} \ + --disable-fortran \ + --enable-shared \ + #cat config.log + + # BUILD + - name: Autotools Build + shell: bash + run: | + export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH + make -j3 + working-directory: ${{ runner.workspace }}/build + + # RUN TESTS + # NORMAL + - name: Autotools Run Tests + run: | + export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH + make check -j + working-directory: ${{ runner.workspace }}/build + + # INSTALL (note that this runs even when we don't run the tests) + - name: Autotools Install + run: | + export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH + make install + working-directory: ${{ runner.workspace }}/build + +# - name: Autotools Verify Install +# run: | +# export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH +# make check-install +# working-directory: ${{ runner.workspace }}/build diff --git a/.github/workflows/nvhpc-cmake.yml b/.github/workflows/nvhpc-cmake.yml new file mode 100644 index 0000000000..b125db5c50 --- /dev/null +++ b/.github/workflows/nvhpc-cmake.yml @@ -0,0 +1,71 @@ +name: hdf4 dev CMake nvhpc + +on: + workflow_call: + inputs: + build_mode: + description: "release vs. debug build" + required: true + type: string + +permissions: + contents: read + +jobs: + nvhpc_build_and_test: + name: "nvhpc ${{ inputs.build_mode }}" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + + - name: Install Linux dependencies + shell: bash + run: | + sudo apt update + sudo apt-get install ninja-build doxygen graphviz + sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev + sudo apt install -y libaec-dev zlib1g-dev wget curl bzip2 flex bison cmake libzip-dev openssl build-essential + + - name: Install NVHPC + shell: bash + run: | + curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg + echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list + sudo apt-get update -y + sudo apt-get install -y nvhpc-23-9 + echo "NVHPCSDK=/opt/nvidia/hpc_sdk" >> $GITHUB_ENV + echo "OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvc" >> $GITHUB_ENV + echo "OMPI_FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvfortran" >> $GITHUB_ENV + echo "CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvc" >> $GITHUB_ENV + echo "FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvfortran" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/lib64:/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/lib" >> $GITHUB_ENV + echo "DESTDIR=/tmp" >> $GITHUB_ENV + + - name: CMake Configure with nvc + shell: bash + run: | + export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake -G Ninja \ + -DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \ + -DJPEG_USE_LOCALCONTENT=OFF \ + -DLIBAEC_USE_LOCALCONTENT=OFF \ + -DZLIB_USE_LOCALCONTENT=OFF \ + -DHDF4_BUILD_FORTRAN:BOOL=ON \ + -DHDF4_BUILD_JAVA:BOOL=OFF \ + $GITHUB_WORKSPACE + + # BUILD + - name: CMake Build + shell: bash + run: | + cmake --build . --parallel 3 --config ${{ inputs.build_mode }} + working-directory: ${{ runner.workspace }}/build + + # RUN TESTS + - name: CMake Run Tests + shell: bash + run: | + ctest . --parallel 2 -C ${{ inputs.build_mode }} -V + working-directory: ${{ runner.workspace }}/build diff --git a/.github/workflows/powerpc64.yml b/.github/workflows/powerpc64.yml index 9bcfcb70e8..1249d04492 100644 --- a/.github/workflows/powerpc64.yml +++ b/.github/workflows/powerpc64.yml @@ -18,7 +18,7 @@ jobs: name: Ubuntu PowerPC Autotools steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.1.1 - uses: uraimo/run-on-arch-action@v2 name: Run commands @@ -58,7 +58,7 @@ jobs: name: Ubuntu PowerPC CMake steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.1.1 - uses: uraimo/run-on-arch-action@v2 name: Run commands diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index 52db808a31..7467887261 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -27,19 +27,13 @@ jobs: version: '${{ matrix.os.version }}' shell: bash run: | - uname -a - echo $SHELL - pwd - ls -lah - whoami - env | sort sudo pkg_add git - git clone https://github.com/HDFGroup/hdf4 - cd hdf4 sudo pkg_add cmake sudo pkg_add jpeg + git clone https://github.com/hyoklee/hdf4 + cd hdf4 mkdir build cd build - cmake -DHDF4_BUILD_FORTRAN:BOOL=OFF .. - make - make test + cmake .. + cmake -T Build + cmake -T Test diff --git a/.github/workflows/r2.yml b/.github/workflows/r2.yml deleted file mode 100644 index 248eeb35fb..0000000000 --- a/.github/workflows/r2.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: r2 - -on: [push, pull_request] - -jobs: - test: # make sure the action works on a clean machine without building - name: ${{ matrix.os.name }} ${{ matrix.os.architecture }} ${{ matrix.os.version }} on ${{ matrix.os.host }} - runs-on: ${{ matrix.os.host }} - strategy: - fail-fast: false - matrix: - os: - - name: openbsd - architecture: x86-64 - version: '7.4' - host: ubuntu-latest - steps: - - name: ${{ matrix.os.name }} - uses: cross-platform-actions/action@v0.22.0 - env: - FOO: A - BAR: B - with: - environment_variables: FOO BAR - operating_system: ${{ matrix.os.name }} - architecture: ${{ matrix.os.architecture }} - version: '${{ matrix.os.version }}' - shell: bash - run: | - uname -a - echo $SHELL - pwd - ls -lah - whoami - env | sort - sudo pkg_add git - git clone https://github.com/hyoklee/hdf4-1 hdf4 - cd hdf4 - sudo pkg_add cmake - sudo pkg_add jpeg - mkdir build - cd build - cmake -D HDF4_BUILD_FORTRAN:BOOL=OFF -D CTEST_DROP_SITE_INIT:STRING="my.cdash.org" -D SITE:STRING=obsd .. - ctest -T Build --output-on-error -j - ctest -T Test --output-on-error -j - ctest -T Submit diff --git a/.github/workflows/remove-files.yml b/.github/workflows/remove-files.yml new file mode 100644 index 0000000000..cdfa063b7a --- /dev/null +++ b/.github/workflows/remove-files.yml @@ -0,0 +1,58 @@ +name: hdf4 dev remove-files + +# Controls when the action will run. Triggers the workflow on a schedule +on: + workflow_call: + inputs: + use_tag: + description: 'Release version tag' + type: string + required: false + default: snapshot + use_environ: + description: 'Environment to locate files' + type: string + required: true + default: snapshots + file_base: + description: "The common base name of the source tarballs" + required: true + type: string + +# Minimal permissions to be inherited by any job that doesn't declare its own permissions +permissions: + contents: read + +# Previous workflows must pass to get here so tag the commit that created the files +jobs: + PreRelease-delfiles: + runs-on: ubuntu-latest + environment: ${{ inputs.use_environ }} + permissions: + contents: write + steps: + - name: Get file base name + id: get-file-base + run: | + FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") + echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + + - name: PreRelease delete from tag + id: delete_prerelease + if: ${{ (inputs.use_environ == 'snapshots') }} + uses: mknejp/delete-release-assets@v1 + with: + token: ${{ github.token }} + tag: "${{ inputs.use_tag }}" + assets: | + ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip + ${{ steps.get-file-base.outputs.FILE_BASE }}.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}.zip + ${{ steps.get-file-base.outputs.FILE_BASE }}-osx12.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-win-vs2022_cl.zip + ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_intel.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-win-vs2022_intel.zip +# ${{ steps.get-file-base.outputs.FILE_BASE }}-hdf_compat_report.html +# ${{ steps.get-file-base.outputs.FILE_BASE }}-mfhdf_compat_report.html +# ${{ steps.get-file-base.outputs.FILE_BASE }}-java_compat_report.html diff --git a/CMakeLists.txt b/CMakeLists.txt index 189f542dfb..b4415cb25e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,6 +149,7 @@ mark_as_advanced (HDF4_NO_PACKAGES) # Set the core names of all the libraries #----------------------------------------------------------------------------- set (HDF4_SRC_LIB_CORENAME "hdf") +set (HDF4_SRC_LIB_SYM_CORENAME "df") set (HDF4_SRC_FCSTUB_LIB_CORENAME "hdf_fcstub") set (HDF4_SRC_FORTRAN_LIB_CORENAME "hdf_fortran") set (HDF4_MF_LIB_CORENAME "mfhdf") @@ -166,6 +167,7 @@ set (HDF4_JAVA_TEST_LIB_CORENAME "jartest4") # Set the true names of all the libraries if customized by external project #----------------------------------------------------------------------------- set (HDF4_SRC_LIB_NAME "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_SRC_LIB_CORENAME}") +set (HDF4_SRC_LIB_SYM_NAME "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_SRC_LIB_SYM_CORENAME}") set (HDF4_SRC_FCSTUB_LIB_NAME "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_SRC_FCSTUB_LIB_CORENAME}") set (HDF4_SRC_FORTRAN_LIB_NAME "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_SRC_FORTRAN_LIB_CORENAME}") set (HDF4_MF_LIB_NAME "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_MF_LIB_CORENAME}") @@ -183,6 +185,7 @@ set (HDF4_JAVA_TEST_LIB_NAME "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_JAVA_TEST_LIB # Set the target names of all the libraries #----------------------------------------------------------------------------- set (HDF4_SRC_LIB_TARGET "${HDF4_SRC_LIB_CORENAME}-static") +set (HDF4_SRC_LIB_SYM_TARGET "${HDF4_SRC_LIB_SYM_CORENAME}-static") set (HDF4_SRC_FCSTUB_LIB_TARGET "${HDF4_SRC_FCSTUB_LIB_CORENAME}-static") set (HDF4_SRC_FORTRAN_LIB_TARGET "${HDF4_SRC_FORTRAN_LIB_CORENAME}-static") set (HDF4_MF_LIB_TARGET "${HDF4_MF_LIB_CORENAME}-static") @@ -195,6 +198,7 @@ set (HDF4_TOOLS_LIB_TARGET "${HDF4_TOOLS_LIB_CORENAME}-static") set (HDF4_JAVA_JNI_LIB_TARGET "${HDF4_JAVA_JNI_LIB_CORENAME}") set (HDF4_JAVA_HDF_LIB_TARGET "${HDF4_JAVA_HDF_LIB_CORENAME}") set (HDF4_JAVA_TEST_LIB_TARGET "${HDF4_JAVA_TEST_LIB_CORENAME}") +set (HDF4_SRC_LIBSH_SYM_TARGET "${HDF4_SRC_LIB_SYM_CORENAME}-shared") set (HDF4_SRC_LIBSH_TARGET "${HDF4_SRC_LIB_CORENAME}-shared") set (HDF4_SRC_FCSTUB_LIBSH_TARGET "${HDF4_SRC_FCSTUB_LIB_CORENAME}-shared") set (HDF4_SRC_FORTRAN_LIBSH_TARGET "${HDF4_SRC_FORTRAN_LIB_CORENAME}-shared") @@ -228,9 +232,9 @@ set (HDF4_SRC_INCLUDE_DIRS ${HDF4_HDFSOURCE_DIR} ${HDF4_MFHDFSOURCE_DIR}) set (CMAKE_MODULE_PATH ${HDF_RESOURCES_DIR} ${CMAKE_MODULE_PATH}) #----------------------------------------------------------------------------- -# parse the full version number from hfile.h and include in H4_VERS_INFO +# parse the full version number from hfile_priv.h and include in H4_VERS_INFO #----------------------------------------------------------------------------- -file (READ ${HDF4_HDFSOURCE_DIR}/hfile.h _hfile_h_contents) +file (READ ${HDF4_HDFSOURCE_DIR}/hfile_priv.h _hfile_h_contents) string (REGEX REPLACE ".*#define[ \t]+LIBVER_MAJOR[ \t]+([0-9]*).*$" "\\1" H4_VERS_MAJOR ${_hfile_h_contents}) string (REGEX REPLACE ".*#define[ \t]+LIBVER_MINOR[ \t]+([0-9]*).*$" @@ -331,7 +335,9 @@ set (H4_ENABLE_STATIC_LIB NO) option (BUILD_SHARED_LIBS "Build Shared Libraries" ON) set (H4_ENABLE_SHARED_LIB NO) -# only shared libraries is true if user forces static OFF +option (HDF4_BUILD_STATIC_TOOLS "Build Static Tools NOT Shared Tools" OFF) + +# only shared libraries/tools is true if user forces static OFF if (NOT BUILD_STATIC_LIBS) set (ONLY_SHARED_LIBS ON CACHE BOOL "Only Build Shared Libraries" FORCE) endif () @@ -341,6 +347,15 @@ if (ONLY_SHARED_LIBS) set (H4_ENABLE_STATIC_LIB NO) set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE) set (BUILD_STATIC_LIBS OFF CACHE BOOL "Build Static Libraries" FORCE) + if (HDF4_BUILD_STATIC_TOOLS) + message (WARNING "Cannot build static tools without static libraries. Building shared tools.") + endif () + set (HDF4_BUILD_STATIC_TOOLS OFF CACHE BOOL "Build Static Tools NOT Shared Tools" FORCE) +endif () + +if (NOT BUILD_SHARED_LIBS AND NOT HDF4_BUILD_STATIC_TOOLS) + message (WARNING "Cannot build shared tools without shared libraries. Building static tools.") + set (HDF4_BUILD_STATIC_TOOLS ON CACHE BOOL "Build Static Tools NOT Shared Tools" FORCE) endif () if (BUILD_STATIC_LIBS) @@ -352,12 +367,6 @@ endif () set (CMAKE_POSITION_INDEPENDENT_CODE ON) -if (NOT BUILD_SHARED_LIBS) - set (tgt_file_ext "") -else () - set (tgt_file_ext "-shared") -endif () - add_definitions (-DHAVE_CONFIG_H) #----------------------------------------------------------------------------- @@ -562,9 +571,13 @@ add_subdirectory (mfhdf) # Option to build HDF4 Java Library #----------------------------------------------------------------------------- if (EXISTS "${HDF4_SOURCE_DIR}/java" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/java") - option (HDF4_BUILD_JAVA "Build Java HDF Library" OFF) + option (HDF4_BUILD_JAVA "Build Java HDF Library" OFF) if (HDF4_BUILD_JAVA) - add_subdirectory (java) + if (NOT BUILD_SHARED_LIBS) + message (FATAL_ERROR "\nJava requires shared libraries!\n") + else () + add_subdirectory (java) + endif () endif () endif () diff --git a/CMakePresets.json b/CMakePresets.json index e3d2b31e1a..95281185c6 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -90,6 +90,26 @@ "ci-StdShar" ] }, + { + "name": "ci-StdShar-Clang-Fortran", + "description": "Clang Standard Fortran Config for x64 (Release)", + "inherits": [ + "ci-x64-Release-Clang", + "ci-Fortran", + "ci-Java", + "ci-StdShar" + ] + }, + { + "name": "ci-StdShar-GNUC-Fortran", + "description": "GNUC Standard Fortran Config for x64 (Release)", + "inherits": [ + "ci-x64-Release-GNUC", + "ci-Fortran", + "ci-Java", + "ci-StdShar" + ] + }, { "name": "ci-StdShar-Intel", "description": "Intel Standard Config for x64 (Release)", @@ -109,6 +129,14 @@ "ci-x64-Release-MSVC" ] }, + { + "name": "ci-StdShar-Clang-Fortran", + "description": "Clang Standard Fortran Build for x64 (Release)", + "configurePreset": "ci-StdShar-Clang-Fortran", + "inherits": [ + "ci-x64-Release-Clang" + ] + }, { "name": "ci-StdShar-Clang", "description": "Clang Standard Build for x64 (Release)", @@ -117,6 +145,15 @@ "ci-x64-Release-Clang" ] }, + { + "name": "ci-StdShar-GNUC-Fortran", + "description": "GNUC Standard Fortran Build for x64 (Release)", + "configurePreset": "ci-StdShar-GNUC-Fortran", + "verbose": true, + "inherits": [ + "ci-x64-Release-GNUC" + ] + }, { "name": "ci-StdShar-GNUC", "description": "GNUC Standard Build for x64 (Release)", @@ -151,6 +188,13 @@ "ci-x64-Release-Clang" ] }, + { + "name": "ci-StdShar-Clang-Fortran", + "configurePreset": "ci-StdShar-Clang-Fortran", + "inherits": [ + "ci-x64-Release-Clang" + ] + }, { "name": "ci-StdShar-OSX-Clang", "configurePreset": "ci-StdShar-Clang", @@ -176,21 +220,11 @@ ] }, { - "name": "ci-StdShar-win-Intel", - "configurePreset": "ci-StdShar-Intel", + "name": "ci-StdShar-GNUC-Fortran", + "configurePreset": "ci-StdShar-GNUC-Fortran", "inherits": [ - "ci-x64-Release-Intel" - ], - "filter": { - "exclude": { - "name": "HDP-dumpv|h4ex_GR_create|h4ex_GR_write|h4ex_VG_add" - } - }, - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Windows" - } + "ci-x64-Release-GNUC" + ] }, { "name": "ci-StdShar-Intel", @@ -211,11 +245,21 @@ "configurePreset": "ci-StdShar-Clang", "inherits": "ci-x64-Release-Clang" }, + { + "name": "ci-StdShar-Clang-Fortran", + "configurePreset": "ci-StdShar-Clang-Fortran", + "inherits": "ci-x64-Release-Clang" + }, { "name": "ci-StdShar-GNUC", "configurePreset": "ci-StdShar-GNUC", "inherits": "ci-x64-Release-GNUC" }, + { + "name": "ci-StdShar-GNUC-Fortran", + "configurePreset": "ci-StdShar-GNUC-Fortran", + "inherits": "ci-x64-Release-GNUC" + }, { "name": "ci-StdShar-Intel", "configurePreset": "ci-StdShar-Intel", @@ -241,6 +285,15 @@ {"type": "package", "name": "ci-StdShar-Clang"} ] }, + { + "name": "ci-StdShar-Clang-Fortran", + "steps": [ + {"type": "configure", "name": "ci-StdShar-Clang-Fortran"}, + {"type": "build", "name": "ci-StdShar-Clang-Fortran"}, + {"type": "test", "name": "ci-StdShar-Clang-Fortran"}, + {"type": "package", "name": "ci-StdShar-Clang-Fortran"} + ] + }, { "name": "ci-StdShar-OSX-Clang", "steps": [ @@ -260,20 +313,20 @@ ] }, { - "name": "ci-StdShar-Intel", + "name": "ci-StdShar-GNUC-Fortran", "steps": [ - {"type": "configure", "name": "ci-StdShar-Intel"}, - {"type": "build", "name": "ci-StdShar-Intel"}, - {"type": "test", "name": "ci-StdShar-Intel"}, - {"type": "package", "name": "ci-StdShar-Intel"} + {"type": "configure", "name": "ci-StdShar-GNUC-Fortran"}, + {"type": "build", "name": "ci-StdShar-GNUC-Fortran"}, + {"type": "test", "name": "ci-StdShar-GNUC-Fortran"}, + {"type": "package", "name": "ci-StdShar-GNUC-Fortran"} ] }, { - "name": "ci-StdShar-win-Intel", + "name": "ci-StdShar-Intel", "steps": [ {"type": "configure", "name": "ci-StdShar-Intel"}, {"type": "build", "name": "ci-StdShar-Intel"}, - {"type": "test", "name": "ci-StdShar-win-Intel"}, + {"type": "test", "name": "ci-StdShar-Intel"}, {"type": "package", "name": "ci-StdShar-Intel"} ] } diff --git a/COPYING b/COPYING index 50fad56a21..f68a28e10e 100644 --- a/COPYING +++ b/COPYING @@ -55,3 +55,40 @@ and Digital Equipment Corporation (DEC). --------------------------------------------------------------------------- +--------------------------------------------------------------------------- +--------------------------------------------------------------------------- + +3rd-party software included in HDF4: XDR + +HDF4 builds the Sun RPC version of XDR as an internal 3rd-party I/O +library under this license: + + Sun RPC is a product of Sun Microsystems, Inc. and is provided for + unrestricted use provided that this legend is included on all tape + media and as a part of the software program in whole or part. Users + may copy or modify Sun RPC without charge, but are not authorized + to license or distribute it to anyone else except as part of a product or + program developed by the user. + + SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + + Sun RPC is provided with no support and without any obligation on the + part of Sun Microsystems, Inc. to assist in its use, correction, + modification or enhancement. + + SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + OR ANY PART THEREOF. + + In no event will Sun Microsystems, Inc. be liable for any lost revenue + or profits or other special, indirect and consequential damages, even if + Sun has been advised of the possibility of such damages. + + Sun Microsystems, Inc. + 2550 Garcia Avenue + Mountain View, California 94043 + +--------------------------------------------------------------------------- + diff --git a/HDF4Examples/CMakePresets.json b/HDF4Examples/CMakePresets.json index af284eb781..fa34261c1a 100644 --- a/HDF4Examples/CMakePresets.json +++ b/HDF4Examples/CMakePresets.json @@ -153,23 +153,6 @@ "ci-x64-Release-GNUC" ] }, - { - "name": "ci-StdShar-win-Intel", - "configurePreset": "ci-StdShar-Intel", - "inherits": [ - "ci-x64-Release-Intel" - ], - "filter": { - "exclude": { - "name": "HDP-dumpv|h4ex_GR_create|h4ex_GR_write|h4ex_VG_add" - } - }, - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Windows" - } - }, { "name": "ci-StdShar-Intel", "configurePreset": "ci-StdShar-Intel", @@ -218,14 +201,6 @@ {"type": "build", "name": "ci-StdShar-Intel"}, {"type": "test", "name": "ci-StdShar-Intel"} ] - }, - { - "name": "ci-StdShar-win-Intel", - "steps": [ - {"type": "configure", "name": "ci-StdShar-Intel"}, - {"type": "build", "name": "ci-StdShar-Intel"}, - {"type": "test", "name": "ci-StdShar-win-Intel"} - ] } ] } diff --git a/HDF4Examples/config/cmake/HDFExampleMacros.cmake b/HDF4Examples/config/cmake/HDFExampleMacros.cmake index b9cf3ff137..012abcbbd1 100644 --- a/HDF4Examples/config/cmake/HDFExampleMacros.cmake +++ b/HDF4Examples/config/cmake/HDFExampleMacros.cmake @@ -120,18 +120,6 @@ macro (HDF4_SUPPORT) message (STATUS "HDF4 Fortran libs: static:${HDF4_static_Fortran_FOUND} and shared:${HDF4_shared_Fortran_FOUND}") message (STATUS "HDF4 Java libs: ${HDF4_Java_FOUND}") if (HDF4_FOUND) - if (USE_SHARED_LIBS) - if (NOT TARGET ${HDF4_NAMESPACE}hdp-shared) - add_executable (${HDF4_NAMESPACE}hdp-shared IMPORTED) - endif () - set (H4EX_HDF4_DUMP_EXECUTABLE $) - else () - if (NOT TARGET ${HDF4_NAMESPACE}hdp) - add_executable (${HDF4_NAMESPACE}hdp IMPORTED) - endif() - set (H4EX_HDF4_DUMP_EXECUTABLE $) - endif() - if (NOT HDF4_static_C_FOUND AND NOT HDF4_shared_C_FOUND) #find library from non-dual-binary package set (FIND_HDF_COMPONENTS C) @@ -165,11 +153,20 @@ macro (HDF4_SUPPORT) if (USE_SHARED_LIBS AND HDF4_shared_C_FOUND) set (H4EX_HDF4_LINK_LIBS ${H4EX_HDF4_LINK_LIBS} ${HDF4_C_SHARED_LIBRARY}) set (HDF4_LIBRARY_PATH ${PACKAGE_PREFIX_DIR}/lib) - set_property (TARGET ${HDF4_NAMESPACE}hdp-shared PROPERTY IMPORTED_LOCATION "${HDF4_TOOLS_DIR}/hdp-shared") else () set (H4EX_HDF4_LINK_LIBS ${H4EX_HDF4_LINK_LIBS} ${HDF4_C_STATIC_LIBRARY}) - set_property (TARGET ${HDF4_NAMESPACE}hdp PROPERTY IMPORTED_LOCATION "${HDF4_TOOLS_DIR}/hdp") endif () + if (HDF4_VERSION VERSION_LESS "4.3" AND NOT HDF4_shared_C_FOUND) + if (NOT TARGET ${HDF4_NAMESPACE}hdp-shared) + add_executable (${HDF4_NAMESPACE}hdp-shared IMPORTED) + endif () + set (H4EX_HDF4_DUMP_EXECUTABLE $) + else () + if (NOT TARGET ${HDF4_NAMESPACE}hdp) + add_executable (${HDF4_NAMESPACE}hdp IMPORTED) + endif() + set (H4EX_HDF4_DUMP_EXECUTABLE $) + endif() if (NOT HDF4_static_Fortran_FOUND AND NOT HDF4_shared_Fortran_FOUND) set (HDF_BUILD_FORTRAN OFF CACHE BOOL "Build FORTRAN support" FORCE) message (STATUS "HDF4 Fortran libs not found - disable build of Fortran examples") diff --git a/HDF4Examples/config/cmake/grepTest.cmake b/HDF4Examples/config/cmake/grepTest.cmake index f5d66ee9e1..75ad68b295 100644 --- a/HDF4Examples/config/cmake/grepTest.cmake +++ b/HDF4Examples/config/cmake/grepTest.cmake @@ -61,11 +61,18 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}") message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () + string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () endif () # if the TEST_ERRREF exists grep the error output with the error reference diff --git a/HDF4Examples/config/cmake/runTest.cmake b/HDF4Examples/config/cmake/runTest.cmake index 2deb4ab434..4e48fec8fa 100644 --- a/HDF4Examples/config/cmake/runTest.cmake +++ b/HDF4Examples/config/cmake/runTest.cmake @@ -122,11 +122,18 @@ endif () message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () + string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () endif () # remove special error output @@ -137,7 +144,7 @@ else () # the error stack remains in the .err file file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) endif () -string (FIND TEST_STREAM "no version information available" TEST_FIND_RESULT) +string (FIND "${TEST_STREAM}" "no version information available" TEST_FIND_RESULT) if (TEST_FIND_RESULT GREATER -1) string (REGEX REPLACE "^.*no version information available[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") # write back the changes to the original files diff --git a/README.md b/README.md index 0cdb0454be..c1e52027a4 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ DOCUMENTATION ------------- Full Documentation and Programming Resources for this release can be found at - https://portal.hdfgroup.org/display/HDF4 + https://portal.hdfgroup.org/hdf4/ See the RELEASE.txt file in the release\_notes/ directory for information specific to the features and updates included in this release of the library. @@ -78,8 +78,8 @@ Periodically development code snapshots are provided at the following URL: https://github.com/HDFGroup/hdf4/releases/tag/snapshot Source packages for current and previous releases are located at: - - https://portal.hdfgroup.org/display/support/Download+HDF4 + + https://portal.hdfgroup.org/downloads/ Development code is available at our Github location: diff --git a/bin/h4_release_check.sh b/bin/h4_release_check.sh index df4e15f711..671350e4d2 100755 --- a/bin/h4_release_check.sh +++ b/bin/h4_release_check.sh @@ -83,12 +83,11 @@ fi # TESTING IF FILES EXISTS ######################### -include_file=(atom.h bitvect.h cdeflate.h cnbit.h cnone.h crle.h cskphuff.h cszip.h dfan.h -dffunc.f90 dffunc.inc dfgr.h df.h dfrig.h dfsd.h dfufp2i.h dynarray.h H4api_adpt.h -h4config.h hbitio.h hchunks.h hcomp.h hcompi.h hconv.h hdatainfo.h hdf2netcdf.h hdf.f90 -hdf.h hdfi.h hdf.inc herr.h hfile.h hkit.h hlimits.h hntdefs.h hproto_fortran.h hproto.h -htags.h linklist.h local_nc.h mfan.h mfani.h mfdatainfo.h mffunc.f90 mffunc.inc mfgr.h -mfgri.h mfhdf.h mfhdfi.h mstdio.h netcdf.f90 netcdf.h netcdf.inc tbbt.h vg.h) +include_file=( +dffunc.f90 dffunc.inc H4api_adpt.h h4config.h hbitio.h hcomp.h hdatainfo.h +hdf2netcdf.h hdf.f90 hdf.h hdf.inc herr.h hlimits.h hntdefs.h hproto_fortran.h hproto.h +htags.h mfan.h mfdatainfo.h mffunc.f90 mffunc.inc mfgr.h mfhdf.h netcdf.f90 netcdf.h +netcdf.inc vg.h) lib_file=(libdf.a libdf.la libhdf4.settings libjpeg.a libmfhdf.a libmfhdf.la libsz.a libz.a) diff --git a/bin/h4vers b/bin/h4vers index 15e9bba9d8..9f6b5d7a74 100755 --- a/bin/h4vers +++ b/bin/h4vers @@ -27,7 +27,7 @@ use strict; ### Purpose # Increments the hdf4 version number by changing the value of -# constants in the hdf/src/hfile.h file. The new version number is +# constants in the hdf/src/hfile_priv.h file. The new version number is # printed on the standard output. An alternate source file name can be # specified as an argument. In any case, the original file is saved # by appending a tilde `~' to the name. @@ -61,11 +61,11 @@ use strict; # and the annotation string is cleared. # # If a file is specified then that file is used instead of -# ./hfile.h or ./hdf/src/hfile.h. +# ./hfile_priv.h or ./hdf/src/hfile_priv.h. # # If the version number is changed (either `-s' or `-i' was used on # the command line) then the first line of the README.md and -# release_notes/RELEASE.txt two levels above the hfile.h file are also +# release_notes/RELEASE.txt two levels above the hfile_priv.h file are also # modified so it looks something like: This is hdf4-1.2.3-pre1 currently # under development. The AC_INIT macro in configure.in will also change # in this case to be something like: AC_INIT([HDF4], [hdf4-1.2.3-pre1], @@ -128,15 +128,15 @@ Usage: $prog [OPTS] [FILE] as \"version 1.1 release 0 (pre1)\" will be printed. FILE The name of the file that contains version information. This is - seldom necessary since files hfile.h, hdf/src/hfile.h, - src/hfile.h, and ../hdf/src/hfile.h are automatically checked. + seldom necessary since files hfile_priv.h, hdf/src/hfile_priv.h, + src/hfile_priv.h, and ../hdf/src/hfile_priv.h are automatically checked. EOF exit 1; } # Parse arguments my ($verbose, $set, $inc, $file, $rc); -my (@files) = ("hdf/src/hfile.h", "../hdf/src/hfile.h", "src/hfile.h", "hfile.h"); +my (@files) = ("hdf/src/hfile_priv.h", "../hdf/src/hfile_priv.h", "src/hfile_priv.h", "hfile_priv.h"); while ($_ = shift) { $_ eq "-s" && do { die "-s switch needs a version number\n" unless @ARGV; @@ -168,12 +168,12 @@ die "mutually exclusive options given\n" if $set && $inc; #print "file is $file.\n"; #print "File array is ", @files; -# Determine file to use as hfile.h, README.md, +# Determine file to use as hfile_priv.h, README.md, # release_notes/RELEASE.txt, configure.in, # and config/cmake/scripts/HDF4config.cmake. # The paths to README.md, release_notes/RELEASE.txt, configure.ac, # and config/cmake/scripts/HDF4config.cmake -# files are always from the directory two levels above hfile.h. +# files are always from the directory two levels above hfile_priv.h. unless ($file) { for (@files) { ($file=$_,last) if -f $_; diff --git a/config/clang-flags b/config/clang-flags index 5698608c0e..3dac6d79e7 100644 --- a/config/clang-flags +++ b/config/clang-flags @@ -4,6 +4,20 @@ # after configure starts and defines, among other things, flags for # the various compilation modes. +# +# Prepend `$srcdir/config/clang-warnings/` to the filename suffix(es) given as +# subroutine argument(s), remove comments starting with # and ending +# at EOL, replace spans of whitespace (including newlines) with spaces, +# and re-emit the file(s) thus filtered on the standard output stream. +# +load_clang_arguments() +{ + set -- $(for arg; do + sed 's,#.*$,,' $srcdir/config/clang-warnings/${arg} + done) + IFS=' ' echo "$*" +} + # Get the compiler version in a way that works for clang # unless a compiler version is already known # @@ -43,15 +57,31 @@ if test "X-clang" = "X-$cc_vendor" -o "X-Apple LLVM" = "X-$cc_vendor"; then echo "compiler '$CC' is $cc_vendor-$cc_version" CFLAGS="$CFLAGS -Wno-error=implicit-function-declaration" - CFLAGS="$CFLAGS -std=c99 -Wall -pedantic" + CFLAGS="$CFLAGS -std=c99" - DEBUG_CFLAGS="-g" + DEBUG_CFLAGS="-g -ftrapv -fno-common" + # -Og is only understood by clang 4+ and Xcode 9+ + # Otherwise use -O1 (which is what -Og usually equates to) + if test "X-clang" = "X-$cc_vendor" -a $cc_vers_major -ge 4 -o "X-Apple LLVM" = "X-$cc_vendor" -a $cc_vers_major -ge 9; then + DEBUG_CFLAGS="$DEBUG_CFLAGS -Og" + else + DEBUG_CFLAGS="$DEBUG_CFLAGS -O1" + fi DEBUG_CPPFLAGS= - PROD_CFLAGS="-O2" + + PROD_CFLAGS="-O3" PROD_CPPFLAGS= + PROFILE_CFLAGS="-pg" PROFILE_CPPFLAGS= + ########### + # General # + ########### + + CFLAGS="$CFLAGS $(load_clang_arguments general)" + CFLAGS="$CFLAGS $(load_clang_arguments no-developer-general)" + ################# # Flags are set # ################# diff --git a/config/cmake-presets/hidden-presets.json b/config/cmake-presets/hidden-presets.json index 0e2246812d..eae754e986 100644 --- a/config/cmake-presets/hidden-presets.json +++ b/config/cmake-presets/hidden-presets.json @@ -96,6 +96,30 @@ "strategy": "external" } }, + { + "name": "ci-Fortran", + "hidden": true, + "cacheVariables": { + "HDF4_BUILD_FORTRAN": "ON" + }, + "toolset": { + "value": "host=x64", + "strategy": "external" + } + }, + { + "name": "ci-Fortran-Clang", + "hidden": true, + "inherits": "ci-Fortran", + "cacheVariables": { + "CMAKE_Fortran_COMPILER": {"type": "FILEPATH", "value": "gfortran"} + }, + "condition": { + "type": "matches", + "string": "${presetName}", + "regex": ".*-Clang" + } + }, { "name": "ci-Java", "hidden": true, diff --git a/config/cmake/HDF4ExampleCache.cmake b/config/cmake/HDF4ExampleCache.cmake index 7aeb1c90a6..e255a90d32 100644 --- a/config/cmake/HDF4ExampleCache.cmake +++ b/config/cmake/HDF4ExampleCache.cmake @@ -48,4 +48,4 @@ endif () message (STATUS "HDF4 Example link libs: ${H4EX_HDF4_LINK_LIBS} Includes: ${H4EX_HDF4_INCLUDE_DIRS}") set (HDF4_TOOLS_DIR ${CMAKE_TEST_OUTPUT_DIRECTORY} CACHE STRING "HDF4 Directory for all Executables" FORCE) -set (H4EX_HDF4_DUMP_EXECUTABLE $ CACHE STRING "HDF4 hdp target" FORCE) +set (H4EX_HDF4_DUMP_EXECUTABLE $ CACHE STRING "HDF4 hdp target" FORCE) diff --git a/config/cmake/grepTest.cmake b/config/cmake/grepTest.cmake index f5d66ee9e1..75ad68b295 100644 --- a/config/cmake/grepTest.cmake +++ b/config/cmake/grepTest.cmake @@ -61,11 +61,18 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}") message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () + string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () endif () # if the TEST_ERRREF exists grep the error output with the error reference diff --git a/config/cmake/hdf4-config.cmake.in b/config/cmake/hdf4-config.cmake.in index bd6fa1ae0d..f720fadf49 100644 --- a/config/cmake/hdf4-config.cmake.in +++ b/config/cmake/hdf4-config.cmake.in @@ -16,20 +16,29 @@ set (${HDF4_PACKAGE_NAME}_VALID_COMPONENTS #----------------------------------------------------------------------------- # User Options #----------------------------------------------------------------------------- -set (${HDF4_PACKAGE_NAME}_BUILD_FORTRAN @HDF4_BUILD_FORTRAN@) -set (${HDF4_PACKAGE_NAME}_BUILD_JAVA @HDF4_BUILD_JAVA@) -set (${HDF4_PACKAGE_NAME}_BUILD_TOOLS @HDF4_BUILD_TOOLS@) -set (${HDF4_PACKAGE_NAME}_BUILD_UTILS @HDF4_BUILD_UTILS@) +# Languages: +#----------------------------------------------------------------------------- +set (${HDF4_PACKAGE_NAME}_BUILD_FORTRAN @HDF4_BUILD_FORTRAN@) +set (${HDF4_PACKAGE_NAME}_BUILD_JAVA @HDF4_BUILD_JAVA@) +#----------------------------------------------------------------------------- +# Features: +#----------------------------------------------------------------------------- +set (${HDF4_PACKAGE_NAME}_BUILD_SHARED_LIBS @H4_ENABLE_SHARED_LIB@) +set (${HDF4_PACKAGE_NAME}_BUILD_STATIC_LIBS @H4_ENABLE_STATIC_LIB@) +#----------------------------------------------------------------------------- +set (${HDF4_PACKAGE_NAME}_BUILD_TOOLS @HDF4_BUILD_TOOLS@) +set (${HDF4_PACKAGE_NAME}_BUILD_UTILS @HDF4_BUILD_UTILS@) +set (${HDF4_PACKAGE_NAME}_BUILD_STATIC_TOOLS @HDF4_BUILD_STATIC_TOOLS@) +#----------------------------------------------------------------------------- set (${HDF4_PACKAGE_NAME}_ENABLE_JPEG_LIB_SUPPORT @HDF4_ENABLE_JPEG_LIB_SUPPORT@) -set (${HDF4_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT @HDF4_ENABLE_Z_LIB_SUPPORT@) -set (${HDF4_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT @HDF4_ENABLE_SZIP_SUPPORT@) -set (${HDF4_PACKAGE_NAME}_ENABLE_SZIP_ENCODING @HDF4_ENABLE_SZIP_ENCODING@) -set (${HDF4_PACKAGE_NAME}_BUILD_SHARED_LIBS @H4_ENABLE_SHARED_LIB@) -set (${HDF4_PACKAGE_NAME}_BUILD_STATIC_LIBS @H4_ENABLE_STATIC_LIB@) -set (${HDF4_PACKAGE_NAME}_PACKAGE_EXTLIBS @HDF4_PACKAGE_EXTLIBS@) -set (${HDF4_PACKAGE_NAME}_EXPORT_LIBRARIES @HDF4_LIBRARIES_TO_EXPORT@) -set (${HDF4_PACKAGE_NAME}_ARCHITECTURE "@CMAKE_GENERATOR_ARCHITECTURE@") -set (${HDF4_PACKAGE_NAME}_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") +set (${HDF4_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT @HDF4_ENABLE_Z_LIB_SUPPORT@) +set (${HDF4_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT @HDF4_ENABLE_SZIP_SUPPORT@) +set (${HDF4_PACKAGE_NAME}_ENABLE_SZIP_ENCODING @HDF4_ENABLE_SZIP_ENCODING@) +#----------------------------------------------------------------------------- +set (${HDF4_PACKAGE_NAME}_PACKAGE_EXTLIBS @HDF4_PACKAGE_EXTLIBS@) +set (${HDF4_PACKAGE_NAME}_EXPORT_LIBRARIES @HDF4_LIBRARIES_TO_EXPORT@) +set (${HDF4_PACKAGE_NAME}_ARCHITECTURE "@CMAKE_GENERATOR_ARCHITECTURE@") +set (${HDF4_PACKAGE_NAME}_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") #----------------------------------------------------------------------------- # Dependencies diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake index 9d2f9fd303..15f24cba8b 100644 --- a/config/cmake/runTest.cmake +++ b/config/cmake/runTest.cmake @@ -122,11 +122,18 @@ endif () message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () + string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () endif () # remove special error output @@ -137,7 +144,7 @@ else () # the error stack remains in the .err file file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) endif () -string (FIND TEST_STREAM "no version information available" TEST_FIND_RESULT) +string (FIND "${TEST_STREAM}" "no version information available" TEST_FIND_RESULT) if (TEST_FIND_RESULT GREATER -1) string (REGEX REPLACE "^.*no version information available[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") # write back the changes to the original files diff --git a/config/gnu-flags b/config/gnu-flags index 08728bf303..7d688e00e9 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -125,6 +125,16 @@ if test "X-gcc" = "X-$cc_vendor"; then PROFILE_CFLAGS="-pg" PROFILE_CPPFLAGS= + #################### + # General warnings # + #################### + + # Add various general warning flags in gnu-warnings for gcc versions 4.8 and later. + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 8 -o $cc_vers_major -gt 4; then + CFLAGS="$CFLAGS $(load_gnu_arguments general)" + CFLAGS="$CFLAGS $(load_gnu_arguments no-developer-general)" + fi + ############################# # Version-specific warnings # ############################# diff --git a/config/gnu-warnings/no-developer-general b/config/gnu-warnings/no-developer-general index fafa1214f3..45f84dba72 100644 --- a/config/gnu-warnings/no-developer-general +++ b/config/gnu-warnings/no-developer-general @@ -6,3 +6,4 @@ # regarding the library settings string (H4libhdf4_settings). We'll turn # it off here but leave it on in the developer flags. -Wno-overlength-strings +-Wno-format-nonliteral diff --git a/configure.ac b/configure.ac index 3919fc2c02..ba69238b00 100644 --- a/configure.ac +++ b/configure.ac @@ -328,6 +328,20 @@ esac AM_CONDITIONAL([HDF_BUILD_FORTRAN], [test "X$BUILD_FORTRAN" = "Xyes"]) AC_SUBST([BUILD_FORTRAN]) +## ------------------------------------------------------------------------- +## Build static libraries by default. Furthermore, fortran shared libraries +## are unsupported. Disallow a user from enabling both shared libraries and +## fortran. +if test "X${enable_shared}" != "Xyes"; then + enable_shared="no" +fi + +if test "X${enable_shared}" = "Xyes"; then + if test "X${BUILD_FORTRAN}" = "Xyes"; then + AC_MSG_ERROR([Cannot build shared fortran libraries. Please configure with --disable-fortran flag.]) + fi +fi + ## ---------------------------------------------------------------------- ## Check if they would like the Java native interface (JNI) compiled ## @@ -350,7 +364,7 @@ AC_ARG_ENABLE([java], if test "X$HDF_JAVA" = "Xyes"; then if test "X${enable_shared}" != "Xno"; then - echo "yes" + AC_MSG_RESULT([yes]) if test "X$CLASSPATH" = "X"; then H4_CLASSPATH=".:$srcdir/java/lib" else @@ -386,23 +400,8 @@ else AC_MSG_RESULT([no]) fi -## ------------------------------------------------------------------------- -## Build static libraries by default. Furthermore, fortran shared libraries -## are unsupported. Disallow a user from enabling both shared libraries and -## fortran. -if test "X${enable_shared}" != "Xyes"; then - enable_shared="no" -fi - -if test "X${enable_shared}" = "Xyes"; then - if test "X${BUILD_FORTRAN}" = "Xyes"; then - AC_MSG_ERROR([Cannot build shared fortran libraries. Please configure with --disable-fortran flag.]) - fi -fi - AC_PROG_LN_S - ## ---------------------------------------------------------------------- ## Check which archiving tool to use. This needs to be done before ## the LT_INIT macro. @@ -569,14 +568,14 @@ AC_ARG_ENABLE([static_exec], [STATIC_EXEC=$enableval]) if test "X$STATIC_EXEC" = "Xyes"; then - echo "yes" + AC_MSG_RESULT([yes]) ## Issue a warning if -static flag is not supported. if test "X$lt_cv_prog_compiler_static_works" = "Xno"; then - echo " warning: -static flag not supported on this system; executable won't statically link shared system libraries." + AC_MSG_WARN([-static flag not supported on this system; executable won't statically link shared system libraries]) fi LT_STATIC_EXEC="-all-static" else - echo "no" + AC_MSG_RESULT([no]) LT_STATIC_EXEC="" fi @@ -757,12 +756,14 @@ case "X-$withval" in X-yes) HAVE_SZIP="yes" AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"], [unset HAVE_SZIP]) - if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then + if test "x$HAVE_SZIP" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, [unset HAVE_SZIP]) fi if test -z "$HAVE_SZIP"; then AC_MSG_ERROR([couldn't find szlib library]) + else + USE_COMP_SZIP="yes" fi ;; X-|X-no|X-none) @@ -1207,6 +1208,7 @@ AC_CONFIG_FILES([Makefile hdf/fortran/Makefile hdf/src/Makefile hdf/test/Makefile + hdf/test/srcdir_str.h hdf/util/Makefile hdf/util/h4cc hdf/util/h4fc @@ -1235,6 +1237,7 @@ AC_CONFIG_FILES([Makefile mfhdf/ncgen/testncgen.sh mfhdf/nctest/Makefile mfhdf/test/Makefile + mfhdf/test/srcdir_str.h mfhdf/test/testmfhdf.sh java/Makefile java/src/Makefile diff --git a/hdf/fortran/CMakeLists.txt b/hdf/fortran/CMakeLists.txt index 45503de51a..0ac55a7dd4 100644 --- a/hdf/fortran/CMakeLists.txt +++ b/hdf/fortran/CMakeLists.txt @@ -29,7 +29,7 @@ set (FORTRAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) #----------------------------------------------------------------------------- # Add Main fortran library #----------------------------------------------------------------------------- -if (NOT ONLY_SHARED_LIBS) +if (BUILD_STATIC_LIBS) add_library (${HDF4_SRC_FCSTUB_LIB_TARGET} STATIC ${HDF4_HDF_SRC_CSTUB_FSRCS} ${HDF4_HDF_SRC_CHDRS} ${HDF4_HDFSOURCE_DIR}/hproto_fortran.h ${HDF4_BINARY_DIR}/h4config.h) target_include_directories (${HDF4_SRC_FCSTUB_LIB_TARGET} PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_BINARY_DIR}" @@ -95,7 +95,7 @@ set (HDF4_F_FORTRAN_SRCS set_source_files_properties (${HDF4_F_FORTRAN_SRCS} PROPERTIES LANGUAGE Fortran) #----------------------------------------------------------------------------- -if (NOT ONLY_SHARED_LIBS) +if (BUILD_STATIC_LIBS) add_library (${HDF4_SRC_FORTRAN_LIB_TARGET} STATIC ${HDF4_F_FORTRAN_SRCS}) target_include_directories (${HDF4_SRC_FORTRAN_LIB_TARGET} PRIVATE "${HDF4_HDF_BINARY_DIR}" diff --git a/hdf/src/CMakeLists.txt b/hdf/src/CMakeLists.txt index 9449ed2f17..3f5aab6993 100644 --- a/hdf/src/CMakeLists.txt +++ b/hdf/src/CMakeLists.txt @@ -66,56 +66,58 @@ set (HDF4_HDF_SRC_CSRCS ) set (HDF4_HDF_SRC_CHDRS - ${HDF4_HDF_SRC_SOURCE_DIR}/atom.h - ${HDF4_HDF_SRC_SOURCE_DIR}/bitvect.h - ${HDF4_HDF_SRC_SOURCE_DIR}/cdeflate.h - ${HDF4_HDF_SRC_SOURCE_DIR}/cnbit.h - ${HDF4_HDF_SRC_SOURCE_DIR}/cnone.h - ${HDF4_HDF_SRC_SOURCE_DIR}/crle.h - ${HDF4_HDF_SRC_SOURCE_DIR}/cskphuff.h - ${HDF4_HDF_SRC_SOURCE_DIR}/cszip.h - ${HDF4_HDF_SRC_SOURCE_DIR}/df.h - ${HDF4_HDF_SRC_SOURCE_DIR}/dfan.h - ${HDF4_HDF_SRC_SOURCE_DIR}/dfgr.h - ${HDF4_HDF_SRC_SOURCE_DIR}/dfrig.h - ${HDF4_HDF_SRC_SOURCE_DIR}/dfsd.h - ${HDF4_HDF_SRC_SOURCE_DIR}/dfufp2i.h - ${HDF4_HDF_SRC_SOURCE_DIR}/dynarray.h ${HDF4_HDF_SRC_SOURCE_DIR}/H4api_adpt.h #${HDF4_BINARY_DIR}/h4config.h ${HDF4_HDF_SRC_SOURCE_DIR}/hbitio.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hchunks.h ${HDF4_HDF_SRC_SOURCE_DIR}/hcomp.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hcompi.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hconv.h ${HDF4_HDF_SRC_SOURCE_DIR}/hdatainfo.h ${HDF4_HDF_SRC_SOURCE_DIR}/hdf.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hdfi.h ${HDF4_HDF_SRC_SOURCE_DIR}/herr.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hfile.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hkit.h ${HDF4_HDF_SRC_SOURCE_DIR}/hlimits.h ${HDF4_HDF_SRC_SOURCE_DIR}/hntdefs.h ${HDF4_HDF_SRC_SOURCE_DIR}/hproto.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hqueue.h ${HDF4_HDF_SRC_SOURCE_DIR}/htags.h - ${HDF4_HDF_SRC_SOURCE_DIR}/linklist.h ${HDF4_HDF_SRC_SOURCE_DIR}/mfan.h - ${HDF4_HDF_SRC_SOURCE_DIR}/mfani.h ${HDF4_HDF_SRC_SOURCE_DIR}/mfgr.h - ${HDF4_HDF_SRC_SOURCE_DIR}/mfgri.h - ${HDF4_HDF_SRC_SOURCE_DIR}/mstdio.h - ${HDF4_HDF_SRC_SOURCE_DIR}/tbbt.h ${HDF4_HDF_SRC_SOURCE_DIR}/vg.h ) +# Internal headers end in _priv.h set (HDF4_PRIVATE_HDF_SRC_CHDRS - ${HDF4_HDF_SRC_SOURCE_DIR}/glist.h - ${HDF4_HDF_SRC_SOURCE_DIR}/mcache.h - ${HDF4_HDF_SRC_SOURCE_DIR}/vgint.h + ${HDF4_HDF_SRC_SOURCE_DIR}/atom_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/bitvect_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/cdeflate_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/cnbit_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/cnone_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/crle_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/cskphuff_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/cszip_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/df_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/dfan_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/dfgr_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/dfrig_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/dfsd_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/dfufp2i_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/dynarray_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/glist_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hchunks_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hcomp_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hconv_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hdf_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/herr_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hfile_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hkit_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hqueue_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/linklist_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/mcache_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/mfan_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/mfgr_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/mstdio_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/tbbt_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/vg_priv.h ) -if (NOT ONLY_SHARED_LIBS) +if (BUILD_STATIC_LIBS) add_library (${HDF4_SRC_LIB_TARGET} STATIC ${HDF4_HDF_SRC_CSRCS} ${HDF4_HDF_SRC_CHDRS} ${HDF4_PRIVATE_HDF_SRC_CHDRS} ${HDF4_BINARY_DIR}/h4config.h) target_include_directories(${HDF4_SRC_LIB_TARGET} PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES}" @@ -136,6 +138,12 @@ if (NOT ONLY_SHARED_LIBS) INTERFACE_INCLUDE_DIRECTORIES "$/include>" ) set (install_targets ${HDF4_SRC_LIB_TARGET}) +# +# add_custom_command(TARGET ${HDF4_SRC_LIB_TARGET} +# COMMAND ${CMAKE_COMMAND} -E create_symlink $ $ +# DEPENDS $ +# ) +# set (install_targets ${install_targets} ${HDF4_SRC_LIB_SYM_TARGET}) endif () if (BUILD_SHARED_LIBS) @@ -161,6 +169,12 @@ if (BUILD_SHARED_LIBS) INTERFACE_COMPILE_DEFINITIONS H4_BUILT_AS_DYNAMIC_LIB=1 ) set (install_targets ${install_targets} ${HDF4_SRC_LIBSH_TARGET}) +# +# add_custom_command(TARGET ${HDF4_SRC_LIBSH_TARGET} +# COMMAND ${CMAKE_COMMAND} -E create_symlink $ $ +# DEPENDS $ +# ) +# set (install_targets ${install_targets} ${HDF4_SRC_LIBSH_SYM_TARGET}) endif () #----------------------------------------------------------------------------- @@ -182,7 +196,7 @@ if (HDF4_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF4_SRC_LIBSH_TARGET} ${HDF4_INSTALL_BIN_DIR} libraries) endif () - if (NOT ONLY_SHARED_LIBS) + if (BUILD_STATIC_LIBS) INSTALL_TARGET_PDB (${HDF4_SRC_LIB_TARGET} ${HDF4_INSTALL_LIB_DIR} libraries) endif () diff --git a/hdf/src/Makefile.am b/hdf/src/Makefile.am index 0bf30c7d35..063cf36714 100644 --- a/hdf/src/Makefile.am +++ b/hdf/src/Makefile.am @@ -20,13 +20,9 @@ CSOURCES = atom.c bitvect.c cdeflate.c cnbit.c cnone.c crle.c cskphuff.c \ mcache.c mfan.c mfgr.c mstdio.c tbbt.c vattr.c vconv.c vg.c \ vgp.c vhi.c vio.c vparse.c vrw.c vsfld.c -CHEADERS = atom.h bitvect.h cdeflate.h cnbit.h cnone.h cskphuff.h crle.h \ - cszip.h df.h dfan.h dfgr.h dfrig.h dfsd.h dfufp2i.h \ - dynarray.h H4api_adpt.h h4config.h hbitio.h hchunks.h hcomp.h \ - hcompi.h hconv.h hdf.h hdfi.h herr.h hfile.h hkit.h hlimits.h \ - hproto.h hntdefs.h htags.h linklist.h mfan.h mfani.h mfgr.h \ - mfgri.h mstdio.h tbbt.h vg.h hdatainfo.h -## hdatainfo.h needs to be added conditionally only, should fix this asap +CHEADERS = H4api_adpt.h h4config.h hbitio.h hcomp.h hdatainfo.h hdf.h \ + herr.h hlimits.h hntdefs.h hproto.h htags.h mfan.h mfgr.h vg.h + FHEADERS = dffunc.f90 hdf.f90 dffunc.inc hdf.inc if HDF_BUILD_FORTRAN diff --git a/hdf/src/atom.c b/hdf/src/atom.c index ac8c22b5aa..bb1fd502b5 100644 --- a/hdf/src/atom.c +++ b/hdf/src/atom.c @@ -23,7 +23,7 @@ DESIGN The groups are stored in an array of pointers to store each group in an element. Each "atomic group" node contains a link to a hash table to manage the atoms in each group. The allowed "atomic groups" are stored - in an enum (called group_t) in atom.h. + in an enum (called group_t) in atom_priv.h. BUGS/LIMITATIONS Can't iterate over the atoms in a group. @@ -46,8 +46,8 @@ EXPORTED ROUTINES HAshutdown - Terminate various static buffers. */ -#include "hdfi.h" -#include "atom.h" +#include "hdf_priv.h" +#include "atom_priv.h" /* # of bits to use for Group ID in each atom (change if MAXGROUP>16) */ #define GROUP_BITS 4 diff --git a/hdf/src/atom.h b/hdf/src/atom_priv.h similarity index 97% rename from hdf/src/atom.h rename to hdf/src/atom_priv.h index 042db4d636..aab31e8647 100644 --- a/hdf/src/atom.h +++ b/hdf/src/atom_priv.h @@ -12,19 +12,14 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: atom.h + * File: atom_priv.h * Purpose: header file for atom API - * Dependencies: - * Invokes: - * Contents: - * Structure definitions: - * Constant definitions: *---------------------------------------------------------------------------*/ -#ifndef H4_ATOM_H -#define H4_ATOM_H +#ifndef H4_ATOM_PRIV_H +#define H4_ATOM_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* Do swap using XOR operator. Ugly but fast... -QAK */ #define HAIswap_cache(i, j) \ @@ -208,4 +203,4 @@ HDFLIBAPI intn HAshutdown(void); } #endif -#endif /* H4_ATOM_H */ +#endif /* H4_ATOM_PRIV_H */ diff --git a/hdf/src/bitvect.c b/hdf/src/bitvect.c index 5ec9f592e6..afe81ecb19 100644 --- a/hdf/src/bitvect.c +++ b/hdf/src/bitvect.c @@ -36,8 +36,8 @@ DESIGN for finding 1 bits as that is not a use case in the HDF4 library. */ -#include "hdfi.h" -#include "bitvect.h" +#include "hdf_priv.h" +#include "bitvect_priv.h" /* Base type of the array used to store the bits */ typedef uint8 bv_base; diff --git a/hdf/src/bitvect.h b/hdf/src/bitvect_priv.h similarity index 93% rename from hdf/src/bitvect.h rename to hdf/src/bitvect_priv.h index b595c779f9..5a59092576 100644 --- a/hdf/src/bitvect.h +++ b/hdf/src/bitvect_priv.h @@ -12,14 +12,14 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: bitvect.h + * File: bitvect_priv.h * Purpose: header file for bit-vector API *---------------------------------------------------------------------------*/ -#ifndef H4_BITVECT_H -#define H4_BITVECT_H +#ifndef H4_BITVECT_PRIV_H +#define H4_BITVECT_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* Boolean values used */ typedef enum { BV_FALSE = 0, BV_TRUE = 1 } bv_bool; @@ -55,4 +55,4 @@ HDFLIBAPI int32 bv_find_next_zero(bv_ptr b); } #endif -#endif /* H4_BITVECT_H */ +#endif /* H4_BITVECT_PRIV_H */ diff --git a/hdf/src/cdeflate.c b/hdf/src/cdeflate.c index 659ad2fc89..9b91bcfda4 100644 --- a/hdf/src/cdeflate.c +++ b/hdf/src/cdeflate.c @@ -12,27 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - FILE - cdeflate.c - HDF gzip 'deflate' encoding I/O routines + cdeflate.c - HDF gzip 'deflate' encoding I/O routines - REMARKS - - DESIGN - - EXPORTED ROUTINES None of these routines are designed to be called by other users except for the modeling layer of the compression routines. - - AUTHOR - Quincey Koziol */ /* General HDF includes */ -#include "hdfi.h" +#include "hdf_priv.h" /* HDF compression includes */ -#include "hcompi.h" /* Internal definitions for compression */ +#include "hcomp_priv.h" /* Internal definitions for compression */ /* Define the [default] size of the buffer to interact with the file */ #define DEFLATE_BUF_SIZE 4096 diff --git a/hdf/src/cdeflate.h b/hdf/src/cdeflate_priv.h similarity index 93% rename from hdf/src/cdeflate.h rename to hdf/src/cdeflate_priv.h index a9f8dd7beb..4cd339432a 100644 --- a/hdf/src/cdeflate.h +++ b/hdf/src/cdeflate_priv.h @@ -12,15 +12,15 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: cdeflate.h + * File: cdeflate_priv.h * Purpose: Header file for gzip 'deflate' encoding information. - * Dependencies: should only be included from hcompi.h + * Dependencies: should only be included from hcomp_priv.h *---------------------------------------------------------------------------*/ -#ifndef H4_CDEFLATE_H -#define H4_CDEFLATE_H +#ifndef H4_CDEFLATE_PRIV_H +#define H4_CDEFLATE_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* Get the gzip 'deflate' header */ #define intf zintf @@ -67,4 +67,4 @@ HDFLIBAPI intn HCPcdeflate_endaccess(accrec_t *access_rec); } #endif -#endif /* H4_CDEFLATE_H */ +#endif /* H4_CDEFLATE_PRIV_H */ diff --git a/hdf/src/cnbit.c b/hdf/src/cnbit.c index b1056f09e2..ce0b73e4a2 100644 --- a/hdf/src/cnbit.c +++ b/hdf/src/cnbit.c @@ -12,24 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - FILE - cnbit.c - HDF N-bit encoding I/O routines + cnbit.c - HDF N-bit encoding I/O routines - REMARKS - - DESIGN - - EXPORTED ROUTINES None of these routines are designed to be called by other users except for the modeling layer of the compression routines. */ /* General HDF includes */ -#include "hdfi.h" +#include "hdf_priv.h" /* HDF compression includes */ -#include "hcompi.h" /* Internal definitions for compression */ +#include "hcomp_priv.h" /* Internal definitions for compression */ /* functions to perform N-bit encoding */ funclist_t cnbit_funcs = {HCPcnbit_stread, diff --git a/hdf/src/cnbit.h b/hdf/src/cnbit_priv.h similarity index 95% rename from hdf/src/cnbit.h rename to hdf/src/cnbit_priv.h index ca50cbe542..e66603f8ee 100644 --- a/hdf/src/cnbit.h +++ b/hdf/src/cnbit_priv.h @@ -12,15 +12,15 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: cnbit.h + * File: cnbit_priv.h * Purpose: Header file for N-bit encoding information. - * Dependencies: should only be included from hcompi.h + * Dependencies: should only be included from hcomp_priv.h *---------------------------------------------------------------------------*/ -#ifndef H4_CNBIT_H -#define H4_CNBIT_H +#ifndef H4_CNBIT_PRIV_H +#define H4_CNBIT_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* size of the N-bit buffer */ #define NBIT_BUF_SIZE (MAX_NT_SIZE * 64) @@ -80,4 +80,4 @@ HDFLIBAPI intn HCPcnbit_endaccess(accrec_t *access_rec); } #endif -#endif /* H4_CNBIT_H */ +#endif /* H4_CNBIT_PRIV_H */ diff --git a/hdf/src/cnone.c b/hdf/src/cnone.c index 9e94724f0a..0d30d9bc73 100644 --- a/hdf/src/cnone.c +++ b/hdf/src/cnone.c @@ -12,26 +12,20 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - FILE - cnone.c - HDF none encoding I/O routines + cnone.c - HDF none encoding I/O routines - REMARKS These routines are only included for completeness and are not actually expected to be used. - DESIGN - - EXPORTED ROUTINES None of these routines are designed to be called by other users except for the modeling layer of the compression routines. */ /* General HDF includes */ -#include "hdfi.h" +#include "hdf_priv.h" /* HDF compression includes */ -#include "hcompi.h" /* Internal definitions for compression */ +#include "hcomp_priv.h" /* Internal definitions for compression */ /* functions to perform run-length encoding */ funclist_t cnone_funcs = {HCPcnone_stread, diff --git a/hdf/src/cnone.h b/hdf/src/cnone_priv.h similarity index 92% rename from hdf/src/cnone.h rename to hdf/src/cnone_priv.h index 9b8167b9f3..489d89656d 100644 --- a/hdf/src/cnone.h +++ b/hdf/src/cnone_priv.h @@ -12,18 +12,18 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: cnone.h + * File: cnone_priv.h * Purpose: Header file for "none" encoding information. - * Dependencies: should only be included from hcompi.h + * Dependencies: should only be included from hcomp_priv.h * Invokes: none * Contents: Structures & definitions for "none" encoding. This header * should only be included in hcomp.c and cnone.c. *---------------------------------------------------------------------------*/ -#ifndef H4_CNONE_H -#define H4_CNONE_H +#ifndef H4_CNONE_PRIV_H +#define H4_CNONE_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* "none" [en|de]coding information */ typedef struct { @@ -60,4 +60,4 @@ HDFLIBAPI intn HCPcnone_endaccess(accrec_t *access_rec); } #endif -#endif /* H4_CNONE_H */ +#endif /* H4_CNONE_PRIV_H */ diff --git a/hdf/src/crle.c b/hdf/src/crle.c index e60e4a1e98..a18641084e 100644 --- a/hdf/src/crle.c +++ b/hdf/src/crle.c @@ -12,24 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - FILE - crle.c - HDF run-length encoding I/O routines + crle.c - HDF run-length encoding I/O routines - REMARKS - - DESIGN - - EXPORTED ROUTINES None of these routines are designed to be called by other users except for the modeling layer of the compression routines. */ /* General HDF includes */ -#include "hdfi.h" +#include "hdf_priv.h" /* HDF compression includes */ -#include "hcompi.h" /* Internal definitions for compression */ +#include "hcomp_priv.h" /* Internal definitions for compression */ /* internal defines */ #define TMP_BUF_SIZE 8192 /* size of throw-away buffer */ diff --git a/hdf/src/crle.h b/hdf/src/crle_priv.h similarity index 95% rename from hdf/src/crle.h rename to hdf/src/crle_priv.h index 9d10832c50..a90fa6a708 100644 --- a/hdf/src/crle.h +++ b/hdf/src/crle_priv.h @@ -12,20 +12,18 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: crle.h + * File: crle_priv.h * Purpose: Header file for run-length encoding information. - * Dependencies: should only be included from hcompi.h + * Dependencies: should only be included from hcomp_priv.h * Invokes: none * Contents: Structures & definitions for run-length encoding. This header * should only be included in hcomp.c and crle.c. - * Structure definitions: - * Constant definitions: *---------------------------------------------------------------------------*/ -#ifndef H4_CRLE_H -#define H4_CRLE_H +#ifndef H4_CRLE_PRIV_H +#define H4_CRLE_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* size of the RLE buffer */ #define RLE_BUF_SIZE 128 @@ -103,4 +101,4 @@ HDFLIBAPI intn HCPcrle_endaccess(accrec_t *access_rec); } #endif -#endif /* H4_CRLE_H */ +#endif /* H4_CRLE_PRIV_H */ diff --git a/hdf/src/cskphuff.c b/hdf/src/cskphuff.c index 212c263b59..9d52595366 100644 --- a/hdf/src/cskphuff.c +++ b/hdf/src/cskphuff.c @@ -12,15 +12,8 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - FILE - cskphuff.c - HDF "skipping" huffman encoding I/O routines + cskphuff.c - HDF "skipping" huffman encoding I/O routines - REMARKS - - DESIGN - - EXPORTED ROUTINES None of these routines are designed to be called by other users except for the modeling layer of the compression routines. */ @@ -31,10 +24,10 @@ */ /* General HDF includes */ -#include "hdfi.h" +#include "hdf_priv.h" /* HDF compression includes */ -#include "hcompi.h" /* Internal definitions for compression */ +#include "hcomp_priv.h" /* Internal definitions for compression */ /* Internal Defines */ #define TMP_BUF_SIZE 8192 /* size of throw-away buffer */ diff --git a/hdf/src/cskphuff.h b/hdf/src/cskphuff_priv.h similarity index 93% rename from hdf/src/cskphuff.h rename to hdf/src/cskphuff_priv.h index 4040ad4716..b644b4acf0 100644 --- a/hdf/src/cskphuff.h +++ b/hdf/src/cskphuff_priv.h @@ -12,15 +12,15 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: cskphuff.h + * File: cskphuff_priv.h * Purpose: Header file for skipping huffman encoding information. - * Dependencies: should only be included from hcompi.h + * Dependencies: should only be included from hcomp_priv.h *---------------------------------------------------------------------------*/ -#ifndef H4_CSKPHUFF_H -#define H4_CSKPHUFF_H +#ifndef H4_CSKPHUFF_PRIV_H +#define H4_CSKPHUFF_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* The maximum source character code: */ #define SKPHUFF_MAX_CHAR 255 @@ -74,4 +74,4 @@ HDFLIBAPI intn HCPcskphuff_endaccess(accrec_t *access_rec); } #endif -#endif /* H4_CSKPHUFF_H */ +#endif /* H4_CSKPHUFF_PRIV_H */ diff --git a/hdf/src/cszip.c b/hdf/src/cszip.c index db1bdb6914..c3bb5296fc 100644 --- a/hdf/src/cszip.c +++ b/hdf/src/cszip.c @@ -13,14 +13,14 @@ /* General HDF includes */ -#include "hdfi.h" +#include "hdf_priv.h" #ifdef H4_HAVE_LIBSZ #include "szlib.h" #endif /* HDF compression includes */ -#include "hcompi.h" /* Internal definitions for compression */ +#include "hcomp_priv.h" /* Internal definitions for compression */ /* internal defines */ #define TMP_BUF_SIZE 8192 /* size of throw-away buffer */ diff --git a/hdf/src/cszip.h b/hdf/src/cszip_priv.h similarity index 94% rename from hdf/src/cszip.h rename to hdf/src/cszip_priv.h index eae0eab359..09bc891dcd 100644 --- a/hdf/src/cszip.h +++ b/hdf/src/cszip_priv.h @@ -12,18 +12,18 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: cszip.h + * File: cszip_priv.h * Purpose: Header file for szip encoding information. - * Dependencies: should only be included from hcompi.h + * Dependencies: should only be included from hcomp_priv.h * Invokes: none * Contents: Structures & definitions for szip encoding. This header * should only be included in hcomp.c and cszip.c. *---------------------------------------------------------------------------*/ -#ifndef H4_CSZIP_H -#define H4_CSZIP_H +#ifndef H4_CSZIP_PRIV_H +#define H4_CSZIP_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* Special parameters for szip compression */ /* [These are aliases for the similar definitions in ricehdf.h header file] */ @@ -88,4 +88,4 @@ HDFLIBAPI intn HCPcszip_endaccess(accrec_t *access_rec); } #endif -#endif /* H4_CSZIP_H */ +#endif /* H4_CSZIP_PRIV_H */ diff --git a/hdf/src/df24.c b/hdf/src/df24.c index 2d064d6206..e68f6d9026 100644 --- a/hdf/src/df24.c +++ b/hdf/src/df24.c @@ -35,8 +35,8 @@ * dimension, compression, color compensation etc. *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfgr.h" +#include "hdf_priv.h" +#include "dfgr_priv.h" static intn Newdata = 0; /* does Readrig contain fresh data? */ static intn dimsset = 0; /* have dimensions been set? */ diff --git a/hdf/src/df24f.c b/hdf/src/df24f.c index 019b90cd25..22a14ac2aa 100644 --- a/hdf/src/df24f.c +++ b/hdf/src/df24f.c @@ -37,8 +37,8 @@ * dimension, compression, color compensation etc. *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfgr.h" +#include "hdf_priv.h" +#include "dfgr_priv.h" #include "hproto_fortran.h" #define LUT 0 diff --git a/hdf/src/df.h b/hdf/src/df_priv.h similarity index 95% rename from hdf/src/df.h rename to hdf/src/df_priv.h index 433ccc3383..14bb699d6b 100644 --- a/hdf/src/df.h +++ b/hdf/src/df_priv.h @@ -12,22 +12,15 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: df.h + * File: df_priv.h * Purpose: header file for HDF routines * Invokes: * Contents: * Structure definitions: DFddh, DFdd, DFdesc, DFdle, DF, DFdi, DFdata - * Procedure type definitions - * Global variables - * Tag definitions - * Error return codes - * Logical constants - * Remarks: This file is included with user programs - * Since it includes stdio.h etc., do not include these after df.h *---------------------------------------------------------------------------*/ -#ifndef H4_DF_H -#define H4_DF_H +#ifndef H4_DF_PRIV_H +#define H4_DF_PRIV_H #include "H4api_adpt.h" @@ -169,4 +162,4 @@ HDFLIBAPI int DFconvert(uint8 *source, uint8 *dest, int ntype, int sourcetype, i } #endif -#endif /* H4_DF_H */ +#endif /* H4_DF_PRIV_H */ diff --git a/hdf/src/dfan.c b/hdf/src/dfan.c index 1f6504a9c0..fbaaad4553 100644 --- a/hdf/src/dfan.c +++ b/hdf/src/dfan.c @@ -51,8 +51,8 @@ * DFANIgetfann: - get file annotation *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfan.h" +#include "hdf_priv.h" +#include "dfan_priv.h" static uint16 Lastref = 0; /* Last ref read/written */ static uint16 Next_label_ref = 0; /* Next file label ref to read/write */ diff --git a/hdf/src/dfan.h b/hdf/src/dfan_priv.h similarity index 94% rename from hdf/src/dfan.h rename to hdf/src/dfan_priv.h index e0e2960bb2..94567827ef 100644 --- a/hdf/src/dfan.h +++ b/hdf/src/dfan_priv.h @@ -12,18 +12,18 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*------------------------------------------------------------------------------ - * File: dfan.h + * File: dfan_priv.h * Purpose: header file for the Annotations set - * Invokes: df.h + * Invokes: df_priv.h * Contents: * Structure definitions: DFANdirentry, DFANdirhead * Constant definitions: DFAN_LABEL, DFAN_DESC *----------------------------------------------------------------------------*/ -#ifndef H4_DFAN_H -#define H4_DFAN_H +#ifndef H4_DFAN_PRIV_H +#define H4_DFAN_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" #define DFAN_LABEL 0 #define DFAN_DESC 1 @@ -55,4 +55,4 @@ typedef struct DFANdirhead { DFANdirentry *entries; /* actually an arbitrary size array */ } DFANdirhead; -#endif /* H4_DFAN_H */ +#endif /* H4_DFAN_PRIV_H */ diff --git a/hdf/src/dfanf.c b/hdf/src/dfanf.c index e11374039a..fd2020f983 100644 --- a/hdf/src/dfanf.c +++ b/hdf/src/dfanf.c @@ -39,9 +39,9 @@ * daiafid_ : add file id (intermediate routine) *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfan.h" -#include "df.h" +#include "hdf_priv.h" +#include "dfan_priv.h" +#include "df_priv.h" #include "hproto_fortran.h" /* conventions used in forming names of routines: diff --git a/hdf/src/dfcomp.c b/hdf/src/dfcomp.c index ac7a26810d..0d6625fbcb 100644 --- a/hdf/src/dfcomp.c +++ b/hdf/src/dfcomp.c @@ -26,7 +26,7 @@ /* This module (dfcomp.c) used to be in charge of the general compression * information but hcomp.c now supersedes it */ -#include "hdfi.h" +#include "hdf_priv.h" #define R8_MAX_BLOCKS 32 #define R8_MAX_LENGTH 512 diff --git a/hdf/src/dfconv.c b/hdf/src/dfconv.c index 493fc4ca3c..3ed3325e59 100644 --- a/hdf/src/dfconv.c +++ b/hdf/src/dfconv.c @@ -61,8 +61,8 @@ /* */ /*****************************************************************************/ -#include "hdfi.h" -#include "hconv.h" +#include "hdf_priv.h" +#include "hconv_priv.h" /* ** Static function prototypes diff --git a/hdf/src/dff.c b/hdf/src/dff.c index 4d7ad5e18f..883e41051a 100644 --- a/hdf/src/dff.c +++ b/hdf/src/dff.c @@ -38,8 +38,8 @@ * dfiishdf: call DFishdf to get HDF string *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "df.h" +#include "hdf_priv.h" +#include "df_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/dfgr.c b/hdf/src/dfgr.c index 53843e2428..02f4f9c68a 100644 --- a/hdf/src/dfgr.c +++ b/hdf/src/dfgr.c @@ -14,7 +14,7 @@ /*----------------------------------------------------------------------------- * File: dfgr.c * Purpose: read and write general raster images - * Invokes: df.c, dfkit.c, dfcomp.c, dfgroup.c, dfgr.h + * Invokes: df.c, dfkit.c, dfcomp.c, dfgroup.c, dfgr_priv.h * Contents: * DFGRgetlutdims : get dimensions of lookup table * DFGRreqlutil : use this interlace when returning lookup table @@ -43,8 +43,8 @@ * dimension, compression, color compensation etc. *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfgr.h" +#include "hdf_priv.h" +#include "dfgr_priv.h" static char *Grlastfile = NULL; static uint8 *Grlutdata = NULL; /* points to lut, if in memory */ diff --git a/hdf/src/dfgr.h b/hdf/src/dfgr_priv.h similarity index 93% rename from hdf/src/dfgr.h rename to hdf/src/dfgr_priv.h index 5c1994b743..7c9207f8ba 100644 --- a/hdf/src/dfgr.h +++ b/hdf/src/dfgr_priv.h @@ -12,18 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: dfgr.h + * File: dfgr_priv.h * Purpose: header file for the Raster Image set - * Invokes: df.h + * Invokes: df_priv.h * Contents: * Structure definitions: DFGRdr, DFGRrig - * Remarks: This is included with user programs which use general raster *---------------------------------------------------------------------------*/ -#ifndef H4_DFGR_H -#define H4_DFGR_H +#ifndef H4_DFGR_PRIV_H +#define H4_DFGR_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* description record: used to describe image data, palette data etc. */ typedef struct { @@ -65,4 +64,4 @@ HDFLIBAPI int32 DFGRIopen(const char *filename, int acc_mode); } #endif -#endif /* H4_DFGR_H */ +#endif /* H4_DFGR_PRIV_H */ diff --git a/hdf/src/dfgroup.c b/hdf/src/dfgroup.c index a3e4232593..2480e8b033 100644 --- a/hdf/src/dfgroup.c +++ b/hdf/src/dfgroup.c @@ -26,8 +26,8 @@ * Each tag/ref combination is called a data identifier (DI). *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" typedef struct DIlist_struct { uint8 *DIlist; diff --git a/hdf/src/dfimcomp.c b/hdf/src/dfimcomp.c index 698dfcd7c2..9a41dd17dc 100644 --- a/hdf/src/dfimcomp.c +++ b/hdf/src/dfimcomp.c @@ -22,7 +22,7 @@ /* DFCunimcomp(), sqr() */ /************************************************************************/ -#include "hdfi.h" +#include "hdf_priv.h" #define PALSIZE 256 #define BIT8 0 diff --git a/hdf/src/dfjpeg.c b/hdf/src/dfjpeg.c index 596d28d0ba..e3b19c4338 100644 --- a/hdf/src/dfjpeg.c +++ b/hdf/src/dfjpeg.c @@ -22,7 +22,7 @@ * that has to know about how to use the JPEG routines. *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" /* Hack to prevent libjpeg from re-defining `boolean` in a way that clashes * with windows.h. This MUST come before including jpeglib.h. diff --git a/hdf/src/dfknat.c b/hdf/src/dfknat.c index bdc1a7a7b9..268f668887 100644 --- a/hdf/src/dfknat.c +++ b/hdf/src/dfknat.c @@ -17,8 +17,6 @@ Purpose: Routines to support "native mode" conversion to and from HDF format - Invokes: - PRIVATE conversion functions: DFKnb1b - Native mode for 8 bit integers DFKnb2b - Native mode for 16 bit integers @@ -47,8 +45,8 @@ /* */ /*****************************************************************************/ -#include "hdfi.h" -#include "hconv.h" +#include "hdf_priv.h" +#include "hconv_priv.h" /*****************************************************************************/ /* NATIVE MODE NUMBER "CONVERSION" ROUTINES */ diff --git a/hdf/src/dfkswap.c b/hdf/src/dfkswap.c index 638b250d3d..b8a372b6eb 100644 --- a/hdf/src/dfkswap.c +++ b/hdf/src/dfkswap.c @@ -17,8 +17,6 @@ Purpose: Routines to support little-endian conversion to and from HDF format - Invokes: - PRIVATE conversion functions: DFKsb2b - Byte swapping for 16 bit integers DFKsb4b - Byte swapping for 32 bit integers @@ -46,8 +44,8 @@ /* */ /*****************************************************************************/ -#include "hdfi.h" -#include "hconv.h" +#include "hdf_priv.h" +#include "hconv_priv.h" /*****************************************************************************/ /* NUMBER CONVERSION ROUTINES FOR BYTE SWAPPING */ diff --git a/hdf/src/dfp.c b/hdf/src/dfp.c index 2a14a3330a..897c99532b 100644 --- a/hdf/src/dfp.c +++ b/hdf/src/dfp.c @@ -27,7 +27,7 @@ * DFPIopen : open/reopen file *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" /* remember that '0' is invalid ref number */ static uint16 Readref = 0; diff --git a/hdf/src/dfpf.c b/hdf/src/dfpf.c index 82648a59ff..c7e03d47e7 100644 --- a/hdf/src/dfpf.c +++ b/hdf/src/dfpf.c @@ -28,7 +28,7 @@ * Remarks: none *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/dfr8.c b/hdf/src/dfr8.c index 4888cdea5a..59b6efe836 100644 --- a/hdf/src/dfr8.c +++ b/hdf/src/dfr8.c @@ -14,7 +14,7 @@ /*----------------------------------------------------------------------------- * File: dfr8.c * Purpose: read and write 8-bit Raster Image Groups - * Invokes: df.c, dfcomp.c, dfgroup.c, dfrig.h + * Invokes: df.c, dfcomp.c, dfgroup.c, dfrig_priv.h * Contents: * DFR8setpalette : specify palette to be used with subsequent 8-bit images * DFR8setcompress : Set the compression for next image written @@ -40,8 +40,8 @@ * The palette is arranged as RGBRGB... *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfrig.h" +#include "hdf_priv.h" +#include "dfrig_priv.h" /* Private Variables */ static uint8 *paletteBuf = NULL; diff --git a/hdf/src/dfr8f.c b/hdf/src/dfr8f.c index f9f9fca7c3..b92877f914 100644 --- a/hdf/src/dfr8f.c +++ b/hdf/src/dfr8f.c @@ -31,7 +31,7 @@ * dfr8restart: Call DFR8restart to reset sequencing to first image *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/dfrig.h b/hdf/src/dfrig_priv.h similarity index 94% rename from hdf/src/dfrig.h rename to hdf/src/dfrig_priv.h index 167147ace9..d932450dac 100644 --- a/hdf/src/dfrig.h +++ b/hdf/src/dfrig_priv.h @@ -12,18 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: dfrig.h + * File: dfrig_priv.h * Purpose: header file for the Raster Image set - * Invokes: df.h + * Invokes: df_priv.h * Contents: * Structure definitions: DFRdr, DFRrig - * Remarks: This is included with user programs which use RIG *---------------------------------------------------------------------------*/ -#ifndef H4_DFRIG_H -#define H4_DFRIG_H +#ifndef H4_DFRIG_PRIV_H +#define H4_DFRIG_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* description record: used to describe image data, palette data etc. */ typedef struct { @@ -64,4 +63,4 @@ typedef struct R8dim { uint16 yd; } R8dim; -#endif /* H4_DFRIG_H */ +#endif /* H4_DFRIG_PRIV_H */ diff --git a/hdf/src/dfrle.c b/hdf/src/dfrle.c index f439c68684..f9f30ca05f 100644 --- a/hdf/src/dfrle.c +++ b/hdf/src/dfrle.c @@ -21,7 +21,7 @@ * Remarks: DFCIrle() and DFCIunrle() compress and decompress RLE encoded info *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" /*----------------------------------------------------------------------------- * Name: DFCIrle diff --git a/hdf/src/dfsd.c b/hdf/src/dfsd.c index 09cbffcdfa..0ec38935f7 100644 --- a/hdf/src/dfsd.c +++ b/hdf/src/dfsd.c @@ -18,7 +18,7 @@ Routines for input and output of numeric data group Invokes: - df.c dfgroup.c dfkit.c df.h dfsd.h + df.c dfgroup.c dfkit.c df_priv.h dfsd_priv.h Public functions: DFSDgetdims - get rank and dim sizes @@ -89,10 +89,10 @@ Fortran stub functions: This version assumes that all the values are floating point. *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfsd.h" +#include "hdf_priv.h" +#include "dfsd_priv.h" -/* MMM: make this definition correct and move to hfile.h, or wherever. */ +/* MMM: make this definition correct and move to hfile_priv.h, or wherever. */ #define DF_NOFILE 0 #define LABEL 0 @@ -2824,7 +2824,7 @@ DFSDIputndg(int32 file_id, uint16 ref, DFSsdg *sdg) /* if dataluf non-NULL, set up to write */ if (sdg->dataluf[luf] && sdg->dataluf[luf][0]) { strcpy((char *)bufp, sdg->dataluf[luf]); - bufp += strlen(bufp) + 1; + bufp += strlen((char *)bufp) + 1; } else { /* dataluf NULL */ *bufp++ = '\0'; @@ -2834,7 +2834,7 @@ DFSDIputndg(int32 file_id, uint16 ref, DFSsdg *sdg) for (i = 0; i < sdg->rank; i++) { if (sdg->dimluf[luf] && sdg->dimluf[luf][i] && sdg->dimluf[luf][i][0]) { /* dimluf not NULL */ strcpy((char *)bufp, sdg->dimluf[luf][i]); - bufp += strlen(bufp) + 1; + bufp += strlen((char *)bufp) + 1; } else { /* dimluf NULL */ *bufp++ = '\0'; @@ -4660,7 +4660,6 @@ DFSDwriteslab(int32 start[], int32 stride[], int32 count[], void *data) int32 fileNTsize; /* size of this NT in the file */ int32 localNTsize; /* size of this NT as it occurs in this machine */ int32 numelements; /* number of floats to read at once */ - int32 sdgsize; /* number of bytes to be written in the SDG */ int32 rowsize; /* number of bytes to be written at once */ /* in the hyperslab */ int32 fileoffset; /* offset into the current dataset in the file */ @@ -4717,11 +4716,6 @@ DFSDwriteslab(int32 start[], int32 stride[], int32 count[], void *data) fileNTsize = DFKNTsize(numtype); fileNT = Writesdg.filenumsubclass; - /* Calculate total bytes in SDS that can be written */ - sdgsize = fileNTsize; - for (i = 0; i < Writesdg.rank; i++) - sdgsize *= Writesdg.dimsizes[i]; - /* Set Access Id */ aid = Writesdg.aid; diff --git a/hdf/src/dfsd.h b/hdf/src/dfsd_priv.h similarity index 97% rename from hdf/src/dfsd.h rename to hdf/src/dfsd_priv.h index e54f59271d..f86dc793b9 100644 --- a/hdf/src/dfsd.h +++ b/hdf/src/dfsd_priv.h @@ -12,9 +12,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: dfsd.h + * File: dfsd_priv.h * Purpose: header file for the Scientific Data set - * Invokes: dfrig.h + * Invokes: dfrig_priv.h * Contents: * Structure definitions: DFSsdg * Constant definitions: DFS_MAXLEN @@ -23,8 +23,8 @@ * multiple dimensions *---------------------------------------------------------------------------*/ -#ifndef H4_DFSD_H -#define H4_DFSD_H +#ifndef H4_DFSD_PRIV_H +#define H4_DFSD_PRIV_H #include "H4api_adpt.h" @@ -109,4 +109,4 @@ HDFLIBAPI int DFSDIsetdatastrs(const char *label, const char *unit, const char * } #endif -#endif /* H4_DFSD_H */ +#endif /* H4_DFSD_PRIV_H */ diff --git a/hdf/src/dfsdf.c b/hdf/src/dfsdf.c index dfb5882f4a..8c2d4a5376 100644 --- a/hdf/src/dfsdf.c +++ b/hdf/src/dfsdf.c @@ -68,8 +68,8 @@ * Remarks: no C stubs needed for the put string routines, only Fortran stubs *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfsd.h" +#include "hdf_priv.h" +#include "dfsd_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/dfstubs.c b/hdf/src/dfstubs.c index bcb5aad99f..eb16faa585 100644 --- a/hdf/src/dfstubs.c +++ b/hdf/src/dfstubs.c @@ -40,8 +40,8 @@ ** Doug Ilg */ -#include "hdfi.h" -#include "df.h" +#include "hdf_priv.h" +#include "df_priv.h" #define DFACC_APPEND 8 #define DFEL_ABSENT 0 diff --git a/hdf/src/dfufp2i.c b/hdf/src/dfufp2i.c index 373cbf77c1..70ebc804ba 100644 --- a/hdf/src/dfufp2i.c +++ b/hdf/src/dfufp2i.c @@ -58,9 +58,9 @@ * *--------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfufp2i.h" -#include "dfsd.h" +#include "hdf_priv.h" +#include "dfufp2i_priv.h" +#include "dfsd_priv.h" /********************************************************************** * diff --git a/hdf/src/dfufp2i.h b/hdf/src/dfufp2i_priv.h similarity index 95% rename from hdf/src/dfufp2i.h rename to hdf/src/dfufp2i_priv.h index 31a3add12d..eb74fbf522 100644 --- a/hdf/src/dfufp2i.h +++ b/hdf/src/dfufp2i_priv.h @@ -11,10 +11,10 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H4_DFUFP2IM_H -#define H4_DFUFP2IM_H +#ifndef H4_DFUFP2I_PRIV_H +#define H4_DFUFP2I_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* Input structure */ typedef struct { @@ -48,7 +48,7 @@ typedef struct { extern "C" { #endif -/* prototypes for dfufp2im.c */ +/* prototypes for dfufp2i.c */ HDFLIBAPI int process(Input *in, Output *out); HDFLIBAPI int generate_scale(int32 dim, float32 *scale); @@ -64,4 +64,4 @@ HDFLIBAPI int DFUfptoimage(int32 hdim, int32 vdim, float32 max, float32 min, flo } #endif -#endif /* H4_DFUFP2IM_H */ +#endif /* H4_DFUFP2I_PRIV_H */ diff --git a/hdf/src/dfufp2if.c b/hdf/src/dfufp2if.c index 5bfaeb5304..827b773ade 100644 --- a/hdf/src/dfufp2if.c +++ b/hdf/src/dfufp2if.c @@ -11,9 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "hdfi.h" -#include "dfufp2i.h" -#include "dfsd.h" +#include "hdf_priv.h" +#include "dfufp2i_priv.h" +#include "dfsd_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/dfunjpeg.c b/hdf/src/dfunjpeg.c index ea9f2d21af..e9eb2f3be8 100644 --- a/hdf/src/dfunjpeg.c +++ b/hdf/src/dfunjpeg.c @@ -23,7 +23,7 @@ * routines. *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" /* Hack to prevent libjpeg from re-defining `boolean` in a way that clashes * with windows.h. This MUST come before including jpeglib.h. @@ -310,7 +310,7 @@ DFCIunjpeg(int32 file_id, uint16 tag, uint16 ref, void *image, int32 xdim, int32 */ struct jpeg_decompress_struct *cinfo_ptr; struct jpeg_error_mgr *jerr_ptr; - JDIMENSION lines_read, lines_left; + JDIMENSION lines_read; JSAMPARRAY buffer; if ((cinfo_ptr = calloc(1, sizeof(struct jpeg_decompress_struct))) == NULL) @@ -335,14 +335,12 @@ DFCIunjpeg(int32 file_id, uint16 tag, uint16 ref, void *image, int32 xdim, int32 jpeg_start_decompress(cinfo_ptr); /* read the whole image in */ - lines_left = (JDIMENSION)ydim; while (cinfo_ptr->output_scanline < cinfo_ptr->output_height) { buffer = (JSAMPARRAY)ℑ lines_read = jpeg_read_scanlines(cinfo_ptr, buffer, 1); - lines_left -= lines_read; - image = (char *)image + + image = (char *)image + ((size_t)cinfo_ptr->output_width * (size_t)cinfo_ptr->output_components * lines_read); - } /* end while */ + } /* Finish reading stuff in */ jpeg_finish_decompress(cinfo_ptr); diff --git a/hdf/src/dfutil.c b/hdf/src/dfutil.c index cdf1451044..7ed4aa64aa 100644 --- a/hdf/src/dfutil.c +++ b/hdf/src/dfutil.c @@ -24,7 +24,7 @@ * This version assumes that all the values are floating point. *--------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" /*----------------------------------------------------------------------------- * Name: DFfindnextref diff --git a/hdf/src/dfutilf.c b/hdf/src/dfutilf.c index 6c50c5b24c..1879abd785 100644 --- a/hdf/src/dfutilf.c +++ b/hdf/src/dfutilf.c @@ -19,7 +19,7 @@ * dfindnr_: For a given tag, find the next ref after the given ref *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/dynarray.c b/hdf/src/dynarray.c index 501d042111..03dc1c4f32 100644 --- a/hdf/src/dynarray.c +++ b/hdf/src/dynarray.c @@ -46,8 +46,8 @@ EXPORTED ROUTINES DAsize_array - Get the current dynarray size */ -#include "hdfi.h" -#include "dynarray.h" +#include "hdf_priv.h" +#include "dynarray_priv.h" typedef struct dynarray_tag { intn num_elems; /* Number of elements in the array currently */ diff --git a/hdf/src/dynarray.h b/hdf/src/dynarray_priv.h similarity index 97% rename from hdf/src/dynarray.h rename to hdf/src/dynarray_priv.h index 3353c0e9ba..633693eb15 100644 --- a/hdf/src/dynarray.h +++ b/hdf/src/dynarray_priv.h @@ -12,14 +12,14 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: dynarray.h + * File: dynarray_priv.h * Purpose: header file for dynamic array API *---------------------------------------------------------------------------*/ -#ifndef H4_DYNARRAY_H -#define H4_DYNARRAY_H +#ifndef H4_DYNARRAY_PRIV_H +#define H4_DYNARRAY_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* Define the pointer to the dynarray without giving outside routines access @@ -134,4 +134,4 @@ void *DAdel_elem(dynarr_p arr_ptr, /* IN: Array to access */ } #endif -#endif /* H4_DYNARRAY_H */ +#endif /* H4_DYNARRAY_PRIV_H */ diff --git a/hdf/src/glist.c b/hdf/src/glist.c index 3a79b6a9e6..f0626bcdd6 100644 --- a/hdf/src/glist.c +++ b/hdf/src/glist.c @@ -17,8 +17,8 @@ by Keith Pomakis(kppomaki@jeeves.uwaterloo.ca)-Spring, 1994 ************************************************************************/ -#include "hdfi.h" -#include "glist.h" +#include "hdf_priv.h" +#include "glist_priv.h" /*+ **************************************************************************** diff --git a/hdf/src/glist.h b/hdf/src/glist_priv.h similarity index 99% rename from hdf/src/glist.h rename to hdf/src/glist_priv.h index c6dc8dbb03..f3ccfaed25 100644 --- a/hdf/src/glist.h +++ b/hdf/src/glist_priv.h @@ -17,10 +17,10 @@ by Keith Pomakis(kppomaki@jeeves.uwaterloo.ca)-Spring, 1994 ************************************************************************/ -#ifndef H4_GLIST_H -#define H4_GLIST_H +#ifndef H4_GLIST_PRIV_H +#define H4_GLIST_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* Structure for each element in the list */ typedef struct GLE_struct { @@ -659,4 +659,4 @@ void HDGLremove_all_such_that(Generic_list list, /*IN: list *******************************************************************************/ #define HDGQcopy_queue HDGLcopy_list -#endif /* H4_GLIST_H */ +#endif /* H4_GLIST_PRIV_H */ diff --git a/hdf/src/hbitio.c b/hdf/src/hbitio.c index 9a51ae1b11..1357129e01 100644 --- a/hdf/src/hbitio.c +++ b/hdf/src/hbitio.c @@ -36,8 +36,8 @@ LOCAL ROUTINES HIwrite2read - switch from writing bits to reading them */ -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* Local Variables */ diff --git a/hdf/src/hblocks.c b/hdf/src/hblocks.c index c4e35fc353..8b532ff7a6 100644 --- a/hdf/src/hblocks.c +++ b/hdf/src/hblocks.c @@ -118,8 +118,8 @@ LOCAL ROUTINES HLInewlink -- write out some data to a linked block */ -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* block_t - record of a linked block. contains the tag and ref of the data elt that forms the linked block */ diff --git a/hdf/src/hbuffer.c b/hdf/src/hbuffer.c index eaa5df5c78..ee9a23e378 100644 --- a/hdf/src/hbuffer.c +++ b/hdf/src/hbuffer.c @@ -45,8 +45,8 @@ EXPORTED ROUTINES ------------------------------------------------------------------------- */ -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* extinfo_t -- external elt information structure */ diff --git a/hdf/src/hchunks.c b/hdf/src/hchunks.c index 8d7f736b1a..eb6f7239b9 100644 --- a/hdf/src/hchunks.c +++ b/hdf/src/hchunks.c @@ -253,13 +253,13 @@ LOCAL ROUTINES #define STATISTICS */ -#include "hdfi.h" -#include "hfile.h" -#include "mcache.h" -#include "hchunks.h" +#include "hdf_priv.h" +#include "hfile_priv.h" +#include "mcache_priv.h" +#include "hchunks_priv.h" -#include "tbbt.h" -#include "mcache.h" +#include "tbbt_priv.h" +#include "mcache_priv.h" #include "hcomp.h" /* Define class, class version and name(partial) for chunk table i.e. Vdata */ @@ -348,7 +348,7 @@ typedef struct chunkinfo_t { /* private functions */ static int32 HMCIstaccess(accrec_t *access_rec, /* IN: access record to fill in */ int16 acc_mode /* IN: access mode */); -/* tbbt.h helper routines */ +/* tbbt_priv.h helper routines */ static intn chkcompare(void *k1, /* IN: first key */ void *k2, /* IN: second key */ intn cmparg /* IN: not sure? */); diff --git a/hdf/src/hchunks.h b/hdf/src/hchunks_priv.h similarity index 96% rename from hdf/src/hchunks.h rename to hdf/src/hchunks_priv.h index f59b97318c..314b5b5919 100644 --- a/hdf/src/hchunks.h +++ b/hdf/src/hchunks_priv.h @@ -12,18 +12,18 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: hchunks.h + * File: hchunks_priv.h * Purpose: Header file for Chunked elements * Dependencies: tbbt.c mcache.c * Contents: Structures & definitions for chunked elements * Structure definitions: DIM_DEF, HCHUNK_DEF *---------------------------------------------------------------------------*/ -#ifndef H4_HCHUNKS_H -#define H4_HCHUNKS_H +#ifndef H4_HCHUNKS_PRIV_H +#define H4_HCHUNKS_PRIV_H -#include "hdfi.h" -#include "hfile.h" /* special info stuff */ +#include "hdf_priv.h" +#include "hfile_priv.h" /* special info stuff */ /* Public structures */ @@ -112,4 +112,4 @@ HDFLIBAPI int32 HMCPgetnumrecs /* has to be here because used in hfile.c */ } #endif -#endif /* H4_HCHUNKS_H */ +#endif /* H4_HCHUNKS_PRIV_H */ diff --git a/hdf/src/hcomp.c b/hdf/src/hcomp.c index 64b74d4bb1..4593caa349 100644 --- a/hdf/src/hcomp.c +++ b/hdf/src/hcomp.c @@ -63,14 +63,14 @@ EXPORTED ROUTINES */ /* General HDF includes */ -#include "hdfi.h" +#include "hdf_priv.h" #ifdef H4_HAVE_LIBSZ #include "szlib.h" #endif /* HDF compression includes */ -#include "hcompi.h" /* Internal definitions for compression */ +#include "hcomp_priv.h" /* Internal definitions for compression */ /* Local defines */ #define COMP_HEADER_VERSION 0 diff --git a/hdf/src/hcompi.h b/hdf/src/hcomp_priv.h similarity index 88% rename from hdf/src/hcompi.h rename to hdf/src/hcomp_priv.h index f1971e19c5..d480e5af4e 100644 --- a/hdf/src/hcompi.h +++ b/hdf/src/hcomp_priv.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: hcompi.h + * File: hcomp_priv.h * Purpose: Internal library header file for compression information * Dependencies: should be included after hdf.h * Invokes: @@ -21,18 +21,18 @@ * Constant definitions: *---------------------------------------------------------------------------*/ -#ifndef H4_HCOMPI_H -#define H4_HCOMPI_H +#ifndef H4_HCOMP_PRIV_H +#define H4_HCOMP_PRIV_H -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* Modeling information */ /* structure for storing modeling information */ /* only allow modeling and master compression routines access */ -#include "mstdio.h" /* stdio modeling header */ +#include "mstdio_priv.h" /* stdio modeling header */ typedef struct comp_model_info_tag { comp_model_t model_type; /* model this stream is using */ @@ -47,12 +47,12 @@ typedef struct comp_model_info_tag { /* structure for storing modeling information */ /* only allow encoding and master compression routines access */ -#include "cnone.h" /* no encoding header */ -#include "crle.h" /* run-length encoding header */ -#include "cnbit.h" /* N-bit encoding header */ -#include "cskphuff.h" /* Skipping huffman encoding header */ -#include "cdeflate.h" /* gzip 'deflate' encoding header */ -#include "cszip.h" /* szip encoding header */ +#include "cnone_priv.h" /* no encoding header */ +#include "crle_priv.h" /* run-length encoding header */ +#include "cnbit_priv.h" /* N-bit encoding header */ +#include "cskphuff_priv.h" /* Skipping huffman encoding header */ +#include "cdeflate_priv.h" /* gzip 'deflate' encoding header */ +#include "cszip_priv.h" /* szip encoding header */ typedef struct comp_coder_info_tag { comp_coder_t coder_type; /* coding scheme this stream is using */ @@ -96,4 +96,4 @@ typedef struct compinfo_tag { comp_state_cache_t sinfo; /* state information for caching */ } compinfo_t; -#endif /* H4_HCOMPI_H */ +#endif /* H4_HCOMP_PRIV_H */ diff --git a/hdf/src/hcompri.c b/hdf/src/hcompri.c index 936d001f12..72783f8564 100644 --- a/hdf/src/hcompri.c +++ b/hdf/src/hcompri.c @@ -44,8 +44,8 @@ ------------------------------------------------------------------------- */ -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* crinfo_t -- compressed raster information structure */ diff --git a/hdf/src/hconv.h b/hdf/src/hconv_priv.h similarity index 96% rename from hdf/src/hconv.h rename to hdf/src/hconv_priv.h index 44de2d782b..0153f508fa 100644 --- a/hdf/src/hconv.h +++ b/hdf/src/hconv_priv.h @@ -12,14 +12,14 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: hconv.h + * File: hconv_priv.h * Purpose: header file for data conversion information & structures *---------------------------------------------------------------------------*/ -#ifndef H4_HCONV_H -#define H4_HCONV_H +#ifndef H4_HCONV_PRIV_H +#define H4_HCONV_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /*****************************************************************************/ /* CONSTANT DEFINITIONS */ @@ -122,4 +122,4 @@ union float_uint_uchar { unsigned char c[4]; }; -#endif /* H4_HCONV_H */ +#endif /* H4_HCONV_PRIV_H */ diff --git a/hdf/src/hdatainfo.c b/hdf/src/hdatainfo.c index 00f49bca7a..b9c44619fd 100644 --- a/hdf/src/hdatainfo.c +++ b/hdf/src/hdatainfo.c @@ -44,12 +44,13 @@ LOW-LEVEL ROUTINES **********************************************************************/ -#include "hdfi.h" -#include "hlimits.h" -#include "vgint.h" -#include "mfani.h" +#include "hdf_priv.h" + #include "mfan.h" -#include "mfgri.h" + +#include "vg_priv.h" +#include "mfan_priv.h" +#include "mfgr_priv.h" #ifdef H4_HAVE_LIBSZ /* we have the szip library */ #include "szlib.h" diff --git a/hdf/src/hdfi.h b/hdf/src/hdf_priv.h similarity index 99% rename from hdf/src/hdfi.h rename to hdf/src/hdf_priv.h index f5b6df2ffa..ebbb9e47c6 100644 --- a/hdf/src/hdfi.h +++ b/hdf/src/hdf_priv.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H4_HDFI_H -#define H4_HDFI_H +#ifndef H4_HDF_PRIV_H +#define H4_HDF_PRIV_H /* Define the I/O scheme before hdf.h to avoid an ordering mess in the * vconv.c code @@ -25,8 +25,6 @@ /* The library always uses UNIXBUFIO */ #define FILELIB UNIXBUFIO -#include "hdf.h" - /*--------------------------------------------------------------------------*/ /* MT/NT constants */ /* Four MT nibbles represent double, float, int, uchar (from most */ @@ -70,6 +68,10 @@ #define DF_MT DFMT_LE #endif +/* Common library headers */ +#include "hdf.h" +#include "herr_priv.h" + /* Standard C library headers */ #include #include @@ -259,4 +261,4 @@ typedef intptr_t hdf_pint_t; */ #define JMEMSYS MEM_ANSI -#endif /* H4_HDFI_H */ +#endif /* H4_HDF_PRIV_H */ diff --git a/hdf/src/hdfalloc.c b/hdf/src/hdfalloc.c index 81dee7778d..8c2dd11b03 100644 --- a/hdf/src/hdfalloc.c +++ b/hdf/src/hdfalloc.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "hdfi.h" +#include "hdf_priv.h" /* LOCAL ROUTINES diff --git a/hdf/src/herr.c b/hdf/src/herr.c index 7149bd6afa..a6c41b6801 100644 --- a/hdf/src/herr.c +++ b/hdf/src/herr.c @@ -26,7 +26,7 @@ EXPORTED ROUTINES HEvalue -- return a error off of the error stack */ -#include "hdfi.h" +#include "hdf_priv.h" /* ** Include files for variable argument processing for HEreport diff --git a/hdf/src/herr.h b/hdf/src/herr.h index 4f6d8bf7b9..a61304a39c 100644 --- a/hdf/src/herr.h +++ b/hdf/src/herr.h @@ -11,123 +11,25 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/*+ herr.h - *** header file for using error routines - *** to be included by all ".c" files - + */ +/* herr.h + * + * Error routines + */ #ifndef H4_HERR_H #define H4_HERR_H #include "hdf.h" -/* HERROR macro, used to facilitate error reporting */ -#define HERROR(e) HEpush(e, __func__, __FILE__, __LINE__) - -/* HRETURN_ERROR macro, used to facilitate error reporting. Makes - same assumptions as HERROR. IN ADDITION, this macro causes - a return from the calling routine */ - -#define HRETURN_ERROR(err, ret_val) \ - do { \ - HERROR(err); \ - return (ret_val); \ - } while (0) - -/* HCLOSE_RETURN_ERROR macro, used to facilitate error reporting. Makes - same assumptions as HRETURN_ERROR. IN ADDITION, this macro causes - the file specified by the id "fid" to be closed */ - -#define HCLOSE_RETURN_ERROR(hfid, err, ret_val) \ - do { \ - HERROR(err); \ - Hclose(hfid); \ - return (ret_val); \ - } while (0) - -/* HGOTO_ERROR macro, used to facilitate error reporting. Makes - same assumptions as HERROR. IN ADDITION, this macro causes - a jump to the label 'done' which should be in every function - Also there is an assumption of a variable 'ret_value' */ - -#define HGOTO_ERROR(err, ret_val) \ - do { \ - HERROR(err); \ - ret_value = ret_val; \ - goto done; \ - } while (0) - -/* HGOTO_FAIL macro, used to facilitate error reporting. This one - is added in 2019 to tidy the code. It is similar to HGOTO_ERROR, - except it does not call HERROR. This is to preserve the exact - behavior as the original code. */ - -#define HGOTO_FAIL(ret_val) \ - do { \ - ret_value = ret_val; \ - goto done; \ - } while (0) - -/* HCLOSE_RETURN_ERROR macro, used to facilitate error reporting. Makes - same assumptions as HRETURN_ERROR. IN ADDITION, this macro causes - the file specified by the id "fid" to be closed - Also , this macro causes a jump to the label 'done' which should - be in every function. There is an assumption of a variable 'ret_value' */ - -#define HCLOSE_GOTO_ERROR(hfid, err, ret_val) \ - do { \ - HERROR(err); \ - Hclose(hfid); \ - ret_value = ret_val; \ - goto done; \ - } while (0) - -/* HGOTO_DONE macro, used to facilitate the new error reporting model. - This macro is just a wrapper to set the return value and jump to the 'done' - label. Also assumption of a variable 'ret_value' */ - -#define HGOTO_DONE(ret_val) \ - do { \ - ret_value = ret_val; \ - goto done; \ - } while (0) - -/* For further error reporting */ -#define HE_REPORT(msg) HEreport(msg) -#define HE_REPORT_RETURN(msg, ret_val) \ - do { \ - HEreport(msg); \ - return (ret_val); \ - } while (0) -#define HE_CLOSE_REPORT_RETURN(hfid, msg, ret_val) \ - do { \ - HEreport(msg); \ - Hclose(hfid); \ - return (ret_val); \ - } while (0) - -#define HE_REPORT_GOTO(msg, ret_val) \ - do { \ - HEreport(msg); \ - ret_value = ret_val; \ - goto done; \ - } while (0) -#define HE_CLOSE_REPORT_GOTO(hfid, msg, ret_val) \ - do { \ - HEreport(msg); \ - Hclose(hfid); \ - ret_value = ret_val; \ - goto done; \ - } while (0) - /* - ====================================================================== - Error codes - - NOTE: Remember to update the error_messages[] structure in herr.c - whenever errors are added/deleted from this list. - ====================================================================== + * ====================================================================== + * Error codes + * + * NOTE: Remember to update the error_messages[] structure in herr.c + * whenever errors are added/deleted from this list. + * ====================================================================== */ + /* Declare an enumerated type which holds all the valid HDF error codes */ typedef enum { DFE_NONE = 0, /* special zero, no error */ diff --git a/hdf/src/herr_priv.h b/hdf/src/herr_priv.h new file mode 100644 index 0000000000..5993982a26 --- /dev/null +++ b/hdf/src/herr_priv.h @@ -0,0 +1,125 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF. The full HDF copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* herr_priv.h + * + * Error routines (private) + */ + +#ifndef H4_HERR_PRIV_H +#define H4_HERR_PRIV_H + +#include "hproto.h" + +/* HERROR macro, used to facilitate error reporting */ +#define HERROR(e) HEpush(e, __func__, __FILE__, __LINE__) + +/* HRETURN_ERROR macro, used to facilitate error reporting. Makes + * same assumptions as HERROR. IN ADDITION, this macro causes + * a return from the calling routine + */ + +#define HRETURN_ERROR(err, ret_val) \ + do { \ + HERROR(err); \ + return (ret_val); \ + } while (0) + +/* HGOTO_ERROR macro, used to facilitate error reporting. Makes + * same assumptions as HERROR. IN ADDITION, this macro causes + * a jump to the label 'done' which should be in every function + * Also there is an assumption of a variable 'ret_value' + */ + +#define HGOTO_ERROR(err, ret_val) \ + do { \ + HERROR(err); \ + ret_value = ret_val; \ + goto done; \ + } while (0) + +/* HGOTO_FAIL macro, used to facilitate error reporting. This one + * is added in 2019 to tidy the code. It is similar to HGOTO_ERROR, + * except it does not call HERROR. This is to preserve the exact + * behavior as the original code. + */ + +#define HGOTO_FAIL(ret_val) \ + do { \ + ret_value = ret_val; \ + goto done; \ + } while (0) + +/* HCLOSE_GOTO_ERROR macro, used to facilitate error reporting. Makes + * same assumptions as HRETURN_ERROR. IN ADDITION, this macro causes + * the file specified by the id "fid" to be closed + * Also , this macro causes a jump to the label 'done' which should + * be in every function. There is an assumption of a variable 'ret_value' + */ + +/* TODO: Refactor this out of library and simply close hfid in the `done` target */ + +#define HCLOSE_GOTO_ERROR(hfid, err, ret_val) \ + do { \ + HERROR(err); \ + Hclose(hfid); \ + ret_value = ret_val; \ + goto done; \ + } while (0) + +/* HGOTO_DONE macro, used to facilitate the new error reporting model. + * This macro is just a wrapper to set the return value and jump to the 'done' + * label. Also assumption of a variable 'ret_value' + */ + +#define HGOTO_DONE(ret_val) \ + do { \ + ret_value = ret_val; \ + goto done; \ + } while (0) + +/*******************************/ +/* For further error reporting */ +/*******************************/ + +#define HE_REPORT(msg) HEreport(msg) + +#define HE_REPORT_RETURN(msg, ret_val) \ + do { \ + HEreport(msg); \ + return (ret_val); \ + } while (0) + +#define HE_CLOSE_REPORT_RETURN(hfid, msg, ret_val) \ + do { \ + HEreport(msg); \ + Hclose(hfid); \ + return (ret_val); \ + } while (0) + +#define HE_REPORT_GOTO(msg, ret_val) \ + do { \ + HEreport(msg); \ + ret_value = ret_val; \ + goto done; \ + } while (0) + +#define HE_CLOSE_REPORT_GOTO(hfid, msg, ret_val) \ + do { \ + HEreport(msg); \ + Hclose(hfid); \ + ret_value = ret_val; \ + goto done; \ + } while (0) + +#endif /* H4_HERR_PRIV_H */ diff --git a/hdf/src/herrf.c b/hdf/src/herrf.c index fbb023bdc4..769fca26cf 100644 --- a/hdf/src/herrf.c +++ b/hdf/src/herrf.c @@ -20,7 +20,7 @@ * Remarks: none *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/hextelt.c b/hdf/src/hextelt.c index 35a07874eb..4382c1aea3 100644 --- a/hdf/src/hextelt.c +++ b/hdf/src/hextelt.c @@ -74,8 +74,8 @@ EXPORTED ROUTINES ------------------------------------------------------------------------- */ -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* Directory separator definitions relating to a path. * Note this does not provide a universal way to recognize diff --git a/hdf/src/hfile.c b/hdf/src/hfile.c index 19fb2b354b..8008526704 100644 --- a/hdf/src/hfile.c +++ b/hdf/src/hfile.c @@ -18,7 +18,7 @@ H-Level Limits ============== - o MAX_ACC access records open at a single time (#define in hfile.h) + o MAX_ACC access records open at a single time (#define in hfile_priv.h) o int16 total tags (fixed) o int32 max length and offset of an element in an HDF file (fixed) @@ -112,9 +112,9 @@ #include -#include "hdfi.h" -#include "hfile.h" -#include "glist.h" /* for double-linked lists, stacks and queues */ +#include "hdf_priv.h" +#include "hfile_priv.h" +#include "glist_priv.h" /* for double-linked lists, stacks and queues */ /*--------------------- Locally defined Globals -----------------------------*/ @@ -155,7 +155,7 @@ extern funclist_t comp_funcs; /* Functions for accessing chunked data elements. For definition of the chunked data element, see hchunk.c. */ -#include "hchunks.h" +#include "hchunks_priv.h" /* Functions for accessing buffered data elements. For definition of the buffered data element, see hbuffer.c. */ @@ -205,7 +205,7 @@ static intn HIstart(void); /*-------------------------------------------------------------------------- NAME - Hopen -- Opens a HDF file. + Hopen -- Opens or creates an HDF file. USAGE int32 Hopen(path, access, ndds) char *path; IN: Name of file to be opened. @@ -2438,7 +2438,7 @@ HDbase_tag(uint16 tag) RETURNS returns SUCCEED (0). DESCRIPTION - Copies values from #defines in hfile.h to provided buffers. This + Copies values from #defines in hfile_priv.h to provided buffers. This information is statistically compiled into the HDF library, so it is not necessary to have any files open to get this information. diff --git a/hdf/src/hfile.h b/hdf/src/hfile_priv.h similarity index 98% rename from hdf/src/hfile.h rename to hdf/src/hfile_priv.h index 447c31ab44..370e60098c 100644 --- a/hdf/src/hfile.h +++ b/hdf/src/hfile_priv.h @@ -11,20 +11,20 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/*+ hfile.h - *** Header for hfile.c, routines for low level data element I/O - + */ +/* hfile_priv.h + * Header for hfile.c, routines for low level data element I/O + */ -#ifndef H4_HFILE_H -#define H4_HFILE_H +#ifndef H4_HFILE_PRIV_H +#define H4_HFILE_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" -#include "tbbt.h" -#include "bitvect.h" -#include "atom.h" -#include "linklist.h" -#include "dynarray.h" +#include "tbbt_priv.h" +#include "bitvect_priv.h" +#include "atom_priv.h" +#include "linklist_priv.h" +#include "dynarray_priv.h" /* Magic cookie for HDF data files */ #define MAGICLEN 4 /* length */ @@ -57,10 +57,10 @@ #define LIBVER_MAJOR 4 #define LIBVER_MINOR 3 #define LIBVER_RELEASE 0 -#define LIBVER_SUBRELEASE "1" /* For pre-releases like snap0 */ - /* Empty string for real releases. */ +#define LIBVER_SUBRELEASE "1" /* For pre-releases like snap0 */ + /* Empty string for real releases */ #define LIBVER_STRING "HDF Version 4.3 Release 0-1, February 5, 2024" -#define LIBVSTR_LEN 80 /* length of version string */ +#define LIBVSTR_LEN 80 /* Length of version string */ #define LIBVER_LEN 92 /* 4+4+4+80 = 92 */ /* end of version tags */ @@ -532,9 +532,9 @@ HDFLIBAPI int32 HCPinfo(accrec_t *access_rec, sp_info_block_t *info_block); HDFLIBAPI int32 get_comp_len(accrec_t *access_rec); /* - ** from hchunks.c - should be the same as found in 'hchunks.h' + ** from hchunks.c - should be the same as found in 'hchunks_priv.h' */ -#include "hchunks.h" +#include "hchunks_priv.h" /* ** from hbuffer.c @@ -789,4 +789,4 @@ intn HTPdump_dds(int32 file_id, /* IN: file ID of HDF file to dump info for */ } #endif -#endif /* H4_HFILE_H */ +#endif /* H4_HFILE_PRIV_H */ diff --git a/hdf/src/hfiledd.c b/hdf/src/hfiledd.c index 5a222ead01..f89a2063ac 100644 --- a/hdf/src/hfiledd.c +++ b/hdf/src/hfiledd.c @@ -84,8 +84,8 @@ OLD ROUTINES HIunregister_tag_ref - mark a ref as un-used for a tag */ -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* Private routines */ static intn HTIfind_dd(filerec_t *file_rec, uint16 look_tag, uint16 look_ref, dd_t **pdd, intn direction); diff --git a/hdf/src/hfilef.c b/hdf/src/hfilef.c index 3f287bf9eb..a0cbad8ce3 100644 --- a/hdf/src/hfilef.c +++ b/hdf/src/hfilef.c @@ -20,7 +20,7 @@ * hclose_: call Hclose to close HDF file *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/hkit.c b/hdf/src/hkit.c index bf449c7db7..c7fb3da2ac 100644 --- a/hdf/src/hkit.c +++ b/hdf/src/hkit.c @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "hdfi.h" -#include "hkit.h" +#include "hdf_priv.h" +#include "hkit_priv.h" /* LOCAL ROUTINES diff --git a/hdf/src/hkit.h b/hdf/src/hkit_priv.h similarity index 97% rename from hdf/src/hkit.h rename to hdf/src/hkit_priv.h index e557d03dbc..8d834b408f 100644 --- a/hdf/src/hkit.h +++ b/hdf/src/hkit_priv.h @@ -11,15 +11,16 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/*+ hkit.h - *** private header file for hkit routines - + */ +/* hkit_priv.h + * + * private header file for hkit routines + */ -#ifndef H4_HKIT_H -#define H4_HKIT_H +#ifndef H4_HKIT_PRIV_H +#define H4_HKIT_PRIV_H -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* tag_messages is the list of tag descriptions in the system, kept as tag-description pairs. To look up a description, a linear search is @@ -158,4 +159,4 @@ static const nt_descript_t nt_descriptions[] = { }; -#endif /* H4_HKIT_H */ +#endif /* H4_HKIT_PRIV_H */ diff --git a/hdf/src/hlimits.h b/hdf/src/hlimits.h index 8873ee4f21..fb7ec30b29 100644 --- a/hdf/src/hlimits.h +++ b/hdf/src/hlimits.h @@ -30,7 +30,7 @@ /************************************************************************** * Generally useful macro definitions - * (These are copied from hdfi.h and should remain included in both files + * (These are copied from hdf_priv.h and should remain included in both files * because hlimits.h is included from netcdf.h which is used in some * netCDF utilities which don't need or want the rest of the HDF header * files. -QAK - 2/17/99 ) @@ -224,7 +224,7 @@ changing the class name variable declaration much easier - BMR 4/1/02*/ * _HDF_ATTRIBUTE "Attr0.0" 8/1/96 */ /* classes of the Vdatas/Vgroups created by the SD interface, - from local_nc.h */ + from nc_priv.h */ #define _HDF_ATTRIBUTE "Attr0.0" /* class of a Vdata containing SD interface attribute */ #define _HDF_VARIABLE "Var0.0" @@ -250,7 +250,7 @@ changing the class name variable declaration much easier - BMR 4/1/02*/ #define ATTR_FIELD_NAME "VALUES" /* The following vdata class name is reserved by the Chunking interface. - originally defined in 'hchunks.h'. The full class name + originally defined in 'hchunks_priv.h'. The full class name currently is "_HDF_CHK_TBL_0". -GV 9/25/97 Made the vdata class name available to other interfaces since it is needed diff --git a/hdf/src/hproto_fortran.h b/hdf/src/hproto_fortran.h index 669ca600e3..4c94aa35c4 100644 --- a/hdf/src/hproto_fortran.h +++ b/hdf/src/hproto_fortran.h @@ -15,7 +15,7 @@ #define H4_H_PROTO_FORTRAN #include "H4api_adpt.h" -#include "df.h" +#include "df_priv.h" #ifdef __cplusplus extern "C" { @@ -536,7 +536,7 @@ HDFFCLIBAPI intf nhinumbr(int32 file_id, uint16 tag); HDFFCLIBAPI intf nhconfinfc(intf *coder_type, intf *info); /* - ** from dfufp2im.c + ** from dfufp2i.c */ #define nduif2i H4_F77_FUNC(duif2i, DUIF2I) diff --git a/hdf/src/hqueue.h b/hdf/src/hqueue_priv.h similarity index 98% rename from hdf/src/hqueue.h rename to hdf/src/hqueue_priv.h index 5f7d24ebd0..f1470250f0 100644 --- a/hdf/src/hqueue.h +++ b/hdf/src/hqueue_priv.h @@ -30,15 +30,15 @@ */ /***************************************************************************** - * File: hqueue.h + * File: hqueue_priv.h * * This is a modffied version of the original Berkeley code for * manipulating a memory pool. This version however is not * compatible with the original Berkeley version. *****************************************************************************/ -#ifndef H4_HQUEUE_H -#define H4_HQUEUE_H +#ifndef H4_HQUEUE_PRIV_H +#define H4_HQUEUE_PRIV_H /* * This file defines three types of data structures: lists, tail queues, @@ -152,4 +152,4 @@ else \ (elm)->field.cqe_prev->field.cqe_next = (elm)->field.cqe_next; \ } -#endif /* H4_HQUEUE_H */ +#endif /* H4_HQUEUE_PRIV_H */ diff --git a/hdf/src/linklist.c b/hdf/src/linklist.c index 5180e16460..60334d45c1 100644 --- a/hdf/src/linklist.c +++ b/hdf/src/linklist.c @@ -28,8 +28,6 @@ DESIGN a pointer to a managed object. The list may be sorted or unsorted, based on the comparison function. -BUGS/LIMITATIONS - LOCAL ROUTINES HULIget_list_node - Gets a list node HULIrelease_list_node - Releases a list node @@ -44,8 +42,8 @@ EXPORTED ROUTINES HULshutdown - Close down the HUL interface */ -#include "hdfi.h" -#include "linklist.h" +#include "hdf_priv.h" +#include "linklist_priv.h" /* Pointer to the list node free list */ static node_info_t *node_free_list = NULL; diff --git a/hdf/src/linklist.h b/hdf/src/linklist_priv.h similarity index 98% rename from hdf/src/linklist.h rename to hdf/src/linklist_priv.h index d7cbfd9c54..895d3a8f6a 100644 --- a/hdf/src/linklist.h +++ b/hdf/src/linklist_priv.h @@ -12,14 +12,14 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: linklist.h + * File: linklist_priv.h * Purpose: header file for linked list API *---------------------------------------------------------------------------*/ -#ifndef H4_LINKLIST_H -#define H4_LINKLIST_H +#ifndef H4_LINKLIST_PRIV_H +#define H4_LINKLIST_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* Definitions for linked-list creation flags */ #define HUL_UNSORTED_LIST 0x0000 @@ -184,4 +184,4 @@ intn HULshutdown(void); } #endif -#endif /* H4_LINKLIST_H */ +#endif /* H4_LINKLIST_PRIV_H */ diff --git a/hdf/src/mcache.c b/hdf/src/mcache.c index 01769d3362..338e63a811 100644 --- a/hdf/src/mcache.c +++ b/hdf/src/mcache.c @@ -49,9 +49,9 @@ #define STATISTICS */ -#include "hdfi.h" -#include "hqueue.h" -#include "mcache.h" +#include "hdf_priv.h" +#include "hqueue_priv.h" +#include "mcache_priv.h" /* Private routines */ static BKT *mcache_bkt(MCACHE *mp); @@ -818,31 +818,30 @@ mcache_stat(MCACHE *mp /* IN: MCACHE cookie */) /* check inputs */ if (mp != NULL) { - (void)fprintf(stderr, "%u pages in the object\n", mp->npages); - (void)fprintf(stderr, "page size %u, caching %u pages of %u page max cache\n", mp->pagesize, - mp->curcache, mp->maxcache); - (void)fprintf(stderr, "%u page puts, %u page gets, %u page new\n", mp->pageput, mp->pageget, - mp->pagenew); - (void)fprintf(stderr, "%u page allocs, %u page flushes\n", mp->pagealloc, mp->pageflush); + fprintf(stderr, "%u pages in the object\n", mp->npages); + fprintf(stderr, "page size %u, caching %u pages of %u page max cache\n", mp->pagesize, mp->curcache, + mp->maxcache); + fprintf(stderr, "%u page puts, %u page gets, %u page new\n", mp->pageput, mp->pageget, mp->pagenew); + fprintf(stderr, "%u page allocs, %u page flushes\n", mp->pagealloc, mp->pageflush); if (mp->cachehit + mp->cachemiss) - (void)fprintf(stderr, "%.0f%% cache hit rate (%u hits, %u misses)\n", - ((double)mp->cachehit / (mp->cachehit + mp->cachemiss)) * 100, mp->cachehit, - mp->cachemiss); - (void)fprintf(stderr, "%u page reads, %u page writes\n", mp->pageread, mp->pagewrite); - (void)fprintf(stderr, "%u listhits, %u listallocs\n", mp->listhit, mp->listalloc); - (void)fprintf(stderr, "sizeof(MCACHE)=%zu, sizeof(BKT)=%zu, sizeof(L_ELEM)=%zu\n", sizeof(MCACHE), - sizeof(BKT), sizeof(L_ELEM)); - (void)fprintf(stderr, "memory pool used %u bytes\n", - (int32)(sizeof(MCACHE) + (sizeof(BKT) + mp->pagesize) * mp->curcache + - (sizeof(L_ELEM) * mp->npages))); + fprintf(stderr, "%.0f%% cache hit rate (%u hits, %u misses)\n", + ((double)mp->cachehit / (mp->cachehit + mp->cachemiss)) * 100, mp->cachehit, + mp->cachemiss); + fprintf(stderr, "%u page reads, %u page writes\n", mp->pageread, mp->pagewrite); + fprintf(stderr, "%u listhits, %u listallocs\n", mp->listhit, mp->listalloc); + fprintf(stderr, "sizeof(MCACHE)=%zu, sizeof(BKT)=%zu, sizeof(L_ELEM)=%zu\n", sizeof(MCACHE), + sizeof(BKT), sizeof(L_ELEM)); + fprintf(stderr, "memory pool used %u bytes\n", + (int32)(sizeof(MCACHE) + (sizeof(BKT) + mp->pagesize) * mp->curcache + + (sizeof(L_ELEM) * mp->npages))); sep = ""; cnt = 0; for (bp = mp->lqh.cqh_first; bp != (void *)&mp->lqh; bp = bp->q.cqe_next) { - (void)fprintf(stderr, "%s%u", sep, bp->pgno); + fprintf(stderr, "%s%u", sep, bp->pgno); if (bp->flags & MCACHE_DIRTY) - (void)fprintf(stderr, "d"); + fprintf(stderr, "d"); if (bp->flags & MCACHE_PINNED) - (void)fprintf(stderr, "P"); + fprintf(stderr, "P"); if (++cnt == 10) { sep = "\n"; cnt = 0; @@ -850,8 +849,8 @@ mcache_stat(MCACHE *mp /* IN: MCACHE cookie */) else sep = ", "; } - (void)fprintf(stderr, "\n"); - (void)fprintf(stderr, "Element hits\n"); + fprintf(stderr, "\n"); + fprintf(stderr, "Element hits\n"); sep = ""; cnt = 0; hitcnt = 0; @@ -859,7 +858,7 @@ mcache_stat(MCACHE *mp /* IN: MCACHE cookie */) lhead = &mp->lhqh[entry]; for (lp = lhead->cqh_first; lp != (void *)lhead; lp = lp->hl.cqe_next) { cnt++; - (void)fprintf(stderr, "%s%u(%u)", sep, lp->pgno, lp->elemhit); + fprintf(stderr, "%s%u(%u)", sep, lp->pgno, lp->elemhit); hitcnt += lp->elemhit; if (cnt >= 8) { sep = "\n"; @@ -869,12 +868,12 @@ mcache_stat(MCACHE *mp /* IN: MCACHE cookie */) sep = ", "; } if (cnt >= 8) { - (void)fprintf(stderr, "\n"); + fprintf(stderr, "\n"); cnt = 0; } } - (void)fprintf(stderr, "\n"); - (void)fprintf(stderr, "Total num of elemhits=%d\n", hitcnt); + fprintf(stderr, "\n"); + fprintf(stderr, "Total num of elemhits=%d\n", hitcnt); } /* end if mp */ } #endif /* STATISTICS */ diff --git a/hdf/src/mcache.h b/hdf/src/mcache_priv.h similarity index 97% rename from hdf/src/mcache.h rename to hdf/src/mcache_priv.h index cd5d0114ce..582770bffc 100644 --- a/hdf/src/mcache.h +++ b/hdf/src/mcache_priv.h @@ -29,7 +29,7 @@ */ /***************************************************************************** - * File: mcache.h + * File: mcache_priv.h * * This is a modified version of the original Berkeley code for * manipulating a memory pool. This version however is not @@ -46,11 +46,11 @@ * -georgev */ -#ifndef H4_MCACHE_H -#define H4_MCACHE_H +#ifndef H4_MCACHE_PRIV_H +#define H4_MCACHE_PRIV_H -#include "hdfi.h" -#include "hqueue.h" /* Circular queue functions(Macros) */ +#include "hdf_priv.h" +#include "hqueue_priv.h" /* Circular queue functions(Macros) */ /* Set return/succeed values */ #ifdef SUCCEED @@ -188,4 +188,4 @@ HDFLIBAPI void mcache_stat(MCACHE *mp /* IN: MCACHE cookie */); } #endif -#endif /* H4_MCACHE_H */ +#endif /* H4_MCACHE_PRIV_H */ diff --git a/hdf/src/mfan.c b/hdf/src/mfan.c index a506742812..1a1129c9eb 100644 --- a/hdf/src/mfan.c +++ b/hdf/src/mfan.c @@ -78,12 +78,12 @@ * *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" -#include "mfani.h" +#include "mfan_priv.h" #include "mfan.h" -#include "atom.h" -#include "hfile.h" /* needed for filerec_t */ +#include "atom_priv.h" +#include "hfile_priv.h" /* needed for filerec_t */ /* Whether we've installed the library termination function yet for this interface */ @@ -569,73 +569,6 @@ ANIcreate_ann_tree(int32 an_id,/* IN: annotation interface id */ return ret_value; } /* ANIcreate_ann_tree */ -#if NOT_USED_YET -/*-------------------------------------------------------------------------- - NAME - ANIfind -- find annotation id for given annotation type and ref number - - DESCRIPTION - Find annotation id for the given annotation type and ref number - - RETURNS - Annotation id if successful and FAIL (-1) otherwise - - AUTHOR - GeorgeV. - - -------------------------------------------------------------------------*/ -static int32 -ANIfind(int32 an_id, /* IN: annotation interface id */ - ann_type type, /* IN: AN_DATA_LABEL for data labels, - AN_DATA_DESC for data descriptions, - AN_FILE_LABEL for file labels, - AN_FILE_DESC for file descriptions.*/ - uint16 ann_ref /* IN: ref of annotation */) -{ - filerec_t *file_rec = NULL; /* file record pointer */ - TBBT_NODE *entry = NULL; - ANentry *ann_entry = NULL; - int32 ann_key; - int32 ret_value = SUCCEED; - - /* Clear error stack */ - HEclear(); - - /* convert an_id i.e. file_id to file rec and check for validity */ - file_rec = HAatom_object(an_id); - if (BADFREC(file_rec)) - HGOTO_ERROR(DFE_ARGS, FAIL); - - /* Check for empty annotation tree of 'type'? */ - if (file_rec->an_num[type] == -1) { - if ((file_rec->an_tree[type] = (TBBT_TREE *)tbbtdmake(ANIanncmp, sizeof(int32), 0)) == NULL) { - HE_REPORT_GOTO("failed to create annotation tree", FAIL); - } - - file_rec->an_num[type] = 0; /* initialize after allocation */ - } - - /* Create key from type/ref pair - * ---------------------------- - * | type(16bits) | ref(16bits) | - * -----------------------------*/ - ann_key = AN_CREATE_KEY(type, ann_ref); - - /* See if annotation of 'type' with ref exits */ - if ((entry = tbbtdfind(file_rec->an_tree[type], &ann_key, NULL)) == NULL) - HE_REPORT_GOTO("failed to find annotation of 'type'", FAIL); - - /* get annotation entry from node */ - ann_entry = (ANentry *)entry->data; - - /* return annotation id */ - ret_value = ann_entry->ann_id; - -done: - return ret_value; -} /* ANIfind */ -#endif /* NOT_USED_YET */ - /*-------------------------------------------------------------------------- NAME ANInumann -- find number of annotation of 'type' that diff --git a/hdf/src/mfan.h b/hdf/src/mfan.h index cb8cdee532..9d9b3925d0 100644 --- a/hdf/src/mfan.h +++ b/hdf/src/mfan.h @@ -19,7 +19,7 @@ #ifndef H4_MFAN_H #define H4_MFAN_H -#include "hdfi.h" +#include "hdf.h" #ifdef __cplusplus extern "C" { diff --git a/hdf/src/mfani.h b/hdf/src/mfan_priv.h similarity index 95% rename from hdf/src/mfani.h rename to hdf/src/mfan_priv.h index 40b90592cd..0c6b9c8dbe 100644 --- a/hdf/src/mfani.h +++ b/hdf/src/mfan_priv.h @@ -12,14 +12,14 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*------------------------------------------------------------------------------ - * File: mfani.h + * File: mfan_priv.h * Purpose: private header file for the Multi-file Annotation Interface *----------------------------------------------------------------------------*/ -#ifndef H4_MFANI_H -#define H4_MFANI_H +#ifndef H4_MFAN_PRIV_H +#define H4_MFAN_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* This structure is used to find which file the annotation belongs to * and use the subsequent file specific annotation 'key' to find the @@ -62,4 +62,4 @@ typedef struct ANentry { /* Obtain Annotation type from key */ #define AN_KEY2TYPE(k) ((int32)((int32)k >> 16)) -#endif /* H4_MFANI_H */ +#endif /* H4_MFAN_PRIV_H */ diff --git a/hdf/src/mfanf.c b/hdf/src/mfanf.c index 25ca8f6f0a..d3c2e25796 100644 --- a/hdf/src/mfanf.c +++ b/hdf/src/mfanf.c @@ -47,7 +47,7 @@ * aftagatype - annotation TAG to corresponding annotation type *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/mfgr.c b/hdf/src/mfgr.c index 303a659038..64c0670d4d 100644 --- a/hdf/src/mfgr.c +++ b/hdf/src/mfgr.c @@ -154,9 +154,8 @@ intn GRIil_convert(const void * inbuf,gr_interlace_t inil,void * outbuf, - Copy a pixel buffer from one interlace to another. */ -#include "hdfi.h" -#include "hlimits.h" -#include "mfgri.h" +#include "hdf_priv.h" +#include "mfgr_priv.h" #ifdef H4_HAVE_LIBSZ /* we have the library */ #include "szlib.h" @@ -3936,11 +3935,6 @@ GRsetaccesstype(int32 riid, uintn accesstype) DESCRIPTION Sets the computed szip parameters before calling HCcreate. - - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG --------------------------------------------------------------------------*/ intn GRsetup_szip_parms(ri_info_t *ri_ptr, comp_info *c_info, int32 *cdims) @@ -3949,7 +3943,6 @@ GRsetup_szip_parms(ri_info_t *ri_ptr, comp_info *c_info, int32 *cdims) int32 ndims; int32 ncomp; int32 xdims[H4_MAX_VAR_DIMS]; - intn ret_value = SUCCEED; ndims = 2; xdims[0] = ri_ptr->img_dim.xdim; @@ -3958,10 +3951,7 @@ GRsetup_szip_parms(ri_info_t *ri_ptr, comp_info *c_info, int32 *cdims) nt = ri_ptr->img_dim.nt; ncomp = ri_ptr->img_dim.ncomps; - ret_value = HCPsetup_szip_parms(c_info, nt, ncomp, ndims, xdims, cdims); - -done: - return ret_value; + return HCPsetup_szip_parms(c_info, nt, ncomp, ndims, xdims, cdims); } #endif diff --git a/hdf/src/mfgri.h b/hdf/src/mfgr_priv.h similarity index 97% rename from hdf/src/mfgri.h rename to hdf/src/mfgr_priv.h index 6e6f5dc80b..7e3f5e1f37 100644 --- a/hdf/src/mfgri.h +++ b/hdf/src/mfgr_priv.h @@ -12,17 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: mfgri.h + * File: mfgr_priv.h * Purpose: private header file for multi-file general raster information *---------------------------------------------------------------------------*/ -#ifndef H4_MFGRI_H -#define H4_MFGRI_H +#ifndef H4_MFGR_PRIV_H +#define H4_MFGR_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" -#include "hfile.h" -#include "tbbt.h" +#include "hfile_priv.h" +#include "tbbt_priv.h" /* This is the size of the hash tables used for GR & RI IDs */ #define GRATOM_HASH_SIZE 32 @@ -135,4 +135,4 @@ HDFLIBAPI void GRIridestroynode(void *n); } #endif -#endif /* H4_MFGRI_H */ +#endif /* H4_MFGR_PRIV_H */ diff --git a/hdf/src/mfgrf.c b/hdf/src/mfgrf.c index f47996a2a4..aee08b74c6 100644 --- a/hdf/src/mfgrf.c +++ b/hdf/src/mfgrf.c @@ -54,7 +54,7 @@ * by palette identifier *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" #include "hproto_fortran.h" /* Local pre-processor macros */ diff --git a/hdf/src/mstdio.c b/hdf/src/mstdio.c index 4ff60da112..f9577f65d4 100644 --- a/hdf/src/mstdio.c +++ b/hdf/src/mstdio.c @@ -12,9 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* -FILE - mstdio.c - HDF stdio-like modeling I/O routines + mstdio.c - HDF stdio-like modeling I/O routines REMARKS Basically a NOP interface, it just calls the encoding layer. @@ -39,11 +37,11 @@ EXPORTED ROUTINES */ /* General HDF includes */ -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* HDF compression includes */ -#include "hcompi.h" /* Internal definitions for compression */ +#include "hcomp_priv.h" /* Internal definitions for compression */ funclist_t mstdio_funcs = {HCPmstdio_stread, HCPmstdio_stwrite, diff --git a/hdf/src/mstdio.h b/hdf/src/mstdio_priv.h similarity index 94% rename from hdf/src/mstdio.h rename to hdf/src/mstdio_priv.h index 35a90eca25..784bc72a74 100644 --- a/hdf/src/mstdio.h +++ b/hdf/src/mstdio_priv.h @@ -12,17 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: mstdio.h + * File: mstdio_priv.h * Purpose: Header file for stdio-like modeling information. * Dependencies: should be included after hdf.h * Contents: Structures & definitions for stdio modeling. This header * should only be included in hcomp.c and mstdio.c. *---------------------------------------------------------------------------*/ -#ifndef H4_MSTDIO_H -#define H4_MSTDIO_H +#ifndef H4_MSTDIO_PRIV_H +#define H4_MSTDIO_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* model information about stdio model */ typedef struct { @@ -59,4 +59,4 @@ HDFLIBAPI intn HCPmstdio_endaccess(accrec_t *access_rec); } #endif -#endif /* H4_MSTDIO_H */ +#endif /* H4_MSTDIO_PRIV_H */ diff --git a/hdf/src/src.inc b/hdf/src/src.inc deleted file mode 100644 index 50f0b8930f..0000000000 --- a/hdf/src/src.inc +++ /dev/null @@ -1,136 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF. The full HDF copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -# -# ################################################################## -# -# Part of MAKEFILE for creating the HDF library, libdf.a, -# -# This file contains the definitions of all the source code and headers -# used in the actual makefile. They are located here for ease of maintenance. -# -# ################################################################## -# -# - -# Header files not included for copying to 'include' directory during installation -# These are private to the library and users do need them -HDRS_NO= glist.h mcache.h hqueue.h - -HDRS=$(H_HDRS) $(DF_HDRS) $(DFAN_HDRS) $(DFRI_HDRS) $(DFSD_HDRS) $(V_HDRS) \ - $(MFAN_HDRS) $(MFGR_HDRS) - -H_HDRS=hfile.h hdf.h hdfi.h herr.h hproto.h hcomp.h hconv.h hbitio.h \ - tbbt.h crle.h cnbit.h mstdio.h cnone.h cskphuff.h cdeflate.h \ - hlimits.h hntdefs.h htags.h hkit.h hcompi.h bitvect.h atom.h \ - dynarray.h linklist.h hchunks.h cszip.h - -DF_HDRS=df.h dfufp2i.h -DFAN_HDRS=dfan.h -DFRI_HDRS=dfrig.h dfgr.h -DFSD_HDRS=dfsd.h -V_HDRS=vg.h -MFAN_HDRS=mfan.h -MFGR_HDRS=mfgr.h - -CSRCS = $(HCSRCS) $(VCSRCS) $(DFCSRCS) $(MFCSRCS) -HCSRCS=hfile.c herr.c hblocks.c hbuffer.c hcompri.c hextelt.c hkit.c hdfalloc.c \ - hcomp.c hbitio.c tbbt.c hdfalloc.c hcomp.c crle.c cnbit.c mstdio.c cnone.c \ - cskphuff.c cdeflate.c bitvect.c atom.c hfiledd.c dynarray.c linklist.c \ - glist.c hchunks.c mcache.c cszip.c - -VCSRCS=vg.c vrw.c vio.c vparse.c vconv.c vsfld.c vgp.c vhi.c vattr.c - -DFCSRCS=$(DFG_CSRCS) $(DFAN_CSRCS) $(DFSD_CSRCS) $(DFRI_CSRCS) -DFG_CSRCS=dfgroup.c dfconv.c dfufp2i.c dfutil.c dfstubs.c dfknat.c dfkswap.c \ - dfkcray.c dfkvms.c dfkconv.c dfkfuji.c -DFAN_CSRCS=dfan.c -DFSD_CSRCS=dfsd.c -DFRI_CSRCS=dfr8.c dfcomp.c dfrle.c dfimcomp.c dfjpeg.c dfunjpeg.c dfp.c \ - dfgr.c df24.c - -MFCSRCS= $(MFAN_CSRCS) $(MFGR_CSRCS) -MFAN_CSRCS=mfan.c -MFGR_CSRCS=mfgr.c - -COBJS = $(HCOBJS) $(VCOBJS) $(DFCOBJS) $(MFCOBJS) -HCOBJS=hfile.o herr.o hblocks.o hbuffer.o hcompri.o hextelt.o hkit.o hdfalloc.o \ - hcomp.o hbitio.o tbbt.o crle.o cnbit.o mstdio.o cnone.o cskphuff.o \ - cdeflate.o bitvect.o atom.o hfiledd.o dynarray.o linklist.o glist.o \ - hchunks.o mcache.o cszip.o - -VCOBJS=vg.o vrw.o vio.o vparse.o vconv.o vsfld.o vgp.o vhi.o vattr.o - -DFCOBJS=$(DFG_COBJS) $(DFAN_COBJS) $(DFSD_COBJS) $(DFRI_COBJS) -DFG_COBJS=dfgroup.o dfconv.o dfufp2i.o dfutil.o dfstubs.o dfknat.o dfkswap.o \ - dfkcray.o dfkvms.o dfkconv.o dfkfuji.o -DFAN_COBJS=dfan.o -DFSD_COBJS=dfsd.o -DFRI_COBJS=dfr8.o dfcomp.o dfrle.o dfimcomp.o dfjpeg.o dfunjpeg.o dfp.o \ - dfgr.o df24.o - -MFCOBJS= $(MFAN_COBJS) $(MFGR_COBJS) -MFAN_COBJS=mfan.o -MFGR_COBJS=mfgr.o - -FSRCS = $(FCSRCS) $(FFSRCS) -FCSRCS=$(H_FCSRCS) $(V_FCSRCS) $(DF_FCSRCS) $(DFAN_FCSRCS) $(DFSD_FCSRCS) \ - $(DFRI_FCSRCS) $(MFAN_FCSRCS) $(MFGR_FCSRCS) -H_FCSRCS=hfilef.c herrf.c -V_FCSRCS=vgf.c vattrf.c -DF_FCSRCS=dff.c dfutilf.c -DFAN_FCSRCS=dfanf.c -DFSD_FCSRCS=dfsdf.c -DFRI_FCSRCS=dfr8f.c dfpf.c df24f.c -MFAN_FCSRCS=mfanf.c -MFGR_FCSRCS=mfgrf.c - -FFSRCS=$(H_FFSRCS) $(V_FFSRCS) $(DF_FFSRCS) $(DFAN_FFSRCS) $(DFSD_FFSRCS) \ - $(DFRI_FFSRCS) $(MFAN_FFSRCS) $(MFGR_FFSRCS) -H_FFSRCS=hfileff.f -V_FFSRCS=vgff.f vattrff.f -DF_FFSRCS=dfff.f dfufp2if.f -DFAN_FFSRCS=dfanff.f -DFSD_FFSRCS=dfsdff.f -DFRI_FFSRCS=df24ff.f dfpff.f dfr8ff.f -MFAN_FFSRCS= -MFGR_FFSRCS=mfgrff.f - -FOBJS = $(FCOBJS) $(FFOBJS) - -FCOBJS=$(H_FCOBJS) $(V_FCOBJS) $(DF_FCOBJS) $(DFAN_FCOBJS) $(DFSD_FCOBJS) \ - $(DFRI_FCOBJS) $(MFAN_FCOBJS) $(MFGR_FCOBJS) -H_FCOBJS=hfilef.o herrf.o -V_FCOBJS=vgf.o vattrf.o -DF_FCOBJS=dff.o dfutilf.o -DFAN_FCOBJS=dfanf.o -DFSD_FCOBJS=dfsdf.o -DFRI_FCOBJS=dfr8f.o dfpf.o df24f.o -MFAN_FCOBJS=mfanf.o -MFGR_FCOBJS=mfgrf.o - -FFOBJS=$(H_FFOBJS) $(V_FFOBJS) $(DF_FFOBJS) $(DFAN_FFOBJS) $(DFSD_FFOBJS) \ - $(DFRI_FFOBJS) $(MFAN_FFOBJS) $(MFGR_FFOBJS) -H_FFOBJS=hfileff.o -V_FFOBJS=vgff.o vattrff.o -DF_FFOBJS=dfff.o dfufp2if.o -DFAN_FFOBJS=dfanff.o -DFSD_FFOBJS=dfsdff.o -DFRI_FFOBJS=df24ff.o dfpff.o dfr8ff.o -MFAN_FFOBJS= -MFGR_FFOBJS=mfgrff.o - -F90INCS=dffunc.f90 hdf.f90 -FINCS=dffunc.inc hdf.inc $(F90INCS) - - diff --git a/hdf/src/tbbt.c b/hdf/src/tbbt.c index 1eceb5ac2d..d62b5c43e5 100644 --- a/hdf/src/tbbt.c +++ b/hdf/src/tbbt.c @@ -15,8 +15,8 @@ /* Extended from (added threads to) Knuth 6.2.3, Algorithm A (AVL trees) */ /* Basic tree structure by Adel'son-Vel'skii and Landis */ -#include "hdfi.h" -#include "tbbt.h" +#include "hdf_priv.h" +#include "tbbt_priv.h" #define PARENT 0 #define LEFT 1 diff --git a/hdf/src/tbbt.h b/hdf/src/tbbt_priv.h similarity index 97% rename from hdf/src/tbbt.h rename to hdf/src/tbbt_priv.h index b9edc0355a..4b62493088 100644 --- a/hdf/src/tbbt.h +++ b/hdf/src/tbbt_priv.h @@ -11,13 +11,13 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* "tbbt.h" -- Data types/routines for threaded, balanced, binary trees. */ +/* "tbbt_priv.h" -- Data types/routines for threaded, balanced, binary trees. */ /* Extended from Knuth 6.2.3, Algorithm A */ #ifndef H4_TBBT_H #define H4_TBBT_H -#include "hdfi.h" +#include "hdf_priv.h" /* Define the "fast compare" values */ #define TBBT_FAST_UINT16_COMPARE 1 @@ -75,8 +75,10 @@ typedef struct tbbt_tree { * each node will be set equal to the pointer to the data item. * * Since the "data item" pointer is the first field of each tree node, these - * routines may be used without this "tbbt.h" file. For example, assume "ITM" - * is the structure definition for the data items you want to store in lists: + * routines may be used without this "tbbt_priv.h" file. For example, assume + * "ITM" is the structure definition for the data items you want to store in + * lists: + * * ITM ***tbbtdmake( int (*cmp)(void *,void *,int), int arg ); * ITM **root= NULL; (* How to create an empty tree w/o tbbtdmake() *) * ITM **tbbtdfind( ITM ***tree, void *key, ITM ***pp ); diff --git a/hdf/src/vattr.c b/hdf/src/vattr.c index edc6be1c93..11f2fb9cca 100644 --- a/hdf/src/vattr.c +++ b/hdf/src/vattr.c @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" /************************************************************** * diff --git a/hdf/src/vattrf.c b/hdf/src/vattrf.c index 0e6cb7ae9c..ce09d79011 100644 --- a/hdf/src/vattrf.c +++ b/hdf/src/vattrf.c @@ -20,8 +20,8 @@ * ******************************************************/ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" #include "hproto_fortran.h" /* ----------------- vsfcfdx ---------------------- diff --git a/hdf/src/vconv.c b/hdf/src/vconv.c index e2e63927e1..28a739d33a 100644 --- a/hdf/src/vconv.c +++ b/hdf/src/vconv.c @@ -27,9 +27,9 @@ * Part of the HDF Vset interface. */ -#include "hdfi.h" -#include "hfile.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "hfile_priv.h" +#include "vg_priv.h" /* ** ================================================================== diff --git a/hdf/src/vg.c b/hdf/src/vg.c index 734af64909..b36b6a504d 100644 --- a/hdf/src/vg.c +++ b/hdf/src/vg.c @@ -61,8 +61,8 @@ PRIVATE functions manipulate vsdir and are used only within this file. PRIVATE data structures in here pertain to vdata in vsdir only. */ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" /* These are used to determine whether a vdata had been created by the library internally, that is, not created by user's application */ diff --git a/hdf/src/vg.h b/hdf/src/vg.h index 8f22e2a91c..2252d97104 100644 --- a/hdf/src/vg.h +++ b/hdf/src/vg.h @@ -20,7 +20,7 @@ * defines symbols and structures used in all v*.c files * * NOTES: - * This include file depends on the basic HDF *.h files hdfi.h and hdf.h. + * This include file depends on the basic HDF *.h file hdf.h. * An 'S' in the comment means that that data field is saved in the HDF file. * ******************************************************************************/ diff --git a/hdf/src/vgint.h b/hdf/src/vg_priv.h similarity index 98% rename from hdf/src/vgint.h rename to hdf/src/vg_priv.h index 454e256b5f..08140add94 100644 --- a/hdf/src/vgint.h +++ b/hdf/src/vg_priv.h @@ -13,26 +13,26 @@ /***************************************************************************** * - * vgint.h + * vg_priv.h * * Part of HDF VSet interface * * defines library private symbols and structures used in v*.c files * * NOTES: - * This include file depends on the basic HDF *.h files hdfi.h and hdf.h. + * This include file depends on the basic HDF *.h files hdf_priv.h and hdf.h. * An 'S' in the comment means that that data field is saved in the HDF file. * ******************************************************************************/ -#ifndef H4_VGINT_H -#define H4_VGINT_H +#ifndef H4_VG_PRIV_H +#define H4_VG_PRIV_H -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* Include file for Threaded, Balanced Binary Tree implementation */ -#include "tbbt.h" +#include "tbbt_priv.h" /* * typedefs for VGROUP, VDATA and VSUBGROUP @@ -272,4 +272,4 @@ HDFLIBAPI void trimendblanks(char *ss); } #endif -#endif /* H4_VGINT_H */ +#endif /* H4_VG_PRIV_H */ diff --git a/hdf/src/vgf.c b/hdf/src/vgf.c index d221b2125b..4559ca8aa5 100644 --- a/hdf/src/vgf.c +++ b/hdf/src/vgf.c @@ -31,8 +31,8 @@ * *********************************************************************** */ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" #include "hproto_fortran.h" /* @@ -680,7 +680,7 @@ nvssextfc(intf *id, _fcd name, intf *offset, intf *namelen) if (!fn) return FAIL; ret = (intf)VSsetexternalfile(*id, fn, *offset); - free((void *)fn); + free(fn); return ret; } diff --git a/hdf/src/vgp.c b/hdf/src/vgp.c index 66071bef26..7fd59fee13 100644 --- a/hdf/src/vgp.c +++ b/hdf/src/vgp.c @@ -101,8 +101,8 @@ EXPORTED ROUTINES *************************************************************************/ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" /* These are used to determine whether a vgroup had been created by the library internally, that is, not created by user's application */ @@ -645,6 +645,10 @@ Vinitialize(HFILEID f /* IN: file handle */) /* clear error stack */ HEclear(); + /* Check file ID */ + if (f < 0) + HGOTO_ERROR(DFE_ARGS, FAIL); + /* Perform global, one-time initialization */ if (library_terminate == FALSE) { if (VIstart() == FAIL) diff --git a/hdf/src/vhi.c b/hdf/src/vhi.c index 5596f24b59..538cf02417 100644 --- a/hdf/src/vhi.c +++ b/hdf/src/vhi.c @@ -22,8 +22,8 @@ * VHmakegroup -- makes a vgroup from tag/ref pairs */ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" /* ------------------------ VHstoredata ------------------------------- NAME diff --git a/hdf/src/vio.c b/hdf/src/vio.c index 7e1073cb2a..5e34f342e8 100644 --- a/hdf/src/vio.c +++ b/hdf/src/vio.c @@ -58,8 +58,8 @@ EXPORTED ROUTINES *************************************************************************/ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" /* Private Function Prototypes */ static intn vunpackvs(VDATA *vs, uint8 buf[], int32 len); diff --git a/hdf/src/vparse.c b/hdf/src/vparse.c index 401640ae4a..dd47693116 100644 --- a/hdf/src/vparse.c +++ b/hdf/src/vparse.c @@ -22,8 +22,8 @@ ************************************************************************/ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" #define ISCOMMA(c) ((c == ',') ? 1 : 0) diff --git a/hdf/src/vrw.c b/hdf/src/vrw.c index 22221a039c..662a870c2c 100644 --- a/hdf/src/vrw.c +++ b/hdf/src/vrw.c @@ -34,8 +34,8 @@ EXPORTED ROUTINES ************************************************************************/ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) diff --git a/hdf/src/vsfld.c b/hdf/src/vsfld.c index 6a0c756a86..ddb0704f4d 100644 --- a/hdf/src/vsfld.c +++ b/hdf/src/vsfld.c @@ -38,8 +38,8 @@ EXPORTED ROUTINES #include -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" /* ** ================================================================== diff --git a/hdf/test/CMakeLists.txt b/hdf/test/CMakeLists.txt index 24cf43f973..ec14ea0be8 100644 --- a/hdf/test/CMakeLists.txt +++ b/hdf/test/CMakeLists.txt @@ -1,6 +1,12 @@ cmake_minimum_required (VERSION 3.12) project (HDF4_HDF_TEST C) +#----------------------------------------------------------------------------- +# Generate the srcdir_str.h file +#----------------------------------------------------------------------------- +set (srcdir ${HDF4_HDF_TEST_SOURCE_DIR}) +configure_file (${HDF4_HDF_TEST_SOURCE_DIR}/srcdir_str.h.in srcdir_str.h @ONLY) + LINK_DIRECTORIES ( ${HDF4_HDF_BINARY_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} @@ -48,7 +54,7 @@ set (testhdf_SRCS #-- Adding test for testhdf add_executable (testhdf ${testhdf_SRCS}) -target_include_directories(testhdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_BINARY_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_HDFSOURCE_DIR}") +target_include_directories(testhdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_BINARY_DIR};${CMAKE_CURRENT_BINARY_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_HDFSOURCE_DIR}") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (testhdf STATIC) target_link_libraries (testhdf PRIVATE ${HDF4_SRC_LIB_TARGET} ${LINK_COMP_LIBS}) diff --git a/hdf/test/bitio.c b/hdf/test/bitio.c index 13bb5c9117..83beb32879 100644 --- a/hdf/test/bitio.c +++ b/hdf/test/bitio.c @@ -119,27 +119,19 @@ test_bitio_write(void) static void test_bitio_read(void) { - int32 fid; - int32 bitid1; - int32 ret; - intn inbits; - uint32 tempbuf; - intn i; - uint8 *test_ptr; - char datafile[512] = ""; - char *srcdir = getenv("srcdir"); + int32 fid; + int32 bitid1; + int32 ret; + intn inbits; + uint32 tempbuf; + intn i; + uint8 *test_ptr; + const char *datafile = get_srcdir_filename(DATAFILE_NAME); SEED((uintn)time(NULL)); MESSAGE(6, printf("Testing bitio read routines\n");); - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(DATAFILE_NAME) + 1) < sizeof(datafile))) { - strcpy(datafile, srcdir); - strcat(datafile, "/"); - } - strcat(datafile, DATAFILE_NAME); - fid = Hopen(datafile, DFACC_READ, 0); CHECK_VOID(fid, FAIL, "Hopen"); diff --git a/hdf/test/buffer.c b/hdf/test/buffer.c index 0ce3b5f61d..6e2a60d2fa 100644 --- a/hdf/test/buffer.c +++ b/hdf/test/buffer.c @@ -25,31 +25,13 @@ - Buffer the compressed element and get times for the buffered element. - Make a new linked block element and get benchmark times - Buffer the linked block element and get times for the buffered element. - - BUGS/LIMITATIONS - - EXPORTED ROUTINES - - AUTHOR - Quincey Koziol - - MODIFICATION HISTORY - 12/11/98 - Wrote tests - 12/20/06 - Compute the wallclock time and use the environment - variable or macro HDF4_TESTPREFIX to add prefix to the - testing files names. Also, it allows to specify the number - of elements in buffer at the command line. - */ #define TESTMASTER -#include "hdf.h" -#ifdef H4_HAVE_SYS_TIME_H -#include -#endif +#include "hdf_priv.h" #include "tutils.h" -#include "hfile.h" +#include "hfile_priv.h" #define TESTFILE_NAME "tbuffer.hdf" #define EXTFILE_NAME "tbuffer.dat" @@ -97,10 +79,8 @@ static long write_test(int32 aid, intn num_timings); static void init_buffer(void) { - intn j; - SEED(time(NULL)); - for (j = 0; j < elemsize; j++) { + for (int j = 0; j < elemsize; j++) { out_buf[j] = (uint8)RAND(); } } /* init_buffers() */ @@ -272,7 +252,7 @@ read_test(int32 aid) } /* Clear input buffer */ - memset(in_buf, 0, elemsize); + memset(in_buf, 0, (size_t)elemsize); /* Increment the total I/O time */ acc_time += (end_time.tv_sec - start_time.tv_sec) * FACTOR + (end_time.tv_usec - start_time.tv_usec); @@ -395,7 +375,7 @@ write_test(int32 aid, intn num_timings) } /* Clear input buffer */ - memset(in_buf, 0, elemsize); + memset(in_buf, 0, (size_t)elemsize); /* Increment the total I/O time */ acc_time += (end_time.tv_sec - start_time.tv_sec) * FACTOR + (end_time.tv_usec - start_time.tv_usec); diff --git a/hdf/test/chunks.c b/hdf/test/chunks.c index e87b623b48..ba481b5b92 100644 --- a/hdf/test/chunks.c +++ b/hdf/test/chunks.c @@ -110,7 +110,7 @@ */ #include "tproto.h" -#include "hchunks.h" +#include "hchunks_priv.h" #define TESTFILE_NAME "tchunks.hdf" #define BUFSIZE 12288 @@ -174,7 +174,7 @@ test_chunks(void) int32 nseek = 0; #endif int32 ret; - HCHUNK_DEF chunk[1]; /* Chunk definition, see 'hchunks.h' */ + HCHUNK_DEF chunk[1]; /* Chunk definition, see 'hchunks_priv.h' */ int32 dims[5]; int32 fill_val_len = 1; uint8 fill_val_u8 = 0; /* test 6 */ diff --git a/hdf/test/comp.c b/hdf/test/comp.c index 1024c7c458..9bbd197621 100644 --- a/hdf/test/comp.c +++ b/hdf/test/comp.c @@ -12,27 +12,16 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - FILE - comp.c - Test HDF compressed data I/O routines + comp.c - Test HDF compressed data I/O routines - DESIGN These are written to test all combinations of modeling and encoding layers with different number types. - - BUGS/LIMITATIONS - - EXPORTED ROUTINES - - AUTHOR - Quincey Koziol - - MODIFICATION HISTORY - 10/19/93 - Through this header in. */ #include + #include "tproto.h" -#include "hfile.h" +#include "hfile_priv.h" #define TESTFILE_NAME "tcomp.hdf" diff --git a/hdf/test/file1.c b/hdf/test/file1.c index 29d32b47e0..c6a3058c34 100644 --- a/hdf/test/file1.c +++ b/hdf/test/file1.c @@ -16,8 +16,15 @@ */ #include "tproto.h" -#include "hfile.h" -#define BIG 128 +#include "hfile_priv.h" + +/* This value can cause platform-specific problems as the number of files + * that can be open at one time via fopen() is often capped by the OS. + * + * The current value doesn't seem to cause problems on any platform. + */ +#define BIG 127 + #define TESTFILE_NAME "thf" #define TESTREF_NAME "tref.hdf" #define MAX_REF_TESTED MAX_REF @@ -35,7 +42,10 @@ test_file_limits(void) #ifdef H4_HAVE_WIN32_API /* Windows can only have 512 stdio files open by default, so we need - * to bump this to handle BIG files open at once. + * to bump this to handle large values for BIG files open at once. + * + * Technically no longer necessary since BIG was adjusted to < 512, but + * worth keeping around in case we need to set this in the future. */ ret = _setmaxstdio(1024); CHECK_VOID(ret, FAIL, "_setmaxstdio"); diff --git a/hdf/test/forsupf.c b/hdf/test/forsupf.c index 73873a2b89..699e766d4d 100644 --- a/hdf/test/forsupf.c +++ b/hdf/test/forsupf.c @@ -12,6 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include +#include #include "hdf.h" #include "fortest.h" diff --git a/hdf/test/litend.c b/hdf/test/litend.c index e85e47189a..34ad11bc08 100644 --- a/hdf/test/litend.c +++ b/hdf/test/litend.c @@ -65,7 +65,7 @@ static void test_little_read(void) { intn rank; - int32 dimsizes[2]; + int32 dimsizes[2] = {-1, -1}; int32 numbertype; int8 *data_i8; uint8 *data_u8; @@ -77,21 +77,14 @@ test_little_read(void) float64 *data_f64; int ret; - char filename[512] = ""; - char *srcdir = getenv("srcdir"); + const char *filename = get_srcdir_filename(FILENAME); MESSAGE(5, printf("Testing Little-Endian Read Routines\n");); MESSAGE(10, printf("Testing Little-Endian INT8 Reading Routines\n");); - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(FILENAME) + 1) < sizeof(filename))) { - strcpy(filename, srcdir); - strcat(filename, "/"); - } - strcat(filename, FILENAME); - ret = DFSDgetdims(filename, &rank, dimsizes, 2); + RESULT("DFSDgetdims"); if (dimsizes[0] != CDIM_Y || dimsizes[1] != CDIM_X) { fprintf(stderr, "Dimensions for INT8 data were incorrect\n"); diff --git a/hdf/test/mgr.c b/hdf/test/mgr.c index c65cbc3f2e..67df784aad 100644 --- a/hdf/test/mgr.c +++ b/hdf/test/mgr.c @@ -25,7 +25,7 @@ #include "tproto.h" #include "mfgr.h" -#include "mfgri.h" +#include "mfgr_priv.h" /* Local pre-processor macros */ #define XDIM 0 @@ -1128,26 +1128,18 @@ extern void test_mgr_dup_images(); static void test_mgr_init(void) { - int32 fid; /* HDF file ID */ - int32 grid; /* GRID for the interface */ - int32 n_datasets; /* number of datasets */ - int32 n_attrs; /* number of attributes */ - int32 ret; /* generic return value */ - char datafile[512] = ""; - char *srcdir = getenv("srcdir"); + int32 fid; /* HDF file ID */ + int32 grid; /* GRID for the interface */ + int32 n_datasets; /* number of datasets */ + int32 n_attrs; /* number of attributes */ + int32 ret; /* generic return value */ + const char *datafile = get_srcdir_filename(DATAFILE); /* Output message about test being performed */ MESSAGE(6, printf("Testing Multi-file Raster Initialization routines\n");); MESSAGE(8, printf("Try creating a new file and checking it out\n");); - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(DATAFILE) + 1) < sizeof(datafile))) { - strcpy(datafile, srcdir); - strcat(datafile, "/"); - } - strcat(datafile, DATAFILE); - /* Create a new file */ fid = Hopen(TESTFILE, DFACC_CREATE, 0); CHECK_VOID(fid, FAIL, "Hopen"); @@ -2631,24 +2623,16 @@ test_mgr_image_b2a2cc(int flag) static void test_mgr_image_b2b1(int flag) { - int32 fid; /* HDF file ID */ - int32 grid; /* GRID for the interface */ - int32 ret; /* generic return value */ - char datafile[512] = ""; - char *srcdir = getenv("srcdir"); + int32 fid; /* HDF file ID */ + int32 grid; /* GRID for the interface */ + int32 ret; /* generic return value */ + const char *datafile = get_srcdir_filename(DATAFILE); (void)flag; /* B2b1 - Read/Write images - with real Data - Existing Image - Whole Image */ MESSAGE(8, printf("Check out I/O from Existing Image - Whole Image\n");); - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(DATAFILE) + 1) < sizeof(datafile))) { - strcpy(datafile, srcdir); - strcat(datafile, "/"); - } - strcat(datafile, DATAFILE); - /* Open up the existing datafile and get the image information from it */ fid = Hopen(datafile, DFACC_READ, 0); CHECK_VOID(fid, FAIL, "Hopen"); @@ -3724,21 +3708,13 @@ static const uint8 jpeg_24bit_j80[JPEGY][JPEGX][3] = { static void test_mgr_old_a(int flag) { - int32 fid; /* HDF file ID */ - int32 grid; /* GRID for the interface */ - int32 ret; /* generic return value */ - char oldrlefile[512] = ""; - char *srcdir = getenv("srcdir"); + int32 fid; /* HDF file ID */ + int32 grid; /* GRID for the interface */ + int32 ret; /* generic return value */ + const char *oldrlefile = get_srcdir_filename(OLDRLEFILE); (void)flag; - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(OLDRLEFILE) + 1) < sizeof(oldrlefile))) { - strcpy(oldrlefile, srcdir); - strcat(oldrlefile, "/"); - } - strcat(oldrlefile, OLDRLEFILE); - /* A - Read RLE compressed data from old raster image file */ MESSAGE(8, printf("Read RLE compressed image\n");); @@ -3797,21 +3773,13 @@ test_mgr_old_a(int flag) static void test_mgr_old_c(int flag) { - int32 fid; /* HDF file ID */ - int32 grid; /* GRID for the interface */ - int32 ret; /* generic return value */ - char oldgreyjpegfile[512] = ""; - char *srcdir = getenv("srcdir"); + int32 fid; /* HDF file ID */ + int32 grid; /* GRID for the interface */ + int32 ret; /* generic return value */ + const char *oldgreyjpegfile = get_srcdir_filename(OLDGREYJPEGFILE); (void)flag; - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(OLDGREYJPEGFILE) + 1) < sizeof(oldgreyjpegfile))) { - strcpy(oldgreyjpegfile, srcdir); - strcat(oldgreyjpegfile, "/"); - } - strcat(oldgreyjpegfile, OLDGREYJPEGFILE); - /* C - Read 8-bit JPEG compressed data from old raster image file */ MESSAGE(8, printf("Read 8-bit JPEG compressed image\n");); @@ -3863,21 +3831,13 @@ test_mgr_old_c(int flag) static void test_mgr_old_e(int flag) { - int32 fid; /* HDF file ID */ - int32 grid; /* GRID for the interface */ - int32 ret; /* generic return value */ - char oldjpegfile[512] = ""; - char *srcdir = getenv("srcdir"); + int32 fid; /* HDF file ID */ + int32 grid; /* GRID for the interface */ + int32 ret; /* generic return value */ + const char *oldjpegfile = get_srcdir_filename(OLDJPEGFILE); (void)flag; - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(OLDJPEGFILE) + 1) < sizeof(oldjpegfile))) { - strcpy(oldjpegfile, srcdir); - strcat(oldjpegfile, "/"); - } - strcat(oldjpegfile, OLDJPEGFILE); - /* E - Read 24-bit JPEG compressed data from old raster image file */ MESSAGE(8, printf("Read 24-bit JPEG compressed image\n");); @@ -3958,21 +3918,13 @@ test_mgr_old(int flag) static void test_mgr_r24_a(int flag) { - int32 fid; /* HDF file ID */ - int32 grid; /* GRID for the interface */ - int32 ret; /* generic return value */ - char gr_r24file[512] = ""; - char *srcdir = getenv("srcdir"); + int32 fid; /* HDF file ID */ + int32 grid; /* GRID for the interface */ + int32 ret; /* generic return value */ + const char *gr_r24file = get_srcdir_filename(GR_R24FILE); (void)flag; - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(GR_R24FILE) + 1) < sizeof(gr_r24file))) { - strcpy(gr_r24file, srcdir); - strcat(gr_r24file, "/"); - } - strcat(gr_r24file, GR_R24FILE); - /* A - Write/Read DF24 image */ MESSAGE(8, printf("Operate on DF24 images\n");); @@ -4479,12 +4431,13 @@ test_mgr_chunkwr_pixel(int flag) data_type, /* data type of the image data */ comp_flag, /* compression flag */ index, i; - int32 start[2], stride[2], edge[2]; - intn is_mappedable; /* TRUE if the image is mapped-able (hmap project)*/ - intn name_generated; /* TRUE if the image has name generated by lib */ - int16 data_out[3 * Y_LENGTH * X_LENGTH]; - char *image_name[] = {"Image_NO", "Image_RL", "Image_Sk", "Image_DF"}; - char *file_name[] = {"ChunkedGR_NO.hdf", "ChunkedGR_RL.hdf", "ChunkedGR_SK.hdf", "ChunkedGR_DF.hdf"}; + int32 start[2], stride[2], edge[2]; + intn is_mappedable; /* TRUE if the image is mapped-able (hmap project)*/ + intn name_generated; /* TRUE if the image has name generated by lib */ + int16 data_out[3 * Y_LENGTH * X_LENGTH]; + const char *image_name[] = {"Image_NO", "Image_RL", "Image_Sk", "Image_DF"}; + const char *file_name[] = {"ChunkedGR_NO.hdf", "ChunkedGR_RL.hdf", "ChunkedGR_SK.hdf", + "ChunkedGR_DF.hdf"}; HDF_CHUNK_DEF chunk_def; int16 chunk_buf[18]; @@ -4513,6 +4466,9 @@ test_mgr_chunkwr_pixel(int flag) /********************** End of variable declaration **********************/ i = flag; + + memset(&chunk_def, 0, sizeof(HDF_CHUNK_DEF)); + /* * Create and open the file. */ @@ -4576,6 +4532,7 @@ test_mgr_chunkwr_pixel(int flag) break; } default: { + comp_flag = HDF_NONE; printf("Error\n"); break; } diff --git a/mfhdf/libsrc/mfhdfi.h b/hdf/test/srcdir_str.h.in similarity index 62% rename from mfhdf/libsrc/mfhdfi.h rename to hdf/test/srcdir_str.h.in index 84ecf2ae2a..067a2280ad 100644 --- a/mfhdf/libsrc/mfhdfi.h +++ b/hdf/test/srcdir_str.h.in @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF. The full HDF copyright notice, including * @@ -11,15 +10,10 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef MFH4_MFHDFI_H -#define MFH4_MFHDFI_H +/* If you are reading this file and it has a '.h' suffix, it was automatically + * generated from the '.in' version. Make changes there. + */ -/* enumerated type used to specify whether a variable is an SDS, coordinate - variable, or its type is unknown because it was created before HDF4.2r2 */ -typedef enum { - IS_SDSVAR = 0, /* variable is an actual SDS */ - IS_CRDVAR = 1, /* variable is a coordinate variable */ - UNKNOWN = 2 /* variable is created before HDF4.2r2, unknown type */ -} hdf_vartype_t; +/* Set the 'srcdir' path from configure time */ +static const char *config_srcdir = "@srcdir@"; -#endif /* MFH4_MFHDFI_H */ diff --git a/hdf/test/tattdatainfo.c b/hdf/test/tattdatainfo.c index fd20eefe87..1686c32554 100644 --- a/hdf/test/tattdatainfo.c +++ b/hdf/test/tattdatainfo.c @@ -406,18 +406,18 @@ test_vgmixedattrs() /* Test Vattrinfo2 and Vgetattr2 on each attribute */ for (ii = 0; ii < n_attrs; ii++) { - char aname[20]; - int32 atype, acount, asize, n_fields; - uint16 refnum; - int jj; - char cvalues[20]; - int32 ivalues[10]; - char *check_attr_names[5] = {"Attribute 6", "Attribute 7", "Attribute 1", "Attribute 2", - "Attribute 5"}; - char *check_attr_values[5] = {"VG0 oldattr0", "VG0 oldattr1", - "", /* int values, added by test_vvsattrs with attr1 */ - "Vgroup0", /* added by test_vvsattrs with attr2 */ - "VG0 newattr"}; + char aname[20]; + int32 atype, acount, asize, n_fields; + uint16 refnum; + int jj; + char cvalues[20]; + int32 ivalues[10]; + const char *check_attr_names[5] = {"Attribute 6", "Attribute 7", "Attribute 1", "Attribute 2", + "Attribute 5"}; + const char *check_attr_values[5] = {"VG0 oldattr0", "VG0 oldattr1", + "", /* int values, added by test_vvsattrs with attr1 */ + "Vgroup0", /* added by test_vvsattrs with attr2 */ + "VG0 newattr"}; /* Get attribute information and verify its name and number of fields, which should be 1 */ diff --git a/hdf/test/tbv.c b/hdf/test/tbv.c index 3d20c7e8f7..6073eb8d66 100644 --- a/hdf/test/tbv.c +++ b/hdf/test/tbv.c @@ -18,7 +18,7 @@ */ #include "tproto.h" -#include "bitvect.h" +#include "bitvect_priv.h" static void test_1(void); static void test_2(void); diff --git a/hdf/test/tmgrcomp.c b/hdf/test/tmgrcomp.c index 1ed731d243..f8a88fe60a 100644 --- a/hdf/test/tmgrcomp.c +++ b/hdf/test/tmgrcomp.c @@ -60,11 +60,10 @@ test_mgr_compress_a() int32 start[2]; /* start of image data to grab */ int32 stride[2]; /* stride of image data to grab */ int32 count[2]; /* Size of image data to operate on */ - intn i, j; /* indices */ /* Initialize data we are going to write out */ - for (i = 0; i < 10; i++) - for (j = 0; j < 10; j++) + for (int i = 0; i < 10; i++) + for (int j = 0; j < 10; j++) image0[i][j] = (uint8)(i + j); /* Get the first image in this file */ @@ -103,7 +102,7 @@ test_mgr_compress_a() if (memcmp(image, image0, 10 * 10) != 0) { MESSAGE(3, printf("Error reading data for gzip compressed image\n");); num_errs++; - } /* end if */ + } /* Close the empty image */ ret = GRendaccess(riid); @@ -159,7 +158,7 @@ test_mgr_compress_a() if (memcmp(image, image0, 10 * 10) != 0) { MESSAGE(3, printf("Error reading 2nd data for gzip compressed image\n");); num_errs++; - } /* end if */ + } /* Close the empty image */ ret = GRendaccess(riid); @@ -210,11 +209,10 @@ test_mgr_compress_b() int32 interlace_mode, n_comps, n_attrs, datatype; /* Image information */ char name[30]; /* Buffer for retrieving image name */ uint8 attr; /* Attribute data */ - intn i, j; /* indices */ /* Initialize data we are going to write out */ - for (i = 0; i < 10; i++) - for (j = 0; j < 10; j++) + for (int i = 0; i < 10; i++) + for (int j = 0; j < 10; j++) image0[i][j] = (uint8)(i + j); /* Get the first image in this file */ @@ -286,7 +284,7 @@ test_mgr_compress_b() if (memcmp(image, image0, 10 * 10) != 0) { MESSAGE(3, printf("Error reading data for gzip compressed image\n");); num_errs++; - } /* end if */ + } /* Close the image */ ret = GRendaccess(riid); @@ -309,16 +307,15 @@ test_mgr_compress_b() static int test_mgr_compress_c() { - intn status; /* status for functions returning an intn */ - int32 file_id, /* HDF file identifier */ - gr_id, /* GR interface identifier */ - ri_id, /* raster image identifier */ - start[2], /* start position to write for each dimension */ - edges[2], /* number of elements to be written along each dimension */ - dim_sizes[2], /* dimension sizes of the image array */ - interlace_mode, /* interlace mode of the image */ - data_type, /* data type of the image data */ - i, j; + int status; /* status for functions returning an int */ + int32 file_id; /* HDF file identifier */ + int32 gr_id; /* GR interface identifier */ + int32 ri_id; /* raster image identifier */ + int32 start[2]; /* start position to write for each dimension */ + int32 edges[2]; /* number of elements to be written along each dimension */ + int32 dim_sizes[2]; /* dimension sizes of the image array */ + int32 interlace_mode; /* interlace mode of the image */ + int32 data_type; /* data type of the image data */ uint8 image_buf[128][128][3]; uint8 read_buf[128][128][3]; comp_info c_info; @@ -351,11 +348,11 @@ test_mgr_compress_c() CHECK(status, FAIL, "GRsetcompress"); /* Fill the image data buffer with values */ - for (i = 0; i < 128; i++) - for (j = 0; j < 128; j++) { - image_buf[i][j][0] = (i + j) + 1; - image_buf[i][j][1] = (i + j) + 1; - image_buf[i][j][2] = (i + j) + 1; + for (uint8 i = 0; i < 128; i++) + for (uint8 j = 0; j < 128; j++) { + image_buf[i][j][0] = (uint8)(i + j + 1); + image_buf[i][j][1] = (uint8)(i + j + 1); + image_buf[i][j][2] = (uint8)(i + j + 1); } /* Write data in the buffer into the image array */ @@ -399,7 +396,7 @@ test_mgr_compress_c() if (fuzzy_memcmp(image_buf, read_buf, 128 * 128 * 3, JPEG_FUZZ) != 0) { MESSAGE(3, printf("tmgrcomp: Error reading data for 24-bit JPEG compressed image\n");); num_errs++; - } /* end if */ + } /* Terminate access to raster image and to GR */ /* interface and, close the HDF file. */ @@ -443,21 +440,20 @@ test_mgr_compress_c() #define DEFLATE_LEVEL 7 /* arbitrary */ #define SKPHUFF_SKIPSIZE 28 /* arbitrary */ -static intn -make_comp_image(int32 grid, char *img_name, comp_coder_t comp_type, /* Compression method */ - comp_info *cinfo, char *message) /* Compression parameters */ +static int +make_comp_image(int32 grid, const char *img_name, comp_coder_t comp_type, /* Compression method */ + comp_info *cinfo, char *message) /* Compression parameters */ { int32 riid; /* RI ID of the working image */ int32 dims[2] = {10, 10}; /* dimensions for the empty image */ uint8 image_data[10][10]; /* space for the image data */ int32 start[2]; /* start of image data to grab */ int32 stride[2]; /* stride of image data to grab */ - intn i, j; /* indices */ - intn ret_value; /* generic return value */ + int ret_value; /* generic return value */ /* Initialize data we are going to write out */ - for (i = 0; i < 10; i++) - for (j = 0; j < 10; j++) + for (int i = 0; i < 10; i++) + for (int j = 0; j < 10; j++) image_data[i][j] = (uint8)(i + j + 10); /* Create the image */ @@ -502,7 +498,7 @@ test_get_compress() comp_coder_t comp_type; /* Compression method */ comp_info cinfo; /* Compression parameters - union */ char err_func[80]; /* name of the functions where failure occurs */ - intn status; /* generic return value */ + int status; /* generic return value */ /* D - Retrieve compression information of compressed images */ MESSAGE(8, printf("Verify the compression information of compressed images\n");); @@ -689,7 +685,7 @@ test_mgr_chunk_compress() /************************* Variable declaration **************************/ - intn status; /* status for functions returning an intn */ + int status; /* status for functions returning an int */ int32 file_id, /* HDF file identifier */ gr_id, /* GR interface identifier */ ri_id[N_IMAGES], /* raster image identifier */ @@ -704,7 +700,7 @@ test_mgr_chunk_compress() comp_coder_t comp_type; int16 data_out[3 * Y_LENGTH * X_LENGTH]; - char *image_name[] = {"Image_NO", "Image_RL", "Image_Sk", "Image_DF"}; + const char *image_name[] = {"Image_NO", "Image_RL", "Image_Sk", "Image_DF"}; HDF_CHUNK_DEF chunk_def[N_IMAGES]; int16 chunk_buf[18]; @@ -879,7 +875,7 @@ test_mgr_chunk_compress() MESSAGE(3, printf("Error in reading chunk at line %d\n", __LINE__);); MESSAGE(3, printf("Image #%d\n", (int)img_num);); num_errs++; - } /* end if */ + } /* Read the whole image. */ start[0] = start[1] = 0; @@ -892,7 +888,7 @@ test_mgr_chunk_compress() MESSAGE(3, printf("%d: Error reading data for the whole image\n", __LINE__);); MESSAGE(3, printf("%d: Compression method\n", (int)img_num);); num_errs++; - } /* end if */ + } status = GRendaccess(ri_id[img_num]); CHECK(status, FAIL, "GRendaccess"); diff --git a/hdf/test/tproto.h b/hdf/test/tproto.h index 83140f4c66..8b597eb506 100644 --- a/hdf/test/tproto.h +++ b/hdf/test/tproto.h @@ -14,7 +14,7 @@ #ifndef H4_TPROTO_H #define H4_TPROTO_H -#include "hdfi.h" +#include "hdf_priv.h" #include "tutils.h" void test_an(void); diff --git a/hdf/test/tree.c b/hdf/test/tree.c index da7f3a53eb..e5f6a953aa 100644 --- a/hdf/test/tree.c +++ b/hdf/test/tree.c @@ -15,25 +15,12 @@ FILE tree.c Test HDF Threaded-Balanced-Binary Tree (tbbt) routines. - - REMARKS - - DESIGN - - BUGS/LIMITATIONS - - EXPORTED ROUTINES - - AUTHOR - Quincey Koziol - - MODIFICATION HISTORY - 10/21/93 - Started coding. */ #include + #include "tproto.h" -#include "tbbt.h" +#include "tbbt_priv.h" #define MAX_TEST_SIZE 31 /* maximum number of elements to insert */ #define NUM_TEST_RUNS 100 /* number of times to insert & remove each size */ diff --git a/hdf/test/tszip.c b/hdf/test/tszip.c index 1caeeb5ff7..bc2a03f1ed 100644 --- a/hdf/test/tszip.c +++ b/hdf/test/tszip.c @@ -134,7 +134,7 @@ test_szip_RI8bit() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for sziped data */ @@ -347,7 +347,7 @@ test_szip_RI16bit() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for sziped data */ @@ -560,7 +560,7 @@ test_szip_RI32bit() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for sziped data */ @@ -773,7 +773,7 @@ test_szip_RIfl32bit() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for sziped data */ @@ -987,7 +987,7 @@ test_szip_RIfl64bit() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for sziped data */ @@ -1144,7 +1144,7 @@ test_szip_chunk() uint32 comp_config; comp_coder_t comp_type; int8 data_out[N_COMPS * LENGTH_CH * WIDTH_CH]; - char *image_name = "Image_chunked_sziped"; + const char *image_name = "Image_chunked_sziped"; HDF_CHUNK_DEF chunk_def; int8 chunk_buf[18]; @@ -1169,7 +1169,7 @@ test_szip_chunk() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for chunked and sziped data. */ diff --git a/hdf/test/tutils.c b/hdf/test/tutils.c index b0f3d07295..c7c77d2118 100644 --- a/hdf/test/tutils.c +++ b/hdf/test/tutils.c @@ -13,6 +13,68 @@ #include "hdf.h" #include "tutils.h" +#include "srcdir_str.h" + +/* Buffer to construct path in and return pointer to */ +static char srcdir_path[1024]; + +/* Buffer to construct file in and return pointer to */ +static char srcdir_testpath[1024]; + +/*------------------------------------------------------------------------- + * Function: get_srcdir_filename + * + * Purpose: Append the test file name to the srcdir path and return the whole string + * + * Return: The string or NULL (errors or not enough space) + * + *------------------------------------------------------------------------- + */ +const char * +get_srcdir_filename(const char *filename) +{ + const char *srcdir = get_srcdir(); + + /* Check for error */ + if (NULL == srcdir) + return NULL; + + /* Build path to test file */ + if ((strlen(srcdir) + strlen(filename) + 1) < sizeof(srcdir_testpath)) { + snprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s/%s", srcdir, filename); + return srcdir_testpath; + } + + /* If not enough space, just return NULL */ + return NULL; +} /* end get_srcdir_filename() */ + +/*------------------------------------------------------------------------- + * Function: get_srcdir + * + * Purpose: Just return the srcdir path + * + * Return: The string + * + *------------------------------------------------------------------------- + */ +const char * +get_srcdir(void) +{ + const char *srcdir = getenv("srcdir"); + + /* Check for using the srcdir from configure time */ + if (NULL == srcdir) + srcdir = config_srcdir; + + /* Build path to all test files */ + if ((strlen(srcdir) + 2) < sizeof(srcdir_path)) { + snprintf(srcdir_path, sizeof(srcdir_path), "%s/", srcdir); + return (srcdir_path); + } + else + return NULL; +} /* end get_srcdir() */ intn fuzzy_memcmp(const void *s1, const void *s2, int32 len, intn fuzz_factor) @@ -46,45 +108,3 @@ print_mismatched(const void *s1, const void *s2, int32 size2cmp) t2++; } } - -/* Generate the correct name for the test file, by prepending the source path - if it exists, otherwise, assume it is the local directory */ -/* NOTE: should move all utilities into mfutil.c or something like that */ -intn -make_datafilename(char *basename, char *testfile, unsigned int size) -{ - char *srcdir = getenv("srcdir"); - char *tempfile = NULL; - - tempfile = (char *)calloc(sizeof(char *), (size + 1)); - - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(basename) + 1) < size)) { - strcpy(tempfile, srcdir); - strcat(tempfile, "/"); - } - - /* Windows doesn't set srcdir, and generates files in a different relative - path, so we need to special case here. It is best to look for the - testfile in the same path, and the Windows test script will make sure - to put it there first. - SJW 2007/09/19 (from tnetcdf.c) */ -#if defined _WIN32 - /* This is to get to the file when the library was built without srcdir - option and the test is ran by ./hdftest in the test src directory - instead of by make check. - BMR 2007/08/09 */ - if (srcdir == NULL) - strcpy(tempfile, "./"); -#endif /* _WIN32 */ - - /* Name of data file */ - strcat(tempfile, basename); - - /* Verify that file name is not NULL */ - if (tempfile == NULL || tempfile[0] == '\0') - return FAIL; - - /* File name is generated, return it */ - strcpy(testfile, tempfile); - free(tempfile); - return SUCCEED; -} diff --git a/hdf/test/tutils.h b/hdf/test/tutils.h index e9edba0cbb..1a0070edfe 100644 --- a/hdf/test/tutils.h +++ b/hdf/test/tutils.h @@ -14,7 +14,7 @@ #ifndef H4_TUTILS_H #define H4_TUTILS_H -#include "hdfi.h" +#include "hdf_priv.h" /* Define these for use in all the tests */ #ifndef TESTMASTER @@ -212,13 +212,15 @@ extern #define ABS(x) ((int)(x) < 0 ? (-x) : x) +/* Just return the srcdir path */ +const char *get_srcdir(void); + +/* Append the test file name to the srcdir path and return the whole string */ +const char *get_srcdir_filename(const char *filename); + intn fuzzy_memcmp(const void *s1, const void *s2, int32 len, intn fuzz_factor); void print_mismatched(const void *s1, const void *s2, int32 size2cmp); -/* Generate the correct name for the test file, by prepending the source path - if it exists, otherwise, assume it is the local directory */ -intn make_datafilename(char *basename, char *testfile, unsigned int size); - /* System command to use for Cleanup */ #if defined _WIN32 #define CLEAN_CMD "del *.hdf" diff --git a/hdf/test/tvnameclass.c b/hdf/test/tvnameclass.c index 64ec6ad226..52de664e97 100644 --- a/hdf/test/tvnameclass.c +++ b/hdf/test/tvnameclass.c @@ -15,7 +15,7 @@ * Tests for vgroup's and vdata's name and class name. */ #include "hdf.h" -#include "hfile.h" +#include "hfile_priv.h" #include "tproto.h" #include "tutils.h" @@ -300,50 +300,42 @@ test_undefined(void) static void test_vgisinternal() { - int32 fid, vgroup_id; - intn is_internal = FALSE; - int32 vref = -1; - intn ii, status; - char testfile[H4_MAX_NC_NAME] = ""; - char internal_array2[2] = {TRUE, TRUE}; + int32 fid, vgroup_id; + intn is_internal = FALSE; + int32 vref = -1; + intn ii, status; + const char *testfile = get_srcdir_filename(GR_FILE); + char internal_array2[2] = {TRUE, TRUE}; /* Use a GR file to test Vgisinternal on internal vgroups */ - /* The file GR_FILE is an existing file in the test_files directory, - make_datafilename builds the file name with correct path */ - if (make_datafilename(GR_FILE, testfile, H4_MAX_NC_NAME) != FAIL) { - /* Open the old GR file and initialize the V interface */ - fid = Hopen(testfile, DFACC_READ, 0); - CHECK_VOID(fid, FAIL, "Hopen: grtdfui83.hdf"); - status = Vstart(fid); - CHECK_VOID(status, FAIL, "Vstart"); - - ii = 0; - while ((vref = Vgetid(fid, vref)) != FAIL) { /* until no more vgroups */ - vgroup_id = Vattach(fid, vref, "r"); /* attach to vgroup */ - - /* Test that the current vgroup is or is not internal as specified - in the array internal_array2 */ - is_internal = Vgisinternal(vgroup_id); - CHECK_VOID(is_internal, FAIL, "Vgisinternal"); - VERIFY_VOID(is_internal, internal_array2[ii], "Vgisinternal"); - - status = Vdetach(vgroup_id); - CHECK_VOID(status, FAIL, "Vdetach"); - - ii++; /* increment vgroup index */ - } - - /* Terminate access to the V interface and close the file */ - status = Vend(fid); - CHECK_VOID(status, FAIL, "Vend"); - status = Hclose(fid); - CHECK_VOID(status, FAIL, "Hclose"); - } - else { - fprintf(stderr, "ERROR>>> Unable to make filename for %s\n", GR_FILE); - H4_FAILED() + /* Open the old GR file and initialize the V interface */ + fid = Hopen(testfile, DFACC_READ, 0); + CHECK_VOID(fid, FAIL, "Hopen: grtdfui83.hdf"); + status = Vstart(fid); + CHECK_VOID(status, FAIL, "Vstart"); + + ii = 0; + while ((vref = Vgetid(fid, vref)) != FAIL) { /* until no more vgroups */ + vgroup_id = Vattach(fid, vref, "r"); /* attach to vgroup */ + + /* Test that the current vgroup is or is not internal as specified + in the array internal_array2 */ + is_internal = Vgisinternal(vgroup_id); + CHECK_VOID(is_internal, FAIL, "Vgisinternal"); + VERIFY_VOID(is_internal, internal_array2[ii], "Vgisinternal"); + + status = Vdetach(vgroup_id); + CHECK_VOID(status, FAIL, "Vdetach"); + + ii++; /* increment vgroup index */ } + + /* Terminate access to the V interface and close the file */ + status = Vend(fid); + CHECK_VOID(status, FAIL, "Vend"); + status = Hclose(fid); + CHECK_VOID(status, FAIL, "Hclose"); } /* test_vgisinternal */ void diff --git a/hdf/test/tvset.c b/hdf/test/tvset.c index b6e01a5aa1..f4d22a559c 100644 --- a/hdf/test/tvset.c +++ b/hdf/test/tvset.c @@ -22,7 +22,7 @@ * */ #include "hdf.h" -#include "hfile.h" +#include "hfile_priv.h" #include "tproto.h" #define VDATA_COUNT 256 /* make this many Vdatas to check for memory leaks */ diff --git a/hdf/util/CMakeLists.txt b/hdf/util/CMakeLists.txt index 7f84edc7cf..9d335a7d87 100644 --- a/hdf/util/CMakeLists.txt +++ b/hdf/util/CMakeLists.txt @@ -3,21 +3,16 @@ project (HDF4_HDF_UTIL C) if (HDF4_BUILD_TOOLS) #-- Adding tool hdfls - if (NOT ONLY_SHARED_LIBS) - add_executable (hdfls ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfls.c) - target_include_directories(hdfls PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdfls ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfls.c) + target_include_directories(hdfls PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdfls STATIC) target_link_libraries (hdfls PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_EXECUTABLES hdfls) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdfls-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfls.c) - target_include_directories(hdfls-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdfls-shared SHARED) - target_link_libraries (hdfls-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} hdfls-shared) + else () + TARGET_C_PROPERTIES (hdfls SHARED) + target_link_libraries (hdfls PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_EXECUTABLES hdfls) #-- Adding utility hdfed set (hdfed_SRCS @@ -27,21 +22,16 @@ if (HDF4_BUILD_TOOLS) ${HDF4_HDF_UTIL_SOURCE_DIR}/he_main.c ) - if (NOT ONLY_SHARED_LIBS) - add_executable (hdfed ${hdfed_SRCS}) - target_include_directories(hdfed PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdfed ${hdfed_SRCS}) + target_include_directories(hdfed PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdfed STATIC) target_link_libraries (hdfed PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} hdfed) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdfed-shared ${hdfed_SRCS}) - target_include_directories(hdfed-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdfed-shared SHARED) - target_link_libraries (hdfed-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} hdfed-shared) + else () + TARGET_C_PROPERTIES (hdfed SHARED) + target_link_libraries (hdfed PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} hdfed) endif () if (HDF4_BUILD_UTILS) @@ -51,21 +41,16 @@ if (HDF4_BUILD_UTILS) ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfgifwr.c ) - if (NOT ONLY_SHARED_LIBS) - add_executable (hdf2gif ${hdf2gif_SRCS}) - target_include_directories(hdf2gif PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdf2gif ${hdf2gif_SRCS}) + target_include_directories(hdf2gif PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdf2gif STATIC) target_link_libraries (hdf2gif PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES hdf2gif) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdf2gif-shared ${hdf2gif_SRCS}) - target_include_directories(hdf2gif-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdf2gif-shared SHARED) - target_link_libraries (hdf2gif-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf2gif-shared) + else () + TARGET_C_PROPERTIES (hdf2gif SHARED) + target_link_libraries (hdf2gif PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES hdf2gif) #-- Adding utility gif2hdf set (gif2hdf_SRCS @@ -76,259 +61,184 @@ if (HDF4_BUILD_UTILS) ${HDF4_HDF_UTIL_SOURCE_DIR}/writehdf.c ) - if (NOT ONLY_SHARED_LIBS) - add_executable (gif2hdf ${gif2hdf_SRCS}) - target_include_directories(gif2hdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (gif2hdf ${gif2hdf_SRCS}) + target_include_directories(gif2hdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (gif2hdf STATIC) target_link_libraries (gif2hdf PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} gif2hdf) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (gif2hdf-shared ${gif2hdf_SRCS}) - target_include_directories(gif2hdf-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (gif2hdf-shared SHARED) - target_link_libraries (gif2hdf-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} gif2hdf-shared) + else () + TARGET_C_PROPERTIES (gif2hdf SHARED) + target_link_libraries (gif2hdf PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} gif2hdf) #-- Adding utility hdf24to8 - if (NOT ONLY_SHARED_LIBS) - add_executable (hdf24to8 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf24to8.c) - target_include_directories(hdf24to8 PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdf24to8 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf24to8.c) + target_include_directories(hdf24to8 PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdf24to8 STATIC) target_link_libraries (hdf24to8 PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf24to8) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdf24to8-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf24to8.c) - target_include_directories(hdf24to8-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdf24to8-shared SHARED) - target_link_libraries (hdf24to8-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf24to8-shared) + else () + TARGET_C_PROPERTIES (hdf24to8 SHARED) + target_link_libraries (hdf24to8 PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf24to8) #-- Adding utility hdftor8 - if (NOT ONLY_SHARED_LIBS) - add_executable (hdftor8 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftor8.c) - target_include_directories(hdftor8 PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdftor8 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftor8.c) + target_include_directories(hdftor8 PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdftor8 STATIC) target_link_libraries (hdftor8 PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdftor8) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdftor8-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftor8.c) - target_include_directories(hdftor8-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdftor8-shared SHARED) - target_link_libraries (hdftor8-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdftor8-shared) + else () + TARGET_C_PROPERTIES (hdftor8 SHARED) + target_link_libraries (hdftor8 PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdftor8) #-- Adding utility ristosds - if (NOT ONLY_SHARED_LIBS) - add_executable (ristosds ${HDF4_HDF_UTIL_SOURCE_DIR}/ristosds.c) - target_include_directories(ristosds PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (ristosds ${HDF4_HDF_UTIL_SOURCE_DIR}/ristosds.c) + target_include_directories(ristosds PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (ristosds STATIC) target_link_libraries (ristosds PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} ristosds) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (ristosds-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/ristosds.c) - target_include_directories(ristosds-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (ristosds-shared SHARED) - target_link_libraries (ristosds-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} ristosds-shared) + else () + TARGET_C_PROPERTIES (ristosds SHARED) + target_link_libraries (ristosds PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} ristosds) #-- Adding utility hdfpack - if (NOT ONLY_SHARED_LIBS) - add_executable (hdfpack ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfpack.c) - target_include_directories(hdfpack PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdfpack ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfpack.c) + target_include_directories(hdfpack PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdfpack STATIC) target_link_libraries (hdfpack PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfpack) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdfpack-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfpack.c) - target_include_directories(hdfpack-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdfpack-shared SHARED) - target_link_libraries (hdfpack-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfpack-shared) + else () + TARGET_C_PROPERTIES (hdfpack SHARED) + target_link_libraries (hdfpack PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfpack) #-- Adding utility paltohdf - if (NOT ONLY_SHARED_LIBS) - add_executable (paltohdf ${HDF4_HDF_UTIL_SOURCE_DIR}/paltohdf.c) - target_include_directories(paltohdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (paltohdf ${HDF4_HDF_UTIL_SOURCE_DIR}/paltohdf.c) + target_include_directories(paltohdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (paltohdf STATIC) target_link_libraries (paltohdf PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} paltohdf) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (paltohdf-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/paltohdf.c) - target_include_directories(paltohdf-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (paltohdf-shared SHARED) - target_link_libraries (paltohdf-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} paltohdf-shared) + else () + TARGET_C_PROPERTIES (paltohdf SHARED) + target_link_libraries (paltohdf PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} paltohdf) #-- Adding utility hdftopal - if (NOT ONLY_SHARED_LIBS) - add_executable (hdftopal ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftopal.c) - target_include_directories(hdftopal PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdftopal ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftopal.c) + target_include_directories(hdftopal PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdftopal STATIC) target_link_libraries (hdftopal PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdftopal) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdftopal-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftopal.c) - target_include_directories(hdftopal-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdftopal-shared SHARED) - target_link_libraries (hdftopal-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdftopal-shared) + else () + TARGET_C_PROPERTIES (hdftopal SHARED) + target_link_libraries (hdftopal PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdftopal) #-- Adding utility r8tohdf - if (NOT ONLY_SHARED_LIBS) - add_executable (r8tohdf ${HDF4_HDF_UTIL_SOURCE_DIR}/r8tohdf.c) - target_include_directories(r8tohdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (r8tohdf ${HDF4_HDF_UTIL_SOURCE_DIR}/r8tohdf.c) + target_include_directories(r8tohdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (r8tohdf STATIC) target_link_libraries (r8tohdf PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} r8tohdf) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (r8tohdf-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/r8tohdf.c) - target_include_directories(r8tohdf-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (r8tohdf-shared SHARED) - target_link_libraries (r8tohdf-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} r8tohdf-shared) + else () + TARGET_C_PROPERTIES (r8tohdf SHARED) + target_link_libraries (r8tohdf PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} r8tohdf) #-- Adding utility hdfcomp - if (NOT ONLY_SHARED_LIBS) - add_executable (hdfcomp ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfcomp.c) - target_include_directories(hdfcomp PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdfcomp ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfcomp.c) + target_include_directories(hdfcomp PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdfcomp STATIC) target_link_libraries (hdfcomp PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfcomp) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdfcomp-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfcomp.c) - target_include_directories(hdfcomp-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdfcomp-shared SHARED) - target_link_libraries (hdfcomp-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfcomp-shared) + else () + TARGET_C_PROPERTIES (hdfcomp SHARED) + target_link_libraries (hdfcomp PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfcomp) #-- Adding utility jpeg2hdf - if (NOT ONLY_SHARED_LIBS) - add_executable (jpeg2hdf ${HDF4_HDF_UTIL_SOURCE_DIR}/jpeg2hdf.c) - target_include_directories(jpeg2hdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (jpeg2hdf ${HDF4_HDF_UTIL_SOURCE_DIR}/jpeg2hdf.c) + target_include_directories(jpeg2hdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (jpeg2hdf STATIC) target_link_libraries (jpeg2hdf PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} jpeg2hdf) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (jpeg2hdf-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/jpeg2hdf.c) - target_include_directories(jpeg2hdf-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (jpeg2hdf-shared SHARED) - target_link_libraries (jpeg2hdf-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} jpeg2hdf-shared) + else () + TARGET_C_PROPERTIES (jpeg2hdf SHARED) + target_link_libraries (jpeg2hdf PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} jpeg2hdf) #-- Adding utility hdf2jpeg - if (NOT ONLY_SHARED_LIBS) - add_executable (hdf2jpeg ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf2jpeg.c) - target_include_directories(hdf2jpeg PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdf2jpeg ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf2jpeg.c) + target_include_directories(hdf2jpeg PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdf2jpeg STATIC) target_link_libraries (hdf2jpeg PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf2jpeg) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdf2jpeg-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf2jpeg.c) - target_include_directories(hdf2jpeg-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdf2jpeg-shared SHARED) - target_link_libraries (hdf2jpeg-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf2jpeg-shared) + else () + TARGET_C_PROPERTIES (hdf2jpeg SHARED) + target_link_libraries (hdf2jpeg PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf2jpeg) #-- Adding utility hdf8to24 - if (NOT ONLY_SHARED_LIBS) - add_executable (hdf8to24 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf8to24.c) - target_include_directories(hdf8to24 PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdf8to24 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf8to24.c) + target_include_directories(hdf8to24 PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdf8to24 STATIC) target_link_libraries (hdf8to24 PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf8to24) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdf8to24-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf8to24.c) - target_include_directories(hdf8to24-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdf8to24-shared SHARED) - target_link_libraries (hdf8to24-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf8to24-shared) + else () + TARGET_C_PROPERTIES (hdf8to24 SHARED) + target_link_libraries (hdf8to24 PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf8to24) #-- Adding utility hdfunpac - if (NOT ONLY_SHARED_LIBS) - add_executable (hdfunpac ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfunpac.c) - target_include_directories(hdfunpac PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdfunpac ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfunpac.c) + target_include_directories(hdfunpac PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdfunpac STATIC) target_link_libraries (hdfunpac PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfunpac) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdfunpac-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfunpac.c) - target_include_directories(hdfunpac-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdfunpac-shared SHARED) - target_link_libraries (hdfunpac-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfunpac-shared) + else () + TARGET_C_PROPERTIES (hdfunpac SHARED) + target_link_libraries (hdfunpac PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfunpac) #-- Adding utility vmake - if (NOT ONLY_SHARED_LIBS) - add_executable (vmake ${HDF4_HDF_UTIL_SOURCE_DIR}/vmake.c) - target_include_directories(vmake PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (vmake ${HDF4_HDF_UTIL_SOURCE_DIR}/vmake.c) + target_include_directories(vmake PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (vmake STATIC) target_link_libraries (vmake PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} vmake) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (vmake-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/vmake.c) - target_include_directories(vmake-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (vmake-shared SHARED) - target_link_libraries (vmake-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} vmake-shared) + else () + TARGET_C_PROPERTIES (vmake SHARED) + target_link_libraries (vmake PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} vmake) #-- Adding utility vshow - if (NOT ONLY_SHARED_LIBS) - add_executable (vshow ${HDF4_HDF_UTIL_SOURCE_DIR}/vshow.c) - target_include_directories(vshow PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (vshow ${HDF4_HDF_UTIL_SOURCE_DIR}/vshow.c) + target_include_directories(vshow PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (vshow STATIC) target_link_libraries (vshow PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} vshow) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (vshow-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/vshow.c) - target_include_directories(vshow-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (vshow-shared SHARED) - target_link_libraries (vshow-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} vshow-shared) + else () + TARGET_C_PROPERTIES (vshow SHARED) + target_link_libraries (vshow PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} vshow) endif () if (BUILD_TESTING AND HDF4_BUILD_UTILS) diff --git a/hdf/util/CMakeTests.cmake b/hdf/util/CMakeTests.cmake index 7d5c76aeb9..e206dc4ad8 100644 --- a/hdf/util/CMakeTests.cmake +++ b/hdf/util/CMakeTests.cmake @@ -123,12 +123,6 @@ add_custom_target(hdf_util_files ALL COMMENT "Copying files needed by hdf_util t ############################################################################## ############################################################################## -if (NOT BUILD_SHARED_LIBS) - set (tgt_ext "") -else () - set (tgt_ext "-shared") -endif () - if (HDF4_BUILD_TOOLS) macro (ADD_LS_TEST_NOL testfile resultfile resultcode) if (HDF4_ENABLE_USING_MEMCHECKER) @@ -138,7 +132,7 @@ if (HDF4_BUILD_TOOLS) NAME HDFLS_NOL-${testfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${testfile}.tmp" @@ -164,7 +158,7 @@ if (HDF4_BUILD_TOOLS) NAME HDFLS-${testfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-l;${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${testfile}.tmp" @@ -190,7 +184,7 @@ if (HDF4_BUILD_TOOLS) NAME HEDIT-${testfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-batch" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_INPUT=${testfile}" @@ -210,7 +204,7 @@ if (HDF4_BUILD_TOOLS) endif () macro (ADD_H4_TEST testname testfile) - add_test (NAME ${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + add_test (NAME ${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (NOT "${last_test}" STREQUAL "") set_tests_properties (${testname} PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME}) else () @@ -230,7 +224,7 @@ macro (ADD_CMP_TEST testname reffile testfile) endmacro () macro (ADD_H4Q_TEST testname testfile) - add_test (NAME ${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} > /dev/null 2>&1) + add_test (NAME ${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} > /dev/null 2>&1) if (NOT "${last_test}" STREQUAL "") set_tests_properties (${testname} PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME}) else () diff --git a/hdf/util/fp2hdf.c b/hdf/util/fp2hdf.c index e274061be1..880f1d3c94 100644 --- a/hdf/util/fp2hdf.c +++ b/hdf/util/fp2hdf.c @@ -353,7 +353,7 @@ main(int argc, char *argv[]) * validate the number of command line arguments */ if (argc < 2) { - (void)fprintf(stderr, err1, argc); + fprintf(stderr, err1, argc); usage(argv[0]); goto err; } @@ -428,7 +428,7 @@ main(int argc, char *argv[]) break; case ERR: /* command syntax error */ default: - (void)fprintf(stderr, "%s", err2); + fprintf(stderr, "%s", err2); usage(argv[0]); goto err; } @@ -438,7 +438,7 @@ main(int argc, char *argv[]) * make sure an output file was specified */ if (!outfile_named) { - (void)fprintf(stderr, "%s", err3); + fprintf(stderr, "%s", err3); usage(argv[0]); goto err; } @@ -456,7 +456,7 @@ main(int argc, char *argv[]) return (0); err: - (void)fprintf(stderr, "%s", err4); + fprintf(stderr, "%s", err4); return (1); } @@ -496,7 +496,7 @@ gdata(char *infile, struct Input *in, FILE *strm, int *is_maxmin) } if (DFSDgetdata(infile, in->rank, hdfdims, in->data)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -505,7 +505,7 @@ gdata(char *infile, struct Input *in, FILE *strm, int *is_maxmin) for (j = 0; j < in->dims[1]; j++) { for (i = 0; i < in->dims[0]; i++, fp32++) { if (gfloat(infile, strm, fp32, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -557,13 +557,13 @@ gdimen(char *infile, struct Input *inp, FILE *strm) */ if (inp->is_hdf == TRUE) { if (DFSDgetdims(infile, &inp->rank, hdfdims, 3) == FAIL) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } /* don't know how to deal with other numbers yet */ if (DFSDgetNT(&nt) == FAIL || nt != DFNT_FLOAT32) { - (void)fprintf(stderr, err4, infile); + fprintf(stderr, err4, infile); goto err; } @@ -582,7 +582,7 @@ gdimen(char *infile, struct Input *inp, FILE *strm) inp->dims[2] = hdfdims[0]; } else { - (void)fprintf(stderr, err2, inp->rank, infile); + fprintf(stderr, err2, inp->rank, infile); goto err; } @@ -593,7 +593,7 @@ gdimen(char *infile, struct Input *inp, FILE *strm) } else { if (gint(infile, strm, &inp->dims[2], inp)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (inp->dims[2] > 1) @@ -601,11 +601,11 @@ gdimen(char *infile, struct Input *inp, FILE *strm) else inp->rank = 2; if (gint(infile, strm, &inp->dims[1], inp)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (gint(infile, strm, &inp->dims[0], inp)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -614,7 +614,7 @@ gdimen(char *infile, struct Input *inp, FILE *strm) * validate dimension sizes */ if ((inp->dims[0] < 2) || (inp->dims[1] < 2)) { - (void)fprintf(stderr, err3, infile); + fprintf(stderr, err3, infile); goto err; } @@ -643,20 +643,20 @@ gfloat(char *infile, FILE *strm, float32 *fp32, struct Input *in) if (in->is_text == TRUE) { if (fscanf(strm, "%e", fp32) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } else if (in->is_fp32 == TRUE) { if (fread((char *)fp32, sizeof(float32), 1, strm) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } else { if (fread((char *)&fp64, sizeof(float64), 1, strm) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } *fp32 = (float32)fp64; @@ -686,7 +686,7 @@ gint(char *infile, FILE *strm, int *ival, struct Input *in) */ if (in->is_text == TRUE) { if (fscanf(strm, "%d", ival) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } @@ -696,7 +696,7 @@ gint(char *infile, FILE *strm, int *ival, struct Input *in) } else { if (fread((char *)ival, sizeof(int), 1, strm) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -729,11 +729,11 @@ gmaxmin(char *infile, struct Input *in, FILE *strm, int *is_maxmin) } else { if (gfloat(infile, strm, &in->max, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (gfloat(infile, strm, &in->min, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (in->max > in->min) @@ -815,14 +815,14 @@ gscale(char *infile, struct Input *in, FILE *strm, int *is_scale) if (in->rank == 2) { for (i = 0; i < hdfdims[0]; i++) { if (gfloat(infile, strm, &in->vscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->vscale[i] = in->vscale[i - 1]; for (i = 0; i < hdfdims[1]; i++) { if (gfloat(infile, strm, &in->hscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -831,21 +831,21 @@ gscale(char *infile, struct Input *in, FILE *strm, int *is_scale) else { for (i = 0; i < hdfdims[0]; i++) { if (gfloat(infile, strm, &in->dscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->dscale[i] = in->dscale[i - 1]; for (i = 0; i < hdfdims[1]; i++) { if (gfloat(infile, strm, &in->vscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->vscale[i] = in->vscale[i - 1]; for (i = 0; i < hdfdims[2]; i++) { if (gfloat(infile, strm, &in->hscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -919,7 +919,7 @@ gtoken(char *s) token = OPT_num; } if (token == ERR) - (void)fprintf(stderr, err1, s); + fprintf(stderr, err1, s); } else if (isnum(s)) /* positive number */ token = OPT_num; @@ -952,11 +952,11 @@ gtype(char *infile, struct Input *in, FILE **strm) in->is_hdf = TRUE; else { if ((*strm = fopen(infile, "r")) == NULL) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (fread(buf, 4, 1, *strm) != 1) { - (void)fprintf(stderr, err2, infile); + fprintf(stderr, err2, infile); goto err; } if (!memcmp("TEXT", buf, 4) || !memcmp("text", buf, 4)) { @@ -968,7 +968,7 @@ gtype(char *infile, struct Input *in, FILE **strm) else { rewind(*strm); if (fread(buf, sizeof(int), 1, *strm) != 1) { - (void)fprintf(stderr, err2, infile); + fprintf(stderr, err2, infile); goto err; } if (!memcmp("FP32", buf, 4) || !memcmp("fp32", buf, 4)) @@ -976,7 +976,7 @@ gtype(char *infile, struct Input *in, FILE **strm) else if (!memcmp("FP64", buf, 4) || !memcmp("fp64", buf, 4)) in->is_fp64 = TRUE; else { - (void)fprintf(stderr, err3, infile); + fprintf(stderr, err3, infile); goto err; } } @@ -998,174 +998,174 @@ gtype(char *infile, struct Input *in, FILE **strm) void help(char *name) { - (void)printf("Name:\n"); - (void)printf("\t %s\n\n", name); - (void)printf("Purpose:\n"); - (void)printf("\t To convert floating point data to HDF Scientific "); - (void)printf("Data Set (SDS)\n"); - (void)printf("\t and/or 8-bit Raster Image Set (RIS8) format, "); - (void)printf("storing the results\n"); - (void)printf("\t in an HDF file. The image data can be scaled "); - (void)printf("about a mean value.\n\n"); - (void)printf("Version:\n"); - (void)printf("\t v1.1 (Apr 30, 1990)\n\n"); - (void)printf("Synopsis:\n"); - (void)printf("\t %s -h[elp], OR\n", name); - (void)printf("\t %s [...] -o[utfile] ", name); - (void)printf("\n"); - (void)printf("\t\t [-r[aster] [ras_opts ...]] [-f[loat]]\n\n"); - (void)printf("\t -h[elp]:\n"); - (void)printf("\t\t Print a helpful summary of usage, and exit.\n\n"); - (void)printf("\t infile(s):\n"); - (void)printf("\t\t Input file(s), containing a single "); - (void)printf("two-dimensional or\n"); - (void)printf("\t\t three-dimensional floating point array in "); - (void)printf("either ASCII\n"); - (void)printf("\t\t text, native floating point, or HDF SDS format. "); - (void)printf("If an\n"); - (void)printf("\t\t HDF file is used for input, it must contain an "); - (void)printf("SDS.\n"); - (void)printf("\t\t The SDS need only contain a dimension record and "); - (void)printf("the\n"); - (void)printf("\t\t data, but if it also contains maximum and "); - (void)printf("minimum values\n"); - (void)printf("\t\t and/or scales for each axis, these will be "); - (void)printf("used. If the\n"); - (void)printf("\t\t input format is ASCII text or native floating "); - (void)printf("point, see\n"); - (void)printf("\t\t \"Notes\" below on how it must be organized.\n\n"); - (void)printf("\t -o[utfile] :\n"); - (void)printf("\t\t Data from one or more input files are stored as "); - (void)printf("one or\n"); - (void)printf("\t\t more data sets and/or images in one HDF output "); - (void)printf("file,\n\t\t\"outfile\".\n\n"); - (void)printf("\t -r[aster]:\n"); - (void)printf("\t\t Store output as a raster image set in the "); - (void)printf("output file\n\n"); - (void)printf("\t -f[loat]:\n"); - (void)printf("\t\t Store output as a scientific data set in the "); - (void)printf("the output file.\n"); - (void)printf("\t\t This is the default if the \"-r\" option is not "); - (void)printf("specified.\n\n"); - (void)printf("\t ras_opts ...\n\n"); - (void)printf("\t -e[xpand] []:\n"); - (void)printf("\t\t Expand float data via pixel replication to "); - (void)printf("produce the\n"); - (void)printf("\t\t image(s). \"horiz\" and \"vert\" give the "); - (void)printf("horizontal and\n"); - (void)printf("\t\t vertical resolution of the image(s) to be "); - (void)printf("produced; and\n"); - (void)printf("\t\t optionally, \"depth\" gives the number of "); - (void)printf("images or depth\n"); - (void)printf("\t\t planes (for 3D input data).\n\n"); - (void)printf("\t-i[nterp] []:\n"); - (void)printf("\t\t Apply bilinear, or trilinear, interpolation to "); - (void)printf("the float\n"); - (void)printf("\t\t data to produce the image(s). \"horiz\", "); - (void)printf("\"vert\", and \"depth\"\n"); - (void)printf("\t\t must be greater than or equal to the dimensions "); - (void)printf("of the\n"); - (void)printf("\t\t original dataset.\n\n"); - (void)printf("\t -p[alfile] :\n"); - (void)printf("\t\t Store the palette with the image. Get the "); - (void)printf("palette from\n"); - (void)printf("\t\t \"palfile\"; which may be an HDF file containing "); - (void)printf("a palette,\n"); - (void)printf("\t\t or a file containing a raw palette.\n\n"); - (void)printf("\t -m[ean] :\n"); - (void)printf("\t\t If a floating point mean value is given, the "); - (void)printf("image will be\n"); - (void)printf("\t\t scaled about the mean. The new extremes "); - (void)printf("(newmax and newmin),\n"); - (void)printf("\t\t as given by:\n\n"); - (void)printf("\t\t newmax = mean + max(abs(max-mean), "); - (void)printf("abs(mean-min))\n"); - (void)printf("\t\t newmin = mean - max(abs(max-mean), "); - (void)printf("abs(mean-min))\n\n"); - (void)printf("\t\t will be equidistant from the mean value. If "); - (void)printf("no mean value\n"); - (void)printf("\t\t is given, then the mean will be: 0.5 * (max "); - (void)printf("+ min)\n\n"); - (void)printf("Notes:\n"); - (void)printf("\t If the input file format is ASCII text or native "); - (void)printf("floating point, it\n"); - (void)printf("\t must have the following input fields:\n\n"); - (void)printf("\t\t format\n"); - (void)printf("\t\t nplanes\n"); - (void)printf("\t\t nrows\n"); - (void)printf("\t\t ncols\n"); - (void)printf("\t\t max_value\n"); - (void)printf("\t\t min_value\n"); - (void)printf("\t\t [plane1 plane2 plane3 ...]\n"); - (void)printf("\t\t row1 row2 row3 ...\n"); - (void)printf("\t\t col1 col2 col3 ...\n"); - (void)printf("\t\t data1 data2 data3 ...\n"); - (void)printf("\t\t ...\n\n"); - (void)printf("\t Where:\n"); - (void)printf("\t\t format:\n"); - (void)printf("\t\t\t Format designator (\"TEXT\", \"FP32\" or "); - (void)printf("\"FP64\").\n"); - (void)printf("\t\t nplanes:\n"); - (void)printf("\t\t\t Dimension of the depth axis (\"1\" for 2D "); - (void)printf("input).\n"); - (void)printf("\t\t nrows:\n"); - (void)printf("\t\t\t Dimension of the vertical axis.\n"); - (void)printf("\t\t ncols:\n"); - (void)printf("\t\t\t Dimension of the horizontal axis.\n"); - (void)printf("\t\t max_value:\n"); - (void)printf("\t\t\t Maximum data value.\n"); - (void)printf("\t\t min_value:\n"); - (void)printf("\t\t\t Minimum data value.\n"); - (void)printf("\t\t plane1, plane2, plane3, ...:\n"); - (void)printf("\t\t\t Scales for depth axis.\n"); - (void)printf("\t\t row1, row2, row3, ...:\n"); - (void)printf("\t\t\t Scales for the vertical axis.\n"); - (void)printf("\t\t col1, col2, col3, ...:\n"); - (void)printf("\t\t\t Scales for the horizontal axis.\n"); - (void)printf("\t\t data1, data2, data3, ...:\n"); - (void)printf("\t\t\t The data ordered by rows, left to right and "); - (void)printf("top\n"); - (void)printf("\t\t\t to bottom; then optionally, ordered by planes,\n"); - (void)printf("\t\t\t front to back.\n\n"); - (void)printf("\t For FP32 and FP64 input format, \"format\", "); - (void)printf("\"nplanes\", \"nrows\", \"ncols\",\n"); - (void)printf("\t and \"nplanes\" are native integers; where "); - (void)printf("\"format\" is the integer\n"); - (void)printf("\t representation of the appropriate 4-character "); - (void)printf("string (0x46503332 for\n"); - (void)printf("\t \"FP32\" and 0x46503634 for \"FP64\"). The "); - (void)printf("remaining input fields are\n"); - (void)printf("\t composed of native 32-bit floating point values for "); - (void)printf("FP32 input format,\n"); - (void)printf("\t or native 64-bit floating point values for FP64 "); - (void)printf("input format.\n\n"); - (void)printf("Examples:\n"); - (void)printf("\t Convert floating point data in \"f1.txt\" to SDS "); - (void)printf("format, and store it\n"); - (void)printf("\t as an SDS in HDF file \"o1\":\n\n"); - (void)printf("\t\t %s f1.txt -o o1\n\n", name); - (void)printf("\t Convert floating point data in \"f2.hdf\" to "); - (void)printf("8-bit raster format, and\n"); - (void)printf("\t store it as an RIS8 in HDF file \"o2\":\n\n"); - (void)printf("\t\t %s f2.hdf -o o2 -r\n\n", name); - (void)printf("\t Convert floating point data in \"f3.bin\" to "); - (void)printf("8-bit raster format and\n"); - (void)printf("\t SDS format, and store both the RIS8 and the SDS "); - (void)printf("in HDF file \"o3\":\n\n"); - (void)printf("\t\t %s f3.bin -o o3 -r -f\n\n", name); - (void)printf("\t Convert floating point data in \"f4\" to a "); - (void)printf("500x600 raster image, and\n"); - (void)printf("\t store the RIS8 in HDF file \"o4\". Also store a "); - (void)printf("palette from \"palfile\"\n"); - (void)printf("\t with the image:\n\n"); - (void)printf("\t\t %s f4 -o o4 -r -e 500 600 -p palfile\n\n", name); - (void)printf("\t Convert floating point data in \"f5\" to 200 "); - (void)printf("planes of 500x600 raster\n"); - (void)printf("\t images, and store the RIS8 in HDF file \"o5\". "); - (void)printf("Also scale the image\n"); - (void)printf("\t data so that it is centered about a mean value "); - (void)printf("of 10.0:\n\n"); - (void)printf("\t\t %s f5 -o o5 -r -i 500 600 200 -m 10.0\n", name); + printf("Name:\n"); + printf("\t %s\n\n", name); + printf("Purpose:\n"); + printf("\t To convert floating point data to HDF Scientific "); + printf("Data Set (SDS)\n"); + printf("\t and/or 8-bit Raster Image Set (RIS8) format, "); + printf("storing the results\n"); + printf("\t in an HDF file. The image data can be scaled "); + printf("about a mean value.\n\n"); + printf("Version:\n"); + printf("\t v1.1 (Apr 30, 1990)\n\n"); + printf("Synopsis:\n"); + printf("\t %s -h[elp], OR\n", name); + printf("\t %s [...] -o[utfile] ", name); + printf("\n"); + printf("\t\t [-r[aster] [ras_opts ...]] [-f[loat]]\n\n"); + printf("\t -h[elp]:\n"); + printf("\t\t Print a helpful summary of usage, and exit.\n\n"); + printf("\t infile(s):\n"); + printf("\t\t Input file(s), containing a single "); + printf("two-dimensional or\n"); + printf("\t\t three-dimensional floating point array in "); + printf("either ASCII\n"); + printf("\t\t text, native floating point, or HDF SDS format. "); + printf("If an\n"); + printf("\t\t HDF file is used for input, it must contain an "); + printf("SDS.\n"); + printf("\t\t The SDS need only contain a dimension record and "); + printf("the\n"); + printf("\t\t data, but if it also contains maximum and "); + printf("minimum values\n"); + printf("\t\t and/or scales for each axis, these will be "); + printf("used. If the\n"); + printf("\t\t input format is ASCII text or native floating "); + printf("point, see\n"); + printf("\t\t \"Notes\" below on how it must be organized.\n\n"); + printf("\t -o[utfile] :\n"); + printf("\t\t Data from one or more input files are stored as "); + printf("one or\n"); + printf("\t\t more data sets and/or images in one HDF output "); + printf("file,\n\t\t\"outfile\".\n\n"); + printf("\t -r[aster]:\n"); + printf("\t\t Store output as a raster image set in the "); + printf("output file\n\n"); + printf("\t -f[loat]:\n"); + printf("\t\t Store output as a scientific data set in the "); + printf("the output file.\n"); + printf("\t\t This is the default if the \"-r\" option is not "); + printf("specified.\n\n"); + printf("\t ras_opts ...\n\n"); + printf("\t -e[xpand] []:\n"); + printf("\t\t Expand float data via pixel replication to "); + printf("produce the\n"); + printf("\t\t image(s). \"horiz\" and \"vert\" give the "); + printf("horizontal and\n"); + printf("\t\t vertical resolution of the image(s) to be "); + printf("produced; and\n"); + printf("\t\t optionally, \"depth\" gives the number of "); + printf("images or depth\n"); + printf("\t\t planes (for 3D input data).\n\n"); + printf("\t-i[nterp] []:\n"); + printf("\t\t Apply bilinear, or trilinear, interpolation to "); + printf("the float\n"); + printf("\t\t data to produce the image(s). \"horiz\", "); + printf("\"vert\", and \"depth\"\n"); + printf("\t\t must be greater than or equal to the dimensions "); + printf("of the\n"); + printf("\t\t original dataset.\n\n"); + printf("\t -p[alfile] :\n"); + printf("\t\t Store the palette with the image. Get the "); + printf("palette from\n"); + printf("\t\t \"palfile\"; which may be an HDF file containing "); + printf("a palette,\n"); + printf("\t\t or a file containing a raw palette.\n\n"); + printf("\t -m[ean] :\n"); + printf("\t\t If a floating point mean value is given, the "); + printf("image will be\n"); + printf("\t\t scaled about the mean. The new extremes "); + printf("(newmax and newmin),\n"); + printf("\t\t as given by:\n\n"); + printf("\t\t newmax = mean + max(abs(max-mean), "); + printf("abs(mean-min))\n"); + printf("\t\t newmin = mean - max(abs(max-mean), "); + printf("abs(mean-min))\n\n"); + printf("\t\t will be equidistant from the mean value. If "); + printf("no mean value\n"); + printf("\t\t is given, then the mean will be: 0.5 * (max "); + printf("+ min)\n\n"); + printf("Notes:\n"); + printf("\t If the input file format is ASCII text or native "); + printf("floating point, it\n"); + printf("\t must have the following input fields:\n\n"); + printf("\t\t format\n"); + printf("\t\t nplanes\n"); + printf("\t\t nrows\n"); + printf("\t\t ncols\n"); + printf("\t\t max_value\n"); + printf("\t\t min_value\n"); + printf("\t\t [plane1 plane2 plane3 ...]\n"); + printf("\t\t row1 row2 row3 ...\n"); + printf("\t\t col1 col2 col3 ...\n"); + printf("\t\t data1 data2 data3 ...\n"); + printf("\t\t ...\n\n"); + printf("\t Where:\n"); + printf("\t\t format:\n"); + printf("\t\t\t Format designator (\"TEXT\", \"FP32\" or "); + printf("\"FP64\").\n"); + printf("\t\t nplanes:\n"); + printf("\t\t\t Dimension of the depth axis (\"1\" for 2D "); + printf("input).\n"); + printf("\t\t nrows:\n"); + printf("\t\t\t Dimension of the vertical axis.\n"); + printf("\t\t ncols:\n"); + printf("\t\t\t Dimension of the horizontal axis.\n"); + printf("\t\t max_value:\n"); + printf("\t\t\t Maximum data value.\n"); + printf("\t\t min_value:\n"); + printf("\t\t\t Minimum data value.\n"); + printf("\t\t plane1, plane2, plane3, ...:\n"); + printf("\t\t\t Scales for depth axis.\n"); + printf("\t\t row1, row2, row3, ...:\n"); + printf("\t\t\t Scales for the vertical axis.\n"); + printf("\t\t col1, col2, col3, ...:\n"); + printf("\t\t\t Scales for the horizontal axis.\n"); + printf("\t\t data1, data2, data3, ...:\n"); + printf("\t\t\t The data ordered by rows, left to right and "); + printf("top\n"); + printf("\t\t\t to bottom; then optionally, ordered by planes,\n"); + printf("\t\t\t front to back.\n\n"); + printf("\t For FP32 and FP64 input format, \"format\", "); + printf("\"nplanes\", \"nrows\", \"ncols\",\n"); + printf("\t and \"nplanes\" are native integers; where "); + printf("\"format\" is the integer\n"); + printf("\t representation of the appropriate 4-character "); + printf("string (0x46503332 for\n"); + printf("\t \"FP32\" and 0x46503634 for \"FP64\"). The "); + printf("remaining input fields are\n"); + printf("\t composed of native 32-bit floating point values for "); + printf("FP32 input format,\n"); + printf("\t or native 64-bit floating point values for FP64 "); + printf("input format.\n\n"); + printf("Examples:\n"); + printf("\t Convert floating point data in \"f1.txt\" to SDS "); + printf("format, and store it\n"); + printf("\t as an SDS in HDF file \"o1\":\n\n"); + printf("\t\t %s f1.txt -o o1\n\n", name); + printf("\t Convert floating point data in \"f2.hdf\" to "); + printf("8-bit raster format, and\n"); + printf("\t store it as an RIS8 in HDF file \"o2\":\n\n"); + printf("\t\t %s f2.hdf -o o2 -r\n\n", name); + printf("\t Convert floating point data in \"f3.bin\" to "); + printf("8-bit raster format and\n"); + printf("\t SDS format, and store both the RIS8 and the SDS "); + printf("in HDF file \"o3\":\n\n"); + printf("\t\t %s f3.bin -o o3 -r -f\n\n", name); + printf("\t Convert floating point data in \"f4\" to a "); + printf("500x600 raster image, and\n"); + printf("\t store the RIS8 in HDF file \"o4\". Also store a "); + printf("palette from \"palfile\"\n"); + printf("\t with the image:\n\n"); + printf("\t\t %s f4 -o o4 -r -e 500 600 -p palfile\n\n", name); + printf("\t Convert floating point data in \"f5\" to 200 "); + printf("planes of 500x600 raster\n"); + printf("\t images, and store the RIS8 in HDF file \"o5\". "); + printf("Also scale the image\n"); + printf("\t data so that it is centered about a mean value "); + printf("of 10.0:\n\n"); + printf("\t\t %s f5 -o o5 -r -i 500 600 200 -m 10.0\n", name); return; } @@ -1193,7 +1193,7 @@ indexes(float32 *scale, int dim, int *idx, int res) * determine the midpoints between scale values */ if ((midpt = (float32 *)malloc((size_t)dim * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } for (i = 0; i < dim - 1; i++) @@ -1292,16 +1292,16 @@ interp(struct Input *in, struct Raster *im) * allocate dynamic memory for the interpolation ratio buffers */ if ((hratio = (float32 *)malloc((size_t)im->hres * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if ((vratio = (float32 *)malloc((unsigned int)im->vres * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if (in->rank == 3) { if ((dratio = (float32 *)malloc((unsigned int)im->dres * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } } @@ -1311,16 +1311,16 @@ interp(struct Input *in, struct Raster *im) * buffers */ if ((hinc = (int *)malloc((unsigned int)im->hres * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if ((voff = (int *)malloc((unsigned int)(im->vres + 1) * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if (in->rank == 3) { if ((doff = (int *)malloc((unsigned int)(im->dres + 1) * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } } @@ -1519,7 +1519,7 @@ palette(char *palfile) */ if (Hishdf(palfile)) { if (DFPgetpal(palfile, pal)) { - (void)fprintf(stderr, err1, palfile); + fprintf(stderr, err1, palfile); goto err; } @@ -1529,19 +1529,19 @@ palette(char *palfile) } else { if ((strm = fopen(palfile, "r")) == NULL) { - (void)fprintf(stderr, err2, palfile); + fprintf(stderr, err2, palfile); goto err; } if (fread((char *)red, 1, 256, strm) != 256) { - (void)fprintf(stderr, err1, palfile); + fprintf(stderr, err1, palfile); goto err; } else if (fread((char *)green, 1, 256, strm) != 256) { - (void)fprintf(stderr, err1, palfile); + fprintf(stderr, err1, palfile); goto err; } else if (fread((char *)blue, 1, 256, strm) != 256) { - (void)fprintf(stderr, err1, palfile); + fprintf(stderr, err1, palfile); goto err; } (void)fclose(strm); @@ -1561,7 +1561,7 @@ palette(char *palfile) * set up the palette as the default for subsequent images */ if (DFR8setpalette(pal)) { - (void)fprintf(stderr, "%s", err3); + fprintf(stderr, "%s", err3); goto err; } @@ -1602,7 +1602,7 @@ pixrep(struct Input *in, struct Raster *im) * determine the scale indexes of the horizontal pixel locations */ if ((hidx = (int *)malloc((unsigned int)(im->hres + 1) * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } @@ -1613,7 +1613,7 @@ pixrep(struct Input *in, struct Raster *im) * determine the scale indexes of the vertical pixel locations */ if ((vidx = (int *)malloc((unsigned int)(im->vres + 1) * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } @@ -1627,7 +1627,7 @@ pixrep(struct Input *in, struct Raster *im) didx = &dummy; if (in->rank == 3) { if ((didx = (int *)malloc((unsigned int)(im->dres + 1) * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } @@ -1639,7 +1639,7 @@ pixrep(struct Input *in, struct Raster *im) * compute the expanded image */ if ((pix = (unsigned char *)malloc((unsigned int)(in->dims[0] + 1))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } for (k = 0, odidx = didx[0] - 1; k < im->dres; k++) { @@ -1736,7 +1736,7 @@ process(struct Options *opt) * create the HDF output file */ if ((hdf = Hopen(opt->outfile, DFACC_CREATE, 0)) == FAIL) { - (void)fprintf(stderr, err1, opt->outfile); + fprintf(stderr, err1, opt->outfile); goto err; } (void)Hclose(hdf); @@ -1770,16 +1770,16 @@ process(struct Options *opt) * get the scale for each axis */ if ((in.hscale = (float32 *)malloc((size_t)(in.dims[0] + 1) * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err2); + fprintf(stderr, "%s", err2); goto err; } if ((in.vscale = (float32 *)malloc((size_t)(in.dims[1] + 1) * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err2); + fprintf(stderr, "%s", err2); goto err; } if (in.rank == 3) { if ((in.dscale = (float32 *)malloc((size_t)(in.dims[2] + 1) * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err2); + fprintf(stderr, "%s", err2); goto err; } } @@ -1791,7 +1791,7 @@ process(struct Options *opt) */ len = in.dims[0] * in.dims[1] * in.dims[2]; if ((in.data = (void *)malloc((size_t)len * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err2); + fprintf(stderr, "%s", err2); goto err; } if (gdata(opt->infiles[i], &in, strm, &is_maxmin)) @@ -1816,45 +1816,45 @@ process(struct Options *opt) } if (DFSDsetNT(DFNT_FLOAT32)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } if (is_scale == TRUE) { if (DFSDsetdims(in.rank, hdfdims)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } if (DFSDsetrange(&in.max, &in.min)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } if (in.rank == 2) { if (DFSDsetdimscale(1, hdfdims[0], in.vscale)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } if (DFSDsetdimscale(2, hdfdims[1], in.hscale)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } } else { if (DFSDsetdimscale(1, hdfdims[0], in.dscale)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } if (DFSDsetdimscale(2, hdfdims[1], in.vscale)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } if (DFSDsetdimscale(3, hdfdims[2], in.hscale)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } } } if (DFSDadddata(opt->outfile, in.rank, hdfdims, in.data)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } } @@ -1868,19 +1868,19 @@ process(struct Options *opt) */ im.hres = (opt->hres == 0) ? in.dims[0] : opt->hres; if ((im.hres < in.dims[0]) && (opt->ctm == EXPAND)) { - (void)fprintf(stderr, "%s", err3a); - (void)fprintf(stderr, err3b, "Horiz."); - (void)fprintf(stderr, err3c, "horiz."); - (void)fprintf(stderr, err3d, in.dims[0]); + fprintf(stderr, "%s", err3a); + fprintf(stderr, err3b, "Horiz."); + fprintf(stderr, err3c, "horiz."); + fprintf(stderr, err3d, in.dims[0]); im.hres = in.dims[0]; opt->hres = in.dims[0]; } im.vres = (opt->vres == 0) ? in.dims[1] : opt->vres; if ((im.vres < in.dims[1]) && (opt->ctm == EXPAND)) { - (void)fprintf(stderr, "%s", err3a); - (void)fprintf(stderr, err3b, "Vert."); - (void)fprintf(stderr, err3c, "vert."); - (void)fprintf(stderr, err3d, in.dims[1]); + fprintf(stderr, "%s", err3a); + fprintf(stderr, err3b, "Vert."); + fprintf(stderr, err3c, "vert."); + fprintf(stderr, err3d, in.dims[1]); im.vres = in.dims[1]; opt->vres = in.dims[1]; } @@ -1888,17 +1888,17 @@ process(struct Options *opt) if (in.rank == 3) { im.dres = (opt->dres == 0) ? in.dims[2] : opt->dres; if ((im.dres < in.dims[2]) && (opt->ctm == EXPAND)) { - (void)fprintf(stderr, "%s", err3a); - (void)fprintf(stderr, err3b, "Depth"); - (void)fprintf(stderr, err3c, "depth"); - (void)fprintf(stderr, err3d, in.dims[2]); + fprintf(stderr, "%s", err3a); + fprintf(stderr, err3b, "Depth"); + fprintf(stderr, err3c, "depth"); + fprintf(stderr, err3d, in.dims[2]); im.dres = in.dims[2]; opt->dres = in.dims[2]; } } len = im.hres * im.vres * im.dres; if ((im.image = (unsigned char *)malloc((unsigned int)len)) == NULL) { - (void)fprintf(stderr, "%s", err2); + fprintf(stderr, "%s", err2); goto err; } @@ -1923,7 +1923,7 @@ process(struct Options *opt) len = im.hres * im.vres; for (j = 0, ip = im.image; j < im.dres; j++, ip += len) { if (DFR8addimage(opt->outfile, ip, im.hres, im.vres, DFTAG_RLE)) { - (void)fprintf(stderr, "%s", err4); + fprintf(stderr, "%s", err4); goto err; } } @@ -1957,27 +1957,27 @@ process(struct Options *opt) void usage(char *name) { - (void)fprintf(stderr, "\nUsage:\t%s -h[elp], OR\n", name); - (void)fprintf(stderr, "\t%s [...] ", name); - (void)fprintf(stderr, "-o[utfile] [options...]\n\n"); - (void)fprintf(stderr, "\toptions...\n"); - (void)fprintf(stderr, "\t -r[aster]:\n"); - (void)fprintf(stderr, "\t produce an image. Could be "); - (void)fprintf(stderr, "followed by:\n"); - (void)fprintf(stderr, "\t -e[xpand] "); - (void)fprintf(stderr, "[]:\n"); - (void)fprintf(stderr, "\t resolution with pixel "); - (void)fprintf(stderr, "replication\n"); - (void)fprintf(stderr, "\t -i[nterp] "); - (void)fprintf(stderr, "[]:\n"); - (void)fprintf(stderr, "\t resolution with interpolation\n"); - (void)fprintf(stderr, "\t -p[alfile] :\n"); - (void)fprintf(stderr, "\t include palette from palfile\n"); - (void)fprintf(stderr, "\t -m[ean] :\n"); - (void)fprintf(stderr, "\t mean value to scale image "); - (void)fprintf(stderr, "around\n"); - (void)fprintf(stderr, "\t -f[loat]:\n"); - (void)fprintf(stderr, "\t produce floating point data\n\n"); + fprintf(stderr, "\nUsage:\t%s -h[elp], OR\n", name); + fprintf(stderr, "\t%s [...] ", name); + fprintf(stderr, "-o[utfile] [options...]\n\n"); + fprintf(stderr, "\toptions...\n"); + fprintf(stderr, "\t -r[aster]:\n"); + fprintf(stderr, "\t produce an image. Could be "); + fprintf(stderr, "followed by:\n"); + fprintf(stderr, "\t -e[xpand] "); + fprintf(stderr, "[]:\n"); + fprintf(stderr, "\t resolution with pixel "); + fprintf(stderr, "replication\n"); + fprintf(stderr, "\t -i[nterp] "); + fprintf(stderr, "[]:\n"); + fprintf(stderr, "\t resolution with interpolation\n"); + fprintf(stderr, "\t -p[alfile] :\n"); + fprintf(stderr, "\t include palette from palfile\n"); + fprintf(stderr, "\t -m[ean] :\n"); + fprintf(stderr, "\t mean value to scale image "); + fprintf(stderr, "around\n"); + fprintf(stderr, "\t -f[loat]:\n"); + fprintf(stderr, "\t produce floating point data\n\n"); return; } diff --git a/hdf/util/fptest.c b/hdf/util/fptest.c index 56b81cec8a..e925b77a1f 100644 --- a/hdf/util/fptest.c +++ b/hdf/util/fptest.c @@ -137,40 +137,40 @@ main(void) _fmode = _O_TEXT; #endif sp = fopen("ctxtr2", "w"); - (void)fprintf(sp, "%s\n", text); - (void)fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); - (void)fprintf(sp, "%14.6E%14.6E\n", ezero, ezero); + fprintf(sp, "%s\n", text); + fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); + fprintf(sp, "%14.6E%14.6E\n", ezero, ezero); for (i = 0; i < nrow; i++) - (void)fprintf(sp, "%14.6E", row4[i]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", row4[i]); + fprintf(sp, "\n"); for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%14.6E", col4[j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", col4[j]); + fprintf(sp, "\n"); for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%14.6E", b32r2[i][j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", b32r2[i][j]); + fprintf(sp, "\n"); } (void)fclose(sp); sp = fopen("ctxtr3", "w"); - (void)fprintf(sp, "%s\n", text); - (void)fprintf(sp, "%10d%10d%10d\n", npln, nrow, ncol); - (void)fprintf(sp, "%14.6E%14.6E\n", ezero, ezero); + fprintf(sp, "%s\n", text); + fprintf(sp, "%10d%10d%10d\n", npln, nrow, ncol); + fprintf(sp, "%14.6E%14.6E\n", ezero, ezero); for (k = 0; k < npln; k++) - (void)fprintf(sp, "%14.6E", pln4[k]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", pln4[k]); + fprintf(sp, "\n"); for (i = 0; i < nrow; i++) - (void)fprintf(sp, "%14.6E", row4[i]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", row4[i]); + fprintf(sp, "\n"); for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%14.6E", col4[j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", col4[j]); + fprintf(sp, "\n"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%14.6E", b32r3[k][i][j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", b32r3[k][i][j]); + fprintf(sp, "\n"); } (void)fclose(sp); diff --git a/hdf/util/gif2hdf.c b/hdf/util/gif2hdf.c index f68c330cb7..0fbbf6ac3c 100644 --- a/hdf/util/gif2hdf.c +++ b/hdf/util/gif2hdf.c @@ -21,8 +21,7 @@ int main(int argv, char *argc[]) { - GIFTOMEM GifMemoryStruct; - GIFIMAGEDESC gifImageDesc; + GIFTOMEM GifMemoryStruct; FILE *fpGif; int32 i; diff --git a/hdf/util/hdf2jpeg.c b/hdf/util/hdf2jpeg.c index bde768fe7d..29dce1ba1f 100644 --- a/hdf/util/hdf2jpeg.c +++ b/hdf/util/hdf2jpeg.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "hdf.h" -#include "hfile.h" +#include "hfile_priv.h" /* Size of the file buffer to copy through */ #define MAX_FILE_BUF 16384 diff --git a/hdf/util/hdfls.c b/hdf/util/hdfls.c index a08715abf2..e7486984d2 100644 --- a/hdf/util/hdfls.c +++ b/hdf/util/hdfls.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "hdf.h" -#include "hfile.h" +#include "hfile_priv.h" #define MAXBUFF 8192 diff --git a/hdf/util/hdfpack.c b/hdf/util/hdfpack.c index 82b91e1abb..c455acab69 100644 --- a/hdf/util/hdfpack.c +++ b/hdf/util/hdfpack.c @@ -33,12 +33,13 @@ ** You must have enough additional disk space for the compacted file. */ -#include "hdf.h" -#include "herr.h" -#include "hfile.h" #include #include +#include "hdf.h" +#include "herr.h" +#include "hfile_priv.h" + typedef struct mydd_t { uint16 tag; uint16 ref; diff --git a/hdf/util/he_cntrl.c b/hdf/util/he_cntrl.c index 5e10f32ae1..438531f3ec 100644 --- a/hdf/util/he_cntrl.c +++ b/hdf/util/he_cntrl.c @@ -936,8 +936,9 @@ getLine(char *p) char * nextWord(char **p) { - char *word; - char *s, *q; + char *word = NULL; + char *s = NULL; + char *q = NULL; unsigned len; q = *p; @@ -1267,15 +1268,16 @@ parsePred(int argc, char *argv[]) int predNum = -1; int state = 0; int key = 0; - int i; - char *s; - char *tok; pred = (HE_PRED *)calloc(HE_PRED_SZ, sizeof(HE_PRED)); - for (i = 1; i < argc; i++) { - s = argv[i]; + for (int i = 1; i < argc; i++) { + + char *s = argv[i]; + while (*s) { + char *tok = NULL; + if (state != 2) tok = nextToken(&s); else @@ -1330,6 +1332,7 @@ parsePred(int argc, char *argv[]) pred[predNum].arg.str = copyStr(tok); } state = 0; + free(tok); break; default: diff --git a/hdf/util/he_disp.c b/hdf/util/he_disp.c index 7b7e545186..8928751184 100644 --- a/hdf/util/he_disp.c +++ b/hdf/util/he_disp.c @@ -210,7 +210,7 @@ rImage(int usepal) * If a palette should be used, send it with the M command. */ if (usepal) { - (void)printf("\033^M;0;256;768;rseq^"); /* start map */ + printf("\033^M;0;256;768;rseq^"); /* start map */ thischar = (int8 *)rgb; for (j = 0; j < 768; j++) { @@ -236,7 +236,7 @@ rImage(int usepal) newxsize = rleIt((char *)thisline, (char *)space, (int)xdim); thisline += xdim; /* increment to next line */ - (void)printf("\033^R;0;%d;%d;%d;rseq^", i * factor, factor, newxsize); + printf("\033^R;0;%d;%d;%d;rseq^", i * factor, factor, newxsize); thischar = space; for (j = 0; j < newxsize; j++) { diff --git a/hdf/util/he_file.c b/hdf/util/he_file.c index 2e734c5e3f..5bf8b55dc7 100644 --- a/hdf/util/he_file.c +++ b/hdf/util/he_file.c @@ -486,10 +486,10 @@ put(char *template, int verbose) int HEputR8(HE_CMD *cmd) { - int i; - int verbose = NO; - char *image = "img#.@.%"; - char *pal = "pal#"; + int i; + int verbose = NO; + const char *image = "img#.@.%"; + const char *pal = "pal#"; for (i = 1; i < cmd->argc; i++) if (cmd->argv[i][0] == '-') diff --git a/hdf/util/he_main.c b/hdf/util/he_main.c index 3bcba2dc04..b2db3c00bb 100644 --- a/hdf/util/he_main.c +++ b/hdf/util/he_main.c @@ -61,7 +61,7 @@ *****************************************************************************/ /* ------ he.c ------- main() main HDF interfacing routines */ -#include "hdfi.h" +#include "hdf_priv.h" #include "he.h" #include @@ -280,10 +280,14 @@ backupName(const char *file) int backupFile(char *file) { - char *back; /* backup file name */ + char *back = NULL; /* backup file name */ + int f = -1; back = backupName(file); - return copyFile(file, back); + f = copyFile(file, back); + free(back); + + return f; } int @@ -405,7 +409,7 @@ initFile(char *file) int closeFile(int keep) { - char *back; + char *back = NULL; if (!fileOpen()) { fprintf(stderr, "No open file to close.\n"); diff --git a/hdf/util/jpeg2hdf.c b/hdf/util/jpeg2hdf.c index 83ed201b2c..a440fd9c9f 100644 --- a/hdf/util/jpeg2hdf.c +++ b/hdf/util/jpeg2hdf.c @@ -15,7 +15,7 @@ #include #include -#include "hdfi.h" +#include "hdf_priv.h" /* Size of the file buffer to copy through */ #define MAX_FILE_BUF 16384 diff --git a/hdf/util/vshow.c b/hdf/util/vshow.c index 9fa3853e26..683f7c4889 100644 --- a/hdf/util/vshow.c +++ b/hdf/util/vshow.c @@ -28,7 +28,8 @@ ******************************************************************************/ #include "hdf.h" -#include "vgint.h" + +#include "vg_priv.h" static int condensed; diff --git a/java/src/jni/h4jni.h b/java/src/jni/h4jni.h index e793d34fa6..8e122820aa 100644 --- a/java/src/jni/h4jni.h +++ b/java/src/jni/h4jni.h @@ -17,9 +17,10 @@ * */ -#include #include +#include + #ifndef Included_h4jni #define Included_h4jni diff --git a/java/src/jni/hdfImp.c b/java/src/jni/hdfImp.c index 187395eb0d..6874d575c3 100644 --- a/java/src/jni/hdfImp.c +++ b/java/src/jni/hdfImp.c @@ -20,16 +20,19 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +#include #include -#include "hdfi.h" -#include "hfile.h" + +#include "hdf.h" +#include "hfile_priv.h" /* only needed for library version symbols */ #include "h4jni.h" #include "hdfImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* * Class: hdf_hdflib_HDFLibrary * Method: Hopen diff --git a/java/src/jni/hdfanImp.c b/java/src/jni/hdfanImp.c index f2b8545ec8..120f23779a 100644 --- a/java/src/jni/hdfanImp.c +++ b/java/src/jni/hdfanImp.c @@ -20,17 +20,19 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include #include #include -#include "hdfi.h" + +#include + +#include "hdf.h" #include "h4jni.h" #include "hdfanImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jlong JNICALL Java_hdf_hdflib_HDFLibrary_ANstart(JNIEnv *env, jclass clss, jlong file_id) { diff --git a/java/src/jni/hdfdfpalImp.c b/java/src/jni/hdfdfpalImp.c index a285d7c6b2..78681d87a0 100644 --- a/java/src/jni/hdfdfpalImp.c +++ b/java/src/jni/hdfdfpalImp.c @@ -20,17 +20,19 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include #include #include -#include "hdfi.h" + +#include + +#include "hdf.h" #include "h4jni.h" #include "hdfdfpalImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jboolean JNICALL Java_hdf_hdflib_HDFLibrary_DFPaddpal(JNIEnv *env, jclass clss, jstring filename, jbyteArray palette) { diff --git a/java/src/jni/hdfdfuImp.c b/java/src/jni/hdfdfuImp.c index 69380a9dbb..8aa3e2b0f7 100644 --- a/java/src/jni/hdfdfuImp.c +++ b/java/src/jni/hdfdfuImp.c @@ -20,15 +20,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfdfuImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jboolean JNICALL Java_hdf_hdflib_HDFLibrary_DFUfptoimage(JNIEnv *env, jclass clss, jint hdim, jint vdim, jfloat max, jfloat min, jfloatArray hscale, jfloatArray vscale, jfloatArray data, diff --git a/java/src/jni/hdfexceptionImp.c b/java/src/jni/hdfexceptionImp.c index 324507d148..5603e39424 100644 --- a/java/src/jni/hdfexceptionImp.c +++ b/java/src/jni/hdfexceptionImp.c @@ -18,12 +18,9 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfexceptionImp.h" @@ -86,6 +83,10 @@ extern "C" { /********************/ static jboolean H4JNIErrorClass(JNIEnv *env, const char *message, const char *className); +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* * Class: hdf_hdflib_HDFLibraryException * Method: printStackTrace0 diff --git a/java/src/jni/hdfgrImp.c b/java/src/jni/hdfgrImp.c index b1ac1c0fa6..6e8d4d8a07 100644 --- a/java/src/jni/hdfgrImp.c +++ b/java/src/jni/hdfgrImp.c @@ -20,16 +20,19 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +#include #include -#include "hdfi.h" + +#include "hdf.h" #include "mfhdf.h" #include "h4jni.h" #include "hdfgrImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + extern jboolean makeChunkInfo(JNIEnv *env, jobject chunkobj, int32 flgs, HDF_CHUNK_DEF *cinf); extern jboolean getNewCompInfo(JNIEnv *env, jobject ciobj, comp_info *cinf); extern jboolean setNewCompInfo(JNIEnv *env, jobject ciobj, comp_coder_t coder, comp_info *cinf); diff --git a/java/src/jni/hdfheImp.c b/java/src/jni/hdfheImp.c index 8f89d1577a..4d20cbc4a6 100644 --- a/java/src/jni/hdfheImp.c +++ b/java/src/jni/hdfheImp.c @@ -20,16 +20,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" -#include "hfile.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfheImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jint JNICALL Java_hdf_hdflib_HDFLibrary_HEvalue(JNIEnv *env, jclass clss, jint level) { diff --git a/java/src/jni/hdfhxImp.c b/java/src/jni/hdfhxImp.c index 6e95d16125..326b760837 100644 --- a/java/src/jni/hdfhxImp.c +++ b/java/src/jni/hdfhxImp.c @@ -20,15 +20,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfhxImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jboolean JNICALL Java_hdf_hdflib_HDFLibrary_HXsetcreatedir(JNIEnv *env, jclass clss, jstring dir) { diff --git a/java/src/jni/hdfnativeImp.c b/java/src/jni/hdfnativeImp.c index 276c446d02..1815297d0e 100644 --- a/java/src/jni/hdfnativeImp.c +++ b/java/src/jni/hdfnativeImp.c @@ -30,15 +30,16 @@ * but unavoidable performance hit. */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfnativeImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* returns int [] */ JNIEXPORT jintArray JNICALL Java_hdf_hdflib_HDFNativeData_byteToInt___3B(JNIEnv *env, jclass clss, jbyteArray bdata) diff --git a/java/src/jni/hdfr24Imp.c b/java/src/jni/hdfr24Imp.c index fd24c3000c..16e098ce94 100644 --- a/java/src/jni/hdfr24Imp.c +++ b/java/src/jni/hdfr24Imp.c @@ -20,15 +20,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfr24Imp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + extern jboolean getOldCompInfo(JNIEnv *env, jobject ciobj, comp_info *cinf); JNIEXPORT jboolean JNICALL diff --git a/java/src/jni/hdfr8Imp.c b/java/src/jni/hdfr8Imp.c index 54e372ef11..a24b9355ae 100644 --- a/java/src/jni/hdfr8Imp.c +++ b/java/src/jni/hdfr8Imp.c @@ -20,15 +20,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfr8Imp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + extern jboolean getOldCompInfo(JNIEnv *env, jobject ciobj, comp_info *cinf); JNIEXPORT jboolean JNICALL diff --git a/java/src/jni/hdfsdsImp.c b/java/src/jni/hdfsdsImp.c index 3cdcf1691b..65cd64839d 100644 --- a/java/src/jni/hdfsdsImp.c +++ b/java/src/jni/hdfsdsImp.c @@ -20,16 +20,19 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +#include #include -#include "hdfi.h" + +#include "hdf.h" #include "mfhdf.h" #include "h4jni.h" #include "hdfsdsImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + extern jboolean makeChunkInfo(JNIEnv *env, jobject chunkobj, int32 flgs, HDF_CHUNK_DEF *cinf); extern jboolean getNewCompInfo(JNIEnv *env, jobject ciobj, comp_info *cinf); extern jboolean setNewCompInfo(JNIEnv *env, jobject ciobj, comp_coder_t coder, comp_info *cinf); diff --git a/java/src/jni/hdfstructsutil.c b/java/src/jni/hdfstructsutil.c index 3178b3fd39..a90bd94ec0 100644 --- a/java/src/jni/hdfstructsutil.c +++ b/java/src/jni/hdfstructsutil.c @@ -19,15 +19,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfstructsutil.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* * Get information from a Java HDFNewCompInfo object in to a C comp_info * struct. diff --git a/java/src/jni/hdfvdataImp.c b/java/src/jni/hdfvdataImp.c index 44999b779e..a04696b37d 100644 --- a/java/src/jni/hdfvdataImp.c +++ b/java/src/jni/hdfvdataImp.c @@ -20,15 +20,18 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +#include #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfvdataImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jlong JNICALL Java_hdf_hdflib_HDFLibrary_VSattach(JNIEnv *env, jclass clss, jlong fid, jint vdata_ref, jstring accessmode) { diff --git a/java/src/jni/hdfvfImp.c b/java/src/jni/hdfvfImp.c index 41c0764f99..af2ed17fa8 100644 --- a/java/src/jni/hdfvfImp.c +++ b/java/src/jni/hdfvfImp.c @@ -20,15 +20,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfvfImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jint JNICALL Java_hdf_hdflib_HDFLibrary_VFfieldesize(JNIEnv *env, jclass clss, jlong vdata_id, int field_index) { diff --git a/java/src/jni/hdfvgroupImp.c b/java/src/jni/hdfvgroupImp.c index 3c40fa8866..aedc94b3c1 100644 --- a/java/src/jni/hdfvgroupImp.c +++ b/java/src/jni/hdfvgroupImp.c @@ -20,15 +20,18 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +#include #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfvgroupImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jboolean JNICALL Java_hdf_hdflib_HDFLibrary_Vstart(JNIEnv *env, jclass clss, jlong fid) { diff --git a/java/src/jni/hdfvhImp.c b/java/src/jni/hdfvhImp.c index 6e308b1127..b5ddd5684c 100644 --- a/java/src/jni/hdfvhImp.c +++ b/java/src/jni/hdfvhImp.c @@ -20,15 +20,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfvhImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jint JNICALL Java_hdf_hdflib_HDFLibrary_VHmakegroup(JNIEnv *env, jclass clss, jlong file_id, jintArray tag_array, jintArray ref_array, jint n_objects, jstring vgroup_name, diff --git a/java/src/jni/hdfvqImp.c b/java/src/jni/hdfvqImp.c index 3a4bfb2a1a..08828b4de6 100644 --- a/java/src/jni/hdfvqImp.c +++ b/java/src/jni/hdfvqImp.c @@ -20,15 +20,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfvqImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jint JNICALL Java_hdf_hdflib_HDFLibrary_VQueryref(JNIEnv *env, jclass clss, jlong vkey) { diff --git a/java/src/jni/hdfvsqImp.c b/java/src/jni/hdfvsqImp.c index 80126cc3e2..42aac9da63 100644 --- a/java/src/jni/hdfvsqImp.c +++ b/java/src/jni/hdfvsqImp.c @@ -20,15 +20,18 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +#include #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfvsqImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jboolean JNICALL Java_hdf_hdflib_HDFLibrary_VSQuerycount(JNIEnv *env, jclass clss, jlong vdata_id, jintArray n_records) { diff --git a/m4/ax_check_class.m4 b/m4/ax_check_class.m4 index 2cc50db4d5..e673c2d35d 100644 --- a/m4/ax_check_class.m4 +++ b/m4/ax_check_class.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_class.html +# https://www.gnu.org/software/autoconf-archive/ax_check_class.html # =========================================================================== # # SYNOPSIS @@ -36,7 +36,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -51,7 +51,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 7 +#serial 12 AU_ALIAS([AC_CHECK_CLASS], [AX_CHECK_CLASS]) AC_DEFUN([AX_CHECK_CLASS],[ @@ -61,73 +61,8 @@ dnl Normally I'd use a AC_CACHE_CHECK here but since the variable name is dnl dynamic I need an extra level of extraction AC_MSG_CHECKING([for $1 class]) AC_CACHE_VAL(ax_cv_class_$ac_var_name, [ -if test x$ac_cv_prog_uudecode_base64 = xyes; then -dnl /** -dnl * Test.java: used to test dynamically if a class exists. -dnl */ -dnl public class Test -dnl { -dnl -dnl public static void -dnl main( String[] argv ) -dnl { -dnl Class lib; -dnl if (argv.length < 1) -dnl { -dnl System.err.println ("Missing argument"); -dnl System.exit (77); -dnl } -dnl try -dnl { -dnl lib = Class.forName (argv[0]); -dnl } -dnl catch (ClassNotFoundException e) -dnl { -dnl System.exit (1); -dnl } -dnl lib = null; -dnl System.exit (0); -dnl } -dnl -dnl } -cat << \EOF > Test.uue -begin-base64 644 Test.class -yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE -bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 -bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ -AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt -ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV -ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp -VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM -amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi -AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B -AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA -AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN -uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK -AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA -JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA -JwAAAAIAKA== -==== -EOF - if $UUDECODE Test.uue; then - : - else - echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD - echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD - cat Test.uue >&AS_MESSAGE_LOG_FD - ac_cv_prog_uudecode_base64=no - fi - rm -f Test.uue - if AC_TRY_COMMAND($JAVA $JAVAFLAGS Test $1) >/dev/null 2>&1; then - eval "ac_cv_class_$ac_var_name=yes" - else - eval "ac_cv_class_$ac_var_name=no" - fi - rm -f Test.class -else AX_TRY_COMPILE_JAVA([$1], , [eval "ac_cv_class_$ac_var_name=yes"], [eval "ac_cv_class_$ac_var_name=no"]) -fi eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`" HAVE_LAST_CLASS=$ac_var_val diff --git a/m4/ax_check_classpath.m4 b/m4/ax_check_classpath.m4 index 3c9081a087..e08a253d8b 100644 --- a/m4/ax_check_classpath.m4 +++ b/m4/ax_check_classpath.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_classpath.html +# https://www.gnu.org/software/autoconf-archive/ax_check_classpath.html # =========================================================================== # # SYNOPSIS @@ -33,7 +33,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -48,7 +48,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 5 +#serial 6 AU_ALIAS([AC_CHECK_CLASSPATH], [AX_CHECK_CLASSPATH]) AC_DEFUN([AX_CHECK_CLASSPATH],[ diff --git a/m4/ax_check_java_home.m4 b/m4/ax_check_java_home.m4 index cfe8f58928..1d60387b1b 100644 --- a/m4/ax_check_java_home.m4 +++ b/m4/ax_check_java_home.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_java_home.html +# https://www.gnu.org/software/autoconf-archive/ax_check_java_home.html # =========================================================================== # # SYNOPSIS @@ -28,7 +28,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -43,7 +43,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 6 +#serial 7 AU_ALIAS([AC_CHECK_JAVA_HOME], [AX_CHECK_JAVA_HOME]) diff --git a/m4/ax_check_junit.m4 b/m4/ax_check_junit.m4 index 39b52d1f73..44dd70df3b 100644 --- a/m4/ax_check_junit.m4 +++ b/m4/ax_check_junit.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_junit.html +# https://www.gnu.org/software/autoconf-archive/ax_check_junit.html # =========================================================================== # # SYNOPSIS @@ -45,7 +45,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 5 +#serial 6 AU_ALIAS([AC_CHECK_JUNIT], [AX_CHECK_JUNIT]) AC_DEFUN([AX_CHECK_JUNIT],[ diff --git a/m4/ax_check_rqrd_class.m4 b/m4/ax_check_rqrd_class.m4 index 8f14241b1b..baa041aca5 100644 --- a/m4/ax_check_rqrd_class.m4 +++ b/m4/ax_check_rqrd_class.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_rqrd_class.html +# https://www.gnu.org/software/autoconf-archive/ax_check_rqrd_class.html # =========================================================================== # # SYNOPSIS @@ -35,7 +35,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -50,7 +50,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 5 +#serial 6 AU_ALIAS([AC_CHECK_RQRD_CLASS], [AX_CHECK_RQRD_CLASS]) AC_DEFUN([AX_CHECK_RQRD_CLASS],[ diff --git a/m4/ax_java_check_class.m4 b/m4/ax_java_check_class.m4 index 917638ae4b..c9d60f7861 100644 --- a/m4/ax_java_check_class.m4 +++ b/m4/ax_java_check_class.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_java_check_class.html +# https://www.gnu.org/software/autoconf-archive/ax_java_check_class.html # =========================================================================== # # SYNOPSIS @@ -15,7 +15,7 @@ # # The macro tries to compile a minimal program importing . Some # newer compilers moan about the failure to use this but fail or produce a -# class file anyway. All moaing is sunk to /dev/null since I only wanted +# class file anyway. All moaning is sunk to /dev/null since I only wanted # to know if the class could be imported. This is a recommended followup # to AX_CHECK_JAVA_PLUGIN with classpath appropriately adjusted. # @@ -34,7 +34,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -49,7 +49,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 9 +#serial 12 AU_ALIAS([DPS_JAVA_CHECK_CLASS], [AX_JAVA_CHECK_CLASS]) AC_DEFUN([AX_JAVA_CHECK_CLASS],[ diff --git a/m4/ax_java_options.m4 b/m4/ax_java_options.m4 index 36c10d922b..722d788027 100644 --- a/m4/ax_java_options.m4 +++ b/m4/ax_java_options.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_java_options.html +# https://www.gnu.org/software/autoconf-archive/ax_java_options.html # =========================================================================== # # SYNOPSIS @@ -27,7 +27,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 6 +#serial 7 AU_ALIAS([AC_JAVA_OPTIONS], [AX_JAVA_OPTIONS]) AC_DEFUN([AX_JAVA_OPTIONS],[ diff --git a/m4/ax_jni_include_dir.m4 b/m4/ax_jni_include_dir.m4 index becb33a34a..cd720987b7 100644 --- a/m4/ax_jni_include_dir.m4 +++ b/m4/ax_jni_include_dir.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html +# https://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html # =========================================================================== # # SYNOPSIS @@ -32,6 +32,10 @@ # # - at the configure level, setenv JAVAC # +# This macro depends on AC_CANONICAL_HOST which requires that config.guess +# and config.sub be distributed along with the source code. See autoconf +# manual for details. +# # Note: This macro can work with the autoconf M4 macros for Java programs. # This particular macro is not part of the original set of macros. # @@ -44,11 +48,13 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 11 +#serial 15 AU_ALIAS([AC_JNI_INCLUDE_DIR], [AX_JNI_INCLUDE_DIR]) AC_DEFUN([AX_JNI_INCLUDE_DIR],[ +AC_REQUIRE([AC_CANONICAL_HOST]) + JNI_INCLUDE_DIRS="" if test "x$JAVA_HOME" != x; then @@ -66,14 +72,23 @@ else fi case "$host_os" in - darwin*) # Apple JDK is at /System location and has headers symlinked elsewhere - case "$_JTOPDIR" in - /System/Library/Frameworks/JavaVM.framework/*) - _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` - _JINC="$_JTOPDIR/Headers";; - *) _JINC="$_JTOPDIR/include";; - esac;; - *) _JINC="$_JTOPDIR/include";; + darwin*) # Apple Java headers are inside the Xcode bundle. + major_macos_version=$(sw_vers -productVersion | sed -n -e 's/^\(@<:@0-9@:>@*\).@<:@0-9@:>@*.@<:@0-9@:>@*/\1/p') + if @<:@ "$major_macos_version" -gt "10" @:>@; then + _JTOPDIR="$(/usr/libexec/java_home)" + _JINC="$_JTOPDIR/include" + else + macos_version=$(sw_vers -productVersion | sed -n -e 's/^@<:@0-9@:>@*.\(@<:@0-9@:>@*\).@<:@0-9@:>@*/\1/p') + if @<:@ "$macos_version" -gt "7" @:>@; then + _JTOPDIR="$(xcrun --show-sdk-path)/System/Library/Frameworks/JavaVM.framework" + _JINC="$_JTOPDIR/Headers" + else + _JTOPDIR="/System/Library/Frameworks/JavaVM.framework" + _JINC="$_JTOPDIR/Headers" + fi + fi + ;; + *) _JINC="$_JTOPDIR/include";; esac _AS_ECHO_LOG([_JTOPDIR=$_JTOPDIR]) _AS_ECHO_LOG([_JINC=$_JINC]) @@ -81,13 +96,21 @@ _AS_ECHO_LOG([_JINC=$_JINC]) # On Mac OS X 10.6.4, jni.h is a symlink: # /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h # -> ../../CurrentJDK/Headers/jni.h. -AC_CHECK_FILE([$_JINC/jni.h], - [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"], - [_JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` - AC_CHECK_FILE([$_JTOPDIR/include/jni.h], - [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"], - AC_MSG_ERROR([cannot find JDK header files])) - ]) +AC_CACHE_CHECK(jni headers, ac_cv_jni_header_path, +[ + if test -f "$_JINC/jni.h"; then + ac_cv_jni_header_path="$_JINC" + JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $ac_cv_jni_header_path" + else + _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` + if test -f "$_JTOPDIR/include/jni.h"; then + ac_cv_jni_header_path="$_JTOPDIR/include" + JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $ac_cv_jni_header_path" + else + ac_cv_jni_header_path=none + fi + fi +]) # get the likely subdirectories for system specific java includes case "$host_os" in @@ -102,13 +125,15 @@ cygwin*) _JNI_INC_SUBDIRS="win32";; *) _JNI_INC_SUBDIRS="genunix";; esac -# add any subdirectories that are present -for JINCSUBDIR in $_JNI_INC_SUBDIRS -do +if test "x$ac_cv_jni_header_path" != "xnone"; then + # add any subdirectories that are present + for JINCSUBDIR in $_JNI_INC_SUBDIRS + do if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR" fi -done + done +fi ]) # _ACJNI_FOLLOW_SYMLINKS diff --git a/m4/ax_prog_jar.m4 b/m4/ax_prog_jar.m4 index 3c60fcaf2d..d474912a05 100644 --- a/m4/ax_prog_jar.m4 +++ b/m4/ax_prog_jar.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_jar.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_jar.html # =========================================================================== # # SYNOPSIS @@ -37,7 +37,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 7 +#serial 8 AU_ALIAS([AC_PROG_JAR], [AX_PROG_JAR]) AC_DEFUN([AX_PROG_JAR],[ diff --git a/m4/ax_prog_java.m4 b/m4/ax_prog_java.m4 index 03961db5b7..c2e6964e2c 100644 --- a/m4/ax_prog_java.m4 +++ b/m4/ax_prog_java.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_java.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_java.html # =========================================================================== # # SYNOPSIS @@ -85,7 +85,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -100,7 +100,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 9 +#serial 10 AU_ALIAS([AC_PROG_JAVA], [AX_PROG_JAVA]) AC_DEFUN([AX_PROG_JAVA],[ diff --git a/m4/ax_prog_java_cc.m4 b/m4/ax_prog_java_cc.m4 index 3df064ff66..ce9612d3f8 100644 --- a/m4/ax_prog_java_cc.m4 +++ b/m4/ax_prog_java_cc.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_java_cc.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_java_cc.html # =========================================================================== # # SYNOPSIS @@ -56,7 +56,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -71,7 +71,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 4 +#serial 5 # AX_PROG_JAVA_CC([COMPILER ...]) # -------------------------- diff --git a/m4/ax_prog_java_works.m4 b/m4/ax_prog_java_works.m4 index 54e132afae..bc7052619e 100644 --- a/m4/ax_prog_java_works.m4 +++ b/m4/ax_prog_java_works.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html # =========================================================================== # # SYNOPSIS @@ -32,7 +32,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -47,57 +47,16 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 9 +#serial 11 AU_ALIAS([AC_PROG_JAVA_WORKS], [AX_PROG_JAVA_WORKS]) AC_DEFUN([AX_PROG_JAVA_WORKS], [ -AC_PATH_PROG(UUDECODE, uudecode, [no]) -if test x$UUDECODE != xno; then -AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [ -dnl /** -dnl * Test.java: used to test if java compiler works. -dnl */ -dnl public class Test -dnl { -dnl -dnl public static void -dnl main( String[] argv ) -dnl { -dnl System.exit (0); -dnl } -dnl -dnl } -cat << \EOF > Test.uue -begin-base64 644 Test.class -yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE -bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 -bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s -YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG -aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB -AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB -AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ= -==== -EOF -if $UUDECODE Test.uue; then - ac_cv_prog_uudecode_base64=yes -else - echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD - echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD - cat Test.uue >&AS_MESSAGE_LOG_FD - ac_cv_prog_uudecode_base64=no -fi -rm -f Test.uue]) -fi -if test x$ac_cv_prog_uudecode_base64 != xyes; then - rm -f Test.class - AC_MSG_WARN([I have to compile Test.class from scratch]) if test x$ac_cv_prog_javac_works = xno; then AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly]) fi if test x$ac_cv_prog_javac_works = x; then AX_PROG_JAVAC fi -fi AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ JAVA_TEST=Test.java CLASS_TEST=Test.class @@ -111,7 +70,6 @@ public static void main (String args[]) { } } EOF changequote([, ])dnl -if test x$ac_cv_prog_uudecode_base64 != xyes; then if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then : else @@ -119,7 +77,6 @@ if test x$ac_cv_prog_uudecode_base64 != xyes; then cat $JAVA_TEST >&AS_MESSAGE_LOG_FD AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)) fi -fi if AC_TRY_COMMAND($JAVA -classpath . $JAVAFLAGS $TEST) >/dev/null 2>&1; then ac_cv_prog_java_works=yes else @@ -127,7 +84,7 @@ else cat $JAVA_TEST >&AS_MESSAGE_LOG_FD AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) fi -rm -fr $JAVA_TEST $CLASS_TEST Test.uue +rm -f $JAVA_TEST $CLASS_TEST ]) AC_PROVIDE([$0])dnl ] diff --git a/m4/ax_prog_javac.m4 b/m4/ax_prog_javac.m4 index d061243cdb..8abb733fce 100644 --- a/m4/ax_prog_javac.m4 +++ b/m4/ax_prog_javac.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_javac.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_javac.html # =========================================================================== # # SYNOPSIS @@ -49,7 +49,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -64,7 +64,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 7 +#serial 8 AU_ALIAS([AC_PROG_JAVAC], [AX_PROG_JAVAC]) AC_DEFUN([AX_PROG_JAVAC],[ diff --git a/m4/ax_prog_javac_works.m4 b/m4/ax_prog_javac_works.m4 index 7dfa1e37d8..9b48149d80 100644 --- a/m4/ax_prog_javac_works.m4 +++ b/m4/ax_prog_javac_works.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html # =========================================================================== # # SYNOPSIS @@ -32,7 +32,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -47,7 +47,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 6 +#serial 7 AU_ALIAS([AC_PROG_JAVAC_WORKS], [AX_PROG_JAVAC_WORKS]) AC_DEFUN([AX_PROG_JAVAC_WORKS],[ diff --git a/m4/ax_prog_javadoc.m4 b/m4/ax_prog_javadoc.m4 index bcb6045a82..b9fcea414d 100644 --- a/m4/ax_prog_javadoc.m4 +++ b/m4/ax_prog_javadoc.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_javadoc.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_javadoc.html # =========================================================================== # # SYNOPSIS @@ -38,7 +38,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 8 +#serial 9 AU_ALIAS([AC_PROG_JAVADOC], [AX_PROG_JAVADOC]) AC_DEFUN([AX_PROG_JAVADOC],[ diff --git a/m4/ax_prog_javah.m4 b/m4/ax_prog_javah.m4 index cefc616d4c..935ec8964b 100644 --- a/m4/ax_prog_javah.m4 +++ b/m4/ax_prog_javah.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_javah.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_javah.html # =========================================================================== # # SYNOPSIS @@ -21,7 +21,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 8 +#serial 11 AU_ALIAS([AC_PROG_JAVAH], [AX_PROG_JAVAH]) AC_DEFUN([AX_PROG_JAVAH],[ @@ -30,19 +30,19 @@ AC_REQUIRE([AC_PROG_CPP])dnl AC_PATH_PROG(JAVAH,javah) AS_IF([test -n "$ac_cv_path_JAVAH"], [ - AC_TRY_CPP([#include ],,[ + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include ]])],[],[ ac_save_CPPFLAGS="$CPPFLAGS" - _ACJAVAH_FOLLOW_SYMLINKS("$ac_cv_path_JAVAH") + _ACJAVAH_FOLLOW_SYMLINKS("$ac_cv_path_JAVAH") ax_prog_javah_bin_dir=`AS_DIRNAME([$_ACJAVAH_FOLLOWED])` ac_dir="`AS_DIRNAME([$ax_prog_javah_bin_dir])`/include" AS_CASE([$build_os], - [cygwin*], + [cygwin*|mingw*], [ac_machdep=win32], [ac_machdep=`AS_ECHO($build_os) | sed 's,[[-0-9]].*,,'`]) CPPFLAGS="$ac_save_CPPFLAGS -I$ac_dir -I$ac_dir/$ac_machdep" - AC_TRY_CPP([#include ], - ac_save_CPPFLAGS="$CPPFLAGS", - AC_MSG_WARN([unable to include ])) + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include ]])], + [ac_save_CPPFLAGS="$CPPFLAGS"], + [AC_MSG_WARN([unable to include ])]) CPPFLAGS="$ac_save_CPPFLAGS"]) ]) ]) diff --git a/m4/ax_try_compile_java.m4 b/m4/ax_try_compile_java.m4 index a8ed6b2a36..245c36c40d 100644 --- a/m4/ax_try_compile_java.m4 +++ b/m4/ax_try_compile_java.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_try_compile_java.html +# https://www.gnu.org/software/autoconf-archive/ax_try_compile_java.html # =========================================================================== # # SYNOPSIS @@ -29,7 +29,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 8 +#serial 10 AU_ALIAS([AC_TRY_COMPILE_JAVA], [AX_TRY_COMPILE_JAVA]) AC_DEFUN([AX_TRY_COMPILE_JAVA],[ @@ -48,8 +48,8 @@ dnl Don't remove the temporary files here, so they can be examined. else echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD cat Test.java >&AS_MESSAGE_LOG_FD -ifelse([$4], , , [ rm -fr Test.java Test.class +ifelse([$4], , , [ rm -f Test.java Test.class $4 ])dnl fi -rm -fr Test.java Test.class]) +rm -f Test.java Test.class]) diff --git a/m4/ax_try_run_java.m4 b/m4/ax_try_run_java.m4 index c680f03f2c..2ebb86d6dc 100644 --- a/m4/ax_try_run_java.m4 +++ b/m4/ax_try_run_java.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_try_run_java.html +# https://www.gnu.org/software/autoconf-archive/ax_try_run_java.html # =========================================================================== # # SYNOPSIS @@ -29,7 +29,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 2 +#serial 3 AU_ALIAS([AC_TRY_RUN_JAVA], [AX_TRY_RUN_JAVA]) AC_DEFUN([AX_TRY_RUN_JAVA],[ diff --git a/mfhdf/dumper/CMakeLists.txt b/mfhdf/dumper/CMakeLists.txt index e9dafb21c2..f7dd463fff 100644 --- a/mfhdf/dumper/CMakeLists.txt +++ b/mfhdf/dumper/CMakeLists.txt @@ -14,25 +14,19 @@ set (hdp_SRCS ${HDF4_MFHDF_DUMPER_SOURCE_DIR}/show.c ) -if (NOT ONLY_SHARED_LIBS) - add_executable (hdp ${hdp_SRCS}) - target_include_directories(hdp PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") +add_executable (hdp ${hdp_SRCS}) +target_include_directories(hdp PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdp STATIC) target_link_libraries (hdp PRIVATE ${HDF4_MF_LIB_TARGET}) - set_target_properties (hdp PROPERTIES COMPILE_DEFINITIONS "HDF") - set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdp") - set (H4_DEP_EXECUTABLES hdp) +else () + TARGET_C_PROPERTIES (hdp SHARED) + target_link_libraries (hdp PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () +set_target_properties (hdp PROPERTIES COMPILE_DEFINITIONS "HDF") +set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdp") -if (BUILD_SHARED_LIBS) - add_executable (hdp-shared ${hdp_SRCS}) - target_include_directories(hdp-shared PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdp-shared SHARED) - target_link_libraries (hdp-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set_target_properties (hdp-shared PROPERTIES COMPILE_DEFINITIONS "HDF") - set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdp-shared") - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} hdp-shared) -endif () +set (H4_DEP_EXECUTABLES hdp) if (BUILD_TESTING) include (CMakeTests.cmake) diff --git a/mfhdf/dumper/CMakeTests.cmake b/mfhdf/dumper/CMakeTests.cmake index 2e3d9548f2..ec37287e78 100644 --- a/mfhdf/dumper/CMakeTests.cmake +++ b/mfhdf/dumper/CMakeTests.cmake @@ -143,7 +143,7 @@ add_custom_target(dumper_files ALL COMMENT "Copying files needed by dumper tests if (NOT BUILD_SHARED_LIBS) set (tgt_ext "") else () - set (tgt_ext "-shared") + set (tgt_ext "") endif () macro (ADD_H4_TEST resultfile resultcode) diff --git a/mfhdf/dumper/hdp.c b/mfhdf/dumper/hdp.c index 43be0323fc..011b634372 100644 --- a/mfhdf/dumper/hdp.c +++ b/mfhdf/dumper/hdp.c @@ -12,8 +12,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "hdp.h" -#include "local_nc.h" -#include "vgint.h" + +#include "nc_priv.h" +#include "vg_priv.h" /********************/ /* Global Variables */ diff --git a/mfhdf/dumper/hdp.h b/mfhdf/dumper/hdp.h index a203fdbc8c..a6ccab9365 100644 --- a/mfhdf/dumper/hdp.h +++ b/mfhdf/dumper/hdp.h @@ -15,7 +15,7 @@ #define DUMPER_HDP_H #include "hdf.h" -#include "hfile.h" +#include "hfile_priv.h" /* Global Variables */ extern intn vinit_done; diff --git a/mfhdf/dumper/hdp_list.c b/mfhdf/dumper/hdp_list.c index b0a5e2f15c..6735b71e3b 100644 --- a/mfhdf/dumper/hdp_list.c +++ b/mfhdf/dumper/hdp_list.c @@ -202,16 +202,16 @@ print_list_header(list_info_t *list_opts) intn print_annots_by_object(const char *fname, int32 an_id, ann_type annot_type, uint16 tag, uint16 ref) { - intn i; - char *buf = NULL; - int32 ann_num; - int32 ann_length; - int32 ann_id = FAIL; - int32 *ann_list = NULL; - char *annot_type_text = "invalid"; /* "label" or "description" */ - char *func_name = "print_annots_by_object"; /* used to print error msg */ - char error_item[256]; /* holds tag, ref, and fname for error msg */ - intn ret_value = SUCCEED; + intn i; + char *buf = NULL; + int32 ann_num; + int32 ann_length; + int32 ann_id = FAIL; + int32 *ann_list = NULL; + const char *annot_type_text = "invalid"; /* "label" or "description" */ + const char *func_name = "print_annots_by_object"; /* used to print error msg */ + char error_item[256]; /* holds tag, ref, and fname for error msg */ + intn ret_value = SUCCEED; /* stores the current values tag, ref, and file name in error_item, just to simplify the error printing statement */ @@ -327,13 +327,13 @@ print_all_file_labels, and print_all_file_descs for the common code. */ intn print_annots_in_file(int32 an_id, const char *fname, int32 n_annotations, ann_type annot_type) { - intn i; - int32 len; - char *annotation = NULL; - char *func_name = "print_annots_in_file"; - int32 ann_id = FAIL; - char *annot_type_text = "invalid"; /* "label" or "description" */ - intn ret_value = SUCCEED; + intn i; + int32 len; + char *annotation = NULL; + const char *func_name = "print_annots_in_file"; + int32 ann_id = FAIL; + const char *annot_type_text = "invalid"; /* "label" or "description" */ + intn ret_value = SUCCEED; /* validate annotation type before processing */ if (annot_type == AN_DATA_LABEL) diff --git a/mfhdf/dumper/hdp_sds.c b/mfhdf/dumper/hdp_sds.c index 411fdf1a1f..59492c39b0 100644 --- a/mfhdf/dumper/hdp_sds.c +++ b/mfhdf/dumper/hdp_sds.c @@ -22,8 +22,8 @@ intn have_szip = 1; #else intn have_szip = 0; #endif -#include "cszip.h" -#include "local_nc.h" /* to use some definitions */ +#include "cszip_priv.h" +#include "nc_priv.h" /* to use some definitions */ void dumpsds_usage(intn argc, char *argv[]) diff --git a/mfhdf/dumper/show.c b/mfhdf/dumper/show.c index 5e66f57481..9a3326b8ca 100644 --- a/mfhdf/dumper/show.c +++ b/mfhdf/dumper/show.c @@ -14,7 +14,8 @@ /* Modified from vshow.c by Eric Tsui, 12/25/1994. */ #include "hdp.h" -#include "vgint.h" + +#include "vg_priv.h" #define BUFFER 1000000 @@ -446,10 +447,15 @@ dumpattr(int32 vid, int32 findex, intn isvs, file_format_t ff, FILE *fp) uint8 *buf = NULL; uint8 *ptr = NULL; intn (*vfmtfn)(void *, file_format_t ff, FILE *); - intn status; - intn ret_value = SUCCEED; - char name[FIELDNAMELENMAX + 1]; - uint8 attrbuf[BUFFER]; + intn status; + intn ret_value = SUCCEED; + char name[FIELDNAMELENMAX + 1]; + uint8 *attrbuf = NULL; + + if (NULL == (attrbuf = (uint8 *)calloc(1, BUFFER))) { + ret_value = FAIL; + goto done; + } /* vdata or vgroup? */ if (isvs) @@ -603,6 +609,7 @@ dumpattr(int32 vid, int32 findex, intn isvs, file_format_t ff, FILE *fp) } /* for i */ done: + free(attrbuf); if (ret_value == FAIL) { /* Failure cleanup */ free(buf); } diff --git a/mfhdf/fortran/CMakeLists.txt b/mfhdf/fortran/CMakeLists.txt index 2c7be8d571..09185fe709 100644 --- a/mfhdf/fortran/CMakeLists.txt +++ b/mfhdf/fortran/CMakeLists.txt @@ -17,7 +17,6 @@ endif () set (HDF4_MFHDF_LIBSRC_CSTUB_FHDRS ${HDF4_MFHDFSOURCE_DIR}/hdf2netcdf.h ${HDF4_MFHDFSOURCE_DIR}/mfhdf.h - ${HDF4_MFHDFSOURCE_DIR}/mfhdfi.h ) if (HDF4_ENABLE_NETCDF) # set (HDF4_MFHDF_LIBSRC_CSTUB_FSRCS ${HDF4_MFHDF_LIBSRC_CSTUB_FSRCS} ${HDF4_BINARY_DIR}/jackets.c) @@ -32,7 +31,7 @@ set (FORTRAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) #----------------------------------------------------------------------------- # Add Main fortran library #----------------------------------------------------------------------------- -if (NOT ONLY_SHARED_LIBS) +if (BUILD_STATIC_LIBS) add_library (${HDF4_MF_FCSTUB_LIB_TARGET} STATIC ${HDF4_MFHDF_LIBSRC_CSTUB_FSRCS} ${HDF4_MFHDF_LIBSRC_CSTUB_FHDRS} ${HDF4_HDF_SRC_CHDRS} ${HDF4_HDFSOURCE_DIR}/hproto_fortran.h) target_include_directories(${HDF4_MF_FCSTUB_LIB_TARGET} PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR}" @@ -88,7 +87,7 @@ set (HDF4_MF_FORTRAN_SRCS ) set_source_files_properties (${HDF4_MF_FORTRAN_SRCS} PROPERTIES LANGUAGE Fortran) #----------------------------------------------------------------------------- -if (NOT ONLY_SHARED_LIBS) +if (BUILD_STATIC_LIBS) add_library (${HDF4_MF_FORTRAN_LIB_TARGET} STATIC ${HDF4_MF_FORTRAN_SRCS}) target_include_directories (${HDF4_MF_FORTRAN_LIB_TARGET} PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_MFHDF_FORTRAN_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_HDF_TESTSOURCE_DIR}" diff --git a/mfhdf/fortran/common.inc b/mfhdf/fortran/common.inc deleted file mode 100644 index 9f55f56ab1..0000000000 --- a/mfhdf/fortran/common.inc +++ /dev/null @@ -1,147 +0,0 @@ -c -c Functions in the FORTRAN interface - - integer nccre, ncopn, ncddef, ncdid, ncvdef, ncvid, nctlen - integer ncsfil - external nccre, ncopn, ncddef, ncdid, ncvdef, ncvid, nctlen - external ncsfil - - integer NCRDWR,NCCREAT,NCEXCL,NCINDEF,NCNSYNC,NCHSYNC - integer NCNDIRTY,NCHDIRTY,NCLINK,NCNOWRIT,NCWRITE - integer NCCLOB,NCNOCLOB,NCGLOBAL,NCFILL,NCNOFILL - integer MAXNCOP,MAXNCDIM,MAXNCATT,MAXNCVAR - integer MAXNCNAM,MAXVDIMS,NCNOERR,NCEBADID - integer NCENFILE,NCEEXIST,NCEINVAL,NCEPERM,NCENOTIN - integer NCEINDEF,NCECOORD,NCEMAXDS,NCENAME - integer NCENOATT,NCEMAXAT,NCEBADTY,NCEBADD, NCESTS - integer NCEUNLIM,NCEMAXVS,NCENOTVR,NCEGLOB,NCENOTNC - integer NCFOOBAR,NCSYSERR,NCFATAL,NCVERBOS, NCENTOOL - - integer NCBYTE,NCCHAR,NCSHORT,NCLONG,NCFLOAT,NCDOUBLE - - parameter(NCBYTE = 1) - parameter(NCCHAR = 2) - parameter(NCSHORT = 3) - parameter(NCLONG = 4) - parameter(NCFLOAT = 5) - parameter(NCDOUBLE = 6) - -c -c masks for the struct NC flag field; passed in as 'mode' arg to -c nccreate and ncopen. -c - -c read/write, 0 => readonly - parameter(NCRDWR = 1) -c in create phase, cleared by ncendef - parameter(NCCREAT = 2) -c on create destroy existing file - parameter(NCEXCL = 4) -c in define mode, cleared by ncendef - parameter(NCINDEF = 8) -c synchronise numrecs on change (X'10') - parameter(NCNSYNC = 16) -c synchronise whole header on change (X'20') - parameter(NCHSYNC = 32) -c numrecs has changed (X'40') - parameter(NCNDIRTY = 64) -c header info has changed (X'80') - parameter(NCHDIRTY = 128) -c prefill vars on endef and increase of record, the default behavior - parameter(NCFILL = 0) -c don't fill vars on endef and increase of record (X'100') - parameter(NCNOFILL = 256) -c isa link (X'8000') - parameter(NCLINK = 32768) - -c -c 'mode' arguments for nccreate and ncopen -c - - parameter(NCNOWRIT = 0) - parameter(NCWRITE = NCRDWR) - parameter(NCCLOB = 11) - parameter(NCNOCLOB = 15) -c -c 'size' argument to ncdimdef for an unlimited dimension -c - LONG_INT NCUNLIM - parameter(NCUNLIM = 0) - -c -c attribute id to put/get a global attribute -c - parameter(NCGLOBAL = 0) -c -c Advisory Maximums -c - parameter(MAXNCOP = 32) - parameter(MAXNCDIM = 32) - parameter(MAXNCATT = 512) - parameter(MAXNCVAR = 512) -c Not enforced - parameter(MAXNCNAM = 128) - parameter(MAXVDIMS = MAXNCDIM) - - -c -c The netcdf data types -c - -c -c Global netcdf error status variable -c Initialized in error.c -c - -c No Error - parameter(NCNOERR = 0) -c Not a netcdf id - parameter(NCEBADID = 1) -c Too many netcdfs open - parameter(NCENFILE = 2) -c netcdf file exists && NCNOCLOB - parameter(NCEEXIST = 3) -c Invalid Argument - parameter(NCEINVAL = 4) -c Write to read only - parameter(NCEPERM = 5) -c Operation not allowed in data mode - parameter(NCENOTIN = 6) -c Operation not allowed in define mode - parameter(NCEINDEF = 7) -c Coordinates out of Domain - parameter(NCECOORD = 8) -c MAXNCDIMS exceeded - parameter(NCEMAXDS = 9) -c String match to name in use - parameter(NCENAME = 10) -c Attribute not found - parameter(NCENOATT = 11) -c MAXNCATTRS exceeded - parameter(NCEMAXAT = 12) -c Not a netcdf data type - parameter(NCEBADTY = 13) -c Invalid dimension id - parameter(NCEBADD = 14) -c NCUNLIMITED in the wrong index - parameter(NCEUNLIM = 15) -c MAXNCVARS exceeded - parameter(NCEMAXVS = 16) -c Variable not found - parameter(NCENOTVR = 17) -c Action prohibited on NCGLOBAL varid - parameter(NCEGLOB = 18) -c Not a netcdf file - parameter(NCENOTNC = 19) - parameter(NCESTS = 20) - parameter (NCENTOOL = 21) - parameter(NCFOOBAR = 32) - parameter(NCSYSERR = -1) - - -c -c Global options variable. Used to determine behavior of error handler. -c Initialized in lerror.c -c - parameter(NCFATAL = 1) - parameter(NCVERBOS = 2) diff --git a/mfhdf/fortran/jackets.c.in b/mfhdf/fortran/jackets.c.in index f03c23c448..f5afdd80a3 100644 --- a/mfhdf/fortran/jackets.c.in +++ b/mfhdf/fortran/jackets.c.in @@ -14,11 +14,12 @@ * */ -#include -#include -#include -#include -#include "local_nc.h" +#include +#include +#include +#include + +#include "nc_priv.h" #if !NC_OLD_FILLVALUES diff --git a/mfhdf/fortran/mfsdf.c b/mfhdf/fortran/mfsdf.c index d2c5abab6e..6359be5d12 100644 --- a/mfhdf/fortran/mfsdf.c +++ b/mfhdf/fortran/mfsdf.c @@ -18,6 +18,9 @@ The basic routines called by fortran will be of the form sfxxxx */ + +#include + #include "mfsdf.h" intf nsfscfill(intf *id, _fcd val); diff --git a/mfhdf/hdfimport/CMakeLists.txt b/mfhdf/hdfimport/CMakeLists.txt index 601a6718f6..6ce4d120bd 100644 --- a/mfhdf/hdfimport/CMakeLists.txt +++ b/mfhdf/hdfimport/CMakeLists.txt @@ -9,27 +9,19 @@ set (hdfimport_SRCS ${HDF4_MFHDF_HDFIMPORT_SOURCE_DIR}/hdfimport.c ) -if (NOT ONLY_SHARED_LIBS) - add_executable (hdfimport ${hdfimport_SRCS}) - target_include_directories(hdfimport PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR}") +add_executable (hdfimport ${hdfimport_SRCS}) +target_include_directories(hdfimport PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR}") +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdfimport STATIC) target_link_libraries (hdfimport PRIVATE ${HDF4_MF_LIB_TARGET}) - set_target_properties (hdfimport PROPERTIES COMPILE_DEFINITIONS "HDF") - set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdfimport") - - set (H4_DEP_EXECUTABLES hdfimport) +else () + TARGET_C_PROPERTIES (hdfimport SHARED) + target_link_libraries (hdfimport PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () +set_target_properties (hdfimport PROPERTIES COMPILE_DEFINITIONS "HDF") +set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdfimport") -if (BUILD_SHARED_LIBS) - add_executable (hdfimport-shared ${hdfimport_SRCS}) - target_include_directories(hdfimport-shared PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdfimport-shared SHARED) - target_link_libraries (hdfimport-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set_target_properties (hdfimport-shared PROPERTIES COMPILE_DEFINITIONS "HDF") - set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdfimport-shared") - - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} hdfimport-shared) -endif () +set (H4_DEP_EXECUTABLES hdfimport) if (BUILD_TESTING) include (CMakeTests.cmake) diff --git a/mfhdf/hdfimport/CMakeTests.cmake b/mfhdf/hdfimport/CMakeTests.cmake index 1d36cf0695..de1a357328 100644 --- a/mfhdf/hdfimport/CMakeTests.cmake +++ b/mfhdf/hdfimport/CMakeTests.cmake @@ -57,7 +57,7 @@ set (hdfimporttest_SRCS add_executable (hdfimporttest ${hdfimporttest_SRCS}) target_include_directories(hdfimporttest PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_BINARY_DIR}") -if (NOT ONLY_SHARED_LIBS) +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdfimporttest STATIC) target_link_libraries (hdfimporttest PRIVATE ${HDF4_MF_LIB_TARGET}) else () @@ -72,7 +72,7 @@ set (gen_sds_floats_SRCS add_executable (gen_sds_floats ${gen_sds_floats_SRCS}) target_include_directories(gen_sds_floats PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_BINARY_DIR}") -if (NOT ONLY_SHARED_LIBS) +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (gen_sds_floats STATIC) target_link_libraries (gen_sds_floats PRIVATE ${HDF4_MF_LIB_TARGET}) else () @@ -89,7 +89,7 @@ endif () if (NOT BUILD_SHARED_LIBS) set (tgt_ext "") else () - set (tgt_ext "-shared") + set (tgt_ext "") endif () macro (ADD_H4_TEST resultfile resultcode testtfile testtype) diff --git a/mfhdf/hdfimport/hdfimport.c b/mfhdf/hdfimport/hdfimport.c index 5082ff5e2a..389e742ff9 100644 --- a/mfhdf/hdfimport/hdfimport.c +++ b/mfhdf/hdfimport/hdfimport.c @@ -177,7 +177,7 @@ #include #include "hdf.h" -#include "hfile.h" +#include "hfile_priv.h" #include "mfhdf.h" #ifdef H4_HAVE_SYS_STAT_H @@ -1731,13 +1731,15 @@ gtype(char *infile, struct Input *in, FILE **strm) else { if (!memcmp("FP64", buf, 4) || !memcmp("fp64", buf, 4)) { in->is_fp64 = TRUE; - if (in->outtype != FP_64) + if (in->outtype != FP_64) { if (in->outtype != NO_NE) { fprintf(stderr, err4, infile); goto err; } - else + else { in->outtype = FP_32; + } + } } else { if (in->outtype != NO_NE) { diff --git a/mfhdf/hdfimport/hdfimporttest.c b/mfhdf/hdfimport/hdfimporttest.c index 2b113296df..51ff742492 100644 --- a/mfhdf/hdfimport/hdfimporttest.c +++ b/mfhdf/hdfimport/hdfimporttest.c @@ -171,91 +171,91 @@ main(void) */ sp = fopen("ctxtr2", "w"); - (void)fprintf(sp, "%s\n", text); - (void)fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); - (void)fprintf(sp, "%14.6E%14.6E\n", (double)ezero, (double)ezero); + fprintf(sp, "%s\n", text); + fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); + fprintf(sp, "%14.6E%14.6E\n", (double)ezero, (double)ezero); for (i = 0; i < nrow; i++) - (void)fprintf(sp, "%14.6E", (double)row4[i]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", (double)row4[i]); + fprintf(sp, "\n"); for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%14.6E", (double)col4[j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", (double)col4[j]); + fprintf(sp, "\n"); for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%14.6E", (double)b32r2[i][j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", (double)b32r2[i][j]); + fprintf(sp, "\n"); } (void)fclose(sp); sp = fopen("ctxti2", "w"); - (void)fprintf(sp, "%s\n", text); - (void)fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); - (void)fprintf(sp, "%10d%10d\n", ezeroi, ezeroi); + fprintf(sp, "%s\n", text); + fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); + fprintf(sp, "%10d%10d\n", ezeroi, ezeroi); for (i = 0; i < nrow; i++) - (void)fprintf(sp, "%10d", row4i[i]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10d", row4i[i]); + fprintf(sp, "\n"); for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%10d", col4i[j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10d", col4i[j]); + fprintf(sp, "\n"); for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%10d", b32i2[i][j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10d", b32i2[i][j]); + fprintf(sp, "\n"); } (void)fclose(sp); sp = fopen("ctxti162", "w"); - (void)fprintf(sp, "%s\n", text); - (void)fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); - (void)fprintf(sp, "%10u%10u\n", ezeroi16, ezeroi16); + fprintf(sp, "%s\n", text); + fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); + fprintf(sp, "%10u%10u\n", ezeroi16, ezeroi16); for (i = 0; i < nrow; i++) - (void)fprintf(sp, "%10u", row4i16[i]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10u", row4i16[i]); + fprintf(sp, "\n"); for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%10u", col4i16[j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10u", col4i16[j]); + fprintf(sp, "\n"); for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%10u", b16i2[i][j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10u", b16i2[i][j]); + fprintf(sp, "\n"); } (void)fclose(sp); sp = fopen("ctxti82", "w"); - (void)fprintf(sp, "%s\n", text); - (void)fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); - (void)fprintf(sp, "%10c%10c\n", ezeroi8, ezeroi8); + fprintf(sp, "%s\n", text); + fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); + fprintf(sp, "%10c%10c\n", ezeroi8, ezeroi8); for (i = 0; i < nrow; i++) - (void)fprintf(sp, "%10c", row4i8[i]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10c", row4i8[i]); + fprintf(sp, "\n"); for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%10c", col4i8[j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10c", col4i8[j]); + fprintf(sp, "\n"); for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%10c", b8i2[i][j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10c", b8i2[i][j]); + fprintf(sp, "\n"); } (void)fclose(sp); sp = fopen("ctxtr3", "w"); - (void)fprintf(sp, "%s\n", text); - (void)fprintf(sp, "%10d%10d%10d\n", npln, nrow, ncol); - (void)fprintf(sp, "%14.6E%14.6E\n", (double)ezero, (double)ezero); + fprintf(sp, "%s\n", text); + fprintf(sp, "%10d%10d%10d\n", npln, nrow, ncol); + fprintf(sp, "%14.6E%14.6E\n", (double)ezero, (double)ezero); for (k = 0; k < npln; k++) - (void)fprintf(sp, "%14.6E", (double)pln4[k]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", (double)pln4[k]); + fprintf(sp, "\n"); for (i = 0; i < nrow; i++) - (void)fprintf(sp, "%14.6E", (double)row4[i]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", (double)row4[i]); + fprintf(sp, "\n"); for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%14.6E", (double)col4[j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", (double)col4[j]); + fprintf(sp, "\n"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%14.6E", (double)b32r3[k][i][j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", (double)b32r3[k][i][j]); + fprintf(sp, "\n"); } (void)fclose(sp); diff --git a/mfhdf/hdiff/CMakeLists.txt b/mfhdf/hdiff/CMakeLists.txt index 297351606f..bc0f53d797 100644 --- a/mfhdf/hdiff/CMakeLists.txt +++ b/mfhdf/hdiff/CMakeLists.txt @@ -21,25 +21,18 @@ set (hdiff_SRCS ${HDF4_MFHDF_UTIL_DIR}/h4getopt.c ) -if (NOT ONLY_SHARED_LIBS) - add_executable(hdiff ${hdiff_SRCS}) - target_include_directories(hdiff PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR};${HDF4_MFHDF_UTIL_DIR}") +add_executable(hdiff ${hdiff_SRCS}) +target_include_directories(hdiff PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR};${HDF4_MFHDF_UTIL_DIR}") +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdiff STATIC) target_link_libraries(hdiff PRIVATE ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS}) - set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdiff") - - set (H4_DEP_EXECUTABLES hdiff) +else () + TARGET_C_PROPERTIES (hdiff SHARED) + target_link_libraries(hdiff PRIVATE ${HDF4_MF_LIBSH_TARGET} ${HDF4_SRC_LIBSH_TARGET} ${LINK_LIBS}) endif () +set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdiff") -if (BUILD_SHARED_LIBS) - add_executable(hdiff-shared ${hdiff_SRCS}) - target_include_directories(hdiff-shared PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR};${HDF4_MFHDF_UTIL_DIR}") - TARGET_C_PROPERTIES (hdiff-shared SHARED) - target_link_libraries(hdiff-shared PRIVATE ${HDF4_MF_LIBSH_TARGET} ${HDF4_SRC_LIBSH_TARGET} ${LINK_LIBS}) - set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdiff-shared") - - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} hdiff-shared) -endif () +set (H4_DEP_EXECUTABLES hdiff) if (BUILD_TESTING) include (CMakeTests.cmake) diff --git a/mfhdf/hdiff/CMakeTests.cmake b/mfhdf/hdiff/CMakeTests.cmake index 5f7ccd2481..0494537229 100644 --- a/mfhdf/hdiff/CMakeTests.cmake +++ b/mfhdf/hdiff/CMakeTests.cmake @@ -46,7 +46,7 @@ endif () if (NOT BUILD_SHARED_LIBS) set (tgt_ext "") else () - set (tgt_ext "-shared") + set (tgt_ext "") endif () macro (ADD_H4_TEST resultfile resultcode) diff --git a/mfhdf/hdiff/hdiff.h b/mfhdf/hdiff/hdiff.h index d2db7ce1ea..07a9949d74 100644 --- a/mfhdf/hdiff/hdiff.h +++ b/mfhdf/hdiff/hdiff.h @@ -11,8 +11,6 @@ #include "mfhdf.h" #include "hdiff_table.h" -#define Printf (void)printf - /* Maximum value for max_err_cnt */ #define MAX_DIFF 0x7FFFFFFF diff --git a/mfhdf/hdiff/hdiff_array.c b/mfhdf/hdiff/hdiff_array.c index dff1b9d5a5..4d75f70e76 100644 --- a/mfhdf/hdiff/hdiff_array.c +++ b/mfhdf/hdiff/hdiff_array.c @@ -20,10 +20,11 @@ #include #include #include + #include "hdf.h" #include "mfhdf.h" #include "hdiff.h" -#include "vgint.h" +#include "vg_priv.h" #ifndef ABS #define ABS(a) (((a) >= 0) ? (a) : -(a)) diff --git a/mfhdf/hdiff/hdiff_main.c b/mfhdf/hdiff/hdiff_main.c index 34b23e79cb..8540bb0620 100644 --- a/mfhdf/hdiff/hdiff_main.c +++ b/mfhdf/hdiff/hdiff_main.c @@ -19,7 +19,7 @@ #include "h4getopt.h" #include "hdf.h" -#include "hfile.h" +#include "hfile_priv.h" #include "mfhdf.h" #include "hdiff.h" @@ -45,8 +45,8 @@ static void usage() { - (void)fprintf(stdout, "hdiff [-V] [-b] [-g] [-s] [-d] [-D] [-S] [-v var1[,...]] [-u var1[,...]] [-e " - "count] [-t limit] [-p relative] file1 file2\n"); + fprintf(stdout, "hdiff [-V] [-b] [-g] [-s] [-d] [-D] [-S] [-v var1[,...]] [-u var1[,...]] [-e " + "count] [-t limit] [-p relative] file1 file2\n"); fprintf(stdout, " [-V] Display version of the HDF4 library and exit\n"); fprintf(stdout, " [-b] Verbose mode\n"); fprintf(stdout, " [-g] Compare global attributes only\n"); diff --git a/mfhdf/hdiff/hdiff_misc.c b/mfhdf/hdiff/hdiff_misc.c index 0d17379b44..dd48d1ddf9 100644 --- a/mfhdf/hdiff/hdiff_misc.c +++ b/mfhdf/hdiff/hdiff_misc.c @@ -123,21 +123,21 @@ pr_att_vals(nc_type type, int len, void *vals) char *sp; unsigned char uc; char gps[30]; /* for ascii of a float or double precision */ - char *f_fmt = "%#.8g"; - char *d_fmt = "%#.16g"; + const char *f_fmt = "%#.8g"; + const char *d_fmt = "%#.16g"; switch (type) { case DFNT_INT8: gp.cp = (char *)vals; for (iel = 0; iel < len; iel++) if (isprint(uc = *gp.cp++ & 0377)) - Printf("'%c'%s", uc, iel < len - 1 ? ", " : ""); + printf("'%c'%s", uc, iel < len - 1 ? ", " : ""); else - Printf("'\\%o'%s", uc, iel < len - 1 ? ", " : ""); + printf("'\\%o'%s", uc, iel < len - 1 ? ", " : ""); break; case DFNT_CHAR: gp.cp = (char *)vals; - Printf("\""); + printf("\""); /* adjust len so trailing nulls don't get printed */ sp = gp.cp + len - 1; while (*sp-- == '\0' && len > 0) @@ -145,47 +145,47 @@ pr_att_vals(nc_type type, int len, void *vals) for (iel = 0; iel < len; iel++) switch (uc = *gp.cp++ & 0377) { case '\b': - Printf("\\b"); + printf("\\b"); break; case '\f': - Printf("\\f"); + printf("\\f"); break; case '\n': /* generate linebreaks after new-lines */ - Printf("\\n\",\n \""); + printf("\\n\",\n \""); break; case '\r': - Printf("\\r"); + printf("\\r"); break; case '\t': - Printf("\\t"); + printf("\\t"); break; case '\v': - Printf("\\v"); + printf("\\v"); break; case '\\': - Printf("\\\\"); + printf("\\\\"); break; case '\'': - Printf("\\'"); + printf("\\'"); break; case '\"': - Printf("\\\""); + printf("\\\""); break; default: - Printf("%c", uc); + printf("%c", uc); break; } - Printf("\""); + printf("\""); break; case DFNT_INT16: gp.sp = (int16 *)vals; for (iel = 0; iel < len; iel++) - Printf("%ds%s", *gp.sp++, iel < len - 1 ? ", " : ""); + printf("%ds%s", *gp.sp++, iel < len - 1 ? ", " : ""); break; case DFNT_INT32: gp.lp = (int32 *)vals; for (iel = 0; iel < len; iel++) - Printf("%d%s", *gp.lp++, iel < len - 1 ? ", " : ""); + printf("%d%s", *gp.lp++, iel < len - 1 ? ", " : ""); break; case DFNT_FLOAT: gp.fp = (float32 *)vals; @@ -197,7 +197,7 @@ pr_att_vals(nc_type type, int len, void *vals) gps[ll + 1] = '\0'; gps[ll] = 'f'; tztrim(gps); /* trim trailing 0's after '.' */ - Printf("%s%s", gps, iel < len - 1 ? ", " : ""); + printf("%s%s", gps, iel < len - 1 ? ", " : ""); } break; case DFNT_DOUBLE: @@ -205,7 +205,7 @@ pr_att_vals(nc_type type, int len, void *vals) for (iel = 0; iel < len; iel++) { (void)sprintf(gps, d_fmt, *gp.dp++); tztrim(gps); /* trim trailing 0's after '.' */ - Printf("%s%s", gps, iel < len - 1 ? ", " : ""); + printf("%s%s", gps, iel < len - 1 ? ", " : ""); } break; default: diff --git a/mfhdf/hdiff/hdiff_vs.c b/mfhdf/hdiff/hdiff_vs.c index 1cc834d8b4..80e4e13217 100644 --- a/mfhdf/hdiff/hdiff_vs.c +++ b/mfhdf/hdiff/hdiff_vs.c @@ -15,7 +15,7 @@ #include "hdiff_list.h" #include "hdiff_mattbl.h" -#include "vgint.h" +#include "vg_priv.h" static void fmt_print(uint8 *x, int32 type); static uint32 vdata_cmp(int32 vs1, int32 vs2, char *gname, char *cname, diff_opt_t *opt); diff --git a/mfhdf/hrepack/CMakeLists.txt b/mfhdf/hrepack/CMakeLists.txt index dc7610b7d8..9cb6e0d1be 100644 --- a/mfhdf/hrepack/CMakeLists.txt +++ b/mfhdf/hrepack/CMakeLists.txt @@ -19,39 +19,30 @@ set (hrepack_SRCS ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_dim.c ) -if (NOT ONLY_SHARED_LIBS) - add_executable (hrepack ${hrepack_SRCS}) - target_include_directories(hrepack PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") +add_executable (hrepack ${hrepack_SRCS}) +target_include_directories(hrepack PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hrepack STATIC) target_link_libraries (hrepack PRIVATE ${HDF4_MF_LIB_TARGET} ${LINK_COMP_LIBS}) - set_target_properties (hrepack PROPERTIES COMPILE_DEFINITIONS "HDF") - set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hrepack") +else () + TARGET_C_PROPERTIES (hrepack SHARED) + target_link_libraries (hrepack PRIVATE ${HDF4_MF_LIBSH_TARGET} ${LINK_COMP_LIBS}) +endif () +set_target_properties (hrepack PROPERTIES COMPILE_DEFINITIONS "HDF") +set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hrepack") - add_executable (hrepack_check ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_check.c) - target_include_directories(hrepack_check PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") +add_executable (hrepack_check ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_check.c) +target_include_directories(hrepack_check PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hrepack_check STATIC) target_link_libraries (hrepack_check PRIVATE ${HDF4_MF_LIB_TARGET}) - set_target_properties (hrepack_check PROPERTIES COMPILE_DEFINITIONS "HDF") - - set (H4_DEP_EXECUTABLES hrepack) +else () + TARGET_C_PROPERTIES (hrepack_check SHARED) + target_link_libraries (hrepack_check PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () +set_target_properties (hrepack_check PROPERTIES COMPILE_DEFINITIONS "HDF") -if (BUILD_SHARED_LIBS) - add_executable (hrepack-shared ${hrepack_SRCS}) - target_include_directories(hrepack-shared PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hrepack-shared SHARED) - target_link_libraries (hrepack-shared PRIVATE ${HDF4_MF_LIBSH_TARGET} ${LINK_COMP_LIBS}) - set_target_properties (hrepack-shared PROPERTIES COMPILE_DEFINITIONS "HDF") - set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hrepack-shared") - - add_executable (hrepack_check-shared ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_check.c) - target_include_directories(hrepack_check-shared PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hrepack_check-shared SHARED) - target_link_libraries (hrepack_check-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set_target_properties (hrepack_check-shared PROPERTIES COMPILE_DEFINITIONS "HDF") - - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} hrepack-shared) -endif () +set (H4_DEP_EXECUTABLES hrepack) if (BUILD_TESTING) include (CMakeTests.cmake) diff --git a/mfhdf/hrepack/CMakeTests.cmake b/mfhdf/hrepack/CMakeTests.cmake index 48e1afd6f3..eec82e3ae0 100644 --- a/mfhdf/hrepack/CMakeTests.cmake +++ b/mfhdf/hrepack/CMakeTests.cmake @@ -34,7 +34,7 @@ endif () if (NOT BUILD_SHARED_LIBS) set (tgt_ext "") else () - set (tgt_ext "-shared") + set (tgt_ext "") endif () macro (ADD_H4_TEST testname testtype testfile) diff --git a/mfhdf/hrepack/hrepack_gr.c b/mfhdf/hrepack/hrepack_gr.c index 321e729f8d..11579f2b48 100644 --- a/mfhdf/hrepack/hrepack_gr.c +++ b/mfhdf/hrepack/hrepack_gr.c @@ -82,10 +82,10 @@ copy_gr(int32 infile_id, int32 outfile_id, int32 gr_in, int32 gr_out, int32 tag, eltsz, /* element size */ nelms, /* number of elements */ data_size; - void *buf = NULL; - uint8 pal_data[256 * 3]; - int can_compress = 1; /* flag to tell if a compression is supported */ - char *pal_path = "palette"; + void *buf = NULL; + uint8 pal_data[256 * 3]; + int can_compress = 1; /* flag to tell if a compression is supported */ + const char *pal_path = "palette"; ri_index = GRreftoindex(gr_in, (uint16)ref); ri_id = GRselect(gr_in, ri_index); diff --git a/mfhdf/hrepack/hrepack_main.c b/mfhdf/hrepack/hrepack_main.c index 56dfa589b5..c55b9351b7 100644 --- a/mfhdf/hrepack/hrepack_main.c +++ b/mfhdf/hrepack/hrepack_main.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "hdf.h" -#include "hfile.h" +#include "hfile_priv.h" #include "mfhdf.h" #include "hrepack.h" #include "hrepack_parse.h" diff --git a/mfhdf/libsrc/CMakeLists.txt b/mfhdf/libsrc/CMakeLists.txt index b3bf90d17d..56dc6539d1 100644 --- a/mfhdf/libsrc/CMakeLists.txt +++ b/mfhdf/libsrc/CMakeLists.txt @@ -5,7 +5,7 @@ project (HDF4_MFHDF_LIBSRC C) # Generate the netcdf.h file containing user settings needed by compilation #----------------------------------------------------------------------------- if (WIN32) - set (H4_WINDOWS_INCLUDE_FILE "#include ") + set (H4_WINDOWS_INCLUDE_FILE "#include ") set (NETCDF_EXTERN HDFLIBAPI) else () set (NETCDF_EXTERN extern) @@ -35,18 +35,17 @@ set (HDF4_MFHDF_LIBSRC_CSRCS ) set (HDF4_MFHDF_LIBSRC_INSTALL_CHDRS - ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/local_nc.h - ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfhdf.h - ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfhdfi.h - ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfdatainfo.h ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/hdf2netcdf.h + ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfdatainfo.h + ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfhdf.h ) set (HDF4_MFHDF_LIBSRC_CHDRS ${HDF4_MFHDF_LIBSRC_INSTALL_CHDRS} - ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/error.h - ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfprivate.h - ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/h4_xdr.h + ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/error_priv.h + ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/h4_xdr_priv.h + ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mf_priv.h + ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/nc_priv.h ) if (HDF4_ENABLE_NETCDF) @@ -57,7 +56,7 @@ else () set (HDF4_MFHDF_LIBSRC_XCHDRS ${HDF4_BINARY_DIR}/hdf4_netcdf.h) endif () -if (NOT ONLY_SHARED_LIBS) +if (BUILD_STATIC_LIBS) add_library (${HDF4_MF_LIB_TARGET} STATIC ${HDF4_MFHDF_LIBSRC_CSRCS} ${HDF4_MFHDF_LIBSRC_CHDRS}) target_include_directories (${HDF4_MF_LIB_TARGET} PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES}" @@ -126,7 +125,7 @@ install ( if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF4_MF_LIBSH_TARGET} ${HDF4_INSTALL_BIN_DIR} libraries) endif () -if (NOT ONLY_SHARED_LIBS) +if (BUILD_STATIC_LIBS) INSTALL_TARGET_PDB (${HDF4_MF_LIB_TARGET} ${HDF4_INSTALL_LIB_DIR} libraries) endif () diff --git a/mfhdf/libsrc/Makefile.am b/mfhdf/libsrc/Makefile.am index 64862de8a5..ffef141c44 100644 --- a/mfhdf/libsrc/Makefile.am +++ b/mfhdf/libsrc/Makefile.am @@ -36,10 +36,9 @@ endif libmfhdf_la_LIBADD = $(top_builddir)/hdf/src/libdf.la if HDF_BUILD_NETCDF -include_HEADERS = hdf2netcdf.h local_nc.h mfhdf.h netcdf.h mfhdfi.h mfdatainfo.h +include_HEADERS = hdf2netcdf.h mfhdf.h netcdf.h mfdatainfo.h else -include_HEADERS = hdf2netcdf.h local_nc.h mfhdf.h hdf4_netcdf.h mfhdfi.h mfdatainfo.h -# mfdatainfo.h should be added conditionally only; should local_nc.h even be here? -BMR +include_HEADERS = hdf2netcdf.h mfhdf.h hdf4_netcdf.h mfdatainfo.h endif # The following is a workaround. Since Fortran is included in this diff --git a/mfhdf/libsrc/array.c b/mfhdf/libsrc/array.c index f821696965..5b7b105548 100644 --- a/mfhdf/libsrc/array.c +++ b/mfhdf/libsrc/array.c @@ -14,7 +14,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" +#include "nc_priv.h" /* * for a netcdf type diff --git a/mfhdf/libsrc/attr.c b/mfhdf/libsrc/attr.c index 762af6a562..5f3ddb9db4 100644 --- a/mfhdf/libsrc/attr.c +++ b/mfhdf/libsrc/attr.c @@ -14,7 +14,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" +#include "nc_priv.h" NC_attr * NC_new_attr(const char *name, nc_type type, unsigned count, const void *values) diff --git a/mfhdf/libsrc/cdf.c b/mfhdf/libsrc/cdf.c index b19edc59d5..595f7d9739 100644 --- a/mfhdf/libsrc/cdf.c +++ b/mfhdf/libsrc/cdf.c @@ -14,10 +14,10 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" -#include "herr.h" +#include "nc_priv.h" +#include "herr_priv.h" -#include "hfile.h" +#include "hfile_priv.h" int32 hdf_get_magicnum(const char *filename); diff --git a/mfhdf/libsrc/dim.c b/mfhdf/libsrc/dim.c index 73bc28794b..08ca191f66 100644 --- a/mfhdf/libsrc/dim.c +++ b/mfhdf/libsrc/dim.c @@ -14,7 +14,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" +#include "nc_priv.h" NC_dim * NC_new_dim(const char *name, long size) diff --git a/mfhdf/libsrc/error.c b/mfhdf/libsrc/error.c index 3b57466072..1e910c8e3e 100644 --- a/mfhdf/libsrc/error.c +++ b/mfhdf/libsrc/error.c @@ -22,7 +22,7 @@ #include #include -#include "local_nc.h" +#include "nc_priv.h" /* * Log SYSTEM errors diff --git a/mfhdf/libsrc/error.h b/mfhdf/libsrc/error_priv.h similarity index 100% rename from mfhdf/libsrc/error.h rename to mfhdf/libsrc/error_priv.h diff --git a/mfhdf/libsrc/file.c b/mfhdf/libsrc/file.c index d7a8d4766e..a2cf72074e 100644 --- a/mfhdf/libsrc/file.c +++ b/mfhdf/libsrc/file.c @@ -16,8 +16,8 @@ #include -#include "local_nc.h" -#include "herr.h" +#include "nc_priv.h" +#include "herr_priv.h" #if defined H4_HAVE_WIN32_API && !defined __MINGW32__ typedef int pid_t; diff --git a/mfhdf/libsrc/globdef.c b/mfhdf/libsrc/globdef.c index 49884fbf76..8a55f3d40d 100644 --- a/mfhdf/libsrc/globdef.c +++ b/mfhdf/libsrc/globdef.c @@ -19,7 +19,7 @@ * to allow the creation of SunOS sharable-libraries. */ -#include "local_nc.h" +#include "nc_priv.h" #ifdef H4_HAVE_NETCDF #include "netcdf.h" diff --git a/mfhdf/libsrc/h4_xdr.c b/mfhdf/libsrc/h4_xdr.c index 689a44ba2b..14bf7cc69c 100644 --- a/mfhdf/libsrc/h4_xdr.c +++ b/mfhdf/libsrc/h4_xdr.c @@ -36,14 +36,14 @@ * xdr. */ -#include "local_nc.h" +#include "nc_priv.h" /* Which header files include htonl() ? */ #ifdef H4_HAVE_WIN32_API /* Use winsock on Win32 (including MinGW) * - * This is included in hdfi.h to ensure winsock2.h is included before + * This is included in hdf_priv.h to ensure winsock2.h is included before * windows.h. */ #else @@ -56,7 +56,7 @@ #endif #endif -#include "h4_xdr.h" +#include "h4_xdr_priv.h" /* * This is the number of bytes per unit of external data. diff --git a/mfhdf/libsrc/h4_xdr.h b/mfhdf/libsrc/h4_xdr_priv.h similarity index 97% rename from mfhdf/libsrc/h4_xdr.h rename to mfhdf/libsrc/h4_xdr_priv.h index 1ea2cf27ba..1c8a1b2aca 100644 --- a/mfhdf/libsrc/h4_xdr.h +++ b/mfhdf/libsrc/h4_xdr_priv.h @@ -32,10 +32,10 @@ * Copyright (C) 1984, Sun Microsystems, Inc. */ -#ifndef H4_XDR_H -#define H4_XDR_H +#ifndef H4_XDR_PRIV_H +#define H4_XDR_PRIV_H -#include "local_nc.h" +#include "nc_priv.h" /* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE * @@ -120,4 +120,4 @@ HDFLIBAPI void h4_xdr_setup_nofile(XDR *xdrs, int ncop); } #endif -#endif /* H4_XDR_H */ +#endif /* H4_XDR_PRIV_H */ diff --git a/mfhdf/libsrc/hdfsds.c b/mfhdf/libsrc/hdfsds.c index 3f17bd6784..5a5cf8847e 100644 --- a/mfhdf/libsrc/hdfsds.c +++ b/mfhdf/libsrc/hdfsds.c @@ -72,7 +72,7 @@ **************************************************************************/ -#include "local_nc.h" +#include "nc_priv.h" #define SDG_MAX_INITIAL 100 diff --git a/mfhdf/libsrc/iarray.c b/mfhdf/libsrc/iarray.c index 8d20ba81b8..aee9700b90 100644 --- a/mfhdf/libsrc/iarray.c +++ b/mfhdf/libsrc/iarray.c @@ -14,7 +14,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" +#include "nc_priv.h" /* values: VAX C doesn't like values[] */ NC_iarray * diff --git a/mfhdf/libsrc/mfprivate.h b/mfhdf/libsrc/mf_priv.h similarity index 93% rename from mfhdf/libsrc/mfprivate.h rename to mfhdf/libsrc/mf_priv.h index c1b0d0325b..22cf0f506d 100644 --- a/mfhdf/libsrc/mfprivate.h +++ b/mfhdf/libsrc/mf_priv.h @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /****************************************************************************** -file - mfprivate.h +file - mf_priv.h This file contains prototypes of private functions that are implemented in mfsd.c. Some of them are used by new functions in mfdatainfo.c. @@ -19,13 +19,12 @@ file - mfprivate.h separately from the rest of the API. These functions were introduced by the hmap project. - Aug 8, 2010 -BMR ******************************************************************************/ -#ifndef MFH4_MFPRIVATE_H -#define MFH4_MFPRIVATE_H +#ifndef MFH4_MF_PRIV_H +#define MFH4_MF_PRIV_H -#include "local_nc.h" +#include "nc_priv.h" /* Get the dimension record */ NC_dim *SDIget_dim(NC *handle, int32 id); @@ -51,4 +50,4 @@ intn SDIapfromid(int32 id, NC **handlep, NC_array ***app); /* Check permission on the file */ int SDI_can_clobber(const char *name); -#endif /* MFH4_MFPRIVATE_H */ +#endif /* MFH4_MF_PRIV_H */ diff --git a/mfhdf/libsrc/mfdatainfo.c b/mfhdf/libsrc/mfdatainfo.c index fb51ebe829..2b8bd84186 100644 --- a/mfhdf/libsrc/mfdatainfo.c +++ b/mfhdf/libsrc/mfdatainfo.c @@ -41,7 +41,7 @@ LOCAL ROUTINES ******************************************************************************/ -#include "local_nc.h" +#include "nc_priv.h" #ifndef DATAINFO_MASTER #define DATAINFO_MASTER @@ -58,7 +58,7 @@ LOCAL ROUTINES #ifdef MFSD_INTERNAL /* Local function prototypes */ -#include "mfprivate.h" +#include "mf_priv.h" #endif static intn get_attr_tag(char *attr_name, uint16 *attr_tag); diff --git a/mfhdf/libsrc/mfhdf.h b/mfhdf/libsrc/mfhdf.h index 192426e2d9..c918dd2635 100644 --- a/mfhdf/libsrc/mfhdf.h +++ b/mfhdf/libsrc/mfhdf.h @@ -29,8 +29,6 @@ #include "hdf4_netcdf.h" #endif -#include "mfhdfi.h" - #define SD_UNLIMITED NC_UNLIMITED /* use this as marker for unlimited dimension */ #define SD_NOFILL NC_NOFILL #define SD_FILL NC_FILL @@ -38,6 +36,17 @@ #define SD_DIMVAL_BW_INCOMP 0 #define SD_RAGGED -1 /* marker for ragged dimension */ +/* enumerated type used to specify whether a variable is an SDS, coordinate + * variable, or its type is unknown because it was created before HDF4.2r2 + * + * NOTE: Formerly in mfhdfi.h + */ +typedef enum { + IS_SDSVAR = 0, /* variable is an actual SDS */ + IS_CRDVAR = 1, /* variable is a coordinate variable */ + UNKNOWN = 2 /* variable is created before HDF4.2r2, unknown type */ +} hdf_vartype_t; + /* used to indicate the type of the variable at an index */ typedef struct hdf_varlist { int32 var_index; /* index of the current variable */ diff --git a/mfhdf/libsrc/mfsd.c b/mfhdf/libsrc/mfsd.c index efa7cc5be1..4ac005077a 100644 --- a/mfhdf/libsrc/mfsd.c +++ b/mfhdf/libsrc/mfsd.c @@ -83,10 +83,10 @@ NOTE: This file needs to have the comments cleaned up for most of the ******************************************************************************/ -#include "local_nc.h" +#include "nc_priv.h" #include "mfhdf.h" -#include "hfile.h" +#include "hfile_priv.h" #ifdef H4_HAVE_LIBSZ /* we have the szip library */ #include "szlib.h" @@ -101,7 +101,7 @@ NOTE: This file needs to have the comments cleaned up for most of the #ifdef MFSD_INTERNAL /* Private function prototypes */ -#include "mfprivate.h" +#include "mf_priv.h" #endif intn SDsetup_szip_parms(int32 id, NC *handle, comp_info *c_info, int32 *cdims); @@ -2959,9 +2959,8 @@ SDgetdimstrs(int32 id, /* IN: dataset ID */ NC_dim *dim = NULL; NC_attr **attr = NULL; char *name = NULL; - int32 ii; int32 namelen; - intn ret_value = SUCCEED; + int ret_value = SUCCEED; /* clear error stack */ HEclear(); @@ -2990,10 +2989,10 @@ SDgetdimstrs(int32 id, /* IN: dataset ID */ name = dim->name->values; namelen = strlen(name); dp = (NC_var **)handle->vars->values; - for (ii = 0; ii < handle->vars->count; ii++, dp++) { + for (int i = 0; i < handle->vars->count; i++, dp++) { /* eliminate vars with rank > 1, coord vars only have rank 1 */ - if ((*dp)->assoc->count == 1) - if (namelen == (*dp)->name->len && strncmp(name, (*dp)->name->values, strlen(name)) == 0) + if ((*dp)->assoc->count == 1) { + if (namelen == (*dp)->name->len && strncmp(name, (*dp)->name->values, strlen(name)) == 0) { /* because a dim was given, make sure that this is a coord var */ /* if it is an SDS, the function will fail */ if ((*dp)->var_type == IS_SDSVAR) { @@ -3008,6 +3007,8 @@ SDgetdimstrs(int32 id, /* IN: dataset ID */ { var = (*dp); } + } + } } } @@ -3555,14 +3556,13 @@ SDsetnbitdataset(int32 id, /* IN: dataset ID */ intn SDsetup_szip_parms(int32 id, NC *handle, comp_info *c_info, int32 *cdims) { - NC_dim *dim; /* to check if the dimension is unlimited */ - int32 dimindex; /* to obtain the NC_dim record */ + NC_dim *dim = NULL; /* to check if the dimension is unlimited */ + int32 dimindex; /* to obtain the NC_dim record */ NC_var *var = NULL; int32 ndims; - int i; int32 xdims[H4_MAX_VAR_DIMS]; int32 nt; - intn ret_value = SUCCEED; + int ret_value = SUCCEED; /* clear error stack */ HEclear(); @@ -3577,9 +3577,11 @@ SDsetup_szip_parms(int32 id, NC *handle, comp_info *c_info, int32 *cdims) } ndims = var->assoc->count; - for (i = 0; i < ndims; i++) { + for (int i = 0; i < ndims; i++) { dimindex = var->assoc->values[i]; dim = SDIget_dim(handle, dimindex); + if (dim == NULL) + HGOTO_ERROR(DFE_ARGS, FAIL); xdims[i] = dim->size; } @@ -3588,7 +3590,7 @@ SDsetup_szip_parms(int32 id, NC *handle, comp_info *c_info, int32 *cdims) ret_value = HCPsetup_szip_parms(c_info, nt, 1, ndims, xdims, cdims); done: - return (ret_value); + return ret_value; } #endif /****************************************************************************** diff --git a/mfhdf/libsrc/local_nc.h b/mfhdf/libsrc/nc_priv.h similarity index 99% rename from mfhdf/libsrc/local_nc.h rename to mfhdf/libsrc/nc_priv.h index 4e7d710091..8bc0fdae02 100644 --- a/mfhdf/libsrc/local_nc.h +++ b/mfhdf/libsrc/nc_priv.h @@ -17,7 +17,7 @@ #ifndef MFH4_LOCAL_NC_H #define MFH4_LOCAL_NC_H -#include "hdfi.h" +#include "hdf_priv.h" /* * netcdf library 'private' data structures, objects and interfaces @@ -28,7 +28,7 @@ #endif /* HDF4's stripped-down XDR implementation */ -#include "h4_xdr.h" +#include "h4_xdr_priv.h" #ifdef H4_HAVE_NETCDF #include "netcdf.h" /* needed for defs of nc_type, ncvoid, ... */ @@ -53,8 +53,8 @@ */ #include "vg.h" -#include "hfile.h" -#include "mfhdfi.h" +#include "hfile_priv.h" +#include "mfhdf.h" #define ATTR_TAG DFTAG_VH #define DIM_TAG DFTAG_VG diff --git a/mfhdf/libsrc/nssdc.c b/mfhdf/libsrc/nssdc.c index 9f4bfc5719..19e9289b75 100644 --- a/mfhdf/libsrc/nssdc.c +++ b/mfhdf/libsrc/nssdc.c @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" -#include "hfile.h" +#include "nc_priv.h" +#include "hfile_priv.h" /* constants/macros pulled out of the CDF library source */ #define V2_CDR_OFFSET 8 diff --git a/mfhdf/libsrc/putget.c b/mfhdf/libsrc/putget.c index 3e7179b7d7..bb81a35e14 100644 --- a/mfhdf/libsrc/putget.c +++ b/mfhdf/libsrc/putget.c @@ -14,8 +14,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" -#include "hfile.h" +#include "nc_priv.h" +#include "hfile_priv.h" /* Local function prototypes */ static bool_t nssdc_xdr_NCvdata(NC *handle, NC_var *vp, unsigned long where, nc_type type, uint32 count, @@ -1806,31 +1806,34 @@ ncvarput(int cdfid, int varid, const long *start, const long *edges, ncvoid *val int NC_fill_buffer(NC *handle, int varid, const long *edges, void *values) { - NC_var *vp; - NC_attr **attr; + NC_var *vp = NULL; + NC_attr **attr = NULL; unsigned long buf_size; - int ii; /* Find the variable structure */ if (handle->vars == NULL) - return (-1); + return -1; vp = NC_hlookupvar(handle, varid); if (vp == NULL) - return (-1); + return -1; /* Compute the size of the buffer using the edges */ buf_size = 1; - for (ii = 0; ii < vp->assoc->count; ii++) + for (int ii = 0; ii < vp->assoc->count; ii++) buf_size = buf_size * edges[ii]; /* Find user-defined fill-value and fill the buffer with it */ attr = NC_findattr(&vp->attrs, _FillValue); - if (attr != NULL) - if (HDmemfill(values, (*attr)->data->values, vp->szof, buf_size) == NULL) - return (-1); + if (attr != NULL) { + if (HDmemfill(values, (*attr)->data->values, vp->szof, buf_size) == NULL) { + return -1; + } /* If no user-defined fill-value, fill the buffer with default fill-value */ - else + else { NC_arrayfill(values, buf_size * vp->szof, vp->type); + } + } + return 0; } diff --git a/mfhdf/libsrc/putgetg.c b/mfhdf/libsrc/putgetg.c index 8c31c6012f..288d7483b5 100644 --- a/mfhdf/libsrc/putgetg.c +++ b/mfhdf/libsrc/putgetg.c @@ -23,7 +23,7 @@ * */ -#include "local_nc.h" +#include "nc_priv.h" /* * Perform I/O on a generalized hyperslab. The efficiency of this diff --git a/mfhdf/libsrc/sharray.c b/mfhdf/libsrc/sharray.c index fa737a91ac..16bc17609f 100644 --- a/mfhdf/libsrc/sharray.c +++ b/mfhdf/libsrc/sharray.c @@ -14,7 +14,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" +#include "nc_priv.h" /* you may wish to tune this: big on a cray, small on a PC? */ #define NC_SHRT_BUFSIZ 8192 diff --git a/mfhdf/libsrc/string.c b/mfhdf/libsrc/string.c index bf17e2067c..413e6126c9 100644 --- a/mfhdf/libsrc/string.c +++ b/mfhdf/libsrc/string.c @@ -14,7 +14,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" +#include "nc_priv.h" static uint32 compute_hash(unsigned count, const char *str) @@ -108,7 +108,7 @@ NC_re_string(NC_string *old, unsigned count, const char *str) return NULL; (void)memcpy(old->values, str, count); - (void)memset(old->values + count, 0, (int)old->count - (int)count + 1); + memset(old->values + count, 0, (int)old->count - (int)count + 1); /* make sure len is always == to the string length */ old->len = count; diff --git a/mfhdf/libsrc/var.c b/mfhdf/libsrc/var.c index 830a168c45..38a0886055 100644 --- a/mfhdf/libsrc/var.c +++ b/mfhdf/libsrc/var.c @@ -14,7 +14,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" +#include "nc_priv.h" NC_var * NC_new_var(const char *name, nc_type type, int ndims, const int *dims) diff --git a/mfhdf/libsrc/xdr_NOTICE.h b/mfhdf/libsrc/xdr_NOTICE.h deleted file mode 100644 index 6f796c8a8c..0000000000 --- a/mfhdf/libsrc/xdr_NOTICE.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ diff --git a/mfhdf/libsrc/xdr_README b/mfhdf/libsrc/xdr_README deleted file mode 100644 index 758452eb78..0000000000 --- a/mfhdf/libsrc/xdr_README +++ /dev/null @@ -1,75 +0,0 @@ - -Mon Apr 17 18:40:07 MDT 1989 - -This directory contains materials copyrighted by Sun Microsystems, Inc. -Please read "NOTICE.h" - -This is the minimum subset of RPCSRC 3.9 needed to build the netcdf library. -It is included here for those systems which lack xdr support. -If your system already has these xdr routines, by all means use them. -Unix systems which support the Network File System (NFS) usually have these -routines in the 'c' library, /usr/lib/libc.a, -so you don't need to link in any additional libraries. -Another candididate is librpclib.a in /usr/lib or /usr/local/lib. - -The complete RPCSRC distribution may be obtained from Sun or -from the sun-spots archive at rice.edu. - -If you must build this portion of the system, make xdrtest. -Running it should produce output like the contents of -testout.sav on standard output. -N.B **** For the double precision numbers, the last three -decimal digits will vary between vaxes and ieee machines. ***** -Running xdrtest will also produce the file "test.xdr". -Once standard out looks good, then do a binary comparison of the -files "test.xdr" and "test_xdr.sav". -(On unix you enter, 'cmp test.xdr test_xdr.sav'). -If the files are byte for byte identical, you are okay. - - -On VAX/VMS, you WILL probably have to build this directory. -The following files are only used on vms: - descrip.mms - The immoral equivalent of a Makefile - htonl.mar - 'Host To Network Long', in VAX Macro - ntohl.mar - 'Network To Host Long', in VAX Macro -Because the stdio implementation in vax C runtime library is so poor, -this code runs 3 times slower on vms than under Ultrix on the same -Microvax. If someone were very civic minded they would rewrite the -file xdrstdio.c as xdr_qio.c. (This is not as bad as it sounds, -the similar thing has already been done for MacOS Toolbox calls.) -The file netcdf/src/file.c would also need to be changed ... -Otherwise, hammer on DEC to get there C language support together. - - -Notes: - -Fri Sep 23 10:11:14 MDT 1988 - -The return value of xdr_getpos and the corresponding argument to xdr_setpos -changed from 'u_int' to 'u_long' (fpos_t??) in anticipation of problems -on micros where sizeof(int) < sizeof(long). OK with Steve Nahm at sun. - - -Thu Mar 9 22:23:00 MDT 1989 - -Added support for architectures where sizeof(enum) == sizeof(char) -in xdr.c:xdr_enum. Note that, as written this is a runtime !?! check... - - -Mon Apr 17 15:08:05 MDT 1989 - -The Iris computers seem to put the xdr routines in /usr/lib/libsun.a. -EG, you don't need to build the ones here. -You may have to muck around to get the include files right on an iris. -Also may need libbsd.a. - - -Wed Apr 26 19:48:46 MDT 1989 - -Fix to xdr_float.c:xdr_float:"#ifdef vax" to handle values less than -2^^-127 properly. - - -May 1989 - -Added MIPSEL #ifdef for ieee, byte swapped machines like DECstations. diff --git a/mfhdf/ncdump/CMakeLists.txt b/mfhdf/ncdump/CMakeLists.txt index e2aaf1a5dd..bfae6bf2e8 100644 --- a/mfhdf/ncdump/CMakeLists.txt +++ b/mfhdf/ncdump/CMakeLists.txt @@ -8,25 +8,18 @@ set (ncdump_SRCS ${HDF4_MFHDF_UTIL_DIR}/h4getopt.c ) -if (NOT ONLY_SHARED_LIBS) - add_executable (ncdump ${ncdump_SRCS}) - target_include_directories (ncdump PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_MFHDF_UTIL_DIR};${HDF4_BINARY_DIR}") +add_executable (ncdump ${ncdump_SRCS}) +target_include_directories (ncdump PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_MFHDF_UTIL_DIR};${HDF4_BINARY_DIR}") +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (ncdump STATIC) target_link_libraries (ncdump PRIVATE ${HDF4_MF_LIB_TARGET}) - set_target_properties (ncdump PROPERTIES COMPILE_DEFINITIONS "HDF") - - set (H4_DEP_EXECUTABLES ncdump) +else () + TARGET_C_PROPERTIES (ncdump SHARED) + target_link_libraries (ncdump PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () +set_target_properties (ncdump PROPERTIES COMPILE_DEFINITIONS "HDF") -if (BUILD_SHARED_LIBS) - add_executable (ncdump-shared ${ncdump_SRCS}) - target_include_directories (ncdump-shared PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_MFHDF_UTIL_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (ncdump-shared SHARED) - target_link_libraries (ncdump-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set_target_properties (ncdump-shared PROPERTIES COMPILE_DEFINITIONS "HDF") - - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} ncdump-shared) -endif () +set (H4_DEP_EXECUTABLES ncdump) if (BUILD_TESTING) include (CMakeTests.cmake) diff --git a/mfhdf/ncdump/CMakeTests.cmake b/mfhdf/ncdump/CMakeTests.cmake index 533fcbdad3..3f9ef58093 100644 --- a/mfhdf/ncdump/CMakeTests.cmake +++ b/mfhdf/ncdump/CMakeTests.cmake @@ -8,7 +8,7 @@ if (NOT BUILD_SHARED_LIBS) set (tgt_ext "") else () - set (tgt_ext "-shared") + set (tgt_ext "") endif () # Remove any output file left over from previous test run diff --git a/mfhdf/ncdump/dumplib.c b/mfhdf/ncdump/dumplib.c index b6c1e31835..e7bdb149bf 100644 --- a/mfhdf/ncdump/dumplib.c +++ b/mfhdf/ncdump/dumplib.c @@ -26,13 +26,13 @@ error(const char *fmt, ...) { va_list args; - (void)fprintf(stderr, "*** %s: ", progname); + fprintf(stderr, "*** %s: ", progname); va_start(args, fmt); (void)vfprintf(stderr, fmt, args); va_end(args); - (void)fprintf(stderr, "\n"); + fprintf(stderr, "\n"); (void)fflush(stderr); /* to ensure log files are current */ } diff --git a/mfhdf/ncdump/ncdump.c b/mfhdf/ncdump/ncdump.c index d317d3e59a..bff4267d50 100644 --- a/mfhdf/ncdump/ncdump.c +++ b/mfhdf/ncdump/ncdump.c @@ -8,7 +8,7 @@ #include #include -#include "local_nc.h" +#include "nc_priv.h" #include "ncdump.h" #include "h4getopt.h" @@ -149,13 +149,13 @@ pr_att_vals(nc_type type, int len, void *vals) gp.cp = (char *)vals; for (iel = 0; iel < len; iel++) if (isprint(uc = *gp.cp++ & 0377)) - Printf("'%c'%s", uc, iel < len - 1 ? ", " : ""); + printf("'%c'%s", uc, iel < len - 1 ? ", " : ""); else - Printf("'\\%o'%s", uc, iel < len - 1 ? ", " : ""); + printf("'\\%o'%s", uc, iel < len - 1 ? ", " : ""); break; case NC_CHAR: gp.cp = (char *)vals; - Printf("\""); + printf("\""); /* adjust len so trailing nulls don't get printed */ sp = gp.cp + len - 1; while (*sp-- == '\0' && len > 0) @@ -163,47 +163,47 @@ pr_att_vals(nc_type type, int len, void *vals) for (iel = 0; iel < len; iel++) switch (uc = *gp.cp++ & 0377) { case '\b': - Printf("\\b"); + printf("\\b"); break; case '\f': - Printf("\\f"); + printf("\\f"); break; case '\n': /* generate linebreaks after new-lines */ - Printf("\\n\",\n \""); + printf("\\n\",\n \""); break; case '\r': - Printf("\\r"); + printf("\\r"); break; case '\t': - Printf("\\t"); + printf("\\t"); break; case '\v': - Printf("\\v"); + printf("\\v"); break; case '\\': - Printf("\\\\"); + printf("\\\\"); break; case '\'': - Printf("\\'"); + printf("\\'"); break; case '\"': - Printf("\\\""); + printf("\\\""); break; default: - Printf("%c", uc); + printf("%c", uc); break; } - Printf("\""); + printf("\""); break; case NC_SHORT: gp.sp = (short *)vals; for (iel = 0; iel < len; iel++) - Printf("%ds%s", *gp.sp++, iel < len - 1 ? ", " : ""); + printf("%ds%s", *gp.sp++, iel < len - 1 ? ", " : ""); break; case NC_LONG: gp.lp = (nclong *)vals; for (iel = 0; iel < len; iel++) - Printf("%d%s", (int)*gp.lp++, iel < len - 1 ? ", " : ""); + printf("%d%s", (int)*gp.lp++, iel < len - 1 ? ", " : ""); break; case NC_FLOAT: gp.fp = (float *)vals; @@ -215,7 +215,7 @@ pr_att_vals(nc_type type, int len, void *vals) gps[ll + 1] = '\0'; gps[ll] = 'f'; tztrim(gps); /* trim trailing 0's after '.' */ - Printf("%s%s", gps, iel < len - 1 ? ", " : ""); + printf("%s%s", gps, iel < len - 1 ? ", " : ""); } break; case NC_DOUBLE: @@ -223,7 +223,7 @@ pr_att_vals(nc_type type, int len, void *vals) for (iel = 0; iel < len; iel++) { (void)sprintf(gps, d_fmt, *gp.dp++); tztrim(gps); /* trim trailing 0's after '.' */ - Printf("%s%s", gps, iel < len - 1 ? ", " : ""); + printf("%s%s", gps, iel < len - 1 ? ", " : ""); } break; default: @@ -306,7 +306,7 @@ do_ncdump(char *path, struct fspec *specp) if (specp->name == NULL) specp->name = name_path(path); - Printf("netcdf %s {\n", specp->name); + printf("netcdf %s {\n", specp->name); /* * get number of dimensions, number of variables, number of global @@ -316,7 +316,7 @@ do_ncdump(char *path, struct fspec *specp) /* get dimension info */ if (ndims > 0) { - Printf("dimensions:\n"); + printf("dimensions:\n"); for (dimid = 0; dimid < ndims; dimid++) { char *fixed_str = NULL; @@ -331,15 +331,15 @@ do_ncdump(char *path, struct fspec *specp) } if (dimid == xdimid) - Printf("\t%s = %s ; // (%d currently)\n", fixed_str, "UNLIMITED", (int)dims[dimid].size); + printf("\t%s = %s ; // (%d currently)\n", fixed_str, "UNLIMITED", (int)dims[dimid].size); else - Printf("\t%s = %ld ;\n", fixed_str, dims[dimid].size); + printf("\t%s = %ld ;\n", fixed_str, dims[dimid].size); free(fixed_str); } } - Printf("\nvariables:\n"); + printf("\nvariables:\n"); /* get variable info, with variable attributes */ for (varid = 0; varid < nvars; varid++) { @@ -353,10 +353,10 @@ do_ncdump(char *path, struct fspec *specp) return; } - Printf("\t%s %s", type_name(var.type), fixed_var); + printf("\t%s %s", type_name(var.type), fixed_var); if (var.ndims > 0) - Printf("("); + printf("("); for (id = 0; id < var.ndims; id++) { char *fixed_dim = sanitize_string(dims[var.dims[id]].name, specp->fix_str); @@ -367,11 +367,11 @@ do_ncdump(char *path, struct fspec *specp) return; } - Printf("%s%s", fixed_dim, id < var.ndims - 1 ? ", " : ")"); + printf("%s%s", fixed_dim, id < var.ndims - 1 ? ", " : ")"); free(fixed_dim); } - Printf(" ;\n"); + printf(" ;\n"); /* get variable attributes */ for (ia = 0; ia < var.natts; ia++) { @@ -386,7 +386,7 @@ do_ncdump(char *path, struct fspec *specp) return; } - Printf("\t\t%s:%s = ", fixed_var, fixed_att); + printf("\t\t%s:%s = ", fixed_var, fixed_att); (void)ncattinq(ncid, varid, att.name, &att.type, &att.len); att.val = (void *)malloc((unsigned)att.len * nctypelen(att.type)); @@ -400,7 +400,7 @@ do_ncdump(char *path, struct fspec *specp) (void)ncattget(ncid, varid, att.name, att.val); pr_att_vals(att.type, att.len, att.val); - Printf(" ;\n"); + printf(" ;\n"); free(att.val); free(fixed_att); } @@ -410,7 +410,7 @@ do_ncdump(char *path, struct fspec *specp) /* get global attributes */ if (ngatts > 0) - Printf("\n// global attributes:\n"); + printf("\n// global attributes:\n"); for (ia = 0; ia < ngatts; ia++) { char *fixed_att; @@ -423,7 +423,7 @@ do_ncdump(char *path, struct fspec *specp) return; } - Printf("\t\t:%s = ", fixed_att); + printf("\t\t:%s = ", fixed_att); (void)ncattinq(ncid, NC_GLOBAL, att.name, &att.type, &att.len); att.val = malloc((unsigned)(att.len * nctypelen(att.type))); @@ -437,14 +437,14 @@ do_ncdump(char *path, struct fspec *specp) (void)ncattget(ncid, NC_GLOBAL, att.name, att.val); pr_att_vals(att.type, att.len, att.val); - Printf(" ;\n"); + printf(" ;\n"); free(att.val); free(fixed_att); } if (!specp->header_only) { if (nvars > 0) - Printf("\ndata:\n"); + printf("\ndata:\n"); /* output variable data */ for (varid = 0; varid < nvars; varid++) { @@ -525,7 +525,7 @@ do_ncdump(char *path, struct fspec *specp) } } - Printf("}\n"); + printf("}\n"); (void)ncclose(ncid); } diff --git a/mfhdf/ncdump/ncdump.h b/mfhdf/ncdump/ncdump.h index 7a21cba63a..87a27e1084 100644 --- a/mfhdf/ncdump/ncdump.h +++ b/mfhdf/ncdump/ncdump.h @@ -6,7 +6,6 @@ #ifndef NCDUMP_H #define NCDUMP_H -#define Printf (void)printf #define ERR_READFAIL \ -2 /* Used to return by vardata() to indicate that \ ncvarget() fails to read the data */ diff --git a/mfhdf/ncdump/vardata.c b/mfhdf/ncdump/vardata.c index 35ddda6e6d..6bb157be4d 100644 --- a/mfhdf/ncdump/vardata.c +++ b/mfhdf/ncdump/vardata.c @@ -85,7 +85,7 @@ pr_vals(struct ncvar *vp, long len, char *fmt, bool more, bool lastrow, void *va case NC_CHAR: gp.cp = (char *)vals; if (fmt == 0 || VD_STREQ(fmt, "%s") || VD_STREQ(fmt, "")) { /* as string */ - Printf("\""); + printf("\""); /* adjust len so trailing nulls don't get printed */ sp = gp.cp + len; while (len > 0 && *--sp == '\0') @@ -93,40 +93,40 @@ pr_vals(struct ncvar *vp, long len, char *fmt, bool more, bool lastrow, void *va for (iel = 0; iel < len; iel++) switch (uc = *gp.cp++ & 0377) { case '\b': - Printf("\\b"); + printf("\\b"); break; case '\f': - Printf("\\f"); + printf("\\f"); break; case '\n': /* generate linebreaks after new-lines */ - Printf("\\n\",\n \""); + printf("\\n\",\n \""); break; case '\r': - Printf("\\r"); + printf("\\r"); break; case '\t': - Printf("\\t"); + printf("\\t"); break; case '\v': - Printf("\\v"); + printf("\\v"); break; case '\\': - Printf("\\\\"); + printf("\\\\"); break; case '\'': - Printf("\\\'"); + printf("\\\'"); break; case '\"': - Printf("\\\""); + printf("\\\""); break; default: if (isprint(uc)) - Printf("%c", uc); + printf("%c", uc); else - Printf("\\%.3o", uc); + printf("\\%.3o", uc); break; } - Printf("\""); + printf("\""); } else { /* use format from C_format attribute */ for (iel = 0; iel < len - 1; iel++) { @@ -221,14 +221,14 @@ static void lastdelim(bool more, bool lastrow) { if (more) { - Printf(", "); + printf(", "); } else { if (lastrow) { - Printf(";"); + printf(";"); } else { - Printf(","); + printf(","); } } } @@ -247,23 +247,27 @@ annotate(struct ncvar *vp, struct fspec *fsp, long cor[], long iel) int id; /* print indices according to data_lang */ - (void)printf(" // %s(", vp->name); + printf(" // %s(", vp->name); switch (fsp->data_lang) { case LANG_C: /* C variable indices */ for (id = 0; id < vrank - 1; id++) - Printf("%d,", (int)cor[id]); - Printf("%d", (int)(cor[id] + iel)); + printf("%d,", (int)cor[id]); + printf("%d", (int)(cor[id] + iel)); break; case LANG_F: /* Fortran variable indices */ - Printf("%d", (int)(cor[vrank - 1] + iel + 1)); + printf("%d", (int)(cor[vrank - 1] + iel + 1)); for (id = vrank - 2; id >= 0; id--) { - Printf(",%d", (int)(1 + cor[id])); + printf(",%d", (int)(1 + cor[id])); } break; + case LANG_NONE: + default: + /* Might want to make this an error */ + break; } - Printf(")\n "); + printf(")\n "); } /* @@ -313,18 +317,18 @@ pr_cvals(struct ncvar *vp, long len, char *fmt, bool more, bool lastrow, void *v case NC_BYTE: gp.cp = (char *)vals; for (iel = 0; iel < len - 1; iel++) { - Printf(fmt, *gp.cp++); - Printf(", "); + printf(fmt, *gp.cp++); + printf(", "); annotate(vp, fsp, cor, iel); } - Printf(fmt, *gp.cp++); + printf(fmt, *gp.cp++); lastdelim(more, lastrow); annotate(vp, fsp, cor, iel); break; case NC_CHAR: gp.cp = (char *)vals; if (fmt == 0 || VD_STREQ(fmt, "%s") || VD_STREQ(fmt, "")) { /* as string */ - Printf("\""); + printf("\""); /* adjust len so trailing nulls don't get printed */ sp = gp.cp + len; while (len > 0 && *--sp == '\0') @@ -332,49 +336,49 @@ pr_cvals(struct ncvar *vp, long len, char *fmt, bool more, bool lastrow, void *v for (iel = 0; iel < len; iel++) switch (uc = *gp.cp++ & 0377) { case '\b': - Printf("\\b"); + printf("\\b"); break; case '\f': - Printf("\\f"); + printf("\\f"); break; case '\n': /* generate linebreaks after new-lines */ - Printf("\\n\",\n \""); + printf("\\n\",\n \""); break; case '\r': - Printf("\\r"); + printf("\\r"); break; case '\t': - Printf("\\t"); + printf("\\t"); break; case '\v': - Printf("\\v"); + printf("\\v"); break; case '\\': - Printf("\\\\"); + printf("\\\\"); break; case '\'': - Printf("\\\'"); + printf("\\\'"); break; case '\"': - Printf("\\\""); + printf("\\\""); break; default: if (isprint(uc)) - Printf("%c", uc); + printf("%c", uc); else - Printf("\\%.3o", uc); + printf("\\%.3o", uc); break; } - Printf("\""); + printf("\""); annotate(vp, fsp, cor, 0); } else { /* use format from C_format attribute */ for (iel = 0; iel < len - 1; iel++) { - Printf(fmt, *gp.cp++); - Printf(", "); + printf(fmt, *gp.cp++); + printf(", "); annotate(vp, fsp, cor, iel); } - Printf(fmt, *gp.cp++); + printf(fmt, *gp.cp++); lastdelim(more, lastrow); annotate(vp, fsp, cor, iel); } @@ -382,22 +386,22 @@ pr_cvals(struct ncvar *vp, long len, char *fmt, bool more, bool lastrow, void *v case NC_SHORT: gp.sp = (short *)vals; for (iel = 0; iel < len - 1; iel++) { - Printf(fmt, *gp.sp++); - Printf(", "); + printf(fmt, *gp.sp++); + printf(", "); annotate(vp, fsp, cor, iel); } - Printf(fmt, *gp.sp++); + printf(fmt, *gp.sp++); lastdelim(more, lastrow); annotate(vp, fsp, cor, iel); break; case NC_LONG: gp.lp = (nclong *)vals; for (iel = 0; iel < len - 1; iel++) { - Printf(fmt, *gp.lp++); - Printf(", "); + printf(fmt, *gp.lp++); + printf(", "); annotate(vp, fsp, cor, iel); } - Printf(fmt, *gp.lp++); + printf(fmt, *gp.lp++); lastdelim(more, lastrow); annotate(vp, fsp, cor, iel); break; @@ -405,17 +409,17 @@ pr_cvals(struct ncvar *vp, long len, char *fmt, bool more, bool lastrow, void *v gp.fp = (float *)vals; for (iel = 0; iel < len - 1; iel++) { if (*gp.fp >= fill_float) - Printf("FloatInf"); + printf("FloatInf"); else - Printf(fmt, (double)*gp.fp); - Printf(","); + printf(fmt, (double)*gp.fp); + printf(","); annotate(vp, fsp, cor, iel); gp.fp++; } if (*gp.fp >= fill_float) - Printf("FloatInf"); + printf("FloatInf"); else - Printf(fmt, (double)*gp.fp); + printf(fmt, (double)*gp.fp); lastdelim(more, lastrow); annotate(vp, fsp, cor, iel); gp.fp++; @@ -424,18 +428,18 @@ pr_cvals(struct ncvar *vp, long len, char *fmt, bool more, bool lastrow, void *v gp.dp = (double *)vals; for (iel = 0; iel < len - 1; iel++) { if (*gp.dp >= fill_double) - Printf("DoubleInf"); + printf("DoubleInf"); else { - Printf(fmt, *gp.dp); + printf(fmt, *gp.dp); } - Printf(","); + printf(","); annotate(vp, fsp, cor, iel); gp.dp++; } if (*gp.dp >= fill_double) - Printf("DoubleInf"); + printf("DoubleInf"); else - Printf(fmt, *gp.dp); + printf(fmt, *gp.dp); lastdelim(more, lastrow); annotate(vp, fsp, cor, iel); gp.dp++; @@ -509,11 +513,11 @@ vardata(struct ncvar *vp, long vdims[], int ncid, int varid, struct fspec *fsp) fixed_var = sanitize_string(vp->name, fsp->fix_str); if (vrank <= 1) { - Printf("\n %s = ", fixed_var); + printf("\n %s = ", fixed_var); set_indent(strlen(fixed_var) + 4); } else { - Printf("\n %s =\n ", fixed_var); + printf("\n %s =\n ", fixed_var); set_indent(2); } @@ -544,29 +548,33 @@ vardata(struct ncvar *vp, long vdims[], int ncid, int varid, struct fspec *fsp) corsav = cor[vrank - 1]; if (fsp->brief_data_cmnts != false && vrank > 1 && left > 0) { /* print brief comment with indices range */ - Printf("// %s(", fixed_var); + printf("// %s(", fixed_var); switch (fsp->data_lang) { case LANG_C: /* print brief comment with C variable indices */ for (id = 0; id < vrank - 1; id++) - Printf("%d,", (int)cor[id]); + printf("%d,", (int)cor[id]); if (vdims[vrank - 1] == 1) - Printf("0"); + printf("0"); else - Printf(" 0-%d", (int)vdims[vrank - 1] - 1); + printf(" 0-%d", (int)vdims[vrank - 1] - 1); break; case LANG_F: /* print brief comment with Fortran variable indices */ if (vdims[vrank - 1] == 1) - Printf("1"); + printf("1"); else - Printf("1-%d ", (int)vdims[vrank - 1]); + printf("1-%d ", (int)vdims[vrank - 1]); for (id = vrank - 2; id >= 0; id--) { - Printf(",%d", (int)(1 + cor[id])); + printf(",%d", (int)(1 + cor[id])); } break; + case LANG_NONE: + default: + /* Might want to make this an error */ + break; } - Printf(")\n "); + printf(")\n "); set_indent(4); } } diff --git a/mfhdf/ncgen/CMakeLists.txt b/mfhdf/ncgen/CMakeLists.txt index 4e7e1cf5f1..490c5b5a07 100644 --- a/mfhdf/ncgen/CMakeLists.txt +++ b/mfhdf/ncgen/CMakeLists.txt @@ -20,25 +20,18 @@ set (ncgen_SRCS ${HDF4_MFHDF_UTIL_DIR}/h4getopt.c ) -if (NOT ONLY_SHARED_LIBS) - add_executable (ncgen ${ncgen_SRCS}) - target_include_directories(ncgen PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_MFHDF_UTIL_DIR};${HDF4_BINARY_DIR}") +add_executable (ncgen ${ncgen_SRCS}) +target_include_directories(ncgen PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_MFHDF_UTIL_DIR};${HDF4_BINARY_DIR}") +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (ncgen STATIC) target_link_libraries (ncgen PRIVATE ${HDF4_MF_LIB_TARGET}) - set_target_properties (ncgen PROPERTIES COMPILE_DEFINITIONS "HDF") - - set (H4_DEP_EXECUTABLES ncgen) +else () + TARGET_C_PROPERTIES (ncgen SHARED) + target_link_libraries (ncgen PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () +set_target_properties (ncgen PROPERTIES COMPILE_DEFINITIONS "HDF") -if (BUILD_SHARED_LIBS) - add_executable (ncgen-shared ${ncgen_SRCS}) - target_include_directories(ncgen-shared PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_MFHDF_UTIL_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (ncgen-shared SHARED) - target_link_libraries (ncgen-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set_target_properties (ncgen-shared PROPERTIES COMPILE_DEFINITIONS "HDF") - - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} ncgen-shared) -endif () +set (H4_DEP_EXECUTABLES ncgen) if (BUILD_TESTING) include (CMakeTests.cmake) diff --git a/mfhdf/ncgen/CMakeTests.cmake b/mfhdf/ncgen/CMakeTests.cmake index c2a71e32a2..6991fb9cf7 100644 --- a/mfhdf/ncgen/CMakeTests.cmake +++ b/mfhdf/ncgen/CMakeTests.cmake @@ -8,7 +8,7 @@ if (NOT BUILD_SHARED_LIBS) set (tgt_ext "") else () - set (tgt_ext "-shared") + set (tgt_ext "") endif () # Remove any output file left over from previous test run diff --git a/mfhdf/ncgen/close.c b/mfhdf/ncgen/close.c index 4896e97781..34613dc09a 100644 --- a/mfhdf/ncgen/close.c +++ b/mfhdf/ncgen/close.c @@ -19,8 +19,6 @@ cl_netcdf() derror("error closing netcdf"); } -#define fpr (void)fprintf - static void cl_c() { diff --git a/mfhdf/ncgen/generate.c b/mfhdf/ncgen/generate.c index ff07282c5b..f93da7e8a9 100644 --- a/mfhdf/ncgen/generate.c +++ b/mfhdf/ncgen/generate.c @@ -314,8 +314,8 @@ fline(const char *stmnt) while (len > 0) { if (line >= FORT_MAX_LINES) derror("FORTRAN statement too long: %s", stmnt); - (void)fprintf(fout, " %c", cont[line++]); - (void)fprintf(fout, "%.66s\n", stmnt); + fprintf(fout, " %c", cont[line++]); + fprintf(fout, "%.66s\n", stmnt); len -= 66; if (len > 0) stmnt += 66; diff --git a/mfhdf/ncgen/genlib.c b/mfhdf/ncgen/genlib.c index 1b64975acd..ae46121867 100644 --- a/mfhdf/ncgen/genlib.c +++ b/mfhdf/ncgen/genlib.c @@ -22,9 +22,9 @@ derror(const char *fmt, ...) va_list args; if (lineno == 1) - (void)fprintf(stderr, "%s: %s: ", progname, cdlname); + fprintf(stderr, "%s: %s: ", progname, cdlname); else - (void)fprintf(stderr, "%s: %s line %d: ", progname, cdlname, lineno); + fprintf(stderr, "%s: %s line %d: ", progname, cdlname, lineno); va_start(args, fmt); diff --git a/mfhdf/ncgen/load.c b/mfhdf/ncgen/load.c index d6ed9243be..db60d275c5 100644 --- a/mfhdf/ncgen/load.c +++ b/mfhdf/ncgen/load.c @@ -88,8 +88,6 @@ load_netcdf(void *rec_start) /* write out record from in-memory structure */ derror("error putting value for variable %s", vars[varnum].name); } -#define fpr (void)fprintf - /* * Remove trailing zeros (after decimal point) but not trailing decimal * point from ss, a string representation of a floating-point number that diff --git a/mfhdf/ncgen/ncgen.h b/mfhdf/ncgen/ncgen.h index f874192042..746c225198 100644 --- a/mfhdf/ncgen/ncgen.h +++ b/mfhdf/ncgen/ncgen.h @@ -6,7 +6,7 @@ #ifndef H4NC_NCGEN_H #define H4NC_NCGEN_H -#include "local_nc.h" +#include "nc_priv.h" #include "generic.h" /* defines union generic */ #define H4_MAX_NC_ATTSIZE 2000 /* max size in bytes of an attribute */ diff --git a/mfhdf/ncgen/ncgen.l b/mfhdf/ncgen/ncgen.l index c9bdd472ad..2a56dbd443 100644 --- a/mfhdf/ncgen/ncgen.l +++ b/mfhdf/ncgen/ncgen.l @@ -7,7 +7,6 @@ /* lex specification for tokens for ncgen */ char errstr[100]; /* for short error messages */ -extern long strtol(); void expand_escapes(); #include diff --git a/mfhdf/ncgen/ncgenyy.c b/mfhdf/ncgen/ncgenyy.c index 7c5537e99a..8e12bd4a5e 100644 --- a/mfhdf/ncgen/ncgenyy.c +++ b/mfhdf/ncgen/ncgenyy.c @@ -642,7 +642,6 @@ char *yytext; /* lex specification for tokens for ncgen */ char errstr[100]; /* for short error messages */ -extern long strtol(); void expand_escapes(); #include diff --git a/mfhdf/nctest/add.c b/mfhdf/nctest/add.c index 42993d033c..587c69cf66 100644 --- a/mfhdf/nctest/add.c +++ b/mfhdf/nctest/add.c @@ -29,7 +29,7 @@ add_dim(struct netcdf *test, struct cdfdim *idim) static char pname[] = "add_dim"; if (test->ndims >= H4_MAX_NC_DIMS) { - (void)fprintf(stderr, "%s: too many dimensions (%d)", pname, test->ndims); + fprintf(stderr, "%s: too many dimensions (%d)", pname, test->ndims); return; } test->dims[test->ndims].size = idim->size; @@ -48,7 +48,7 @@ add_var(struct netcdf *test, struct cdfvar *ivar) int i; if (test->nvars >= H4_MAX_NC_VARS) { - (void)fprintf(stderr, "%s: too many variables (%d)", pname, test->nvars); + fprintf(stderr, "%s: too many variables (%d)", pname, test->nvars); return; } @@ -71,7 +71,7 @@ add_att(struct netcdf *test, int varid, struct cdfatt *iatt) int ia; /* attribute number */ if (test->natts >= MAX_TEST_ATTS) { - (void)fprintf(stderr, "%s: too many attributes (%d)", pname, test->natts); + fprintf(stderr, "%s: too many attributes (%d)", pname, test->natts); return; } @@ -135,7 +135,7 @@ del_att(struct netcdf *test, int varid, struct cdfatt *iatt) } } /* not found */ - (void)fprintf(stderr, "%s: no such attribute as (%s, %s)", pname, test->vars[varid].name, iatt->name); + fprintf(stderr, "%s: no such attribute as (%s, %s)", pname, test->vars[varid].name, iatt->name); } /* keep max record written updated */ @@ -178,8 +178,8 @@ errvar(struct netcdf *cdfp, struct cdfvar *varp) break; } - (void)fprintf(stderr, " name=%s type=%s dims=(", varp->name, types); + fprintf(stderr, " name=%s type=%s dims=(", varp->name, types); for (id = 0; id < varp->ndims; id++) - (void)fprintf(stderr, "%d%s", (int)cdfp->dims[varp->dims[id]].size, id < varp->ndims - 1 ? ", " : ""); - (void)fprintf(stderr, ")\n"); + fprintf(stderr, "%d%s", (int)cdfp->dims[varp->dims[id]].size, id < varp->ndims - 1 ? ", " : ""); + fprintf(stderr, ")\n"); } diff --git a/mfhdf/nctest/atttests.c b/mfhdf/nctest/atttests.c index 497fa1a705..e862d7fcf7 100644 --- a/mfhdf/nctest/atttests.c +++ b/mfhdf/nctest/atttests.c @@ -74,7 +74,7 @@ test_ncattput(char *path) {"ww", NC_LONG, 1, ___, 0}; static struct cdfatt tmp; /* attribute */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -316,9 +316,9 @@ test_ncattput(char *path) } free(tmp.name); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -342,7 +342,7 @@ test_ncattinq(char *path) static struct cdfvar vv = /* new variable */ {"vv", NC_SHORT, 2, ___, 0}; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -428,9 +428,9 @@ test_ncattinq(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -459,7 +459,7 @@ test_ncattget(char *path) static char pname[] = "test_ncattget"; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -519,9 +519,9 @@ test_ncattget(char *path) error(" cdfid=%d, varname=%s, attname=%s, type=%d, len=%d", cdfid, test_g->vars[test_g->atts[ia].var].name, test_g->atts[ia].name, test_g->atts[ia].type, test_g->atts[ia].len); - (void)fprintf(stderr, "should have got:"); + fprintf(stderr, "should have got:"); val_out(test_g->atts[ia].type, test_g->atts[ia].len, test_g->atts[ia].val); - (void)fprintf(stderr, " instead got:"); + fprintf(stderr, " instead got:"); val_out(tmp.type, tmp.len, tmp.val); nerrs++; } @@ -562,9 +562,9 @@ test_ncattget(char *path) error(" cdfid=%d, varname=%s, attname=%s, type=%d, len=%d", cdfid, test_g->vars[test_g->atts[ia].var].name, test_g->atts[ia].name, test_g->atts[ia].type, test_g->atts[ia].len); - (void)fprintf(stderr, "should have got:"); + fprintf(stderr, "should have got:"); val_out(test_g->atts[ia].type, test_g->atts[ia].len, test_g->atts[ia].val); - (void)fprintf(stderr, " instead got:"); + fprintf(stderr, " instead got:"); val_out(tmp.type, tmp.len, tmp.val); nerrs++; } @@ -593,9 +593,9 @@ test_ncattget(char *path) return; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -633,7 +633,7 @@ test_ncattcopy(char *path1, char *path2) {___, "att", NC_FLOAT, LEN_OF(float_vals), (void *)float_vals}; static struct cdfatt tmp; /* attribute */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path1, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -911,9 +911,9 @@ test_ncattcopy(char *path1, char *path2) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -939,7 +939,7 @@ test_ncattname(char *path) static struct cdfatt att = /* attribute */ {___, ___, NC_SHORT, LEN_OF(short_vals), (void *)short_vals}; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -1103,9 +1103,9 @@ test_ncattname(char *path) free(tmp.name); free(att.name); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -1134,7 +1134,7 @@ test_ncattrename(char *path) {___, "arggh", NC_SHORT, LEN_OF(short_vals), (void *)short_vals}; int ynum; /* attribute number */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -1256,9 +1256,9 @@ test_ncattrename(char *path) return; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -1291,7 +1291,7 @@ test_ncattdel(char *path) int natts; /* number of variable attributes */ int xdimid; /* id of unlimited dimension */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -1434,7 +1434,7 @@ test_ncattdel(char *path) free(vtmp.name); free(yav.dims); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/cdftests.c b/mfhdf/nctest/cdftests.c index c82f1bdfd9..edc8d9822c 100644 --- a/mfhdf/nctest/cdftests.c +++ b/mfhdf/nctest/cdftests.c @@ -39,7 +39,7 @@ test_nccreate(char *path) static char pname[] = "test_nccreate"; int cdfid; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = nccreate(path, NC_CLOBBER)) == -1) { error("%s: nccreate failed to NC_CLOBBER", pname); @@ -72,9 +72,9 @@ test_nccreate(char *path) /* Initialize in-memory netcdf to empty */ add_reset(test_g); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -98,7 +98,7 @@ test_ncopen(char *path) static struct cdfatt title = /* attribute */ {NC_GLOBAL, "title", NC_CHAR, LEN_OF(title_val), (void *)title_val}; - (void)fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); if ((cdfid0 = ncopen(xpath, NC_NOWRITE)) != -1) { error("%s: ncopen should fail opening nonexistent file", pname); @@ -168,9 +168,9 @@ test_ncopen(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -199,7 +199,7 @@ test_ncredef(char *path) static struct cdfatt aa_units = /* attribute */ {___, "units", NC_CHAR, LEN_OF(units_val), (void *)units_val}; - (void)fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -259,9 +259,9 @@ test_ncredef(char *path) } free(aa.dims); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -291,7 +291,7 @@ test_ncendef(char *path) static struct cdfatt bb_range = /* attribute */ {___, "valid_range", NC_FLOAT, LEN_OF(bb_rangev), (void *)bb_rangev}; - (void)fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -353,9 +353,9 @@ test_ncendef(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -373,7 +373,7 @@ test_ncclose(char *path) static char pname[] = "test_ncclose"; int cdfid; /* netcdf id */ - (void)fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -405,9 +405,9 @@ test_ncclose(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -448,7 +448,7 @@ test_ncinquire(char *path) static struct cdfatt cc_units = /* attribute */ {___, "units", NC_CHAR, LEN_OF(units_val), (void *)units_val}; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -562,9 +562,9 @@ test_ncinquire(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -591,7 +591,7 @@ test_ncsync(char *path) static struct cdfatt dd_fill_val = /* attribute */ {___, "fill_value", NC_SHORT, LEN_OF(dd_fill_valv), (void *)dd_fill_valv}; - (void)fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); if ((cdfid0 = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen in NC_WRITE mode failed", pname); @@ -694,9 +694,9 @@ test_ncsync(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -718,7 +718,7 @@ test_ncabort(char *path) {___, "temp", NC_SHORT, LEN_OF(attv), (void *)attv}; int cdfid; /* netcdf id */ - (void)fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -777,7 +777,7 @@ test_ncabort(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/dimtests.c b/mfhdf/nctest/dimtests.c index 6f40291746..ebb7d46530 100644 --- a/mfhdf/nctest/dimtests.c +++ b/mfhdf/nctest/dimtests.c @@ -48,7 +48,7 @@ test_ncdimdef(char *path) int xdimid; /* id of unlimited dimension, or -1 if none */ int dimid; /* dimension id */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -126,9 +126,9 @@ test_ncdimdef(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -149,7 +149,7 @@ test_ncdimid(char *path) static struct cdfdim nn = /* dimension */ {"nn", 1}; /* 1 should be a valid dimension size */ - (void)fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -207,9 +207,9 @@ test_ncdimid(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -229,7 +229,7 @@ test_ncdiminq(char *path) int dimid; /* dimension id */ struct cdfdim dim; /* dimension */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -304,9 +304,9 @@ test_ncdiminq(char *path) } free(dim.name); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -332,7 +332,7 @@ test_ncdimrename(char *path) static struct cdfdim qq = /* dimension */ {"qq", 10}; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -418,7 +418,7 @@ test_ncdimrename(char *path) } free(dim.name); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/error.c b/mfhdf/nctest/error.c index e2c7a09a62..c2b26d29a9 100644 --- a/mfhdf/nctest/error.c +++ b/mfhdf/nctest/error.c @@ -26,13 +26,13 @@ error(const char *fmt, ...) { va_list args; - (void)fprintf(stderr, "*** "); + fprintf(stderr, "*** "); va_start(args, fmt); (void)vfprintf(stderr, fmt, args); va_end(args); - (void)fprintf(stderr, "\n"); + fprintf(stderr, "\n"); error_count++; } diff --git a/mfhdf/nctest/misctest.c b/mfhdf/nctest/misctest.c index bcbfe7e8fc..338a398d17 100644 --- a/mfhdf/nctest/misctest.c +++ b/mfhdf/nctest/misctest.c @@ -30,7 +30,7 @@ test_nctypelen() int nerrs = 0; static char pname[] = "test_nctypelen"; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if (nctypelen(NC_BYTE) != sizeof(char)) { error("%s: nctypelen failed for NC_BYTE", pname); @@ -57,7 +57,7 @@ test_nctypelen() nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/rec.c b/mfhdf/nctest/rec.c index b7877294f8..787d7a4c31 100644 --- a/mfhdf/nctest/rec.c +++ b/mfhdf/nctest/rec.c @@ -129,7 +129,7 @@ test_ncrecinq(char *path) long trvarsizes[VARS]; /* true rec size of each record variable */ int iv; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((ncid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -203,9 +203,9 @@ test_ncrecinq(char *path) } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -320,7 +320,7 @@ test_ncrecput(char *path) nc_type vartype[VARS]; void *zeros[VARS]; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((ncid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -445,9 +445,9 @@ test_ncrecput(char *path) } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -475,7 +475,7 @@ test_ncrecget(char *path) nc_type vartype[VARS]; void *zeros[VARS]; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((ncid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -577,7 +577,7 @@ test_ncrecget(char *path) } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/val.c b/mfhdf/nctest/val.c index 24e6dc28f9..91c7b8cda4 100644 --- a/mfhdf/nctest/val.c +++ b/mfhdf/nctest/val.c @@ -211,33 +211,33 @@ val_out(nc_type type, long len, void *vals) double *dp; } gp; - (void)fprintf(stderr, " "); + fprintf(stderr, " "); switch (type) { case NC_BYTE: case NC_CHAR: gp.cp = (char *)vals; for (iel = 0; iel < len; iel++) - (void)fprintf(stderr, "%d%s", *gp.cp++, iel < len - 1 ? ", " : ""); + fprintf(stderr, "%d%s", *gp.cp++, iel < len - 1 ? ", " : ""); break; case NC_SHORT: gp.sp = (short *)vals; for (iel = 0; iel < len; iel++) - (void)fprintf(stderr, "%d%s", *gp.sp++, iel < len - 1 ? ", " : ""); + fprintf(stderr, "%d%s", *gp.sp++, iel < len - 1 ? ", " : ""); break; case NC_LONG: gp.lp = (nclong *)vals; for (iel = 0; iel < len; iel++) - (void)fprintf(stderr, "%d%s", (int)*gp.lp++, iel < len - 1 ? ", " : ""); + fprintf(stderr, "%d%s", (int)*gp.lp++, iel < len - 1 ? ", " : ""); break; case NC_FLOAT: gp.fp = (float *)vals; for (iel = 0; iel < len; iel++) - (void)fprintf(stderr, "%g%s", (double)*gp.fp++, iel < len - 1 ? ", " : ""); + fprintf(stderr, "%g%s", (double)*gp.fp++, iel < len - 1 ? ", " : ""); break; case NC_DOUBLE: gp.dp = (double *)vals; for (iel = 0; iel < len; iel++) - (void)fprintf(stderr, "%g%s", *gp.dp++, iel < len - 1 ? ", " : ""); + fprintf(stderr, "%g%s", *gp.dp++, iel < len - 1 ? ", " : ""); break; default: error("%s: bad type, test program error", pname); diff --git a/mfhdf/nctest/vardef.c b/mfhdf/nctest/vardef.c index 6f8c14e3da..045e3a4384 100644 --- a/mfhdf/nctest/vardef.c +++ b/mfhdf/nctest/vardef.c @@ -59,7 +59,7 @@ test_ncvardef(char *path) int nd = LEN_OF(di); /* number of dimensions */ int di_id[LEN_OF(di)]; /* dimension ids */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -272,7 +272,7 @@ test_ncvardef(char *path) for (iv = 0; iv < nv; iv++) free(va[iv].dims); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/varget.c b/mfhdf/nctest/varget.c index b9000871e4..656afab2a5 100644 --- a/mfhdf/nctest/varget.c +++ b/mfhdf/nctest/varget.c @@ -42,7 +42,7 @@ test_ncvarget(char *path) void *vals; /* pointer to block of values */ } hc; /* test hypercube */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -143,7 +143,7 @@ test_ncvarget(char *path) } free(hc.vals); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/varget_unlim.c b/mfhdf/nctest/varget_unlim.c index 7a39eed7d7..21eefba3c7 100644 --- a/mfhdf/nctest/varget_unlim.c +++ b/mfhdf/nctest/varget_unlim.c @@ -50,7 +50,7 @@ test_ncvarget_unlim(char *basefile) long start[3], count[3]; int i, j, n; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if (srcdir) { strcpy(testfile, srcdir); @@ -156,7 +156,7 @@ test_ncvarget_unlim(char *basefile) status = ncclose(ncid); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/vargetg.c b/mfhdf/nctest/vargetg.c index 4ad5177f42..f004b0a9c4 100644 --- a/mfhdf/nctest/vargetg.c +++ b/mfhdf/nctest/vargetg.c @@ -44,7 +44,7 @@ test_ncvargetg(char *path) } hc; /* test hypercube */ long strides[H4_MAX_VAR_DIMS]; /* external, I/O strides */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -149,7 +149,7 @@ test_ncvargetg(char *path) } free(hc.vals); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/varput.c b/mfhdf/nctest/varput.c index f7a091fd56..e2e5fd05dc 100644 --- a/mfhdf/nctest/varput.c +++ b/mfhdf/nctest/varput.c @@ -45,7 +45,7 @@ test_ncvarput(char *path) int tmp; int id; /* dimension id */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); /* handle case where struct netcdf test is uninitialised */ hc.cor[0] = 0; @@ -150,7 +150,7 @@ test_ncvarput(char *path) } free(hc.vals); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/varputg.c b/mfhdf/nctest/varputg.c index 713f2b5cba..4a870bfd57 100644 --- a/mfhdf/nctest/varputg.c +++ b/mfhdf/nctest/varputg.c @@ -47,7 +47,7 @@ test_ncvarputg(char *path) int id; /* dimension id */ long strides[H4_MAX_VAR_DIMS]; /* external, I/O strides */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -153,7 +153,7 @@ test_ncvarputg(char *path) } free(hc.vals); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/vartests.c b/mfhdf/nctest/vartests.c index 336eaeee09..2d34a752e5 100644 --- a/mfhdf/nctest/vartests.c +++ b/mfhdf/nctest/vartests.c @@ -42,7 +42,7 @@ test_ncvarid(char *path) static struct cdfvar xx = /* variable */ {"xx", NC_FLOAT, 1, ___, 0}; - (void)fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -98,9 +98,9 @@ test_ncvarid(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -121,7 +121,7 @@ test_ncvarinq(char *path) struct cdfvar var; /* variable */ int idim; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -223,9 +223,9 @@ test_ncvarinq(char *path) free(var.dims); free(var.name); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } struct cdfelm { /* coordinates and generic value */ @@ -381,7 +381,7 @@ test_ncvarput1(char *path) int iv; /* variable id */ struct cdfelm elm; /* coordinates and value of test point */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -448,9 +448,9 @@ test_ncvarput1(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -472,7 +472,7 @@ test_ncvarget1(char *path) int iv; /* variable id */ struct cdfelm elm; /* coordinates and value of test point */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -539,9 +539,9 @@ test_ncvarget1(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -569,7 +569,7 @@ test_ncvarrename(char *path) static struct cdfvar zz = /* variable */ {"zz", NC_BYTE, 2, ___, 0}; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -670,7 +670,7 @@ test_ncvarrename(char *path) free(var.name); free(var.dims); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/vputget.c b/mfhdf/nctest/vputget.c index 0fadd48228..43b985f8bc 100644 --- a/mfhdf/nctest/vputget.c +++ b/mfhdf/nctest/vputget.c @@ -91,16 +91,16 @@ test_varputget(int cdfid) error("%s: ncvarput failed for point %d, variable %s", pname, ie, test_g->vars[iv].name); nerrs++; errvar(test_g, &test_g->vars[iv]); - (void)fprintf(stderr, " corner = ("); + fprintf(stderr, " corner = ("); for (id = 0; id < test_g->vars[iv].ndims; id++) - (void)fprintf(stderr, "%d%s", (int)hc[ie].cor[id], - (id < test_g->vars[iv].ndims - 1) ? ", " : ""); - (void)fprintf(stderr, ")\n"); - (void)fprintf(stderr, " edge = ("); + fprintf(stderr, "%d%s", (int)hc[ie].cor[id], + (id < test_g->vars[iv].ndims - 1) ? ", " : ""); + fprintf(stderr, ")\n"); + fprintf(stderr, " edge = ("); for (id = 0; id < test_g->vars[iv].ndims; id++) - (void)fprintf(stderr, "%d%s", (int)hc[ie].edg[id], - (id < test_g->vars[iv].ndims - 1) ? ", " : ""); - (void)fprintf(stderr, ")\n"); + fprintf(stderr, "%d%s", (int)hc[ie].edg[id], + (id < test_g->vars[iv].ndims - 1) ? ", " : ""); + fprintf(stderr, ")\n"); } else { add_data(test_g, iv, hc[ie].cor, hc[ie].edg); /* keep test in sync */ diff --git a/mfhdf/nctest/vputgetg.c b/mfhdf/nctest/vputgetg.c index 0a54331cf9..9fdb270e9d 100644 --- a/mfhdf/nctest/vputgetg.c +++ b/mfhdf/nctest/vputgetg.c @@ -116,26 +116,24 @@ test_varputgetg(int cdfid) error("%s: ncvarputg failed for point %d, variable %s", pname, ie, test_g->vars[iv].name); nerrs++; errvar(test_g, &test_g->vars[iv]); - (void)fprintf(stderr, " corner = ("); + fprintf(stderr, " corner = ("); for (id = 0; id < test_g->vars[iv].ndims; id++) - (void)fprintf(stderr, "%d%s", (int)hc[ie].cor[id], - (id < test_g->vars[iv].ndims - 1) ? ", " : ""); - (void)fprintf(stderr, ")\n"); - (void)fprintf(stderr, " edge = ("); + fprintf(stderr, "%d%s", (int)hc[ie].cor[id], + (id < test_g->vars[iv].ndims - 1) ? ", " : ""); + fprintf(stderr, ")\n"); + fprintf(stderr, " edge = ("); for (id = 0; id < test_g->vars[iv].ndims; id++) - (void)fprintf(stderr, "%d%s", (int)hc[ie].edg[id], - (id < test_g->vars[iv].ndims - 1) ? ", " : ""); - (void)fprintf(stderr, ")\n"); - (void)fprintf(stderr, " external strides = ("); + fprintf(stderr, "%d%s", (int)hc[ie].edg[id], + (id < test_g->vars[iv].ndims - 1) ? ", " : ""); + fprintf(stderr, ")\n"); + fprintf(stderr, " external strides = ("); for (id = 0; id < test_g->vars[iv].ndims; id++) - (void)fprintf(stderr, "%d%s", (int)strides[id], - (id < test_g->vars[iv].ndims - 1) ? ", " : ""); - (void)fprintf(stderr, ")\n"); - (void)fprintf(stderr, " internal basis vector = ("); + fprintf(stderr, "%d%s", (int)strides[id], (id < test_g->vars[iv].ndims - 1) ? ", " : ""); + fprintf(stderr, ")\n"); + fprintf(stderr, " internal basis vector = ("); for (id = 0; id < test_g->vars[iv].ndims; id++) - (void)fprintf(stderr, "%d%s", (int)basis[id], - (id < test_g->vars[iv].ndims - 1) ? ", " : ""); - (void)fprintf(stderr, ")\n"); + fprintf(stderr, "%d%s", (int)basis[id], (id < test_g->vars[iv].ndims - 1) ? ", " : ""); + fprintf(stderr, ")\n"); } else { long dsize[H4_MAX_VAR_DIMS]; diff --git a/mfhdf/test/CMakeLists.txt b/mfhdf/test/CMakeLists.txt index 417a1d04a6..b9dc5e7722 100644 --- a/mfhdf/test/CMakeLists.txt +++ b/mfhdf/test/CMakeLists.txt @@ -1,6 +1,12 @@ cmake_minimum_required (VERSION 3.12) project (HDF4_MFHDF_TEST C) +#----------------------------------------------------------------------------- +# Generate the srcdir_str.h file +#----------------------------------------------------------------------------- +set (srcdir ${HDF4_MFHDF_TEST_SOURCE_DIR}) +configure_file (${HDF4_MFHDF_TEST_SOURCE_DIR}/srcdir_str.h.in srcdir_str.h @ONLY) + set (hdftest_SRCS ${HDF4_MFHDF_TEST_SOURCE_DIR}/hdftest.c ${HDF4_MFHDF_TEST_SOURCE_DIR}/tchunk.c @@ -25,7 +31,7 @@ set (hdftest_SRCS #-- Adding test for hdftest add_executable (hdftest ${hdftest_SRCS}) -target_include_directories(hdftest PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") +target_include_directories(hdftest PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR};${CMAKE_CURRENT_BINARY_DIR}") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (hdftest STATIC) target_link_libraries (hdftest PRIVATE ${HDF4_MF_LIB_TARGET}) diff --git a/mfhdf/test/cdftest.c b/mfhdf/test/cdftest.c index 80957e0ff2..e63ef150ce 100644 --- a/mfhdf/test/cdftest.c +++ b/mfhdf/test/cdftest.c @@ -600,7 +600,7 @@ main(void) cdf_assert(ncvarget1(id, Byte_id, indices[6], (ncvoid *)&got) != -1); printf("got val = %c (0x%02x) \n", got.by[0], got.by[0]); - /* (void)memset(new,0,256) ; */ + /* memset(new,0,256) ; */ { char *cp = new; for (; cp < &new[sizeof(new) - 1]; *cp++ = 0) diff --git a/mfhdf/test/hdftest.h b/mfhdf/test/hdftest.h index b347739cef..fd71d11944 100644 --- a/mfhdf/test/hdftest.h +++ b/mfhdf/test/hdftest.h @@ -101,12 +101,15 @@ /*************************** Utility Functions ***************************/ +/* Just return the srcdir path */ +const char *get_srcdir(void); + +/* Append the test file name to the srcdir path and return the whole string */ +const char *get_srcdir_filename(const char *filename); + /* Generates the correct name of the source path */ intn make_sourcepath(char *src_path, unsigned int size); -/* Generates the correct name for the test file */ -intn make_datafilename(const char *basename, char *testfile, unsigned int size); - /* Calls SDcreate, SDwritedata, and SDendaccess */ int32 make_SDS(int32 sd_id, char *sds_name, int32 type, int32 rank, int32 *dim_sizes, int32 unlim_dim, void *written_data); diff --git a/mfhdf/test/srcdir_str.h.in b/mfhdf/test/srcdir_str.h.in new file mode 100644 index 0000000000..067a2280ad --- /dev/null +++ b/mfhdf/test/srcdir_str.h.in @@ -0,0 +1,19 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF. The full HDF copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* If you are reading this file and it has a '.h' suffix, it was automatically + * generated from the '.in' version. Make changes there. + */ + +/* Set the 'srcdir' path from configure time */ +static const char *config_srcdir = "@srcdir@"; + diff --git a/mfhdf/test/tdatainfo.c b/mfhdf/test/tdatainfo.c index fa8937c8d1..77f6464e45 100644 --- a/mfhdf/test/tdatainfo.c +++ b/mfhdf/test/tdatainfo.c @@ -27,7 +27,7 @@ #include #include -#include "hdfi.h" +#include "hdf_priv.h" #include "mfhdf.h" #ifdef H4_HAVE_FCNTL_H diff --git a/mfhdf/test/texternal.c b/mfhdf/test/texternal.c index 6466fc5756..1b4b075d64 100644 --- a/mfhdf/test/texternal.c +++ b/mfhdf/test/texternal.c @@ -15,7 +15,7 @@ #include /* Need to pick up H4_HAVE_SYS_STAT_H from mfhdf.h */ -#include "hdfi.h" +#include "hdf_priv.h" #include "mfhdf.h" #ifdef H4_HAVE_UNISTD_H @@ -728,7 +728,7 @@ test_change_extdir(void) intn num_errs = 0; /* number of errors in compression test so far */ status = make_sourcepath(dir_name, MAX_PATH_LEN); - CHECK(status, FAIL, "make_datafilename"); + CHECK(status, FAIL, "make_sourcepath"); /* When srcdir is not available, make up a directory to create the external file to cause subsequent reads to look outside of the current directory */ @@ -889,7 +889,7 @@ test_HDFFR_1609(void) intn num_errs = 0; /* number of errors in compression test so far */ status = make_sourcepath(dir_name, MAX_PATH_LEN); - CHECK(status, FAIL, "make_datafilename"); + CHECK(status, FAIL, "make_sourcepath"); /* When srcdir is not available, make up a directory to create the external file to cause subsequent reads to look outside of the current directory */ diff --git a/mfhdf/test/tfile.c b/mfhdf/test/tfile.c index 973683e98c..72b1a4204b 100644 --- a/mfhdf/test/tfile.c +++ b/mfhdf/test/tfile.c @@ -14,7 +14,7 @@ #include "mfhdf.h" #include "hdftest.h" -#include "local_nc.h" +#include "nc_priv.h" /******************************************************************** Name: test_file_inuse() - tests preventing of an in-use file being @@ -375,16 +375,13 @@ test_longfilename() static int test_fileformat() { - int32 fid; /* file id */ - intn ishdf = 0; /* true if file has HDF format */ - intn isnetcdf = 0; /* true if file has classic netCDF format */ - intn isnetcdf64 = 0; /* true if file has 64-bit netCDF format */ - intn num_errs = 0; /* number of errors so far */ - char testfile[512] = ""; - const char *hdf_basename = "hdffile.hdf"; /* hdf file to test */ - const char *netcdf1_basename = "Roy.nc"; /* classic netCDF file to test */ - const char *netcdf2_basename = "Roy-64.nc"; /* netCDF 64-bit file to test */ - intn status = 0; /* status returned by called functions */ + int32 fid; /* file id */ + intn ishdf = 0; /* true if file has HDF format */ + intn isnetcdf = 0; /* true if file has classic netCDF format */ + intn isnetcdf64 = 0; /* true if file has 64-bit netCDF format */ + intn num_errs = 0; /* number of errors so far */ + const char *hdf_basename = "hdffile.hdf"; /* hdf file to test */ + intn status = 0; /* status returned by called functions */ /* Create an empty HDF file to test Hishdf. */ fid = SDstart(hdf_basename, DFACC_CREATE); @@ -400,27 +397,31 @@ test_fileformat() isnetcdf64 = HDisnetcdf64(hdf_basename); VERIFY(isnetcdf64, FALSE, "test_fileformat: HDisnetcdf64"); - /* Make the name of the classic netCDF file */ - make_datafilename(netcdf1_basename, testfile, sizeof(testfile)); + /* Test a classic netCDF file */ + { + const char *netcdf_filename = get_srcdir_filename("Roy.nc"); - /* Verify that this is not an HDF file */ - ishdf = Hishdf(testfile); - VERIFY(ishdf, FALSE, "test_fileformat: Hishdf"); + /* Verify that this is not an HDF file */ + ishdf = Hishdf(netcdf_filename); + VERIFY(ishdf, FALSE, "test_fileformat: Hishdf"); - /* Verify that this is a classic netCDF file */ - isnetcdf = HDisnetcdf(testfile); - VERIFY(isnetcdf, TRUE, "test_fileformat: HDisnetcdf"); + /* Verify that this is a classic netCDF file */ + isnetcdf = HDisnetcdf(netcdf_filename); + VERIFY(isnetcdf, TRUE, "test_fileformat: HDisnetcdf"); + } - /* Make the name of the netCDF 64-bit file */ - make_datafilename(netcdf2_basename, testfile, sizeof(testfile)); + /* Test a 64-bit netCDF file */ + { + const char *netcdf_filename = get_srcdir_filename("Roy-64.nc"); - /* Verify that this is a netCDF 64-bit file */ - isnetcdf64 = HDisnetcdf64(testfile); - VERIFY(isnetcdf64, TRUE, "test_fileformat: HDisnetcdf64"); + /* Verify that this is a netCDF 64-bit file */ + isnetcdf64 = HDisnetcdf64(netcdf_filename); + VERIFY(isnetcdf64, TRUE, "test_fileformat: HDisnetcdf64"); - /* Verify that this is not a classic netCDF file */ - isnetcdf = HDisnetcdf(testfile); - VERIFY(isnetcdf, FALSE, "test_fileformat: HDisnetcdf"); + /* Verify that this is not a classic netCDF file */ + isnetcdf = HDisnetcdf(netcdf_filename); + VERIFY(isnetcdf, FALSE, "test_fileformat: HDisnetcdf"); + } return num_errs; } diff --git a/mfhdf/test/tncunlim.c b/mfhdf/test/tncunlim.c index 206f661dbc..627cf225d7 100644 --- a/mfhdf/test/tncunlim.c +++ b/mfhdf/test/tncunlim.c @@ -141,7 +141,7 @@ test_1dim_singlevar() long start[] = {0}; long edges[1]; edges[0] = dimsize; - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -174,7 +174,7 @@ test_1dim_singlevar() long start[] = {0}; long edges[1]; edges[0] = dimsize; - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -404,7 +404,7 @@ test_1dim_multivars() long start[] = {0}; long edges[1]; edges[0] = dimsize; - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); /* Read and verify data of Variable 1 */ status = ncvarget(ncid, varid1, start, edges, outdata); @@ -421,7 +421,7 @@ test_1dim_multivars() /* Read and verify data of Variable 2 */ edges[0] = 2; /* only reading what written to this variable so far */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid2, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -437,7 +437,7 @@ test_1dim_multivars() /* Try to read again but up to the max number of records, 4 in this case because the other variable in the file has 4 elements written */ edges[0] = dimsize; - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid2, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -482,7 +482,7 @@ test_1dim_multivars() /* Read and verify data of Variable 1 */ /* read data should be: 300 301 302 303 400 401 */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid1, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -497,7 +497,7 @@ test_1dim_multivars() /* Read and verify data of Variable 2 */ /* read data should be: 102 104 -2 -2 -2 -2 */ edges[0] = 2; - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid2, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -534,7 +534,7 @@ test_1dim_multivars() /* Read and verify data of Variable 1 */ /* read data should be: 300 301 302 303 400 401 -1 */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid1, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -548,7 +548,7 @@ test_1dim_multivars() /* Read and verify data of Variable 1 */ /* read data should be: 102 104 -2 -2 200 201 202 */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid2, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -588,7 +588,7 @@ test_1dim_multivars() /* Read and verify data of Variable 1; read data should be: */ /* 300 301 302 303 400 401 -1 -1 -1 -1 -1 -1 500 501 502 */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid1, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -602,7 +602,7 @@ test_1dim_multivars() /* Read and verify data of Variable 2; read data should be: */ /* 102 104 -2 -2 200 201 202 -2 -2 -2 -2 -2 -2 -2 -2 */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid2, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -615,7 +615,7 @@ test_1dim_multivars() } } /* end read data */ -#if NOTRUN +#if 0 /* The following test is to verify that attempting to read pass the maximum number of records in the file will fail. However, because ncvarget leads to the internal function NCcoordck which uses NCadvise to display the diff --git a/mfhdf/test/tncvargetfill.c b/mfhdf/test/tncvargetfill.c index af1e03b050..975c4c3b29 100644 --- a/mfhdf/test/tncvargetfill.c +++ b/mfhdf/test/tncvargetfill.c @@ -166,8 +166,6 @@ test_1dim_multivars() /* result data to compare against read data */ int16 sdresult1[] = {300, 301, 302, 303, -1, -1, 306, 307}; int16 sdresult2[] = {102, 104}; - int16 ncresult1[] = {300, 301, 302, 303, -1, -1, 306, 307}; /* same as sd result */ - int16 ncresult2[] = {102, 104, -2, -2, -2, -2, -2, -2}; /* Create a new file */ fid = SDstart(FILENAME1, DFACC_CREATE); @@ -678,9 +676,6 @@ test_readings(long max_numrecs) /* data resulted from reading at start=[4,0,0] for edges=[6,1,1] */ int16 result3D_start400_edge611[6] = {-3, -3, -3, 800, -3, -3}; - /* data resulted from reading at start=[4] for edges=[6] */ - int16 result1D_start4_edge6[] = {302, 303, -1, -1, -1, -1}; - /* Open the file for reading and writing with nc API */ ncid = ncopen(FILENAME2, NC_RDWR); CHECK(ncid, -1, "ncopen"); diff --git a/mfhdf/test/tnetcdf.c b/mfhdf/test/tnetcdf.c index d34207a9c4..cf097efb15 100644 --- a/mfhdf/test/tnetcdf.c +++ b/mfhdf/test/tnetcdf.c @@ -50,33 +50,13 @@ static intn test_read_dim() { - int32 fid, sds_id, status, dim1_id; - int32 dim_sizes[H4_MAX_VAR_DIMS]; /* read dimensions */ - int32 array_rank, num_type, attributes; - char dim_name[H4_MAX_NC_NAME], name[H4_MAX_NC_NAME]; - int32 size, dim_data_type, dim_num_attrs; - char testfile[512] = ""; - intn num_errs = 0; /* number of errors so far */ - - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(NC_FILE) + 1) < sizeof(testfile))) { - strcpy(testfile, srcdir); - strcat(testfile, "/"); - } - - /* Windows doesn't set srcdir, and generates files in a different relative - path, so we need to special case here. It is best to look for the - testfile in the same path, and the Windows test script will make sure - to put it there first. - SJW 2007/09/19 */ -#if !defined _WIN32 - /* This is to get to the file when the library was built without - srcdir option and the test is ran by ./hdftest in the src directory - hdf4/mfhdf/libsrc instead of by make check. - BMR 2007/08/09 */ - if (srcdir == NULL) - strcpy(testfile, "./"); -#endif /* _WIN32 */ - - strcat(testfile, NC_FILE); + int32 fid, sds_id, status, dim1_id; + int32 dim_sizes[H4_MAX_VAR_DIMS]; /* read dimensions */ + int32 array_rank, num_type, attributes; + char dim_name[H4_MAX_NC_NAME], name[H4_MAX_NC_NAME]; + int32 size, dim_data_type, dim_num_attrs; + intn num_errs = 0; /* number of errors so far */ + const char *testfile = get_srcdir_filename(NC_FILE); /* Create the file defined by BASIC_FILE and initiate the SD interface. */ fid = SDstart(testfile, DFACC_READ); @@ -142,33 +122,12 @@ test_netcdf_reading() char name[H4_MAX_NC_NAME]; int32 status; intn i, j; - intn num_errs = 0; /* number of errors so far */ - const char *basename = "test1.nc"; - char testfile[512] = ""; + intn num_errs = 0; /* number of errors so far */ + const char *testfile = get_srcdir_filename("test1.nc"); /* Output message about test being performed */ TESTING("reading of netCDF file using the SDxxx interface (tnetcdf.c)"); - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(basename) + 1) < sizeof(testfile))) { - strcpy(testfile, srcdir); - strcat(testfile, "/"); - } - - /* Windows doesn't set srcdir, and generates files in a different relative - path, so we need to special case here. It is best to look for the - testfile in the same path, and the Windows test script will make sure - to put it there first. - SJW 2007/09/19 */ -#if !defined _WIN32 - /* This is to get to the file 'test1.nc' when the library was built without - srcdir option and the test is ran by ./hdftest in the src directory - hdf4/mfhdf/libsrc instead of by make check. - BMR 2007/08/09 */ - if (srcdir == NULL) - strcpy(testfile, "./"); -#endif /* _WIN32 */ - - strcat(testfile, basename); - /* Open the file 'test1.nc' and initialize the SD interface. */ sd_id = SDstart(testfile, DFACC_RDONLY); CHECK(sd_id, FAIL, "netCDF Read Test 1. SDstart failed on file test1.nc"); diff --git a/mfhdf/test/tsd.c b/mfhdf/test/tsd.c index c3a14a838d..0ceac18e3e 100644 --- a/mfhdf/test/tsd.c +++ b/mfhdf/test/tsd.c @@ -18,7 +18,7 @@ #include "mfhdf.h" #include "hdftest.h" -#include "hfile.h" +#include "hfile_priv.h" #define FILE_NAME "sdtest.hdf" /* data file to test ID types */ diff --git a/mfhdf/test/tszip.c b/mfhdf/test/tszip.c index bacf978108..04c9b3bc92 100644 --- a/mfhdf/test/tszip.c +++ b/mfhdf/test/tszip.c @@ -834,8 +834,8 @@ test_szip_chunk() for (j = 0; j < CLENGTH; j++) { for (i = 0; i < CWIDTH; i++) { if (chunk_out[j][i] != chunk4[j][i]) { - fprintf(stderr, "Bogus val in loc [%d][%d] in chunk #4, want %ld got %ld\n", j, i, - chunk4[j][i], chunk_out[j][i]); + fprintf(stderr, "Bogus val in loc [%d][%d] in chunk #4, want %d got %d\n", j, i, chunk4[j][i], + chunk_out[j][i]); num_errs++; } } @@ -852,8 +852,8 @@ test_szip_chunk() for (j = 0; j < CLENGTH; j++) { for (i = 0; i < CWIDTH; i++) if (chunk_out[j][i] != chunk5[j][i]) { - fprintf(stderr, "Bogus val in loc [%d][%d] in chunk #5, want %ld got %ld\n", j, i, - chunk5[j][i], chunk_out[j][i]); + fprintf(stderr, "Bogus val in loc [%d][%d] in chunk #5, want %d got %d\n", j, i, chunk5[j][i], + chunk_out[j][i]); num_errs++; } } @@ -885,9 +885,6 @@ test_szip_chunk() #define CHK_DIM1 2 /* second dimension of the chunk */ #define CHK_DIM2 2 /* third dimension of the chunk */ -int16 all_data[SDS_DIM0][SDS_DIM1][SDS_DIM2]; -int16 out_data[SDS_DIM0][SDS_DIM1][SDS_DIM2]; - static intn test_szip_chunk_3d() { @@ -903,8 +900,11 @@ test_szip_chunk_3d() int16 fill_value = 0; /* Fill value */ comp_coder_t comp_type; /* to retrieve compression type into */ comp_info cinfo; /* compression information structure */ - int num_errs = 0; /* number of errors so far */ - int i, j, k; + int16 all_data[SDS_DIM0][SDS_DIM1][SDS_DIM2]; + int16 out_data[SDS_DIM0][SDS_DIM1][SDS_DIM2]; + + int num_errs = 0; /* number of errors so far */ + int i, j, k; for (i = 0; i < SDS_DIM0; i++) { for (j = 0; j < SDS_DIM1; j++) { @@ -1024,7 +1024,7 @@ test_szip_chunk_3d() for (j = 0; j < SDS_DIM1; j++) { for (k = 0; k < SDS_DIM2; k++) { if (out_data[i][j][k] != all_data[i][j][k]) { - fprintf(stderr, "Bogus val in loc [%d][%d][%d] want %ld got %ld\n", i, j, k, + fprintf(stderr, "Bogus val in loc [%d][%d][%d] want %d got %d\n", i, j, k, out_data[i][j][k], all_data[i][j][k]); num_errs++; } @@ -1215,18 +1215,14 @@ test_getszipinfo() int32 attributes = -1; char name[H4_MAX_NC_NAME]; comp_coder_t comp_type; - int32 comp_size = -1; - int32 uncomp_size = -1; - int32 orig_size = -1; - int num_errs = 0; /* number of errors so far */ - char testfile[512] = ""; - const char *basename = "sds_szipped.dat"; + int32 comp_size = -1; + int32 uncomp_size = -1; + int32 orig_size = -1; + int num_errs = 0; /* number of errors so far */ + const char *testfile = get_srcdir_filename("sds_szipped.dat"); /********************* End of variable declaration ***********************/ - /* Make the name for the test file */ - make_datafilename(basename, testfile, sizeof(testfile)); - /* Open the file and select dataset SDS1_NAME */ sd_id = SDstart(testfile, DFACC_RDONLY); CHECK(sd_id, FAIL, "SDstart"); @@ -1314,8 +1310,7 @@ test_getszipdata() int i, j; int num_errs = 0; /* number of errors so far */ int32 out_data[SZ_LENGTH][SZ_WIDTH]; - char testfile[512] = ""; - const char *basename = "sds_szipped.dat"; + const char *testfile = get_srcdir_filename("sds_szipped.dat"); /* data to compare against read data from sds_szipped.dat */ int32 in_data[SZ_LENGTH][SZ_WIDTH] = { @@ -1328,9 +1323,6 @@ test_getszipdata() /********************* End of variable declaration ***********************/ - /* Make the name for the test file */ - make_datafilename(basename, testfile, sizeof(testfile)); - /* Open the file */ sd_id = SDstart(testfile, DFACC_READ); CHECK(sd_id, FAIL, "SDstart"); diff --git a/mfhdf/test/tutils.c b/mfhdf/test/tutils.c index f55764a7bb..439541d892 100644 --- a/mfhdf/test/tutils.c +++ b/mfhdf/test/tutils.c @@ -15,8 +15,69 @@ #include #include "mfhdf.h" - #include "hdftest.h" +#include "srcdir_str.h" + +/* Buffer to construct path in and return pointer to */ +static char srcdir_path[1024]; + +/* Buffer to construct file in and return pointer to */ +static char srcdir_testpath[1024]; + +/*------------------------------------------------------------------------- + * Function: get_srcdir_filename + * + * Purpose: Append the test file name to the srcdir path and return the whole string + * + * Return: The string or NULL (errors or not enough space) + * + *------------------------------------------------------------------------- + */ +const char * +get_srcdir_filename(const char *filename) +{ + const char *srcdir = get_srcdir(); + + /* Check for error */ + if (NULL == srcdir) + return NULL; + + /* Build path to test file */ + if ((strlen(srcdir) + strlen(filename) + 1) < sizeof(srcdir_testpath)) { + snprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s/%s", srcdir, filename); + return srcdir_testpath; + } + + /* If not enough space, just return NULL */ + return NULL; +} /* end get_srcdir_filename() */ + +/*------------------------------------------------------------------------- + * Function: get_srcdir + * + * Purpose: Just return the srcdir path + * + * Return: The string + * + *------------------------------------------------------------------------- + */ +const char * +get_srcdir(void) +{ + const char *srcdir = getenv("srcdir"); + + /* Check for using the srcdir from configure time */ + if (NULL == srcdir) + srcdir = config_srcdir; + + /* Build path to all test files */ + if ((strlen(srcdir) + 2) < sizeof(srcdir_path)) { + snprintf(srcdir_path, sizeof(srcdir_path), "%s/", srcdir); + return (srcdir_path); + } + else + return NULL; +} /* end get_srcdir() */ /******************************************************************** Name: make_sourcepath() - Generates the source path @@ -34,7 +95,7 @@ make_sourcepath(char *src_path, unsigned int size) char *tempdir = NULL; tempdir = (char *)malloc(size * sizeof(char)); - CHECK_ALLOC(tempdir, "tempdir", "make_datafilename"); + CHECK_ALLOC(tempdir, "tempdir", "make_sourcepath"); memset(tempdir, 0, size); /* Generate the source path */ @@ -57,41 +118,6 @@ make_sourcepath(char *src_path, unsigned int size) return SUCCEED; } -/******************************************************************** - Name: make_datafilename() - Generates the correct name for the test file. - Description: - Generate the correct name for the test file by prepending the source - path if it exists, otherwise, assume it is the local directory. - Return value: - Returns SUCCEED if the file name is generated successfully, or - FAIL, otherwise. -*********************************************************************/ -intn -make_datafilename(const char *basename, char *testfile, unsigned int size) -{ - char *srcdir = getenv("srcdir"); - char *tempfile = NULL; - - /* Leave room for the file name and null char */ - unsigned int max_dir_len = size - strlen(basename) - 1; - - tempfile = (char *)malloc(size * sizeof(char)); - CHECK_ALLOC(tempfile, "tempfile", "make_datafilename"); - - if (make_sourcepath(tempfile, max_dir_len) == FAIL) { - free(tempfile); - return FAIL; - } - - /* Name of data file */ - strcat(tempfile, basename); - - /* File name is generated, return it */ - strcpy(testfile, tempfile); - free(tempfile); - return SUCCEED; -} - /******************************************************************** Name: make_SDS() - Creates and writes a 3-D unlimited SDS. Description: diff --git a/mfhdf/util/h4getopt.c b/mfhdf/util/h4getopt.c index 2312856841..805e682994 100644 --- a/mfhdf/util/h4getopt.c +++ b/mfhdf/util/h4getopt.c @@ -84,7 +84,7 @@ h4getopt(int argc, char *const argv[], const char *optstring) if (*place == 0) ++h4optind; if (h4opterr && *optstring != ':') - (void)fprintf(stderr, "unknown option -- %c\n", h4optopt); + fprintf(stderr, "unknown option -- %c\n", h4optopt); return BADCH; } @@ -108,7 +108,7 @@ h4getopt(int argc, char *const argv[], const char *optstring) if (*optstring == ':') return BADARG; if (h4opterr) - (void)fprintf(stderr, "option requires an argument -- %c\n", h4optopt); + fprintf(stderr, "option requires an argument -- %c\n", h4optopt); return BADCH; } place = EMSG; diff --git a/release_notes/INSTALL_CMake.txt b/release_notes/INSTALL_CMake.txt index 2ab720c7d5..29319d176d 100644 --- a/release_notes/INSTALL_CMake.txt +++ b/release_notes/INSTALL_CMake.txt @@ -692,6 +692,7 @@ HDF4_BUILD_UTILS "Build HDF4 Utilities" OFF HDF4_ENABLE_NETCDF "Build HDF4 versions of NetCDF-3 APIS" ON HDF4_BUILD_JAVA "Build Java HDF Library" OFF HDF4_BUILD_NETCDF_TOOLS "Build HDF4 versions of ncdump and ncgen" ON +HDF4_BUILD_STATIC_TOOLS "Build Static Tools Not Shared Tools" OFF ---------------- HDF4 Folder Build Options --------------------- Defaults relative to $ diff --git a/release_notes/RELEASE.txt b/release_notes/RELEASE.txt index 932d86cd1d..9667e7a884 100644 --- a/release_notes/RELEASE.txt +++ b/release_notes/RELEASE.txt @@ -39,6 +39,13 @@ New features and changes ======================== Configuration: ------------- + - New option for building and naming tools in CMake + + The following option has been added: + HDF4_BUILD_STATIC_TOOLS "Build Static Tools Not Shared Tools" OFF + + The default will build shared tools unless BUILD_SHARED_LIBS = OFF. + - XDR changes We now only support building HDF4 with the XDR implementation packaged @@ -124,7 +131,40 @@ New features and changes C Library: ---------- - hdfi.h is no longer included by hdf.h + - Private headers are no longer deployed + + The following private headers are not a part of the public API and + will no longer be deployed when installing the library: + + atom.h + bitvect.h + cdeflate.h + cnbit.h + cnone.h + crle.h + cskphuff.h + cszip.h + df.h + dfan.h + dfgr.h + dfrig.h + dfsd.h + dfufp2i.h + dynarray.h + hchunks.h + hcompi.h + hconv.h + hdfi.h + hfile.h + hkit.h + linklist.h + local_nc.h + mfani.h + mfgri.h + mstdio.h + tbbt.h + + - hdfi.h is no longer included by hdf.h In the past, hdfi.h (an internal header file) was included in the public hdf.h header. This is no longer the case. Anything that @@ -156,6 +196,16 @@ Support for new platforms and compilers Bugs fixed since HDF 4.2.16 =========================== + - Fix --with-szlib with no paths not detecting the encoder + + The --with-szlib option in the Autotools has been broken when used + without include/library paths for the past decade (git blame says 11 + years ago). A misnamed variable and a missing setting would skip + the encoder check, so the library could only be added in decode-only + mode. + + This has been fixed and szip encoding will now be detected normally. + - Fixed an external file bug introduced in 4.2.16 Fixing HDFFR-1607 introduced a bug where the flag that indicates whether