├── .codecov.yml ├── .github └── workflows │ ├── build.yml │ ├── build_freebsd.yml │ ├── build_ossfuzz.yml │ └── build_shared.yml ├── .gitignore ├── AUTHORS ├── COPYING ├── COPYING.LESSER ├── ChangeLog ├── Makefile.am ├── NEWS ├── README ├── acinclude.m4 ├── appveyor.yml ├── autogen.ps1 ├── autogen.sh ├── build.ps1 ├── common ├── Makefile.am ├── byte_stream.h ├── common.h ├── config_borlandc.h ├── config_msc.h ├── config_winapi.h ├── file_stream.h ├── memory.h ├── narrow_string.h ├── system_string.h ├── types.h.in └── wide_string.h ├── configure.ac ├── documentation ├── CUE sheet format.asciidoc └── Optical disc RAW format.asciidoc ├── dpkg ├── changelog.in ├── compat ├── control ├── copyright ├── libodraw-dev.install ├── libodraw-tools.install ├── libodraw.install ├── rules └── source │ └── format ├── include ├── Makefile.am ├── libodraw.h.in └── libodraw │ ├── codepage.h │ ├── definitions.h.in │ ├── error.h │ ├── extern.h │ ├── features.h.in │ └── types.h.in ├── libodraw.ini ├── libodraw.pc.in ├── libodraw.spec.in ├── libodraw ├── Makefile.am ├── libodraw.c ├── libodraw.rc.in ├── libodraw_codepage.h ├── libodraw_cue_parser.y ├── libodraw_cue_scanner.l ├── libodraw_data_file.c ├── libodraw_data_file.h ├── libodraw_data_file_descriptor.c ├── libodraw_data_file_descriptor.h ├── libodraw_debug.c ├── libodraw_debug.h ├── libodraw_definitions.h.in ├── libodraw_error.c ├── libodraw_error.h ├── libodraw_extern.h ├── libodraw_handle.c ├── libodraw_handle.h ├── libodraw_io_handle.c ├── libodraw_io_handle.h ├── libodraw_libbfio.h ├── libodraw_libcdata.h ├── libodraw_libcerror.h ├── libodraw_libclocale.h ├── libodraw_libcnotify.h ├── libodraw_libcpath.h ├── libodraw_libuna.h ├── libodraw_notify.c ├── libodraw_notify.h ├── libodraw_sector_range.c ├── libodraw_sector_range.h ├── libodraw_support.c ├── libodraw_support.h ├── libodraw_track_value.c ├── libodraw_track_value.h ├── libodraw_types.h └── libodraw_unused.h ├── m4 ├── common.m4 ├── libbfio.m4 ├── libcdata.m4 ├── libcerror.m4 ├── libcfile.m4 ├── libclocale.m4 ├── libcnotify.m4 ├── libcpath.m4 ├── libcrypto.m4 ├── libcsplit.m4 ├── libcthreads.m4 ├── libhmac.m4 ├── libuna.m4 ├── pthread.m4 ├── tests.m4 └── types.m4 ├── manuals ├── Makefile.am ├── libodraw.3 └── odrawinfo.1 ├── msvscpp ├── Makefile.am ├── libbfio │ └── libbfio.vcproj ├── libcdata │ └── libcdata.vcproj ├── libcerror │ └── libcerror.vcproj ├── libcfile │ └── libcfile.vcproj ├── libclocale │ └── libclocale.vcproj ├── libcnotify │ └── libcnotify.vcproj ├── libcpath │ └── libcpath.vcproj ├── libcsplit │ └── libcsplit.vcproj ├── libcthreads │ └── libcthreads.vcproj ├── libhmac │ └── libhmac.vcproj ├── libodraw.sln ├── libodraw │ └── libodraw.vcproj ├── libuna │ └── libuna.vcproj ├── odraw_test_cue_parser │ └── odraw_test_cue_parser.vcproj ├── odraw_test_data_file │ └── odraw_test_data_file.vcproj ├── odraw_test_data_file_descriptor │ └── odraw_test_data_file_descriptor.vcproj ├── odraw_test_error │ └── odraw_test_error.vcproj ├── odraw_test_handle │ └── odraw_test_handle.vcproj ├── odraw_test_io_handle │ └── odraw_test_io_handle.vcproj ├── odraw_test_notify │ └── odraw_test_notify.vcproj ├── odraw_test_sector_range │ └── odraw_test_sector_range.vcproj ├── odraw_test_support │ └── odraw_test_support.vcproj ├── odraw_test_track_value │ └── odraw_test_track_value.vcproj ├── odrawinfo │ └── odrawinfo.vcproj └── odrawverify │ └── odrawverify.vcproj ├── odrawtools ├── Makefile.am ├── byte_size_string.c ├── byte_size_string.h ├── digest_hash.c ├── digest_hash.h ├── info_handle.c ├── info_handle.h ├── log_handle.c ├── log_handle.h ├── odrawinfo.c ├── odrawtools_getopt.c ├── odrawtools_getopt.h ├── odrawtools_i18n.h ├── odrawtools_libbfio.h ├── odrawtools_libcerror.h ├── odrawtools_libclocale.h ├── odrawtools_libcnotify.h ├── odrawtools_libcsplit.h ├── odrawtools_libhmac.h ├── odrawtools_libodraw.h ├── odrawtools_libuna.h ├── odrawtools_output.c ├── odrawtools_output.h ├── odrawtools_signal.c ├── odrawtools_signal.h ├── odrawtools_system_split_string.h ├── odrawtools_unused.h ├── odrawverify.c ├── process_status.c ├── process_status.h ├── storage_media_buffer.c ├── storage_media_buffer.h ├── verification_handle.c └── verification_handle.h ├── ossfuzz ├── Makefile.am ├── handle_fuzzer.cc ├── ossfuzz_libbfio.h └── ossfuzz_libodraw.h ├── po ├── ChangeLog ├── Makevars.in └── POTFILES.in ├── runtests.ps1 ├── runtests.sh ├── synclibs.ps1 ├── synclibs.sh ├── synctestdata.ps1 ├── synctestdata.sh ├── syncwinflexbison.ps1 └── tests ├── Makefile.am ├── build.sh ├── data ├── cue_parser.1 ├── cue_parser.2 ├── cue_parser.3 ├── cue_parser.4 └── cue_parser.5 ├── lsan.suppressions ├── odraw_test_cue_parser.c ├── odraw_test_data_file.c ├── odraw_test_data_file_descriptor.c ├── odraw_test_error.c ├── odraw_test_functions.c ├── odraw_test_functions.h ├── odraw_test_getopt.c ├── odraw_test_getopt.h ├── odraw_test_handle.c ├── odraw_test_io_handle.c ├── odraw_test_libbfio.h ├── odraw_test_libcerror.h ├── odraw_test_libclocale.h ├── odraw_test_libcnotify.h ├── odraw_test_libcthreads.h ├── odraw_test_libodraw.h ├── odraw_test_libuna.h ├── odraw_test_macros.h ├── odraw_test_memory.c ├── odraw_test_memory.h ├── odraw_test_notify.c ├── odraw_test_sector_range.c ├── odraw_test_support.c ├── odraw_test_track_value.c ├── odraw_test_unused.h ├── pkgbuild.sh ├── runtests.sh ├── syncsharedlibs.sh ├── test_library.ps1 ├── test_library.sh ├── test_manpage.sh ├── test_odrawinfo.ps1 ├── test_odrawinfo.sh ├── test_odrawverify.sh └── test_runner.sh /.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | precision: 2 3 | round: down 4 | range: 70...100 5 | status: 6 | project: true 7 | patch: true 8 | changes: false 9 | ignore: 10 | - "libbfio/*" 11 | - "libcdata/*" 12 | - "libcerror/*" 13 | - "libcfile/*" 14 | - "libclocale/*" 15 | - "libcnotify/*" 16 | - "libcpath/*" 17 | - "libcsplit/*" 18 | - "libcthreads/*" 19 | - "libhmac/*" 20 | - "libuna/*" 21 | - "tests/*" 22 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # Build from source. 2 | name: build 3 | on: [push, pull_request] 4 | permissions: read-all 5 | jobs: 6 | build_ubuntu: 7 | runs-on: ubuntu-22.04 8 | strategy: 9 | matrix: 10 | include: 11 | - architecture: 'x86' 12 | compiler: 'clang' 13 | configure_options: '' 14 | - architecture: 'x64' 15 | compiler: 'clang' 16 | configure_options: '' 17 | - architecture: 'x86' 18 | compiler: 'gcc' 19 | configure_options: '' 20 | - architecture: 'x64' 21 | compiler: 'gcc' 22 | configure_options: '' 23 | - architecture: 'x64' 24 | compiler: 'gcc' 25 | configure_options: '--enable-wide-character-type' 26 | - architecture: 'x64' 27 | compiler: 'gcc' 28 | configure_options: '--enable-static-executables=yes --enable-multi-threading-support=no' 29 | steps: 30 | - uses: actions/checkout@v4 31 | - name: Install build dependencies 32 | run: | 33 | sudo apt-get -y install autoconf automake autopoint build-essential byacc flex git libssl-dev libtool pkg-config 34 | - name: Download test data 35 | run: | 36 | if test -x "synctestdata.sh"; then ./synctestdata.sh; fi 37 | - name: Building from source 38 | env: 39 | CC: ${{ matrix.compiler }} 40 | run: | 41 | tests/build.sh ${{ matrix.configure_options }} 42 | - name: Run tests 43 | run: | 44 | tests/runtests.sh 45 | build_dist: 46 | runs-on: ubuntu-22.04 47 | strategy: 48 | matrix: 49 | include: 50 | - architecture: 'x64' 51 | compiler: 'gcc' 52 | configure_options: '' 53 | steps: 54 | - uses: actions/checkout@v4 55 | - name: Install build dependencies 56 | run: | 57 | sudo apt-get -y install autoconf automake autopoint build-essential byacc flex git libssl-dev libtool pkg-config 58 | - name: Download test data 59 | run: | 60 | if test -x "synctestdata.sh"; then ./synctestdata.sh; fi 61 | - name: Building from source 62 | env: 63 | CC: ${{ matrix.compiler }} 64 | run: | 65 | tests/build.sh ${{ matrix.configure_options }} 66 | - name: Run tests 67 | run: | 68 | make distcheck 69 | coverage_ubuntu: 70 | runs-on: ubuntu-22.04 71 | strategy: 72 | matrix: 73 | include: 74 | - architecture: 'x86' 75 | compiler: 'gcc' 76 | configure_options: '--enable-wide-character-type' 77 | - architecture: 'x64' 78 | compiler: 'gcc' 79 | configure_options: '--enable-wide-character-type' 80 | steps: 81 | - uses: actions/checkout@v4 82 | - name: Install build dependencies 83 | run: | 84 | sudo apt-get -y install autoconf automake autopoint build-essential byacc flex git libssl-dev libtool pkg-config 85 | - name: Download test data 86 | run: | 87 | if test -x "synctestdata.sh"; then ./synctestdata.sh; fi 88 | - name: Building from source 89 | env: 90 | CC: ${{ matrix.compiler }} 91 | run: | 92 | tests/build.sh ${{ matrix.configure_options }} --enable-shared=no CFLAGS="--coverage -O0" CPPFLAGS="-DOPTIMIZATION_DISABLED" LDFLAGS="--coverage" 93 | - name: Run tests 94 | run: | 95 | make check CHECK_WITH_STDERR=1 SKIP_TOOLS_END_TO_END_TESTS=1 96 | - name: Generate coverage data 97 | run: | 98 | for DIRECTORY in `find . -maxdepth 1 -type d`; do \ 99 | (cd ${DIRECTORY} && find . -maxdepth 1 -name \*.gcno -type f -exec gcov -pb {} \;) \ 100 | done 101 | - name: Upload coverage report to Codecov 102 | uses: codecov/codecov-action@v4 103 | with: 104 | name: linux-${{ matrix.architecture }}-gcc-no-optimization 105 | token: ${{ secrets.CODECOV_TOKEN }} 106 | -------------------------------------------------------------------------------- /.github/workflows/build_freebsd.yml: -------------------------------------------------------------------------------- 1 | # Build from source on FreeBSD. 2 | name: build_freebsd 3 | on: [push] 4 | permissions: read-all 5 | jobs: 6 | build_freebsd: 7 | runs-on: ubuntu-22.04 8 | steps: 9 | - uses: actions/checkout@v4 10 | - name: Building from source 11 | id: build_freebsd 12 | uses: vmactions/freebsd-vm@v1 13 | with: 14 | usesh: true 15 | mem: 4096 16 | # Note that the test scripts require bash 17 | prepare: | 18 | pkg install -y autoconf automake bash byacc flex gettext git libtool openssl pkgconf 19 | run: | 20 | tests/build.sh 21 | tests/runtests.sh 22 | -------------------------------------------------------------------------------- /.github/workflows/build_ossfuzz.yml: -------------------------------------------------------------------------------- 1 | # Build OSSFuzz fuzz targets from source. 2 | name: build_ossfuzz 3 | on: 4 | push: 5 | branches: [main] 6 | permissions: read-all 7 | jobs: 8 | build_ossfuzz: 9 | runs-on: ubuntu-22.04 10 | strategy: 11 | matrix: 12 | include: 13 | - architecture: 'x64' 14 | compiler: 'gcc' 15 | configure_options: '' 16 | steps: 17 | - name: Install build dependencies 18 | run: | 19 | sudo apt-get -y install git 20 | - uses: actions/checkout@v4 21 | with: 22 | repository: google/oss-fuzz 23 | path: oss-fuzz 24 | - name: Build OSSFuzz fuzz targets 25 | working-directory: oss-fuzz 26 | run: | 27 | mkdir -p projects/libodraw 28 | cp projects/libyal/build.sh projects/libodraw/ 29 | cp projects/libyal/project.yaml projects/libodraw/ 30 | head -n 20 projects/libyal/Dockerfile > projects/libodraw/Dockerfile 31 | echo "RUN git clone --depth 1 https://github.com/libyal/libodraw.git libodraw" >> projects/libodraw/Dockerfile 32 | tail -n 3 projects/libyal/Dockerfile >> projects/libodraw/Dockerfile 33 | python3 infra/helper.py build_image --pull libodraw 34 | python3 infra/helper.py build_fuzzers --sanitizer address libodraw 35 | python3 infra/helper.py check_build libodraw 36 | -------------------------------------------------------------------------------- /.github/workflows/build_shared.yml: -------------------------------------------------------------------------------- 1 | # Build from source with libyal dependencies as shared libraries. 2 | name: build_shared 3 | on: 4 | push: 5 | branches: [main] 6 | permissions: read-all 7 | jobs: 8 | build_shared_ubuntu: 9 | runs-on: ubuntu-22.04 10 | strategy: 11 | matrix: 12 | include: 13 | - architecture: 'x64' 14 | compiler: 'gcc' 15 | configure_options: '--enable-wide-character-type' 16 | steps: 17 | - uses: actions/checkout@v4 18 | - name: Install build dependencies 19 | run: | 20 | sudo apt-get -y install autoconf automake autopoint build-essential byacc flex git libssl-dev libtool pkg-config 21 | - name: Download test data 22 | run: | 23 | if test -x "synctestdata.sh"; then ./synctestdata.sh; fi 24 | - name: Prepare shared libraries 25 | run: | 26 | tests/syncsharedlibs.sh --use-head 27 | - name: Building from source 28 | env: 29 | CC: ${{ matrix.compiler }} 30 | run: | 31 | tests/build.sh ${{ matrix.configure_options }} 32 | - name: Run tests 33 | run: | 34 | tests/runtests.sh 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Files to ignore by git 2 | # 3 | # Version: 20231119 4 | 5 | # Generic auto-generated build files 6 | *~ 7 | *.a 8 | *.gcda 9 | *.gcno 10 | *.gcov 11 | *.la 12 | *.lai 13 | *.lib 14 | *.lineno 15 | *.lo 16 | *.log 17 | *.loT 18 | *.o 19 | *.obj 20 | *.Plo 21 | *.Po 22 | *.so 23 | *.so.[0-9][0-9]* 24 | *.so.[0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]* 25 | *.swp 26 | *.Tpo 27 | *.trs 28 | *.whl 29 | /*.egg-info/ 30 | __pycache__ 31 | .deps 32 | .dirstamp 33 | .libs 34 | .tox 35 | INSTALL 36 | Makefile 37 | Makefile.bcc 38 | Makefile.in 39 | stamp-h[1-9] 40 | 41 | # Specific auto-generated build files 42 | /ABOUT-NLS 43 | /aclocal.m4 44 | /autom4te.cache/ 45 | /build 46 | /compile 47 | /confdefs.h 48 | /config.cache 49 | /config.guess 50 | /config.log 51 | /config.rpath 52 | /config.status 53 | /config.sub 54 | /configure 55 | /conftest.c 56 | /depcomp 57 | /dist 58 | /install-sh 59 | /libtool 60 | /ltmain.sh 61 | /m4/codeset.m4 62 | /m4/extern-inline.m4 63 | /m4/fcntl-o.m4 64 | /m4/gettext.m4 65 | /m4/glibc21.m4 66 | /m4/glibc2.m4 67 | /m4/host-cpu-c-abi.m4 68 | /m4/iconv.m4 69 | /m4/intdiv0.m4 70 | /m4/intldir.m4 71 | /m4/intl.m4 72 | /m4/intlmacosx.m4 73 | /m4/intmax.m4 74 | /m4/inttypes_h.m4 75 | /m4/inttypes-pri.m4 76 | /m4/lcmessage.m4 77 | /m4/lib-ld.m4 78 | /m4/lib-link.m4 79 | /m4/lib-prefix.m4 80 | /m4/libtool.m4 81 | /m4/lock.m4 82 | /m4/longlong.m4 83 | /m4/lt~obsolete.m4 84 | /m4/ltoptions.m4 85 | /m4/ltsugar.m4 86 | /m4/ltversion.m4 87 | /m4/nls.m4 88 | /m4/pkg.m4 89 | /m4/po.m4 90 | /m4/printf-posix.m4 91 | /m4/progtest.m4 92 | /m4/size_max.m4 93 | /m4/stdint_h.m4 94 | /m4/threadlib.m4 95 | /m4/uintmax_t.m4 96 | /m4/visibility.m4 97 | /m4/wchar_t.m4 98 | /m4/wint_t.m4 99 | /m4/xsize.m4 100 | /MANIFEST 101 | /missing 102 | /po/boldquot.sed 103 | /po/en@boldquot.header 104 | /po/en@quot.header 105 | /po/insert-header.sin 106 | /po/Makefile.in.in 107 | /po/Makevars 108 | /po/Makevars.template 109 | /po/POTFILES 110 | /po/quot.sed 111 | /po/remove-potcdate.sed 112 | /po/remove-potcdate.sin 113 | /po/Rules-quot 114 | /test-driver 115 | /ylwrap 116 | 117 | # Project specific files 118 | /common/config.h 119 | /common/config.h.in 120 | /common/types.h 121 | /dpkg/changelog 122 | /include/libodraw.h 123 | /include/libodraw/definitions.h 124 | /include/libodraw/features.h 125 | /include/libodraw/types.h 126 | /libodraw.pc 127 | /libodraw.spec 128 | /libodraw/libodraw.rc 129 | /libodraw/libodraw_cue_parser.c 130 | /libodraw/libodraw_cue_parser.h 131 | /libodraw/libodraw_cue_parser.output 132 | /libodraw/libodraw_cue_scanner.c 133 | /libodraw/libodraw_definitions.h 134 | /odrawtools/*.exe 135 | /odrawtools/odrawinfo 136 | /odrawtools/odrawverify 137 | /tests/*.exe 138 | /tests/input 139 | /tests/notify_stream.log 140 | /tests/odraw_test_cue_parser 141 | /tests/odraw_test_data_file 142 | /tests/odraw_test_data_file_descriptor 143 | /tests/odraw_test_error 144 | /tests/odraw_test_handle 145 | /tests/odraw_test_io_handle 146 | /tests/odraw_test_notify 147 | /tests/odraw_test_sector_range 148 | /tests/odraw_test_support 149 | /tests/odraw_test_track_value 150 | /tests/tmp* 151 | 152 | # Local library dependencies specific files 153 | /libbfio 154 | /libcdata 155 | /libcerror 156 | /libcfile 157 | /libclocale 158 | /libcnotify 159 | /libcpath 160 | /libcsplit 161 | /libcthreads 162 | /libhmac 163 | /libuna 164 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Acknowledgements: libodraw 2 | 3 | Copyright (C) 2010-2024, Joachim Metz 4 | 5 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I m4 2 | 3 | SUBDIRS = \ 4 | include \ 5 | common \ 6 | libcerror \ 7 | libcthreads \ 8 | libcdata \ 9 | libclocale \ 10 | libcnotify \ 11 | libcsplit \ 12 | libuna \ 13 | libcfile \ 14 | libcpath \ 15 | libbfio \ 16 | libodraw \ 17 | libhmac \ 18 | odrawtools \ 19 | po \ 20 | manuals \ 21 | tests \ 22 | ossfuzz \ 23 | msvscpp 24 | 25 | DPKG_FILES = \ 26 | dpkg/changelog \ 27 | dpkg/changelog.in \ 28 | dpkg/compat \ 29 | dpkg/control \ 30 | dpkg/copyright \ 31 | dpkg/rules \ 32 | dpkg/libodraw-dev.install \ 33 | dpkg/libodraw.install \ 34 | dpkg/libodraw-tools.install \ 35 | dpkg/source/format 36 | 37 | GETTEXT_FILES = \ 38 | config.rpath \ 39 | po/Makevars.in 40 | 41 | PKGCONFIG_FILES = \ 42 | libodraw.pc.in 43 | 44 | SPEC_FILES = \ 45 | libodraw.spec \ 46 | libodraw.spec.in 47 | 48 | EXTRA_DIST = \ 49 | $(DPKG_FILES) \ 50 | $(GETTEXT_FILES) \ 51 | $(PKGCONFIG_FILES) \ 52 | $(SPEC_FILES) 53 | 54 | DISTCLEANFILES = \ 55 | config.status \ 56 | config.cache \ 57 | config.log \ 58 | libodraw.pc \ 59 | libodraw.spec \ 60 | Makefile \ 61 | Makefile.in \ 62 | po/Makevars 63 | 64 | pkgconfigdir = $(libdir)/pkgconfig 65 | 66 | pkgconfig_DATA = \ 67 | libodraw.pc 68 | 69 | libtool: @LIBTOOL_DEPS@ 70 | cd $(srcdir) && $(SHELL) ./config.status --recheck 71 | 72 | lib: library 73 | 74 | library: 75 | (cd $(srcdir)/common && $(MAKE) $(AM_MAKEFLAGS)) 76 | (cd $(srcdir)/libcerror && $(MAKE) $(AM_MAKEFLAGS)) 77 | (cd $(srcdir)/libcthreads && $(MAKE) $(AM_MAKEFLAGS)) 78 | (cd $(srcdir)/libcdata && $(MAKE) $(AM_MAKEFLAGS)) 79 | (cd $(srcdir)/libclocale && $(MAKE) $(AM_MAKEFLAGS)) 80 | (cd $(srcdir)/libcnotify && $(MAKE) $(AM_MAKEFLAGS)) 81 | (cd $(srcdir)/libcsplit && $(MAKE) $(AM_MAKEFLAGS)) 82 | (cd $(srcdir)/libuna && $(MAKE) $(AM_MAKEFLAGS)) 83 | (cd $(srcdir)/libcfile && $(MAKE) $(AM_MAKEFLAGS)) 84 | (cd $(srcdir)/libcpath && $(MAKE) $(AM_MAKEFLAGS)) 85 | (cd $(srcdir)/libbfio && $(MAKE) $(AM_MAKEFLAGS)) 86 | (cd $(srcdir)/libodraw && $(MAKE) $(AM_MAKEFLAGS)) 87 | (cd $(srcdir)/po && $(MAKE) $(AM_MAKEFLAGS)) 88 | 89 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libodraw/f3d9b6b33a2c160514d8f56c60c3a47c4322f8ad/NEWS -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | libodraw is a library to access to optical disc (split) RAW image files (bin/cue, iso/cue). 2 | 3 | Project information: 4 | 5 | * Status: alpha 6 | * Licence: LGPLv3+ 7 | 8 | Planned: 9 | 10 | * Multi-threading support 11 | 12 | For more information see: 13 | 14 | * Project documentation: https://github.com/libyal/libodraw/wiki/Home 15 | * How to build from source: https://github.com/libyal/libodraw/wiki/Building 16 | 17 | -------------------------------------------------------------------------------- /autogen.ps1: -------------------------------------------------------------------------------- 1 | # Script to generate the necessary files for a msvscpp build 2 | # 3 | # Version: 20240306 4 | 5 | $WinFlex = "..\win_flex_bison\win_flex.exe" 6 | $WinBison = "..\win_flex_bison\win_bison.exe" 7 | 8 | $Library = Get-Content -Path configure.ac | select -skip 3 -first 1 | % { $_ -Replace " \[","" } | % { $_ -Replace "\],","" } 9 | $Version = Get-Content -Path configure.ac | select -skip 4 -first 1 | % { $_ -Replace " \[","" } | % { $_ -Replace "\],","" } 10 | $Prefix = ${Library}.Substring(3) 11 | 12 | Get-Content -Path "include\${Library}.h.in" | Out-File -Encoding ascii "include\${Library}.h" 13 | Get-Content -Path "include\${Library}\definitions.h.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "include\${Library}\definitions.h" 14 | Get-Content -Path "include\${Library}\features.h.in" | % { $_ -Replace "@[A-Z0-9_]*@","0" } | Out-File -Encoding ascii "include\${Library}\features.h" 15 | Get-Content -Path "include\${Library}\types.h.in" | % { $_ -Replace "@[A-Z0-9_]*@","0" } | Out-File -Encoding ascii "include\${Library}\types.h" 16 | Get-Content -Path "common\types.h.in" | % { $_ -Replace "@PACKAGE@","${Library}" } | Out-File -Encoding ascii "common\types.h" 17 | Get-Content -Path "${Library}\${Library}_definitions.h.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "${Library}\${Library}_definitions.h" 18 | Get-Content -Path "${Library}\${Library}.rc.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "${Library}\${Library}.rc" 19 | 20 | If (Test-Path "setup.cfg.in") 21 | { 22 | Get-Content -Path "setup.cfg.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "setup.cfg" 23 | } 24 | 25 | If (Test-Path "${Prefix}.net") 26 | { 27 | Get-Content -Path "${Prefix}.net\${Prefix}.net.rc.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "${Prefix}.net\${Prefix}.net.rc" 28 | } 29 | 30 | $NamePrefix = "" 31 | 32 | ForEach (${Library} in Get-ChildItem -Directory -Path "lib*") 33 | { 34 | ForEach (${DirectoryElement} in Get-ChildItem -Path "${Library}\*.l") 35 | { 36 | $OutputFile = ${DirectoryElement} -Replace ".l$",".c" 37 | 38 | $NamePrefix = Split-Path -path ${DirectoryElement} -leaf 39 | $NamePrefix = ${NamePrefix} -Replace ".l$","_" 40 | 41 | Write-Host "Running: ${WinFlex} -Cf ${DirectoryElement}" 42 | 43 | # PowerShell will raise NativeCommandError if win_flex writes to stdout or stderr 44 | # therefore 2>&1 is added and the output is stored in a variable. 45 | $Output = Invoke-Expression -Command "& '${WinFlex}' -Cf ${DirectoryElement} 2>&1" 46 | Write-Host ${Output} 47 | 48 | # Moving manually since `win_flex -o filename' does not provide the expected behavior. 49 | Move-Item "lex.yy.c" ${OutputFile} -force 50 | } 51 | 52 | ForEach (${DirectoryElement} in Get-ChildItem -Path "${Library}\*.y") 53 | { 54 | $OutputFile = ${DirectoryElement} -Replace ".y$",".c" 55 | 56 | Write-Host "Running: ${WinBison} -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement}" 57 | 58 | # PowerShell will raise NativeCommandError if win_bison writes to stdout or stderr 59 | # therefore 2>&1 is added and the output is stored in a variable. 60 | $Output = Invoke-Expression -Command "& '${WinBison}' -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement} 2>&1" 61 | Write-Host ${Output} 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script to generate ./configure using the autotools 3 | # 4 | # Version: 20230405 5 | 6 | EXIT_SUCCESS=0; 7 | EXIT_FAILURE=1; 8 | 9 | BINDIR="/usr/bin"; 10 | 11 | if ! test -x "${BINDIR}/aclocal"; 12 | then 13 | BINDIR="/usr/local/bin"; 14 | fi 15 | if ! test -x "${BINDIR}/aclocal"; 16 | then 17 | BINDIR="/usr/local/bin"; 18 | fi 19 | if ! test -x "${BINDIR}/aclocal"; 20 | then 21 | # Default location of MacPorts installed binaries. 22 | BINDIR="/opt/local/bin"; 23 | fi 24 | if ! test -x "${BINDIR}/aclocal"; 25 | then 26 | # Default location of 32-bit MSYS2-MinGW installed binaries. 27 | BINDIR="/mingw32/bin"; 28 | fi 29 | if ! test -x "${BINDIR}/aclocal"; 30 | then 31 | # Default location of 64-bit MSYS2-MinGW installed binaries. 32 | BINDIR="/mingw64/bin"; 33 | fi 34 | 35 | if ! test -x "${BINDIR}/aclocal"; 36 | then 37 | echo "Unable to find autotools"; 38 | 39 | exit ${EXIT_FAILURE}; 40 | fi 41 | 42 | ACLOCAL="${BINDIR}/aclocal"; 43 | AUTOCONF="${BINDIR}/autoconf"; 44 | AUTOHEADER="${BINDIR}/autoheader"; 45 | AUTOMAKE="${BINDIR}/automake"; 46 | AUTOPOINT="${BINDIR}/autopoint"; 47 | AUTORECONF="${BINDIR}/autoreconf"; 48 | LIBTOOLIZE="${BINDIR}/libtoolize"; 49 | PKGCONFIG="${BINDIR}/pkg-config"; 50 | 51 | if test "${OSTYPE}" = "msys"; 52 | then 53 | # Work-around for autopoint failing to detect gettext version 54 | # using func_trace (which is not available) on MSYS by writing 55 | # the gettext version to intl/VERSION. 56 | if ! test -d intl; 57 | then 58 | mkdir intl; 59 | fi 60 | GETTEXT_VERSION=`gettext --version | head -n1 | sed 's/^.* //'`; 61 | 62 | echo "gettext-${GETTEXT_VERSION}" > intl/VERSION; 63 | 64 | elif ! test -x "${PKGCONFIG}"; 65 | then 66 | if test "${BINDIR}" != "/usr/bin"; 67 | then 68 | # On OpenBSD most of the autotools are located in 69 | # /usr/local/bin while pkg-config is located in /usr/bin 70 | PKGCONFIG="/usr/bin/pkg-config"; 71 | fi 72 | if ! test -x "${PKGCONFIG}"; 73 | then 74 | echo "Unable to find: pkg-config"; 75 | 76 | exit ${EXIT_FAILURE}; 77 | fi 78 | fi 79 | 80 | if test -x "${AUTORECONF}"; 81 | then 82 | ${AUTORECONF} --force --install 83 | if test $? -ne 0; 84 | then 85 | exit $?; 86 | fi 87 | else 88 | if ! test -x "${ACLOCAL}"; 89 | then 90 | echo "Unable to find: aclocal"; 91 | 92 | exit ${EXIT_FAILURE}; 93 | fi 94 | 95 | if ! test -x "${AUTOCONF}"; 96 | then 97 | echo "Unable to find: autoconf"; 98 | 99 | exit ${EXIT_FAILURE}; 100 | fi 101 | 102 | if ! test -x "${AUTOHEADER}"; 103 | then 104 | echo "Unable to find: autoheader"; 105 | 106 | exit ${EXIT_FAILURE}; 107 | fi 108 | 109 | if ! test -x "${AUTOMAKE}"; 110 | then 111 | echo "Unable to find: automake"; 112 | 113 | exit ${EXIT_FAILURE}; 114 | fi 115 | 116 | if ! test -x "${AUTOPOINT}"; 117 | then 118 | echo "Unable to find: autopoint"; 119 | 120 | exit ${EXIT_FAILURE}; 121 | fi 122 | 123 | if ! test -x "${LIBTOOLIZE}"; 124 | then 125 | echo "Unable to find: libtoolize"; 126 | 127 | exit ${EXIT_FAILURE}; 128 | fi 129 | 130 | ${AUTOPOINT} --force; 131 | if test $? -ne 0; 132 | then 133 | exit $?; 134 | fi 135 | 136 | ${ACLOCAL} --force --install -I m4; 137 | if test $? -ne 0; 138 | then 139 | exit $?; 140 | fi 141 | 142 | ${LIBTOOLIZE} --force; 143 | if test $? -ne 0; 144 | then 145 | exit $?; 146 | fi 147 | 148 | ${AUTOHEADER} --force; 149 | if test $? -ne 0; 150 | then 151 | exit $?; 152 | fi 153 | 154 | ${AUTOCONF} --force; 155 | if test $? -ne 0; 156 | then 157 | exit $?; 158 | fi 159 | 160 | ${AUTOMAKE} --force --add-missing; 161 | if test $? -ne 0; 162 | then 163 | exit $?; 164 | fi 165 | 166 | fi 167 | 168 | exit ${EXIT_SUCCESS}; 169 | 170 | -------------------------------------------------------------------------------- /common/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | -I../include -I$(top_srcdir)/include 3 | 4 | EXTRA_DIST = \ 5 | byte_stream.h \ 6 | common.h \ 7 | config.h \ 8 | config_borlandc.h \ 9 | config_msc.h \ 10 | config_winapi.h \ 11 | file_stream.h \ 12 | memory.h \ 13 | narrow_string.h \ 14 | system_string.h \ 15 | types.h \ 16 | types.h.in \ 17 | wide_string.h 18 | 19 | DISTCLEANFILES = \ 20 | config.h \ 21 | types.h \ 22 | Makefile \ 23 | Makefile.in 24 | 25 | -------------------------------------------------------------------------------- /common/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Common include file 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _COMMON_H ) 23 | #define _COMMON_H 24 | 25 | #if defined( HAVE_CONFIG_H ) 26 | #include "config.h" 27 | #endif 28 | 29 | /* Include the Borland/CodeGear C++ Builder compiler specific configuration 30 | */ 31 | #if defined( __BORLANDC__ ) 32 | #include "config_borlandc.h" 33 | 34 | /* Include the Microsoft Visual Studio C++ compiler specific configuration 35 | */ 36 | #elif defined( _MSC_VER ) 37 | #include "config_msc.h" 38 | #endif 39 | 40 | #include "config_winapi.h" 41 | 42 | #endif /* !defined( _COMMON_H ) */ 43 | 44 | -------------------------------------------------------------------------------- /common/config_borlandc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Configuration for the Borland/CodeGear C++ Builder compiler 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _CONFIG_BORLANDC_H ) 23 | #define _CONFIG_BORLANDC_H 24 | 25 | #endif /* !defined( _CONFIG_BORLANDC_H ) */ 26 | 27 | -------------------------------------------------------------------------------- /common/config_msc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Configuration for the Microsoft Visual Studio C++ compiler 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _CONFIG_MSC_H ) 23 | #define _CONFIG_MSC_H 24 | 25 | /* Disable warning C4127: conditional expression is constant 26 | */ 27 | #pragma warning( disable : 4127 ) 28 | 29 | /* Disable warning C4201: nonstandard extension used : nameless struct/union 30 | */ 31 | #pragma warning( disable : 4201 ) 32 | 33 | #endif /* !defined( _CONFIG_MSC_H ) */ 34 | 35 | -------------------------------------------------------------------------------- /common/config_winapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Configuration file for WINAPI 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _CONFIG_WINAPI_H ) 23 | #define _CONFIG_WINAPI_H 24 | 25 | /* Define the earliest supported WINAPI version 26 | #define WINVER 0x0501 27 | */ 28 | 29 | /* If necessary make sure WINAPI is defined 30 | */ 31 | #if defined( HAVE_WINDOWS_H ) || defined( __BORLANDC__ ) || defined( _MSC_VER ) 32 | #include 33 | #endif 34 | 35 | #if defined( WINAPI ) 36 | 37 | /* Define to the address where bug reports for this package should be sent. 38 | */ 39 | #define PACKAGE_BUGREPORT "joachim.metz@gmail.com" 40 | 41 | /* Define the size of the integer for WINAPI 42 | */ 43 | #if !defined( SIZEOF_INT ) 44 | #define SIZEOF_INT 4 45 | #endif 46 | 47 | /* Define the size of size_t for WINAPI 48 | * Do not define when pyconfig.h has been included via python.h 49 | */ 50 | #if !defined( HAVE_PYCONFIG_H ) 51 | 52 | #if !defined( SIZEOF_SIZE_T ) 53 | #if __WORDSIZE == 64 54 | #define SIZEOF_SIZE_T 8 55 | #else 56 | #define SIZEOF_SIZE_T 4 57 | #endif 58 | #endif 59 | 60 | #endif /* !defined( HAVE_PYCONFIG_H ) */ 61 | 62 | /* Define the size of the wide character for WINAPI 63 | */ 64 | #if !defined( SIZEOF_WCHAR_T ) 65 | #define SIZEOF_WCHAR_T 2 66 | #endif 67 | 68 | /* Enable the DllMain function 69 | */ 70 | #define HAVE_DLLMAIN 1 71 | 72 | /* Enable verbose output 73 | #define HAVE_VERBOSE_OUTPUT 1 74 | */ 75 | 76 | /* Enable debug output 77 | #define HAVE_DEBUG_OUTPUT 1 78 | */ 79 | 80 | /* Enable both the narrow and wide character functions 81 | */ 82 | #if !defined( HAVE_WIDE_CHARACTER_TYPE ) 83 | #define HAVE_WIDE_CHARACTER_TYPE 1 84 | #endif 85 | 86 | /* If not controlled by config.h enable multi-thread support 87 | */ 88 | #if !defined( HAVE_CONFIG_H ) && !defined( HAVE_MULTI_THREAD_SUPPORT ) 89 | #define HAVE_MULTI_THREAD_SUPPORT 1 90 | #endif 91 | 92 | #endif /* defined( WINAPI ) */ 93 | 94 | #endif /* !defined( _CONFIG_WINAPI_H ) */ 95 | 96 | -------------------------------------------------------------------------------- /common/memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Memory functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _MEMORY_H ) 23 | #define _MEMORY_H 24 | 25 | #include "common.h" 26 | 27 | #if defined( HAVE_GLIB_H ) 28 | #include 29 | #endif 30 | 31 | #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) 32 | #include 33 | #endif 34 | 35 | #if defined( HAVE_STRING_H ) || defined( WINAPI ) 36 | #include 37 | #endif 38 | 39 | #if defined( __cplusplus ) 40 | extern "C" { 41 | #endif 42 | 43 | /* Note that 128 MiB is an arbitrary selected upper limit here 44 | */ 45 | #define MEMORY_MAXIMUM_ALLOCATION_SIZE \ 46 | ( 128 * 1024 * 1024 ) 47 | 48 | /* Memory allocation 49 | */ 50 | #if defined( HAVE_GLIB_H ) 51 | #define memory_allocate( size ) \ 52 | g_malloc( (gsize) size ) 53 | 54 | #elif defined( WINAPI ) 55 | #define memory_allocate( size ) \ 56 | HeapAlloc( GetProcessHeap(), 0, (SIZE_T) size ) 57 | 58 | #elif defined( HAVE_MALLOC ) 59 | #define memory_allocate( size ) \ 60 | malloc( size ) 61 | #endif 62 | 63 | #define memory_allocate_structure( type ) \ 64 | (type *) memory_allocate( sizeof( type ) ) 65 | 66 | #define memory_allocate_structure_as_value( type ) \ 67 | (intptr_t *) memory_allocate( sizeof( type ) ) 68 | 69 | /* Memory reallocation 70 | */ 71 | #if defined( HAVE_GLIB_H ) 72 | #define memory_reallocate( buffer, size ) \ 73 | g_realloc( (gpointer) buffer, (gsize) size ) 74 | 75 | #elif defined( WINAPI ) 76 | /* HeapReAlloc does not allocate empty (NULL) buffers as realloc does 77 | */ 78 | #define memory_reallocate( buffer, size ) \ 79 | ( buffer == NULL ) ? \ 80 | HeapAlloc( GetProcessHeap(), 0, (SIZE_T) size ) : \ 81 | HeapReAlloc( GetProcessHeap(), 0, (LPVOID) buffer, (SIZE_T) size ) 82 | 83 | #elif defined( HAVE_REALLOC ) 84 | #define memory_reallocate( buffer, size ) \ 85 | realloc( (void *) buffer, size ) 86 | #endif 87 | 88 | /* Memory free 89 | */ 90 | #if defined( HAVE_GLIB_H ) 91 | #define memory_free( buffer ) \ 92 | g_free( (gpointer) buffer ) 93 | 94 | #elif defined( WINAPI ) 95 | #define memory_free( buffer ) \ 96 | ( buffer == NULL ) ? TRUE : HeapFree( GetProcessHeap(), 0, (LPVOID) buffer ) 97 | 98 | #elif defined( HAVE_FREE ) 99 | #define memory_free( buffer ) \ 100 | free( (void *) buffer ) 101 | #endif 102 | 103 | /* Memory compare 104 | */ 105 | #if defined( HAVE_MEMCMP ) || defined( WINAPI ) 106 | #define memory_compare( buffer1, buffer2, size ) \ 107 | memcmp( (const void *) buffer1, (const void *) buffer2, size ) 108 | #endif 109 | 110 | /* Memory copy 111 | */ 112 | #if defined( HAVE_MEMCPY ) || defined( WINAPI ) 113 | #define memory_copy( destination, source, count ) \ 114 | memcpy( (void *) destination, (void *) source, count ) 115 | #endif 116 | 117 | /* Memory set 118 | */ 119 | #if defined( HAVE_MEMSET ) || defined( WINAPI ) 120 | #define memory_set( buffer, value, count ) \ 121 | memset( (void *) buffer, (int) value, count ) 122 | #endif 123 | 124 | #if defined( __cplusplus ) 125 | } 126 | #endif 127 | 128 | #endif /* !defined( _MEMORY_H ) */ 129 | 130 | -------------------------------------------------------------------------------- /dpkg/changelog.in: -------------------------------------------------------------------------------- 1 | libodraw (@VERSION@-1) unstable; urgency=low 2 | 3 | * Auto-generated 4 | 5 | -- Joachim Metz @DPKG_DATE@ 6 | -------------------------------------------------------------------------------- /dpkg/compat: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /dpkg/control: -------------------------------------------------------------------------------- 1 | Source: libodraw 2 | Priority: extra 3 | Maintainer: Joachim Metz 4 | Build-Depends: debhelper (>= 9), dh-autoreconf, pkg-config, libssl-dev 5 | Standards-Version: 4.1.4 6 | Section: libs 7 | Homepage: https://github.com/libyal/libodraw 8 | Vcs-Git: https://github.com/libyal/libodraw.git 9 | 10 | Package: libodraw 11 | Architecture: any 12 | Depends: ${shlibs:Depends}, ${misc:Depends} 13 | Conflicts: libodraw1 14 | Replaces: libodraw1 15 | Suggests: libodraw-dbg 16 | Description: Library to access optical disc (split) RAW formats 17 | libodraw is a library to access optical disc (split) RAW formats. 18 | 19 | Package: libodraw-dbg 20 | Architecture: any 21 | Section: debug 22 | Depends: libodraw (= ${binary:Version}), ${misc:Depends} 23 | Description: Debugging symbols for libodraw 24 | Debugging symbols for libodraw. 25 | 26 | Package: libodraw-dev 27 | Section: libdevel 28 | Architecture: any 29 | Depends: libodraw (= ${binary:Version}), ${misc:Depends} 30 | Description: Header files and libraries for developing applications for libodraw 31 | Header files and libraries for developing applications for libodraw. 32 | 33 | Package: libodraw-tools 34 | Section: utils 35 | Architecture: any 36 | Depends: libodraw (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} 37 | Conflicts: libodraw-utils 38 | Replaces: libodraw-utils 39 | Description: Several tools for accessing optical disc (split) RAW formats 40 | Several tools for accessing optical disc (split) RAW formats. 41 | 42 | Package: libodraw-tools-dbg 43 | Section: debug 44 | Architecture: any 45 | Depends: libodraw-tools (= ${binary:Version}), ${misc:Depends} 46 | Description: Debugging symbols for libodraw-tools 47 | Debugging symbols for libodraw-tools. 48 | 49 | -------------------------------------------------------------------------------- /dpkg/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: libodraw 3 | Source: https://github.com/libyal/libodraw 4 | 5 | Files: * 6 | Copyright: 2010-2024, Joachim Metz 7 | License: LGPL-3.0+ 8 | 9 | License: LGPL-3.0+ 10 | This package is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU Lesser General Public 12 | License as published by the Free Software Foundation; either 13 | version 3 of the License, or (at your option) any later version. 14 | . 15 | This package is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | Lesser General Public License for more details. 19 | . 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | . 23 | On Debian systems, the complete text of the GNU Lesser General 24 | Public License can be found in "/usr/share/common-licenses/LGPL-3". 25 | 26 | -------------------------------------------------------------------------------- /dpkg/libodraw-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/* 2 | usr/lib/*-*/lib*.a 3 | usr/lib/*-*/lib*.so 4 | usr/lib/*-*/pkgconfig/* 5 | usr/share/man/man3 6 | -------------------------------------------------------------------------------- /dpkg/libodraw-tools.install: -------------------------------------------------------------------------------- 1 | usr/bin 2 | usr/share/man/man1 3 | -------------------------------------------------------------------------------- /dpkg/libodraw.install: -------------------------------------------------------------------------------- 1 | usr/lib/*-*/lib*.so.* 2 | -------------------------------------------------------------------------------- /dpkg/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | 4 | # Uncomment for debhelper verbose output. 5 | # export DH_VERBOSE=1 6 | 7 | %: 8 | dh $@ --buildsystem=autoconf --with=autoreconf 9 | 10 | .PHONY: override_dh_auto_configure 11 | override_dh_auto_configure: 12 | dh_auto_configure -- CFLAGS="-g" 13 | 14 | .PHONY: override_dh_install 15 | override_dh_install: 16 | dh_install --fail-missing -X.la 17 | 18 | .PHONY: override_dh_strip 19 | override_dh_strip: 20 | ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS))) 21 | dh_strip -plibodraw --dbg-package=libodraw-dbg 22 | dh_strip -plibodraw-tools --dbg-package=libodraw-tools-dbg 23 | endif 24 | 25 | -------------------------------------------------------------------------------- /dpkg/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | include_HEADERS = \ 2 | libodraw.h 3 | 4 | pkginclude_HEADERS = \ 5 | libodraw/codepage.h \ 6 | libodraw/definitions.h \ 7 | libodraw/error.h \ 8 | libodraw/extern.h \ 9 | libodraw/features.h \ 10 | libodraw/types.h 11 | 12 | EXTRA_DIST = \ 13 | libodraw.h.in \ 14 | libodraw/definitions.h.in \ 15 | libodraw/features.h.in \ 16 | libodraw/types.h.in 17 | 18 | DISTCLEANFILES = \ 19 | libodraw.h \ 20 | libodraw/definitions.h \ 21 | libodraw/features.h \ 22 | libodraw/types.h \ 23 | Makefile \ 24 | Makefile.in 25 | 26 | -------------------------------------------------------------------------------- /include/libodraw/definitions.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions for libodraw 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_DEFINITIONS_H ) 23 | #define _LIBODRAW_DEFINITIONS_H 24 | 25 | #include 26 | 27 | #define LIBODRAW_VERSION @VERSION@ 28 | 29 | /* The version string 30 | */ 31 | #define LIBODRAW_VERSION_STRING "@VERSION@" 32 | 33 | /* The access flags definitions 34 | * bit 1 set to 1 for read access 35 | * bit 2 set to 1 for write access 36 | * bit 3-8 not used 37 | */ 38 | enum LIBODRAW_ACCESS_FLAGS 39 | { 40 | LIBODRAW_ACCESS_FLAG_READ = 0x01, 41 | /* Reserved: not supported yet */ 42 | LIBODRAW_ACCESS_FLAG_WRITE = 0x02 43 | }; 44 | 45 | /* The file access macros 46 | */ 47 | #define LIBODRAW_OPEN_READ ( LIBODRAW_ACCESS_FLAG_READ ) 48 | /* Reserved: not supported yet */ 49 | #define LIBODRAW_OPEN_WRITE ( LIBODRAW_ACCESS_FLAG_WRITE ) 50 | /* Reserved: not supported yet */ 51 | #define LIBODRAW_OPEN_READ_WRITE ( LIBODRAW_ACCESS_FLAG_READ | LIBODRAW_ACCESS_FLAG_WRITE ) 52 | 53 | /* The file types 54 | */ 55 | enum LIBODRAW_FILE_TYPES 56 | { 57 | LIBODRAW_FILE_TYPE_UNKNOWN, 58 | LIBODRAW_FILE_TYPE_BINARY_LITTLE_ENDIAN, 59 | LIBODRAW_FILE_TYPE_BINARY_BIG_ENDIAN, 60 | LIBODRAW_FILE_TYPE_AUDIO_AIFF, 61 | LIBODRAW_FILE_TYPE_AUDIO_WAVE, 62 | LIBODRAW_FILE_TYPE_AUDIO_MPEG1_LAYER3, 63 | }; 64 | 65 | #define LIBODRAW_FILE_TYPE_BINARY LIBODRAW_FILE_TYPE_BINARY_LITTLE_ENDIAN 66 | #define LIBODRAW_FILE_TYPE_MOTOROLA LIBODRAW_FILE_TYPE_BINARY_BIG_ENDIAN 67 | #define LIBODRAW_FILE_TYPE_AIFF LIBODRAW_FILE_TYPE_AUDIO_AIFF 68 | #define LIBODRAW_FILE_TYPE_WAVE LIBODRAW_FILE_TYPE_AUDIO_WAVE 69 | #define LIBODRAW_FILE_TYPE_MP3 LIBODRAW_FILE_TYPE_AUDIO_MPEG1_LAYER3 70 | 71 | /* The track types 72 | */ 73 | enum LIBODRAW_TRACK_TYPES 74 | { 75 | LIBODRAW_TRACK_TYPE_UNKNOWN, 76 | LIBODRAW_TRACK_TYPE_AUDIO, 77 | LIBODRAW_TRACK_TYPE_CDG, 78 | LIBODRAW_TRACK_TYPE_MODE1_2048, 79 | LIBODRAW_TRACK_TYPE_MODE1_2352, 80 | LIBODRAW_TRACK_TYPE_MODE2_2048, 81 | LIBODRAW_TRACK_TYPE_MODE2_2324, 82 | LIBODRAW_TRACK_TYPE_MODE2_2336, 83 | LIBODRAW_TRACK_TYPE_MODE2_2352, 84 | LIBODRAW_TRACK_TYPE_CDI_2336, 85 | LIBODRAW_TRACK_TYPE_CDI_2352, 86 | }; 87 | 88 | #endif /* !defined( _LIBODRAW_DEFINITIONS_H ) */ 89 | 90 | -------------------------------------------------------------------------------- /include/libodraw/extern.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The extern definition 3 | * 4 | * This header should be included in header files that export or import 5 | * library functions 6 | * 7 | * Copyright (C) 2010-2024, Joachim Metz 8 | * 9 | * Refer to AUTHORS for acknowledgements. 10 | * 11 | * This program is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Lesser General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public License 22 | * along with this program. If not, see . 23 | */ 24 | 25 | #if !defined( _LIBODRAW_EXTERN_H ) 26 | #define _LIBODRAW_EXTERN_H 27 | 28 | /* To export functions from the libodraw DLL define LIBODRAW_DLL_EXPORT 29 | * To import functions from the libodraw DLL define LIBODRAW_DLL_IMPORT 30 | * Otherwise use default extern statement 31 | */ 32 | #if defined( LIBODRAW_DLL_EXPORT ) 33 | #define LIBODRAW_EXTERN __declspec(dllexport) 34 | 35 | #elif defined( LIBODRAW_DLL_IMPORT ) 36 | #define LIBODRAW_EXTERN extern __declspec(dllimport) 37 | 38 | #else 39 | #define LIBODRAW_EXTERN extern 40 | 41 | #endif 42 | 43 | #endif /* !defined( _LIBODRAW_EXTERN_H ) */ 44 | 45 | -------------------------------------------------------------------------------- /include/libodraw/features.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Features of libodraw 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_FEATURES_H ) 23 | #define _LIBODRAW_FEATURES_H 24 | 25 | /* The libodraw type support features 26 | */ 27 | #if defined( WINAPI ) || @HAVE_WIDE_CHARACTER_TYPE@ 28 | #define LIBODRAW_HAVE_WIDE_CHARACTER_TYPE 1 29 | #endif 30 | 31 | #if defined( WINAPI ) || @HAVE_MULTI_THREAD_SUPPORT@ 32 | #define LIBODRAW_HAVE_MULTI_THREAD_SUPPORT 1 33 | #endif 34 | 35 | #if defined( HAVE_LIBBFIO ) || ( !defined( WINAPI ) && @HAVE_LIBBFIO@ ) 36 | #define LIBODRAW_HAVE_BFIO 1 37 | #endif 38 | 39 | #if !defined( LIBODRAW_DEPRECATED ) 40 | #if defined( __GNUC__ ) && __GNUC__ >= 3 41 | #define LIBODRAW_DEPRECATED __attribute__ ((__deprecated__)) 42 | #elif defined( _MSC_VER ) 43 | #define LIBODRAW_DEPRECATED __declspec(deprecated) 44 | #else 45 | #define LIBODRAW_DEPRECATED 46 | #endif 47 | #endif 48 | 49 | #endif /* !defined( _LIBODRAW_FEATURES_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libodraw.ini: -------------------------------------------------------------------------------- 1 | [project] 2 | description: "libodraw is a library to access to optical disc (split) RAW image files (bin/cue, iso/cue)." 3 | name: "libodraw" 4 | status: "alpha" 5 | year_of_creation: "2010" 6 | documentation_url: "https://github.com/libyal/libodraw/tree/main/documentation" 7 | features: ["debug_output", "ossfuzz", "tools"] 8 | 9 | [library] 10 | build_dependencies: ["lex", "yacc"] 11 | description: "Library to access optical disc (split) RAW formats" 12 | features: ["pthread", "wide_character_type"] 13 | public_types: ["data_file", "handle"] 14 | 15 | [tools] 16 | build_dependencies: ["crypto"] 17 | description: "Several tools for accessing optical disc (split) RAW formats" 18 | names: ["odrawinfo", "odrawverify"] 19 | 20 | [troubleshooting] 21 | example: "odrawinfo disc.cue" 22 | 23 | [tests] 24 | profiles: ["libodraw", "odrawinfo", "odrawverify"] 25 | info_tool_options_per_profile: [""] 26 | info_tool_profiles: ["odrawinfo"] 27 | verify_tool_options: "-q" 28 | example_filename1: "disc1.cue" 29 | example_filename2: "disc2.cue" 30 | 31 | -------------------------------------------------------------------------------- /libodraw.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libodraw 7 | Description: Library to access optical disc (split) RAW formats 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lodraw 10 | Libs.private: @ax_libbfio_pc_libs_private@ @ax_libcdata_pc_libs_private@ @ax_libcerror_pc_libs_private@ @ax_libcfile_pc_libs_private@ @ax_libclocale_pc_libs_private@ @ax_libcnotify_pc_libs_private@ @ax_libcpath_pc_libs_private@ @ax_libcsplit_pc_libs_private@ @ax_libcthreads_pc_libs_private@ @ax_libuna_pc_libs_private@ @ax_pthread_pc_libs_private@ 11 | Cflags: -I${includedir} 12 | 13 | -------------------------------------------------------------------------------- /libodraw.spec.in: -------------------------------------------------------------------------------- 1 | Name: libodraw 2 | Version: @VERSION@ 3 | Release: 1 4 | Summary: Library to access optical disc (split) RAW formats 5 | Group: System Environment/Libraries 6 | License: LGPL-3.0-or-later 7 | Source: %{name}-%{version}.tar.gz 8 | URL: https://github.com/libyal/libodraw 9 | @libodraw_spec_requires@ @ax_libbfio_spec_requires@ @ax_libcdata_spec_requires@ @ax_libcerror_spec_requires@ @ax_libcfile_spec_requires@ @ax_libclocale_spec_requires@ @ax_libcnotify_spec_requires@ @ax_libcpath_spec_requires@ @ax_libcsplit_spec_requires@ @ax_libcthreads_spec_requires@ @ax_libuna_spec_requires@ 10 | BuildRequires: gcc @ax_libbfio_spec_build_requires@ @ax_libcdata_spec_build_requires@ @ax_libcerror_spec_build_requires@ @ax_libcfile_spec_build_requires@ @ax_libclocale_spec_build_requires@ @ax_libcnotify_spec_build_requires@ @ax_libcpath_spec_build_requires@ @ax_libcsplit_spec_build_requires@ @ax_libcthreads_spec_build_requires@ @ax_libuna_spec_build_requires@ 11 | 12 | %description -n libodraw 13 | Library to access optical disc (split) RAW formats 14 | 15 | %package -n libodraw-static 16 | Summary: Library to access optical disc (split) RAW formats 17 | Group: Development/Libraries 18 | Requires: libodraw = %{version}-%{release} 19 | 20 | %description -n libodraw-static 21 | Static library version of libodraw. 22 | 23 | %package -n libodraw-devel 24 | Summary: Header files and libraries for developing applications for libodraw 25 | Group: Development/Libraries 26 | Requires: libodraw = %{version}-%{release} 27 | 28 | %description -n libodraw-devel 29 | Header files and libraries for developing applications for libodraw. 30 | 31 | %package -n libodraw-tools 32 | Summary: Several tools for accessing optical disc (split) RAW formats 33 | Group: Applications/System 34 | Requires: libodraw = %{version}-%{release} @ax_libcrypto_spec_requires@ @ax_libhmac_spec_requires@ 35 | @libodraw_spec_tools_build_requires@ @ax_libcrypto_spec_build_requires@ @ax_libhmac_spec_build_requires@ 36 | 37 | %description -n libodraw-tools 38 | Several tools for accessing optical disc (split) RAW formats 39 | 40 | %prep 41 | %setup -q 42 | 43 | %build 44 | %configure --prefix=/usr --libdir=%{_libdir} --mandir=%{_mandir} 45 | make %{?_smp_mflags} 46 | 47 | %install 48 | rm -rf %{buildroot} 49 | %make_install 50 | 51 | %clean 52 | rm -rf %{buildroot} 53 | 54 | %post -p /sbin/ldconfig 55 | 56 | %postun -p /sbin/ldconfig 57 | 58 | %files -n libodraw 59 | %license COPYING COPYING.LESSER 60 | %doc AUTHORS README 61 | %{_libdir}/*.so.* 62 | 63 | %files -n libodraw-static 64 | %license COPYING COPYING.LESSER 65 | %doc AUTHORS README 66 | %{_libdir}/*.a 67 | 68 | %files -n libodraw-devel 69 | %license COPYING COPYING.LESSER 70 | %doc AUTHORS README 71 | %{_libdir}/*.so 72 | %{_libdir}/pkgconfig/libodraw.pc 73 | %{_includedir}/* 74 | %{_mandir}/man3/* 75 | 76 | %files -n libodraw-tools 77 | %license COPYING COPYING.LESSER 78 | %doc AUTHORS README 79 | %{_bindir}/* 80 | %{_mandir}/man1/* 81 | 82 | %changelog 83 | * @SPEC_DATE@ Joachim Metz @VERSION@-1 84 | - Auto-generated 85 | 86 | -------------------------------------------------------------------------------- /libodraw/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_LFLAGS = -Cf 2 | AM_YFLAGS = -d -v -l -p libodraw_cue_scanner_ 3 | 4 | AM_CPPFLAGS = \ 5 | -I../include -I$(top_srcdir)/include \ 6 | -I../common -I$(top_srcdir)/common \ 7 | @LIBCERROR_CPPFLAGS@ \ 8 | @LIBCTHREADS_CPPFLAGS@ \ 9 | @LIBCDATA_CPPFLAGS@ \ 10 | @LIBCLOCALE_CPPFLAGS@ \ 11 | @LIBCNOTIFY_CPPFLAGS@ \ 12 | @LIBCSPLIT_CPPFLAGS@ \ 13 | @LIBUNA_CPPFLAGS@ \ 14 | @LIBCFILE_CPPFLAGS@ \ 15 | @LIBCPATH_CPPFLAGS@ \ 16 | @LIBBFIO_CPPFLAGS@ \ 17 | @PTHREAD_CPPFLAGS@ \ 18 | @LIBODRAW_DLL_EXPORT@ 19 | 20 | BUILT_SOURCES = libodraw_cue_parser.h 21 | 22 | lib_LTLIBRARIES = libodraw.la 23 | 24 | libodraw_la_SOURCES = \ 25 | libodraw.c \ 26 | libodraw_codepage.h \ 27 | libodraw_cue_parser.y \ 28 | libodraw_cue_scanner.l \ 29 | libodraw_data_file.c libodraw_data_file.h \ 30 | libodraw_data_file_descriptor.c libodraw_data_file_descriptor.h \ 31 | libodraw_debug.c libodraw_debug.h \ 32 | libodraw_definitions.h \ 33 | libodraw_error.c libodraw_error.h \ 34 | libodraw_extern.h \ 35 | libodraw_handle.c libodraw_handle.h \ 36 | libodraw_io_handle.c libodraw_io_handle.h \ 37 | libodraw_libbfio.h \ 38 | libodraw_libcdata.h \ 39 | libodraw_libcerror.h \ 40 | libodraw_libclocale.h \ 41 | libodraw_libcnotify.h \ 42 | libodraw_libcpath.h \ 43 | libodraw_libuna.h \ 44 | libodraw_notify.c libodraw_notify.h \ 45 | libodraw_sector_range.c libodraw_sector_range.h \ 46 | libodraw_support.c libodraw_support.h \ 47 | libodraw_track_value.c libodraw_track_value.h \ 48 | libodraw_types.h \ 49 | libodraw_unused.h 50 | 51 | libodraw_la_LIBADD = \ 52 | @LIBCERROR_LIBADD@ \ 53 | @LIBCTHREADS_LIBADD@ \ 54 | @LIBCDATA_LIBADD@ \ 55 | @LIBCLOCALE_LIBADD@ \ 56 | @LIBCNOTIFY_LIBADD@ \ 57 | @LIBCSPLIT_LIBADD@ \ 58 | @LIBUNA_LIBADD@ \ 59 | @LIBCFILE_LIBADD@ \ 60 | @LIBCPATH_LIBADD@ \ 61 | @LIBBFIO_LIBADD@ \ 62 | @PTHREAD_LIBADD@ 63 | 64 | libodraw_la_LDFLAGS = -no-undefined -version-info 1:0:0 65 | 66 | EXTRA_DIST = \ 67 | libodraw_definitions.h.in \ 68 | libodraw_cue_parser.c libodraw_cue_parser.h \ 69 | libodraw_cue_scanner.c \ 70 | libodraw.rc \ 71 | libodraw.rc.in 72 | 73 | DISTCLEANFILES = \ 74 | libodraw_definitions.h \ 75 | libodraw.rc \ 76 | libodraw_cue_parser.c \ 77 | libodraw_cue_parser.h \ 78 | libodraw_cue_parser.output \ 79 | libodraw_cue_scanner.c \ 80 | Makefile \ 81 | Makefile.in 82 | 83 | sources-local: $(BUILT_SOURCES) 84 | 85 | splint-local: 86 | @echo "Running splint on libodraw ..." 87 | -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(libodraw_la_SOURCES) 88 | 89 | -------------------------------------------------------------------------------- /libodraw/libodraw.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Library to access optical disc (split) RAW formats 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | 24 | #if defined( WINAPI ) 25 | #include 26 | #endif 27 | 28 | #include "libodraw_unused.h" 29 | 30 | /* Define HAVE_LOCAL_LIBODRAW for local use of libodraw 31 | */ 32 | #if !defined( HAVE_LOCAL_LIBODRAW ) 33 | 34 | #if defined( WINAPI ) && defined( HAVE_DLLMAIN ) 35 | 36 | #if defined( _MANAGED ) 37 | #pragma managed( push, off ) 38 | #endif 39 | 40 | /* Defines the entry point for the DLL 41 | */ 42 | BOOL WINAPI DllMain( 43 | HINSTANCE hinstDLL, 44 | DWORD fdwReason, 45 | LPVOID lpvReserved ) 46 | { 47 | LIBODRAW_UNREFERENCED_PARAMETER( lpvReserved ) 48 | 49 | switch( fdwReason ) 50 | { 51 | case DLL_PROCESS_ATTACH: 52 | DisableThreadLibraryCalls( 53 | hinstDLL ); 54 | break; 55 | 56 | case DLL_THREAD_ATTACH: 57 | break; 58 | 59 | case DLL_THREAD_DETACH: 60 | break; 61 | 62 | case DLL_PROCESS_DETACH: 63 | break; 64 | } 65 | return( TRUE ); 66 | } 67 | 68 | /* Function that indicates the library is a DLL 69 | * Returns 1 70 | */ 71 | int libodraw_is_dll( 72 | void ) 73 | { 74 | return( 1 ); 75 | } 76 | 77 | #endif /* defined( WINAPI ) && defined( HAVE_DLLMAIN ) */ 78 | 79 | #endif /* !defined( HAVE_LOCAL_LIBODRAW ) */ 80 | 81 | -------------------------------------------------------------------------------- /libodraw/libodraw.rc.in: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef GCC_WINDRES 4 | VS_VERSION_INFO VERSIONINFO 5 | #else 6 | VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 7 | #endif 8 | FILEVERSION 1,0,0,0 9 | PRODUCTVERSION 1,0,0,0 10 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 11 | #ifdef _DEBUG 12 | FILEFLAGS 0x1L 13 | #else 14 | FILEFLAGS 0x0L 15 | #endif 16 | FILEOS VOS__WINDOWS32 17 | FILETYPE VFT_DLL 18 | FILESUBTYPE 0x0L 19 | BEGIN 20 | BLOCK "StringFileInfo" 21 | BEGIN 22 | BLOCK "040904E4" 23 | BEGIN 24 | VALUE "FileDescription", "Library to access optical disc (split) RAW formats\0" 25 | VALUE "FileVersion", "@VERSION@" "\0" 26 | VALUE "InternalName", "libodraw.dll\0" 27 | VALUE "LegalCopyright", "(C) 2010-2024, Joachim Metz \0" 28 | VALUE "OriginalFilename", "libodraw.dll\0" 29 | VALUE "ProductName", "libodraw\0" 30 | VALUE "ProductVersion", "@VERSION@" "\0" 31 | VALUE "Comments", "For more information visit https://github.com/libyal/libodraw/\0" 32 | END 33 | END 34 | BLOCK "VarFileInfo" 35 | BEGIN 36 | VALUE "Translation", 0x0409, 1200 37 | END 38 | END 39 | -------------------------------------------------------------------------------- /libodraw/libodraw_codepage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Codepage functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_INTERNAL_CODEPAGE_H ) 23 | #define _LIBODRAW_INTERNAL_CODEPAGE_H 24 | 25 | #include 26 | #include 27 | 28 | #if defined( __cplusplus ) 29 | extern "C" { 30 | #endif 31 | 32 | /* Define HAVE_LOCAL_LIBODRAW for local use of libodraw 33 | * The definitions in are copied here 34 | * for local use of libodraw 35 | */ 36 | #if !defined( HAVE_LOCAL_LIBODRAW ) 37 | 38 | #include 39 | 40 | #else 41 | 42 | /* The codepage definitions 43 | */ 44 | enum LIBODRAW_CODEPAGES 45 | { 46 | LIBODRAW_CODEPAGE_ASCII = 20127, 47 | 48 | LIBODRAW_CODEPAGE_ISO_8859_1 = 28591, 49 | LIBODRAW_CODEPAGE_ISO_8859_2 = 28592, 50 | LIBODRAW_CODEPAGE_ISO_8859_3 = 28593, 51 | LIBODRAW_CODEPAGE_ISO_8859_4 = 28594, 52 | LIBODRAW_CODEPAGE_ISO_8859_5 = 28595, 53 | LIBODRAW_CODEPAGE_ISO_8859_6 = 28596, 54 | LIBODRAW_CODEPAGE_ISO_8859_7 = 28597, 55 | LIBODRAW_CODEPAGE_ISO_8859_8 = 28598, 56 | LIBODRAW_CODEPAGE_ISO_8859_9 = 28599, 57 | LIBODRAW_CODEPAGE_ISO_8859_10 = 28600, 58 | LIBODRAW_CODEPAGE_ISO_8859_11 = 28601, 59 | LIBODRAW_CODEPAGE_ISO_8859_13 = 28603, 60 | LIBODRAW_CODEPAGE_ISO_8859_14 = 28604, 61 | LIBODRAW_CODEPAGE_ISO_8859_15 = 28605, 62 | LIBODRAW_CODEPAGE_ISO_8859_16 = 28606, 63 | 64 | LIBODRAW_CODEPAGE_KOI8_R = 20866, 65 | LIBODRAW_CODEPAGE_KOI8_U = 21866, 66 | 67 | LIBODRAW_CODEPAGE_WINDOWS_874 = 874, 68 | LIBODRAW_CODEPAGE_WINDOWS_932 = 932, 69 | LIBODRAW_CODEPAGE_WINDOWS_936 = 936, 70 | LIBODRAW_CODEPAGE_WINDOWS_949 = 949, 71 | LIBODRAW_CODEPAGE_WINDOWS_950 = 950, 72 | LIBODRAW_CODEPAGE_WINDOWS_1250 = 1250, 73 | LIBODRAW_CODEPAGE_WINDOWS_1251 = 1251, 74 | LIBODRAW_CODEPAGE_WINDOWS_1252 = 1252, 75 | LIBODRAW_CODEPAGE_WINDOWS_1253 = 1253, 76 | LIBODRAW_CODEPAGE_WINDOWS_1254 = 1254, 77 | LIBODRAW_CODEPAGE_WINDOWS_1255 = 1255, 78 | LIBODRAW_CODEPAGE_WINDOWS_1256 = 1256, 79 | LIBODRAW_CODEPAGE_WINDOWS_1257 = 1257, 80 | LIBODRAW_CODEPAGE_WINDOWS_1258 = 1258 81 | }; 82 | 83 | #endif /* !defined( HAVE_LOCAL_LIBODRAW ) */ 84 | 85 | #if defined( __cplusplus ) 86 | } 87 | #endif 88 | 89 | #endif /* !defined( _LIBODRAW_INTERNAL_CODEPAGE_H ) */ 90 | 91 | -------------------------------------------------------------------------------- /libodraw/libodraw_data_file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Data file functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_INTERNAL_DATA_FILE_H ) 23 | #define _LIBODRAW_INTERNAL_DATA_FILE_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libodraw_extern.h" 29 | #include "libodraw_data_file_descriptor.h" 30 | #include "libodraw_handle.h" 31 | #include "libodraw_libcerror.h" 32 | #include "libodraw_types.h" 33 | 34 | #if defined( __cplusplus ) 35 | extern "C" { 36 | #endif 37 | 38 | typedef struct libodraw_internal_data_file libodraw_internal_data_file_t; 39 | 40 | struct libodraw_internal_data_file 41 | { 42 | /* The internal handle 43 | */ 44 | libodraw_internal_handle_t *internal_handle; 45 | 46 | /* The data file descriptor 47 | */ 48 | libodraw_data_file_descriptor_t *data_file_descriptor; 49 | }; 50 | 51 | int libodraw_data_file_initialize( 52 | libodraw_data_file_t **data_file, 53 | libodraw_internal_handle_t *internal_handle, 54 | libodraw_data_file_descriptor_t *data_file_descriptor, 55 | libcerror_error_t **error ); 56 | 57 | LIBODRAW_EXTERN \ 58 | int libodraw_data_file_free( 59 | libodraw_data_file_t **data_file, 60 | libcerror_error_t **error ); 61 | 62 | LIBODRAW_EXTERN \ 63 | int libodraw_data_file_get_filename_size( 64 | libodraw_data_file_t *data_file, 65 | size_t *filename_size, 66 | libcerror_error_t **error ); 67 | 68 | LIBODRAW_EXTERN \ 69 | int libodraw_data_file_get_filename( 70 | libodraw_data_file_t *data_file, 71 | char *filename, 72 | size_t filename_size, 73 | libcerror_error_t **error ); 74 | 75 | LIBODRAW_EXTERN \ 76 | int libodraw_data_file_set_filename( 77 | libodraw_data_file_t *data_file, 78 | const char *filename, 79 | size_t filename_length, 80 | libcerror_error_t **error ); 81 | 82 | #if defined( HAVE_WIDE_CHARACTER_TYPE ) 83 | LIBODRAW_EXTERN \ 84 | int libodraw_data_file_get_filename_size_wide( 85 | libodraw_data_file_t *data_file, 86 | size_t *filename_size, 87 | libcerror_error_t **error ); 88 | 89 | LIBODRAW_EXTERN \ 90 | int libodraw_data_file_get_filename_wide( 91 | libodraw_data_file_t *data_file, 92 | wchar_t *filename, 93 | size_t filename_size, 94 | libcerror_error_t **error ); 95 | 96 | LIBODRAW_EXTERN \ 97 | int libodraw_data_file_set_filename_wide( 98 | libodraw_data_file_t *data_file, 99 | const wchar_t *filename, 100 | size_t filename_length, 101 | libcerror_error_t **error ); 102 | #endif 103 | 104 | LIBODRAW_EXTERN \ 105 | int libodraw_data_file_get_type( 106 | libodraw_data_file_t *data_file, 107 | uint8_t *type, 108 | libcerror_error_t **error ); 109 | 110 | #if defined( __cplusplus ) 111 | } 112 | #endif 113 | 114 | #endif /* !defined( _LIBODRAW_INTERNAL_DATA_FILE_H ) */ 115 | 116 | -------------------------------------------------------------------------------- /libodraw/libodraw_data_file_descriptor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Data file descriptor functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_DATA_FILE_DESCRIPTOR_H ) 23 | #define _LIBODRAW_DATA_FILE_DESCRIPTOR_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libodraw_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct libodraw_data_file_descriptor libodraw_data_file_descriptor_t; 35 | 36 | struct libodraw_data_file_descriptor 37 | { 38 | /* The name 39 | */ 40 | system_character_t *name; 41 | 42 | /* The name size 43 | */ 44 | size_t name_size; 45 | 46 | /* Value to indicate the name was set by the data_file_set_filename functions 47 | */ 48 | uint8_t name_set; 49 | 50 | /* The type 51 | */ 52 | uint8_t type; 53 | }; 54 | 55 | int libodraw_data_file_descriptor_initialize( 56 | libodraw_data_file_descriptor_t **data_file_descriptor, 57 | libcerror_error_t **error ); 58 | 59 | int libodraw_data_file_descriptor_free( 60 | libodraw_data_file_descriptor_t **data_file_descriptor, 61 | libcerror_error_t **error ); 62 | 63 | int libodraw_data_file_descriptor_get_name_size( 64 | libodraw_data_file_descriptor_t *data_file_descriptor, 65 | size_t *name_size, 66 | libcerror_error_t **error ); 67 | 68 | int libodraw_data_file_descriptor_get_name( 69 | libodraw_data_file_descriptor_t *data_file_descriptor, 70 | char *name, 71 | size_t name_size, 72 | libcerror_error_t **error ); 73 | 74 | int libodraw_data_file_descriptor_set_name( 75 | libodraw_data_file_descriptor_t *data_file_descriptor, 76 | const char *name, 77 | size_t name_length, 78 | libcerror_error_t **error ); 79 | 80 | #if defined( HAVE_WIDE_CHARACTER_TYPE ) 81 | 82 | int libodraw_data_file_descriptor_get_name_size_wide( 83 | libodraw_data_file_descriptor_t *data_file_descriptor, 84 | size_t *name_size, 85 | libcerror_error_t **error ); 86 | 87 | int libodraw_data_file_descriptor_get_name_wide( 88 | libodraw_data_file_descriptor_t *data_file_descriptor, 89 | wchar_t *name, 90 | size_t name_size, 91 | libcerror_error_t **error ); 92 | 93 | int libodraw_data_file_descriptor_set_name_wide( 94 | libodraw_data_file_descriptor_t *data_file_descriptor, 95 | const wchar_t *name, 96 | size_t name_length, 97 | libcerror_error_t **error ); 98 | 99 | #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ 100 | 101 | #if defined( __cplusplus ) 102 | } 103 | #endif 104 | 105 | #endif /* !defined( _LIBODRAW_DATA_FILE_DESCRIPTOR_H ) */ 106 | 107 | -------------------------------------------------------------------------------- /libodraw/libodraw_debug.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Debug functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | #include "libodraw_debug.h" 26 | #include "libodraw_libbfio.h" 27 | #include "libodraw_libcerror.h" 28 | #include "libodraw_libcnotify.h" 29 | 30 | #if defined( HAVE_DEBUG_OUTPUT ) 31 | 32 | /* Prints the read offsets 33 | * Returns 1 if successful or -1 on error 34 | */ 35 | int libodraw_debug_print_read_offsets( 36 | libbfio_handle_t *file_io_handle, 37 | libcerror_error_t **error ) 38 | { 39 | static char *function = "libodraw_debug_print_read_offsets"; 40 | off64_t offset = 0; 41 | size64_t size = 0; 42 | int number_of_offsets = 0; 43 | int offset_iterator = 0; 44 | 45 | if( file_io_handle == NULL ) 46 | { 47 | libcerror_error_set( 48 | error, 49 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, 50 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, 51 | "%s: invalid file IO handle.", 52 | function ); 53 | 54 | return( -1 ); 55 | } 56 | if( libbfio_handle_get_number_of_offsets_read( 57 | file_io_handle, 58 | &number_of_offsets, 59 | error ) != 1 ) 60 | { 61 | libcerror_error_set( 62 | error, 63 | LIBCERROR_ERROR_DOMAIN_RUNTIME, 64 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, 65 | "%s: unable to retrieve number of offsets read.", 66 | function ); 67 | 68 | return( -1 ); 69 | } 70 | libcnotify_printf( 71 | "Offsets read:\n" ); 72 | 73 | for( offset_iterator = 0; 74 | offset_iterator < number_of_offsets; 75 | offset_iterator++ ) 76 | { 77 | if( libbfio_handle_get_offset_read( 78 | file_io_handle, 79 | offset_iterator, 80 | &offset, 81 | &size, 82 | error ) != 1 ) 83 | { 84 | libcerror_error_set( 85 | error, 86 | LIBCERROR_ERROR_DOMAIN_RUNTIME, 87 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, 88 | "%s: unable to retrieve offset: %d.", 89 | function, 90 | ( offset_iterator + 1 ) ); 91 | 92 | return( -1 ); 93 | } 94 | libcnotify_printf( 95 | "%08" PRIi64 " ( 0x%08" PRIx64 " ) - %08" PRIi64 " ( 0x%08" PRIx64 " ) size: %" PRIu64 "\n", 96 | offset, 97 | offset, 98 | offset + size, 99 | offset + size, 100 | size ); 101 | } 102 | libcnotify_printf( 103 | "\n" ); 104 | 105 | return( 1 ); 106 | } 107 | 108 | #endif 109 | 110 | -------------------------------------------------------------------------------- /libodraw/libodraw_debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Debug functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_DEBUG_H ) 23 | #define _LIBODRAW_DEBUG_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libodraw_libbfio.h" 29 | #include "libodraw_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | #if defined( HAVE_DEBUG_OUTPUT ) 36 | 37 | int libodraw_debug_print_read_offsets( 38 | libbfio_handle_t *file_io_handle, 39 | libcerror_error_t **error ); 40 | 41 | #endif 42 | 43 | #if defined( __cplusplus ) 44 | } 45 | #endif 46 | 47 | #endif /* !defined( _LIBODRAW_DEBUG_H ) */ 48 | 49 | -------------------------------------------------------------------------------- /libodraw/libodraw_definitions.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal definitions 3 | * 4 | * Copyright (c) 2010-2013-2011, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_INTERNAL_DEFINITIONS_H ) 23 | #define _LIBODRAW_INTERNAL_DEFINITIONS_H 24 | 25 | #include 26 | #include 27 | 28 | #define LIBODRAW_ENDIAN_BIG _BYTE_STREAM_ENDIAN_BIG 29 | #define LIBODRAW_ENDIAN_LITTLE _BYTE_STREAM_ENDIAN_LITTLE 30 | 31 | /* Define HAVE_LOCAL_LIBODRAW for local use of libodraw 32 | */ 33 | #if !defined( HAVE_LOCAL_LIBODRAW ) 34 | #include 35 | 36 | /* The definitions in are copied here 37 | * for local use of libodraw 38 | */ 39 | #else 40 | #define LIBODRAW_VERSION @VERSION@ 41 | 42 | /* The version string 43 | */ 44 | #define LIBODRAW_VERSION_STRING "@VERSION@" 45 | 46 | /* The access flags definitions 47 | * bit 1 set to 1 for read access 48 | * bit 2 set to 1 for write access 49 | * bit 3-8 not used 50 | */ 51 | enum LIBODRAW_ACCESS_FLAGS 52 | { 53 | LIBODRAW_ACCESS_FLAG_READ = 0x01, 54 | /* Reserved: not supported yet */ 55 | LIBODRAW_ACCESS_FLAG_WRITE = 0x02 56 | }; 57 | 58 | /* The file access macros 59 | */ 60 | #define LIBODRAW_OPEN_READ ( LIBODRAW_ACCESS_FLAG_READ ) 61 | /* Reserved: not supported yet */ 62 | #define LIBODRAW_OPEN_WRITE ( LIBODRAW_ACCESS_FLAG_WRITE ) 63 | /* Reserved: not supported yet */ 64 | #define LIBODRAW_OPEN_READ_WRITE ( LIBODRAW_ACCESS_FLAG_READ | LIBODRAW_ACCESS_FLAG_WRITE ) 65 | 66 | /* The file types 67 | */ 68 | enum LIBODRAW_FILE_TYPES 69 | { 70 | LIBODRAW_FILE_TYPE_UNKNOWN, 71 | LIBODRAW_FILE_TYPE_BINARY_LITTLE_ENDIAN, 72 | LIBODRAW_FILE_TYPE_BINARY_BIG_ENDIAN, 73 | LIBODRAW_FILE_TYPE_AUDIO_AIFF, 74 | LIBODRAW_FILE_TYPE_AUDIO_WAVE, 75 | LIBODRAW_FILE_TYPE_AUDIO_MPEG1_LAYER3, 76 | }; 77 | 78 | #define LIBODRAW_FILE_TYPE_BINARY LIBODRAW_FILE_TYPE_BINARY_LITTLE_ENDIAN 79 | #define LIBODRAW_FILE_TYPE_MOTOROLA LIBODRAW_FILE_TYPE_BINARY_BIG_ENDIAN 80 | #define LIBODRAW_FILE_TYPE_AIFF LIBODRAW_FILE_TYPE_AUDIO_AIFF 81 | #define LIBODRAW_FILE_TYPE_WAVE LIBODRAW_FILE_TYPE_AUDIO_WAVE 82 | #define LIBODRAW_FILE_TYPE_MP3 LIBODRAW_FILE_TYPE_AUDIO_MPEG1_LAYER3 83 | 84 | /* The track types 85 | */ 86 | enum LIBODRAW_TRACK_TYPES 87 | { 88 | LIBODRAW_TRACK_TYPE_UNKNOWN, 89 | LIBODRAW_TRACK_TYPE_AUDIO, 90 | LIBODRAW_TRACK_TYPE_CDG, 91 | LIBODRAW_TRACK_TYPE_MODE1_2048, 92 | LIBODRAW_TRACK_TYPE_MODE1_2352, 93 | LIBODRAW_TRACK_TYPE_MODE2_2048, 94 | LIBODRAW_TRACK_TYPE_MODE2_2324, 95 | LIBODRAW_TRACK_TYPE_MODE2_2336, 96 | LIBODRAW_TRACK_TYPE_MODE2_2352, 97 | LIBODRAW_TRACK_TYPE_CDI_2336, 98 | LIBODRAW_TRACK_TYPE_CDI_2352, 99 | }; 100 | 101 | #endif /* !defined( HAVE_LOCAL_LIBODRAW ) */ 102 | 103 | #endif /* !defined( _LIBODRAW_INTERNAL_DEFINITIONS_H ) */ 104 | 105 | -------------------------------------------------------------------------------- /libodraw/libodraw_error.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Error functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #include "libodraw_error.h" 27 | #include "libodraw_libcerror.h" 28 | 29 | #if !defined( HAVE_LOCAL_LIBODRAW ) 30 | 31 | /* Free an error and its elements 32 | */ 33 | void libodraw_error_free( 34 | libodraw_error_t **error ) 35 | { 36 | libcerror_error_free( 37 | (libcerror_error_t **) error ); 38 | } 39 | 40 | /* Prints a descriptive string of the error to the stream 41 | * Returns the number of printed characters if successful or -1 on error 42 | */ 43 | int libodraw_error_fprint( 44 | libodraw_error_t *error, 45 | FILE *stream ) 46 | { 47 | int print_count = 0; 48 | 49 | print_count = libcerror_error_fprint( 50 | (libcerror_error_t *) error, 51 | stream ); 52 | 53 | return( print_count ); 54 | } 55 | 56 | /* Prints a descriptive string of the error to the string 57 | * The end-of-string character is not included in the return value 58 | * Returns the number of printed characters if successful or -1 on error 59 | */ 60 | int libodraw_error_sprint( 61 | libodraw_error_t *error, 62 | char *string, 63 | size_t size ) 64 | { 65 | int print_count = 0; 66 | 67 | print_count = libcerror_error_sprint( 68 | (libcerror_error_t *) error, 69 | string, 70 | size ); 71 | 72 | return( print_count ); 73 | } 74 | 75 | /* Prints a backtrace of the error to the stream 76 | * Returns the number of printed characters if successful or -1 on error 77 | */ 78 | int libodraw_error_backtrace_fprint( 79 | libodraw_error_t *error, 80 | FILE *stream ) 81 | { 82 | int print_count = 0; 83 | 84 | print_count = libcerror_error_backtrace_fprint( 85 | (libcerror_error_t *) error, 86 | stream ); 87 | 88 | return( print_count ); 89 | } 90 | 91 | /* Prints a backtrace of the error to the string 92 | * The end-of-string character is not included in the return value 93 | * Returns the number of printed characters if successful or -1 on error 94 | */ 95 | int libodraw_error_backtrace_sprint( 96 | libodraw_error_t *error, 97 | char *string, 98 | size_t size ) 99 | { 100 | int print_count = 0; 101 | 102 | print_count = libcerror_error_backtrace_sprint( 103 | (libcerror_error_t *) error, 104 | string, 105 | size ); 106 | 107 | return( print_count ); 108 | } 109 | 110 | #endif /* !defined( HAVE_LOCAL_LIBODRAW ) */ 111 | 112 | -------------------------------------------------------------------------------- /libodraw/libodraw_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Error functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_INTERNAL_ERROR_H ) 23 | #define _LIBODRAW_INTERNAL_ERROR_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #if !defined( HAVE_LOCAL_LIBODRAW ) 30 | #include 31 | #endif 32 | 33 | #include "libodraw_extern.h" 34 | 35 | #if defined( __cplusplus ) 36 | extern "C" { 37 | #endif 38 | 39 | #if !defined( HAVE_LOCAL_LIBODRAW ) 40 | 41 | LIBODRAW_EXTERN \ 42 | void libodraw_error_free( 43 | libodraw_error_t **error ); 44 | 45 | LIBODRAW_EXTERN \ 46 | int libodraw_error_fprint( 47 | libodraw_error_t *error, 48 | FILE *stream ); 49 | 50 | LIBODRAW_EXTERN \ 51 | int libodraw_error_sprint( 52 | libodraw_error_t *error, 53 | char *string, 54 | size_t size ); 55 | 56 | LIBODRAW_EXTERN \ 57 | int libodraw_error_backtrace_fprint( 58 | libodraw_error_t *error, 59 | FILE *stream ); 60 | 61 | LIBODRAW_EXTERN \ 62 | int libodraw_error_backtrace_sprint( 63 | libodraw_error_t *error, 64 | char *string, 65 | size_t size ); 66 | 67 | #endif /* !defined( HAVE_LOCAL_LIBODRAW ) */ 68 | 69 | #if defined( __cplusplus ) 70 | } 71 | #endif 72 | 73 | #endif /* !defined( _LIBODRAW_INTERNAL_ERROR_H ) */ 74 | 75 | -------------------------------------------------------------------------------- /libodraw/libodraw_extern.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal extern definition 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_INTERNAL_EXTERN_H ) 23 | #define _LIBODRAW_INTERNAL_EXTERN_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBODRAW for local use of libodraw 28 | */ 29 | #if !defined( HAVE_LOCAL_LIBODRAW ) 30 | 31 | #include 32 | 33 | #if defined( __CYGWIN__ ) || defined( __MINGW32__ ) 34 | #define LIBODRAW_EXTERN_VARIABLE extern 35 | #else 36 | #define LIBODRAW_EXTERN_VARIABLE LIBODRAW_EXTERN 37 | #endif 38 | 39 | #else 40 | #define LIBODRAW_EXTERN /* extern */ 41 | #define LIBODRAW_EXTERN_VARIABLE extern 42 | 43 | #endif /* !defined( HAVE_LOCAL_LIBODRAW ) */ 44 | 45 | #endif /* !defined( _LIBODRAW_INTERNAL_EXTERN_H ) */ 46 | 47 | -------------------------------------------------------------------------------- /libodraw/libodraw_io_handle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Input/Output (IO) handle functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_IO_HANDLE_H ) 23 | #define _LIBODRAW_IO_HANDLE_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libodraw_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct libodraw_io_handle libodraw_io_handle_t; 35 | 36 | struct libodraw_io_handle 37 | { 38 | /* The number of bytes per sector 39 | */ 40 | uint32_t bytes_per_sector; 41 | 42 | /* The mode 43 | */ 44 | uint8_t mode; 45 | 46 | /* The codepage of the extended ASCII strings 47 | */ 48 | int ascii_codepage; 49 | 50 | /* Value to indicate if abort was signalled 51 | */ 52 | int abort; 53 | }; 54 | 55 | int libodraw_io_handle_initialize( 56 | libodraw_io_handle_t **io_handle, 57 | libcerror_error_t **error ); 58 | 59 | int libodraw_io_handle_free( 60 | libodraw_io_handle_t **io_handle, 61 | libcerror_error_t **error ); 62 | 63 | int libodraw_io_handle_clear( 64 | libodraw_io_handle_t *io_handle, 65 | libcerror_error_t **error ); 66 | 67 | ssize_t libodraw_io_handle_copy_sector_data_to_buffer( 68 | libodraw_io_handle_t *io_handle, 69 | const uint8_t *sector_data, 70 | size_t sector_data_size, 71 | uint32_t bytes_per_sector, 72 | uint8_t track_type, 73 | uint8_t *buffer, 74 | size_t buffer_size, 75 | uint32_t sector_index, 76 | uint32_t sector_offset, 77 | libcerror_error_t **error ); 78 | 79 | #if defined( __cplusplus ) 80 | } 81 | #endif 82 | 83 | #endif /* !defined( _LIBODRAW_IO_HANDLE_H ) */ 84 | 85 | -------------------------------------------------------------------------------- /libodraw/libodraw_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_LIBBFIO_H ) 23 | #define _LIBODRAW_LIBBFIO_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio 28 | */ 29 | #if defined( HAVE_LOCAL_LIBBFIO ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT 43 | * before including libbfio.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 46 | #define LIBBFIO_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( LIBBFIO_HAVE_MULTI_THREAD_SUPPORT ) 52 | #error Multi-threading support requires libbfio with multi-threading support 53 | #endif 54 | 55 | #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ 56 | 57 | #endif /* !defined( _LIBODRAW_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /libodraw/libodraw_libcdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcdata header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_LIBCDATA_H ) 23 | #define _LIBODRAW_LIBCDATA_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCDATA for local use of libcdata 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCDATA ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBCDATA_DLL_IMPORT 43 | * before including libcdata.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 46 | #define LIBCDATA_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #endif /* defined( HAVE_LOCAL_LIBCDATA ) */ 52 | 53 | #endif /* !defined( _LIBODRAW_LIBCDATA_H ) */ 54 | 55 | -------------------------------------------------------------------------------- /libodraw/libodraw_libcerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcerror header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_LIBCERROR_H ) 23 | #define _LIBODRAW_LIBCERROR_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCERROR for local use of libcerror 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCERROR ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCERROR_DLL_IMPORT 39 | * before including libcerror.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCERROR_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCERROR ) */ 48 | 49 | #endif /* !defined( _LIBODRAW_LIBCERROR_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libodraw/libodraw_libclocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libclocale header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_LIBCLOCALE_H ) 23 | #define _LIBODRAW_LIBCLOCALE_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCLOCALE for local use of libclocale 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCLOCALE ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCLOCALE_DLL_IMPORT 39 | * before including libclocale.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCLOCALE_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCLOCALE ) */ 48 | 49 | #endif /* !defined( _LIBODRAW_LIBCLOCALE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libodraw/libodraw_libcnotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcnotify header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_LIBCNOTIFY_H ) 23 | #define _LIBODRAW_LIBCNOTIFY_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCNOTIFY for local use of libcnotify 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCNOTIFY ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCNOTIFY_DLL_IMPORT 39 | * before including libcnotify.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCNOTIFY_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCNOTIFY ) */ 48 | 49 | #endif /* !defined( _LIBODRAW_LIBCNOTIFY_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libodraw/libodraw_libcpath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal libcpath header 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_LIBCPATH_H ) 23 | #define _LIBODRAW_LIBCPATH_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCPATH for local use of libcpath 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCPATH ) 30 | 31 | #include 32 | #include 33 | 34 | #else 35 | 36 | /* If libtool DLL support is enabled set LIBCPATH_DLL_IMPORT 37 | * before including libcpath.h 38 | */ 39 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 40 | #define LIBCPATH_DLL_IMPORT 41 | #endif 42 | 43 | #include 44 | 45 | #endif /* defined( HAVE_LOCAL_LIBCPATH ) */ 46 | 47 | #endif /* !defined( _LIBODRAW_LIBCPATH_H ) */ 48 | 49 | -------------------------------------------------------------------------------- /libodraw/libodraw_libuna.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libuna header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_LIBUNA_H ) 23 | #define _LIBODRAW_LIBUNA_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBUNA for local use of libuna 28 | */ 29 | #if defined( HAVE_LOCAL_LIBUNA ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | #else 47 | 48 | /* If libtool DLL support is enabled set LIBUNA_DLL_IMPORT 49 | * before including libuna.h 50 | */ 51 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 52 | #define LIBUNA_DLL_IMPORT 53 | #endif 54 | 55 | #include 56 | 57 | #endif /* defined( HAVE_LOCAL_LIBUNA ) */ 58 | 59 | #endif /* !defined( _LIBODRAW_LIBUNA_H ) */ 60 | 61 | -------------------------------------------------------------------------------- /libodraw/libodraw_notify.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Notification functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) 27 | #include 28 | #endif 29 | 30 | #include "libodraw_libcerror.h" 31 | #include "libodraw_libcnotify.h" 32 | #include "libodraw_notify.h" 33 | 34 | #if !defined( HAVE_LOCAL_LIBODRAW ) 35 | 36 | /* Sets the verbose notification 37 | */ 38 | void libodraw_notify_set_verbose( 39 | int verbose ) 40 | { 41 | libcnotify_verbose_set( 42 | verbose ); 43 | } 44 | 45 | /* Sets the notification stream 46 | * Returns 1 if successful or -1 on error 47 | */ 48 | int libodraw_notify_set_stream( 49 | FILE *stream, 50 | libcerror_error_t **error ) 51 | { 52 | static char *function = "libodraw_notify_set_stream"; 53 | 54 | if( libcnotify_stream_set( 55 | stream, 56 | error ) != 1 ) 57 | { 58 | libcerror_error_set( 59 | error, 60 | LIBCERROR_ERROR_DOMAIN_RUNTIME, 61 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, 62 | "%s: unable to set stream.", 63 | function ); 64 | 65 | return( -1 ); 66 | } 67 | return( 1 ); 68 | } 69 | 70 | /* Opens the notification stream using a filename 71 | * The stream is opened in append mode 72 | * Returns 1 if successful or -1 on error 73 | */ 74 | int libodraw_notify_stream_open( 75 | const char *filename, 76 | libcerror_error_t **error ) 77 | { 78 | static char *function = "libodraw_notify_stream_open"; 79 | 80 | if( libcnotify_stream_open( 81 | filename, 82 | error ) != 1 ) 83 | { 84 | libcerror_error_set( 85 | error, 86 | LIBCERROR_ERROR_DOMAIN_IO, 87 | LIBCERROR_IO_ERROR_OPEN_FAILED, 88 | "%s: unable to open stream.", 89 | function ); 90 | 91 | return( -1 ); 92 | } 93 | return( 1 ); 94 | } 95 | 96 | /* Closes the notification stream if opened using a filename 97 | * Returns 0 if successful or -1 on error 98 | */ 99 | int libodraw_notify_stream_close( 100 | libcerror_error_t **error ) 101 | { 102 | static char *function = "libodraw_notify_stream_close"; 103 | 104 | if( libcnotify_stream_close( 105 | error ) != 0 ) 106 | { 107 | libcerror_error_set( 108 | error, 109 | LIBCERROR_ERROR_DOMAIN_IO, 110 | LIBCERROR_IO_ERROR_OPEN_FAILED, 111 | "%s: unable to open stream.", 112 | function ); 113 | 114 | return( -1 ); 115 | } 116 | return( 0 ); 117 | } 118 | 119 | #endif /* !defined( HAVE_LOCAL_LIBODRAW ) */ 120 | 121 | -------------------------------------------------------------------------------- /libodraw/libodraw_notify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Notification functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_NOTIFY_H ) 23 | #define _LIBODRAW_NOTIFY_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "libodraw_extern.h" 30 | #include "libodraw_libcerror.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | #if !defined( HAVE_LOCAL_LIBODRAW ) 37 | 38 | LIBODRAW_EXTERN \ 39 | void libodraw_notify_set_verbose( 40 | int verbose ); 41 | 42 | LIBODRAW_EXTERN \ 43 | int libodraw_notify_set_stream( 44 | FILE *stream, 45 | libcerror_error_t **error ); 46 | 47 | LIBODRAW_EXTERN \ 48 | int libodraw_notify_stream_open( 49 | const char *filename, 50 | libcerror_error_t **error ); 51 | 52 | LIBODRAW_EXTERN \ 53 | int libodraw_notify_stream_close( 54 | libcerror_error_t **error ); 55 | 56 | #endif /* !defined( HAVE_LOCAL_LIBODRAW ) */ 57 | 58 | #if defined( __cplusplus ) 59 | } 60 | #endif 61 | 62 | #endif /* !defined( _LIBODRAW_NOTIFY_H ) */ 63 | 64 | -------------------------------------------------------------------------------- /libodraw/libodraw_sector_range.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Sector range functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_SECTOR_RANGE_H ) 23 | #define _LIBODRAW_SECTOR_RANGE_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libodraw_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct libodraw_sector_range libodraw_sector_range_t; 35 | 36 | struct libodraw_sector_range 37 | { 38 | /* The start sector 39 | */ 40 | uint64_t start_sector; 41 | 42 | /* The end sector 43 | */ 44 | uint64_t end_sector; 45 | 46 | /* The number of sectors 47 | */ 48 | uint64_t number_of_sectors; 49 | }; 50 | 51 | int libodraw_sector_range_initialize( 52 | libodraw_sector_range_t **sector_range, 53 | libcerror_error_t **error ); 54 | 55 | int libodraw_sector_range_free( 56 | libodraw_sector_range_t **sector_range, 57 | libcerror_error_t **error ); 58 | 59 | int libodraw_sector_range_get( 60 | libodraw_sector_range_t *sector_range, 61 | uint64_t *start_sector, 62 | uint64_t *number_of_sectors, 63 | libcerror_error_t **error ); 64 | 65 | int libodraw_sector_range_set( 66 | libodraw_sector_range_t *sector_range, 67 | uint64_t start_sector, 68 | uint64_t number_of_sectors, 69 | libcerror_error_t **error ); 70 | 71 | #if defined( __cplusplus ) 72 | } 73 | #endif 74 | 75 | #endif /* !defined( _LIBODRAW_SECTOR_RANGE_H ) */ 76 | 77 | -------------------------------------------------------------------------------- /libodraw/libodraw_support.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Support functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #include "libodraw_codepage.h" 27 | #include "libodraw_definitions.h" 28 | #include "libodraw_io_handle.h" 29 | #include "libodraw_libbfio.h" 30 | #include "libodraw_libcerror.h" 31 | #include "libodraw_libclocale.h" 32 | #include "libodraw_support.h" 33 | 34 | #if !defined( HAVE_LOCAL_LIBODRAW ) 35 | 36 | /* Returns the library version 37 | */ 38 | const char *libodraw_get_version( 39 | void ) 40 | { 41 | return( (const char *) LIBODRAW_VERSION_STRING ); 42 | } 43 | 44 | /* Returns the access flags for reading 45 | */ 46 | int libodraw_get_access_flags_read( 47 | void ) 48 | { 49 | return( (int) LIBODRAW_ACCESS_FLAG_READ ); 50 | } 51 | 52 | /* Returns the access flags for reading and writing 53 | */ 54 | int libodraw_get_access_flags_read_write( 55 | void ) 56 | { 57 | return( (int) ( LIBODRAW_ACCESS_FLAG_READ | LIBODRAW_ACCESS_FLAG_WRITE ) ); 58 | } 59 | 60 | /* Returns the access flags for writing 61 | */ 62 | int libodraw_get_access_flags_write( 63 | void ) 64 | { 65 | return( (int) LIBODRAW_ACCESS_FLAG_WRITE ); 66 | } 67 | 68 | /* Retrieves the narrow system string codepage 69 | * A value of 0 represents no codepage, UTF-8 encoding is used instead 70 | * Returns 1 if successful or -1 on error 71 | */ 72 | int libodraw_get_codepage( 73 | int *codepage, 74 | libcerror_error_t **error ) 75 | { 76 | static char *function = "libodraw_get_codepage"; 77 | 78 | if( libclocale_codepage_get( 79 | codepage, 80 | error ) != 1 ) 81 | { 82 | libcerror_error_set( 83 | error, 84 | LIBCERROR_ERROR_DOMAIN_RUNTIME, 85 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, 86 | "%s: unable to retrieve codepage.", 87 | function ); 88 | 89 | return( -1 ); 90 | } 91 | return( 1 ); 92 | } 93 | 94 | /* Sets the narrow system string codepage 95 | * A value of 0 represents no codepage, UTF-8 encoding is used instead 96 | * Returns 1 if successful or -1 on error 97 | */ 98 | int libodraw_set_codepage( 99 | int codepage, 100 | libcerror_error_t **error ) 101 | { 102 | static char *function = "libodraw_set_codepage"; 103 | 104 | if( libclocale_codepage_set( 105 | codepage, 106 | error ) != 1 ) 107 | { 108 | libcerror_error_set( 109 | error, 110 | LIBCERROR_ERROR_DOMAIN_RUNTIME, 111 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, 112 | "%s: unable to set codepage.", 113 | function ); 114 | 115 | return( -1 ); 116 | } 117 | return( 1 ); 118 | } 119 | 120 | #endif /* !defined( HAVE_LOCAL_LIBODRAW ) */ 121 | 122 | -------------------------------------------------------------------------------- /libodraw/libodraw_support.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Support functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_SUPPORT_H ) 23 | #define _LIBODRAW_SUPPORT_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libodraw_extern.h" 29 | #include "libodraw_libbfio.h" 30 | #include "libodraw_libcerror.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | #if !defined( HAVE_LOCAL_LIBODRAW ) 37 | 38 | LIBODRAW_EXTERN \ 39 | const char *libodraw_get_version( 40 | void ); 41 | 42 | LIBODRAW_EXTERN \ 43 | int libodraw_get_access_flags_read( 44 | void ); 45 | 46 | LIBODRAW_EXTERN \ 47 | int libodraw_get_access_flags_read_write( 48 | void ); 49 | 50 | LIBODRAW_EXTERN \ 51 | int libodraw_get_access_flags_write( 52 | void ); 53 | 54 | LIBODRAW_EXTERN \ 55 | int libodraw_get_codepage( 56 | int *codepage, 57 | libcerror_error_t **error ); 58 | 59 | LIBODRAW_EXTERN \ 60 | int libodraw_set_codepage( 61 | int codepage, 62 | libcerror_error_t **error ); 63 | 64 | #endif /* !defined( HAVE_LOCAL_LIBODRAW ) */ 65 | 66 | #if defined( __cplusplus ) 67 | } 68 | #endif 69 | 70 | #endif /* !defined( _LIBODRAW_SUPPORT_H ) */ 71 | 72 | -------------------------------------------------------------------------------- /libodraw/libodraw_track_value.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Track value functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_TRACK_VALUE_H ) 23 | #define _LIBODRAW_TRACK_VALUE_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libodraw_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct libodraw_track_value libodraw_track_value_t; 35 | 36 | struct libodraw_track_value 37 | { 38 | /* The start sector 39 | */ 40 | uint64_t start_sector; 41 | 42 | /* The end sector 43 | */ 44 | uint64_t end_sector; 45 | 46 | /* The number of sectors 47 | */ 48 | uint64_t number_of_sectors; 49 | 50 | /* The bytes per sector 51 | */ 52 | uint32_t bytes_per_sector; 53 | 54 | /* The type 55 | */ 56 | uint8_t type; 57 | 58 | /* The data file index 59 | */ 60 | int data_file_index; 61 | 62 | /* The start sector relative to the start of the data file 63 | */ 64 | uint64_t data_file_start_sector; 65 | 66 | /* The data file offset 67 | */ 68 | off64_t data_file_offset; 69 | }; 70 | 71 | int libodraw_track_value_initialize( 72 | libodraw_track_value_t **track_value, 73 | libcerror_error_t **error ); 74 | 75 | int libodraw_track_value_free( 76 | libodraw_track_value_t **track_value, 77 | libcerror_error_t **error ); 78 | 79 | int libodraw_track_value_get( 80 | libodraw_track_value_t *track_value, 81 | uint64_t *start_sector, 82 | uint64_t *number_of_sectors, 83 | uint8_t *type, 84 | int *data_file_index, 85 | uint64_t *data_file_start_sector, 86 | libcerror_error_t **error ); 87 | 88 | int libodraw_track_value_set( 89 | libodraw_track_value_t *track_value, 90 | uint64_t start_sector, 91 | uint64_t number_of_sectors, 92 | uint8_t type, 93 | int data_file_index, 94 | uint64_t data_file_start_sector, 95 | libcerror_error_t **error ); 96 | 97 | int libodraw_track_value_get_bytes_per_sector( 98 | libodraw_track_value_t *track_value, 99 | uint32_t *bytes_per_sector, 100 | libcerror_error_t **error ); 101 | 102 | #if defined( __cplusplus ) 103 | } 104 | #endif 105 | 106 | #endif /* !defined( _LIBODRAW_TRACK_VALUE_H ) */ 107 | 108 | -------------------------------------------------------------------------------- /libodraw/libodraw_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal type definitions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_INTERNAL_TYPES_H ) 23 | #define _LIBODRAW_INTERNAL_TYPES_H 24 | 25 | #include 26 | #include 27 | 28 | /* Define HAVE_LOCAL_LIBODRAW for local use of libodraw 29 | * The definitions in are copied here 30 | * for local use of libodraw 31 | */ 32 | #if defined( HAVE_LOCAL_LIBODRAW ) 33 | 34 | /* The following type definitions hide internal data structures 35 | */ 36 | #if defined( HAVE_DEBUG_OUTPUT ) && !defined( WINAPI ) 37 | typedef struct libodraw_data_file {} libodraw_data_file_t; 38 | typedef struct libodraw_handle {} libodraw_handle_t; 39 | 40 | #else 41 | typedef intptr_t libodraw_data_file_t; 42 | typedef intptr_t libodraw_handle_t; 43 | 44 | #endif /* defined( HAVE_DEBUG_OUTPUT ) && !defined( WINAPI ) */ 45 | 46 | #endif /* defined( HAVE_LOCAL_LIBODRAW ) */ 47 | 48 | #endif /* !defined( _LIBODRAW_INTERNAL_TYPES_H ) */ 49 | 50 | -------------------------------------------------------------------------------- /libodraw/libodraw_unused.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions to silence compiler warnings about unused function attributes/parameters. 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBODRAW_UNUSED_H ) 23 | #define _LIBODRAW_UNUSED_H 24 | 25 | #include 26 | 27 | #if !defined( LIBODRAW_ATTRIBUTE_UNUSED ) 28 | #if defined( __GNUC__ ) && __GNUC__ >= 3 29 | #define LIBODRAW_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 30 | #else 31 | #define LIBODRAW_ATTRIBUTE_UNUSED 32 | #endif 33 | #endif 34 | 35 | #if defined( _MSC_VER ) 36 | #define LIBODRAW_UNREFERENCED_PARAMETER( parameter ) \ 37 | UNREFERENCED_PARAMETER( parameter ); 38 | #else 39 | #define LIBODRAW_UNREFERENCED_PARAMETER( parameter ) \ 40 | /* parameter */ 41 | #endif 42 | 43 | #endif /* !defined( _LIBODRAW_UNUSED_H ) */ 44 | 45 | -------------------------------------------------------------------------------- /m4/pthread.m4: -------------------------------------------------------------------------------- 1 | dnl Functions for pthread 2 | dnl 3 | dnl Version: 20240513 4 | 5 | dnl Function to detect if pthread is available 6 | AC_DEFUN([AX_PTHREAD_CHECK_LIB], 7 | [AS_IF( 8 | [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_pthread" = xno], 9 | [ac_cv_pthread=no], 10 | [ac_cv_pthread=check 11 | dnl Check if parameters were provided 12 | dnl For both --with-pthread which returns "yes" and --with-pthread= which returns "" 13 | dnl treat them as auto-detection. 14 | AS_IF( 15 | [test "x$ac_cv_with_pthread" != x && test "x$ac_cv_with_pthread" != xauto-detect && test "x$ac_cv_with_pthread" != xyes], 16 | [AX_CHECK_LIB_DIRECTORY_EXISTS([pthread])]) 17 | ]) 18 | 19 | AS_IF( 20 | [test "x$ac_cv_pthread" = xcheck], 21 | [dnl Check for headers 22 | AC_CHECK_HEADERS([pthread.h]) 23 | 24 | AS_IF( 25 | [test "x$ac_cv_header_pthread_h" = xno], 26 | [ac_cv_pthread=no], 27 | [ac_cv_pthread=yes 28 | 29 | AX_CHECK_LIB_FUNCTIONS( 30 | [pthread], 31 | [pthread], 32 | [[pthread_create], 33 | [pthread_exit], 34 | [pthread_join], 35 | [pthread_cond_init], 36 | [pthread_cond_destroy], 37 | [pthread_cond_broadcast], 38 | [pthread_cond_signal], 39 | [pthread_cond_wait], 40 | [pthread_mutex_init], 41 | [pthread_mutex_destroy], 42 | [pthread_mutex_lock], 43 | [pthread_mutex_trylock], 44 | [pthread_mutex_unlock], 45 | [pthread_rwlock_init], 46 | [pthread_rwlock_destroy], 47 | [pthread_rwlock_rdlock], 48 | [pthread_rwlock_wrlock], 49 | [pthread_rwlock_unlock]]) 50 | 51 | ac_cv_pthread_LIBADD="-lpthread" 52 | ]) 53 | 54 | AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([pthread]) 55 | ]) 56 | 57 | AS_IF( 58 | [test "x$ac_cv_pthread" = xpthread], 59 | [AC_DEFINE( 60 | [HAVE_PTHREAD], 61 | [1], 62 | [Define to 1 if you have the 'pthread' library (-lpthread).]) 63 | ]) 64 | 65 | AS_IF( 66 | [test "x$ac_cv_pthread" != xno], 67 | [AC_SUBST( 68 | [HAVE_PTHREAD], 69 | [1]) ], 70 | [AC_SUBST( 71 | [HAVE_PTHREAD], 72 | [0]) 73 | ]) 74 | ]) 75 | 76 | dnl Function to detect how to enable pthread 77 | AC_DEFUN([AX_PTHREAD_CHECK_ENABLE], 78 | [AX_COMMON_ARG_WITH( 79 | [pthread], 80 | [pthread], 81 | [search for pthread in includedir and libdir or in the specified DIR, or no if not to use pthread], 82 | [auto-detect], 83 | [DIR]) 84 | 85 | dnl Check for a shared library version 86 | AX_PTHREAD_CHECK_LIB 87 | 88 | AS_IF( 89 | [test "x$ac_cv_pthread_CPPFLAGS" != "x"], 90 | [AC_SUBST( 91 | [PTHREAD_CPPFLAGS], 92 | [$ac_cv_pthread_CPPFLAGS]) 93 | ]) 94 | AS_IF( 95 | [test "x$ac_cv_pthread_LIBADD" != "x"], 96 | [AC_SUBST( 97 | [PTHREAD_LIBADD], 98 | [$ac_cv_pthread_LIBADD]) 99 | ]) 100 | 101 | AS_IF( 102 | [test "x$ac_cv_pthread" = xpthread], 103 | [AC_SUBST( 104 | [ax_pthread_pc_libs_private], 105 | [-lpthread]) 106 | ]) 107 | ]) 108 | 109 | -------------------------------------------------------------------------------- /m4/tests.m4: -------------------------------------------------------------------------------- 1 | dnl Functions for testing 2 | dnl 3 | dnl Version: 20200712 4 | 5 | dnl Function to detect if tests dependencies are available 6 | AC_DEFUN([AX_TESTS_CHECK_LOCAL], 7 | [AC_CHECK_HEADERS([dlfcn.h]) 8 | 9 | AC_CHECK_FUNCS([fmemopen getopt mkstemp setenv tzset unlink]) 10 | 11 | AC_CHECK_LIB( 12 | dl, 13 | dlsym) 14 | 15 | AS_IF( 16 | [test "x$lt_cv_prog_gnu_ld" = xyes && test "x$ac_cv_lib_dl_dlsym" = xyes], 17 | [AC_DEFINE( 18 | [HAVE_GNU_DL_DLSYM], 19 | [1], 20 | [Define to 1 if dlsym function is available in GNU dl.]) 21 | ]) 22 | ]) 23 | 24 | dnl Function to detect if OSS-Fuzz build environment is available 25 | AC_DEFUN([AX_TESTS_CHECK_OSSFUZZ], 26 | [AM_CONDITIONAL( 27 | HAVE_LIB_FUZZING_ENGINE, 28 | [test "x${LIB_FUZZING_ENGINE}" != x]) 29 | AC_SUBST( 30 | [LIB_FUZZING_ENGINE], 31 | ["${LIB_FUZZING_ENGINE}"]) 32 | ]) 33 | 34 | -------------------------------------------------------------------------------- /m4/types.m4: -------------------------------------------------------------------------------- 1 | dnl Functions for type definitions 2 | dnl 3 | dnl Version: 20180727 4 | 5 | dnl Function to detect if type definitions are available 6 | AC_DEFUN([AX_TYPES_CHECK_LOCAL], 7 | [AS_IF( 8 | [test "x$ac_cv_enable_winapi" = xyes], 9 | [ac_cv_enable_wide_character_type=yes]) 10 | 11 | AS_IF( 12 | [test "x$ac_cv_enable_wide_character_type" = xyes], 13 | [AC_DEFINE( 14 | [HAVE_WIDE_CHARACTER_TYPE], 15 | [1], 16 | [Define to 1 if wide character type should be used.]) 17 | AC_SUBST( 18 | [HAVE_WIDE_CHARACTER_TYPE], 19 | [1]) ], 20 | [AC_SUBST( 21 | [HAVE_WIDE_CHARACTER_TYPE], 22 | [0]) 23 | ]) 24 | 25 | AC_CHECK_HEADERS([sys/types.h inttypes.h stdint.h wchar.h]) 26 | 27 | AS_IF( 28 | [test "x$ac_cv_header_sys_types_h" = xyes], 29 | [AC_SUBST( 30 | [HAVE_SYS_TYPES_H], 31 | [1])], 32 | [AC_SUBST( 33 | [HAVE_SYS_TYPES_H], 34 | [0]) 35 | ]) 36 | 37 | AS_IF( 38 | [test "x$ac_cv_header_inttypes_h" = xyes], 39 | [AC_SUBST( 40 | [HAVE_INTTYPES_H], 41 | [1])], 42 | [AC_SUBST( 43 | [HAVE_INTTYPES_H], 44 | [0]) 45 | ]) 46 | 47 | AS_IF( 48 | [test "x$ac_cv_header_stdint_h" = xyes], 49 | [AC_SUBST( 50 | [HAVE_STDINT_H], 51 | [1])], 52 | [AC_SUBST( 53 | [HAVE_STDINT_H], 54 | [0]) 55 | ]) 56 | 57 | AS_IF( 58 | [test "x$ac_cv_header_wchar_h" = xyes], 59 | [AC_SUBST( 60 | [HAVE_WCHAR_H], 61 | [1]) ], 62 | [AC_SUBST( 63 | [HAVE_WCHAR_H], 64 | [0]) 65 | ]) 66 | 67 | AC_TYPE_MODE_T 68 | AC_TYPE_OFF_T 69 | AC_TYPE_SIZE_T 70 | 71 | AC_CHECK_TYPE( 72 | [size32_t], 73 | [AC_SUBST( 74 | [HAVE_SIZE32_T], 75 | [1])], 76 | [AC_SUBST( 77 | [HAVE_SIZE32_T], 78 | [0]) 79 | ]) 80 | 81 | AC_CHECK_TYPE( 82 | [ssize32_t], 83 | [AC_SUBST( 84 | [HAVE_SSIZE32_T], 85 | [1])], 86 | [AC_SUBST( 87 | [HAVE_SSIZE32_T], 88 | [0]) 89 | ]) 90 | 91 | AC_CHECK_TYPE( 92 | [size64_t], 93 | [AC_SUBST( 94 | [HAVE_SIZE64_T], 95 | [1])], 96 | [AC_SUBST( 97 | [HAVE_SIZE64_T], 98 | [0]) 99 | ]) 100 | 101 | AC_CHECK_TYPE( 102 | [ssize64_t], 103 | [AC_SUBST( 104 | [HAVE_SSIZE64_T], 105 | [1])], 106 | [AC_SUBST( 107 | [HAVE_SSIZE64_T], 108 | [0]) 109 | ]) 110 | 111 | AC_CHECK_TYPE( 112 | [off64_t], 113 | [AC_SUBST( 114 | [HAVE_OFF64_T], 115 | [1])], 116 | [AC_SUBST( 117 | [HAVE_OFF64_T], 118 | [0]) 119 | ]) 120 | 121 | AC_CHECK_TYPE([ssize_t]) 122 | AC_CHECK_TYPE([u64]) 123 | 124 | AC_CHECK_SIZEOF([int]) 125 | AC_CHECK_SIZEOF([long]) 126 | AC_CHECK_SIZEOF([off_t]) 127 | AC_CHECK_SIZEOF([size_t]) 128 | 129 | AS_IF( 130 | [test "x$ac_cv_header_wchar_h" = xyes], 131 | [AC_CHECK_SIZEOF([wchar_t])]) 132 | ]) 133 | 134 | -------------------------------------------------------------------------------- /manuals/Makefile.am: -------------------------------------------------------------------------------- 1 | man_MANS = \ 2 | odrawinfo.1 \ 3 | libodraw.3 4 | 5 | EXTRA_DIST = \ 6 | odrawinfo.1 \ 7 | libodraw.3 8 | 9 | DISTCLEANFILES = \ 10 | Makefile \ 11 | Makefile.in 12 | 13 | -------------------------------------------------------------------------------- /manuals/odrawinfo.1: -------------------------------------------------------------------------------- 1 | .Dd March 7, 2019 2 | .Dt odrawinfo 3 | .Os libodraw 4 | .Sh NAME 5 | .Nm odrawinfo 6 | .Nd determines information about an optical disc (split) RAW file 7 | .Sh SYNOPSIS 8 | .Nm odrawinfo 9 | .Op Fl hivV 10 | .Ar source 11 | .Sh DESCRIPTION 12 | .Nm odrawinfo 13 | is a utility to determine information about an optical disc (split) RAW file 14 | .Pp 15 | .Nm odrawinfo 16 | is part of the 17 | .Nm libodraw 18 | package. 19 | .Nm libodraw 20 | is a library to access optical disc (split) RAW formats 21 | .Pp 22 | .Ar source 23 | is the source file. 24 | .Pp 25 | The options are as follows: 26 | .Bl -tag -width Ds 27 | .It Fl h 28 | shows this help 29 | .It Fl i 30 | ignore data file(s) 31 | .It Fl v 32 | verbose output to stderr 33 | .It Fl V 34 | print version 35 | .El 36 | .Sh ENVIRONMENT 37 | None 38 | .Sh FILES 39 | None 40 | .Sh EXAMPLES 41 | .Bd -literal 42 | # odrawinfo cd.cue 43 | odrawinfo 20110111 44 | 45 | Optical disc: 46 | media size: 42885120 47 | 48 | Data files: 49 | total number: 1 50 | filename: disc1_single.iso (type: binary little-endian) 51 | 52 | Sessions: 53 | total number: 2 54 | at sectors(s): 0 - 20619 number: 20620 55 | at sectors(s): 20620 - 20939 number: 320 56 | 57 | Lead-outs: 58 | total number: 1 59 | at sectors(s): 9220 - 20619 number: 11400 60 | 61 | Tracks: 62 | total number: 2 63 | type: mode1/2352 (sector size: 2352) at sectors(s): 0 - 9219 number: 9220 (data file: 0, start sector: 0) 64 | type: mode1/2352 (sector size: 2352) at sectors(s): 20620 - 20939 number: 320 (data file: 0, start sector: 20620) 65 | 66 | .Ed 67 | .Sh DIAGNOSTICS 68 | Errors, verbose and debug output are printed to stderr when verbose output \-v is enabled. 69 | Verbose and debug output are only printed when enabled at compilation. 70 | .Sh BUGS 71 | Please report bugs of any kind to or on the project website: 72 | https://github.com/libyal/libodraw/ 73 | .Sh AUTHOR 74 | These man pages were written by Joachim Metz. 75 | .Sh COPYRIGHT 76 | Copyright (C) 2010-2024, Joachim Metz . 77 | This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 78 | .Sh SEE ALSO 79 | .Xr odrawexport 1 80 | -------------------------------------------------------------------------------- /msvscpp/Makefile.am: -------------------------------------------------------------------------------- 1 | MSVSCPP_FILES = \ 2 | libbfio/libbfio.vcproj \ 3 | libcdata/libcdata.vcproj \ 4 | libcerror/libcerror.vcproj \ 5 | libcfile/libcfile.vcproj \ 6 | libclocale/libclocale.vcproj \ 7 | libcnotify/libcnotify.vcproj \ 8 | libcpath/libcpath.vcproj \ 9 | libcsplit/libcsplit.vcproj \ 10 | libcthreads/libcthreads.vcproj \ 11 | libhmac/libhmac.vcproj \ 12 | libodraw/libodraw.vcproj \ 13 | libuna/libuna.vcproj \ 14 | odraw_test_cue_parser/odraw_test_cue_parser.vcproj \ 15 | odraw_test_data_file/odraw_test_data_file.vcproj \ 16 | odraw_test_data_file_descriptor/odraw_test_data_file_descriptor.vcproj \ 17 | odraw_test_error/odraw_test_error.vcproj \ 18 | odraw_test_handle/odraw_test_handle.vcproj \ 19 | odraw_test_io_handle/odraw_test_io_handle.vcproj \ 20 | odraw_test_notify/odraw_test_notify.vcproj \ 21 | odraw_test_sector_range/odraw_test_sector_range.vcproj \ 22 | odraw_test_support/odraw_test_support.vcproj \ 23 | odraw_test_track_value/odraw_test_track_value.vcproj \ 24 | odrawinfo/odrawinfo.vcproj \ 25 | odrawverify/odrawverify.vcproj \ 26 | libodraw.sln 27 | 28 | EXTRA_DIST = \ 29 | $(MSVSCPP_FILES) 30 | 31 | DISTCLEANFILES = \ 32 | Makefile \ 33 | Makefile.in 34 | 35 | -------------------------------------------------------------------------------- /odrawtools/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | -I../include -I$(top_srcdir)/include \ 3 | -I../common -I$(top_srcdir)/common \ 4 | @LIBCERROR_CPPFLAGS@ \ 5 | @LIBCDATA_CPPFLAGS@ \ 6 | @LIBCLOCALE_CPPFLAGS@ \ 7 | @LIBCNOTIFY_CPPFLAGS@ \ 8 | @LIBCSPLIT_CPPFLAGS@ \ 9 | @LIBUNA_CPPFLAGS@ \ 10 | @LIBCFILE_CPPFLAGS@ \ 11 | @LIBCPATH_CPPFLAGS@ \ 12 | @LIBBFIO_CPPFLAGS@ \ 13 | @LIBHMAC_CPPFLAGS@ \ 14 | @LIBCRYPTO_CPPFLAGS@ \ 15 | @LIBODRAW_DLL_IMPORT@ 16 | 17 | AM_LDFLAGS = @STATIC_LDFLAGS@ 18 | 19 | bin_PROGRAMS = \ 20 | odrawinfo \ 21 | odrawverify 22 | 23 | odrawinfo_SOURCES = \ 24 | info_handle.c info_handle.h \ 25 | odrawinfo.c \ 26 | odrawtools_getopt.c odrawtools_getopt.h \ 27 | odrawtools_i18n.h \ 28 | odrawtools_libbfio.h \ 29 | odrawtools_libcerror.h \ 30 | odrawtools_libclocale.h \ 31 | odrawtools_libcnotify.h \ 32 | odrawtools_libodraw.h \ 33 | odrawtools_libuna.h \ 34 | odrawtools_output.c odrawtools_output.h \ 35 | odrawtools_signal.c odrawtools_signal.h \ 36 | odrawtools_unused.h 37 | 38 | odrawinfo_LDADD = \ 39 | @LIBCNOTIFY_LIBADD@ \ 40 | @LIBCLOCALE_LIBADD@ \ 41 | ../libodraw/libodraw.la \ 42 | @LIBCERROR_LIBADD@ \ 43 | @LIBINTL@ 44 | 45 | odrawverify_SOURCES = \ 46 | byte_size_string.c byte_size_string.h \ 47 | digest_hash.c digest_hash.h \ 48 | log_handle.c log_handle.h \ 49 | process_status.c process_status.h \ 50 | odrawverify.c \ 51 | odrawtools_getopt.c odrawtools_getopt.h \ 52 | odrawtools_i18n.h \ 53 | odrawtools_libcerror.h \ 54 | odrawtools_libclocale.h \ 55 | odrawtools_libcnotify.h \ 56 | odrawtools_libcsplit.h \ 57 | odrawtools_libhmac.h \ 58 | odrawtools_libodraw.h \ 59 | odrawtools_libuna.h \ 60 | odrawtools_output.c odrawtools_output.h \ 61 | odrawtools_signal.c odrawtools_signal.h \ 62 | odrawtools_system_split_string.h \ 63 | odrawtools_unused.h \ 64 | storage_media_buffer.c storage_media_buffer.h \ 65 | verification_handle.c verification_handle.h 66 | 67 | odrawverify_LDADD = \ 68 | @LIBHMAC_LIBADD@ \ 69 | @LIBCRYPTO_LIBADD@ \ 70 | @LIBCSPLIT_LIBADD@ \ 71 | @LIBCNOTIFY_LIBADD@ \ 72 | @LIBCLOCALE_LIBADD@ \ 73 | ../libodraw/libodraw.la \ 74 | @LIBCERROR_LIBADD@ \ 75 | @LIBINTL@ 76 | 77 | DISTCLEANFILES = \ 78 | Makefile \ 79 | Makefile.in 80 | 81 | splint-local: 82 | @echo "Running splint on odrawinfo ..." 83 | -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(odrawinfo_SOURCES) 84 | @echo "Running splint on odrawverify ..." 85 | -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(odrawverify_SOURCES) 86 | 87 | -------------------------------------------------------------------------------- /odrawtools/byte_size_string.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Byte size string functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _BYTE_SIZE_STRING_H ) 23 | #define _BYTE_SIZE_STRING_H 24 | 25 | #include 26 | #include 27 | 28 | #include "odrawtools_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | enum BYTE_SIZE_STRING_UNITS 35 | { 36 | BYTE_SIZE_STRING_UNIT_MEGABYTE = 1000, 37 | BYTE_SIZE_STRING_UNIT_MEBIBYTE = 1024 38 | }; 39 | 40 | int byte_size_string_create( 41 | system_character_t *byte_size_string, 42 | size_t byte_size_string_length, 43 | uint64_t size, 44 | int units, 45 | libcerror_error_t **error ); 46 | 47 | int byte_size_string_convert( 48 | const system_character_t *byte_size_string, 49 | size_t byte_size_string_length, 50 | uint64_t *size, 51 | libcerror_error_t **error ); 52 | 53 | #if defined( __cplusplus ) 54 | } 55 | #endif 56 | 57 | #endif /* !defined( _BYTE_SIZE_STRING_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /odrawtools/digest_hash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Crypographic digest hash 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _DIGEST_HASH_H ) 23 | #define _DIGEST_HASH_H 24 | 25 | #include 26 | #include 27 | 28 | #include "odrawtools_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | int digest_hash_copy_to_string( 35 | const uint8_t *digest_hash, 36 | size_t digest_hash_size, 37 | system_character_t *string, 38 | size_t string_size, 39 | libcerror_error_t **error ); 40 | 41 | #if defined( __cplusplus ) 42 | } 43 | #endif 44 | 45 | #endif /* !defined( _DIGEST_HASH_H ) */ 46 | 47 | -------------------------------------------------------------------------------- /odrawtools/info_handle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Info handle 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _INFO_HANDLE_H ) 23 | #define _INFO_HANDLE_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "odrawtools_libcerror.h" 30 | #include "odrawtools_libodraw.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | typedef struct info_handle info_handle_t; 37 | 38 | struct info_handle 39 | { 40 | /* The libodraw input handle 41 | */ 42 | libodraw_handle_t *input_handle; 43 | 44 | /* Value to indicate to ignore the data files 45 | */ 46 | uint8_t ignore_data_files; 47 | 48 | /* The notification output stream 49 | */ 50 | FILE *notify_stream; 51 | }; 52 | 53 | const char *info_handle_get_data_file_type( 54 | uint8_t data_file_type ); 55 | 56 | const char *info_handle_get_track_type( 57 | uint8_t track_type ); 58 | 59 | int info_handle_initialize( 60 | info_handle_t **info_handle, 61 | libcerror_error_t **error ); 62 | 63 | int info_handle_free( 64 | info_handle_t **info_handle, 65 | libcerror_error_t **error ); 66 | 67 | int info_handle_signal_abort( 68 | info_handle_t *info_handle, 69 | libcerror_error_t **error ); 70 | 71 | int info_handle_open_input( 72 | info_handle_t *info_handle, 73 | const system_character_t *filename, 74 | libcerror_error_t **error ); 75 | 76 | int info_handle_close( 77 | info_handle_t *info_handle, 78 | libcerror_error_t **error ); 79 | 80 | int info_handle_data_files_fprint( 81 | info_handle_t *info_handle, 82 | libcerror_error_t **error ); 83 | 84 | int info_handle_sessions_fprint( 85 | info_handle_t *info_handle, 86 | libcerror_error_t **error ); 87 | 88 | int info_handle_lead_outs_fprint( 89 | info_handle_t *info_handle, 90 | libcerror_error_t **error ); 91 | 92 | int info_handle_tracks_fprint( 93 | info_handle_t *info_handle, 94 | libcerror_error_t **error ); 95 | 96 | int info_handle_handle_fprint( 97 | info_handle_t *info_handle, 98 | libcerror_error_t **error ); 99 | 100 | #if defined( __cplusplus ) 101 | } 102 | #endif 103 | 104 | #endif /* !defined( _INFO_HANDLE_H ) */ 105 | 106 | -------------------------------------------------------------------------------- /odrawtools/log_handle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Log handle 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LOG_HANDLE_H ) 23 | #define _LOG_HANDLE_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "odrawtools_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | typedef struct log_handle log_handle_t; 36 | 37 | struct log_handle 38 | { 39 | /* The log stream 40 | */ 41 | FILE *log_stream; 42 | }; 43 | 44 | int log_handle_initialize( 45 | log_handle_t **log_handle, 46 | libcerror_error_t **error ); 47 | 48 | int log_handle_free( 49 | log_handle_t **log_handle, 50 | libcerror_error_t **error ); 51 | 52 | int log_handle_open( 53 | log_handle_t *log_handle, 54 | const system_character_t *filename, 55 | libcerror_error_t **error ); 56 | 57 | int log_handle_close( 58 | log_handle_t *log_handle, 59 | libcerror_error_t **error ); 60 | 61 | void log_handle_printf( 62 | log_handle_t *log_handle, 63 | char *format, 64 | ... ); 65 | 66 | #if defined( __cplusplus ) 67 | } 68 | #endif 69 | 70 | #endif /* !defined( _LOG_HANDLE_H ) */ 71 | 72 | -------------------------------------------------------------------------------- /odrawtools/odrawtools_getopt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GetOpt functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAWTOOLS_GETOPT_H ) 23 | #define _ODRAWTOOLS_GETOPT_H 24 | 25 | #include 26 | #include 27 | 28 | /* unistd.h is included here to export getopt, optarg, optind and optopt 29 | */ 30 | #if defined( HAVE_UNISTD_H ) 31 | #include 32 | #endif 33 | 34 | #if defined( __cplusplus ) 35 | extern "C" { 36 | #endif 37 | 38 | #if defined( HAVE_GETOPT ) 39 | #define odrawtools_getopt( argument_count, argument_values, options_string ) \ 40 | getopt( argument_count, argument_values, options_string ) 41 | 42 | #else 43 | 44 | #if !defined( __CYGWIN__ ) 45 | extern int optind; 46 | extern system_character_t *optarg; 47 | extern system_integer_t optopt; 48 | 49 | #else 50 | int optind; 51 | system_character_t *optarg; 52 | system_integer_t optopt; 53 | 54 | #endif /* !defined( __CYGWIN__ ) */ 55 | 56 | system_integer_t odrawtools_getopt( 57 | int argument_count, 58 | system_character_t * const argument_values[], 59 | const system_character_t *options_string ); 60 | 61 | #endif /* defined( HAVE_GETOPT ) */ 62 | 63 | #if defined( __cplusplus ) 64 | } 65 | #endif 66 | 67 | #endif /* !defined( _ODRAWTOOLS_GETOPT_H ) */ 68 | 69 | -------------------------------------------------------------------------------- /odrawtools/odrawtools_i18n.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Internationalization (i18n) functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAWTOOLS_I18N_H ) 23 | #define _ODRAWTOOLS_I18N_H 24 | 25 | #include 26 | 27 | #if defined( HAVE_LIBINTL_H ) 28 | #include 29 | #endif 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | /* TODO for now do nothing i18n-like 36 | #define _( string ) \ 37 | gettext( string ) 38 | */ 39 | 40 | #define _( string ) \ 41 | string 42 | 43 | #if defined( __cplusplus ) 44 | } 45 | #endif 46 | 47 | #endif /* !defined( _ODRAWTOOLS_I18N_H ) */ 48 | 49 | -------------------------------------------------------------------------------- /odrawtools/odrawtools_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAWTOOLS_LIBBFIO_H ) 23 | #define _ODRAWTOOLS_LIBBFIO_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio 28 | */ 29 | #if defined( HAVE_LOCAL_LIBBFIO ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT 43 | * before including libbfio.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 46 | #define LIBBFIO_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( LIBBFIO_HAVE_MULTI_THREAD_SUPPORT ) 52 | #error Multi-threading support requires libbfio with multi-threading support 53 | #endif 54 | 55 | #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ 56 | 57 | #endif /* !defined( _ODRAWTOOLS_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /odrawtools/odrawtools_libcerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcerror header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAWTOOLS_LIBCERROR_H ) 23 | #define _ODRAWTOOLS_LIBCERROR_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCERROR for local use of libcerror 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCERROR ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCERROR_DLL_IMPORT 39 | * before including libcerror.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 42 | #define LIBCERROR_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCERROR ) */ 48 | 49 | #endif /* !defined( _ODRAWTOOLS_LIBCERROR_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /odrawtools/odrawtools_libclocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libclocale header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAWTOOLS_LIBCLOCALE_H ) 23 | #define _ODRAWTOOLS_LIBCLOCALE_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCLOCALE for local use of libclocale 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCLOCALE ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCLOCALE_DLL_IMPORT 39 | * before including libclocale.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 42 | #define LIBCLOCALE_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCLOCALE ) */ 48 | 49 | #endif /* !defined( _ODRAWTOOLS_LIBCLOCALE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /odrawtools/odrawtools_libcnotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcnotify header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAWTOOLS_LIBCNOTIFY_H ) 23 | #define _ODRAWTOOLS_LIBCNOTIFY_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCNOTIFY for local use of libcnotify 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCNOTIFY ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCNOTIFY_DLL_IMPORT 39 | * before including libcnotify.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 42 | #define LIBCNOTIFY_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCNOTIFY ) */ 48 | 49 | #endif /* !defined( _ODRAWTOOLS_LIBCNOTIFY_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /odrawtools/odrawtools_libcsplit.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal libcsplit header 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAWTOOLS_LIBCSPLIT_H ) 23 | #define _ODRAWTOOLS_LIBCSPLIT_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCSPLIT for local use of libcsplit 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCSPLIT ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #else 39 | 40 | /* If libtool DLL support is enabled set LIBCSPLIT_DLL_IMPORT 41 | * before including libcsplit.h 42 | */ 43 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 44 | #define LIBCSPLIT_DLL_IMPORT 45 | #endif 46 | 47 | #include 48 | 49 | #endif 50 | 51 | #endif 52 | 53 | -------------------------------------------------------------------------------- /odrawtools/odrawtools_libhmac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libhmac header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAWTOOLS_LIBHMAC_H ) 23 | #define _ODRAWTOOLS_LIBHMAC_H 24 | 25 | #include 26 | 27 | #if defined( HAVE_LOCAL_LIBHMAC ) 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #else 38 | 39 | /* If libtool DLL support is enabled set LIBHMAC_DLL_IMPORT 40 | * before including libhmac.h 41 | */ 42 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 43 | #define LIBHMAC_DLL_IMPORT 44 | #endif 45 | 46 | #include 47 | 48 | #endif /* defined( HAVE_LOCAL_LIBHMAC ) */ 49 | 50 | #endif /* !defined( _ODRAWTOOLS_LIBHMAC_H ) */ 51 | 52 | -------------------------------------------------------------------------------- /odrawtools/odrawtools_libodraw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libodraw header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAWTOOLS_LIBODRAW_H ) 23 | #define _ODRAWTOOLS_LIBODRAW_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | #endif /* !defined( _ODRAWTOOLS_LIBODRAW_H ) */ 30 | 31 | -------------------------------------------------------------------------------- /odrawtools/odrawtools_libuna.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libuna header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAWTOOLS_LIBUNA_H ) 23 | #define _ODRAWTOOLS_LIBUNA_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBUNA for local use of libuna 28 | */ 29 | #if defined( HAVE_LOCAL_LIBUNA ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | #else 47 | 48 | /* If libtool DLL support is enabled set LIBUNA_DLL_IMPORT 49 | * before including libuna.h 50 | */ 51 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 52 | #define LIBUNA_DLL_IMPORT 53 | #endif 54 | 55 | #include 56 | 57 | #endif /* defined( HAVE_LOCAL_LIBUNA ) */ 58 | 59 | #endif /* !defined( _ODRAWTOOLS_LIBUNA_H ) */ 60 | 61 | -------------------------------------------------------------------------------- /odrawtools/odrawtools_output.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Common output functions for the odrawtools 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAWTOOLS_OUTPUT_H ) 23 | #define _ODRAWTOOLS_OUTPUT_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "odrawtools_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | int odrawtools_output_initialize( 36 | int stdio_mode, 37 | libcerror_error_t **error ); 38 | 39 | void odrawtools_output_copyright_fprint( 40 | FILE *stream ); 41 | 42 | void odrawtools_output_version_fprint( 43 | FILE *stream, 44 | const system_character_t *program ); 45 | 46 | void odrawtools_output_version_detailed_fprint( 47 | FILE *stream, 48 | const system_character_t *program ); 49 | 50 | #if defined( __cplusplus ) 51 | } 52 | #endif 53 | 54 | #endif /* !defined( _ODRAWTOOLS_OUTPUT_H ) */ 55 | 56 | -------------------------------------------------------------------------------- /odrawtools/odrawtools_signal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Signal handling functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAWTOOLS_SIGNAL_H ) 23 | #define _ODRAWTOOLS_SIGNAL_H 24 | 25 | #include 26 | #include 27 | 28 | #include "odrawtools_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | #if !defined( HAVE_SIGNAL_H ) && !defined( WINAPI ) 35 | #error missing signal functions 36 | #endif 37 | 38 | #if defined( WINAPI ) 39 | typedef unsigned long odrawtools_signal_t; 40 | 41 | #else 42 | typedef int odrawtools_signal_t; 43 | 44 | #endif /* defined( WINAPI ) */ 45 | 46 | #if defined( WINAPI ) 47 | 48 | BOOL WINAPI odrawtools_signal_handler( 49 | odrawtools_signal_t signal ); 50 | 51 | #if defined( _MSC_VER ) 52 | 53 | void odrawtools_signal_initialize_memory_debug( 54 | void ); 55 | 56 | #endif /* defined( _MSC_VER ) */ 57 | 58 | #endif /* defined( WINAPI ) */ 59 | 60 | int odrawtools_signal_attach( 61 | void (*signal_handler)( odrawtools_signal_t ), 62 | libcerror_error_t **error ); 63 | 64 | int odrawtools_signal_detach( 65 | libcerror_error_t **error ); 66 | 67 | #if defined( __cplusplus ) 68 | } 69 | #endif 70 | 71 | #endif /* !defined( _ODRAWTOOLS_SIGNAL_H ) */ 72 | 73 | -------------------------------------------------------------------------------- /odrawtools/odrawtools_system_split_string.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Split system string functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAWTOOLS_SYSTEM_SPLIT_STRING_H ) 23 | #define _ODRAWTOOLS_SYSTEM_SPLIT_STRING_H 24 | 25 | #include 26 | #include 27 | 28 | #include "odrawtools_libcsplit.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) 35 | #define system_split_string_t \ 36 | libcsplit_wide_split_string_t 37 | 38 | #define system_split_string_free( split_string, error ) \ 39 | libcsplit_wide_split_string_free( split_string, error ) 40 | 41 | #define system_split_string_get_number_of_segments( split_string, number_of_segments, error ) \ 42 | libcsplit_wide_split_string_get_number_of_segments( split_string, number_of_segments, error ) 43 | 44 | #define system_split_string_get_segment_by_index( split_string, segment_index, string_segment, string_segment_size, error ) \ 45 | libcsplit_wide_split_string_get_segment_by_index( split_string, segment_index, string_segment, string_segment_size, error ) 46 | 47 | #define system_string_split( string, string_size, delimiter, split_string, error ) \ 48 | libcsplit_wide_string_split( string, string_size, (wchar_t) delimiter, split_string, error ) 49 | 50 | #else 51 | #define system_split_string_t \ 52 | libcsplit_narrow_split_string_t 53 | 54 | #define system_split_string_free( split_string, error ) \ 55 | libcsplit_narrow_split_string_free( split_string, error ) 56 | 57 | #define system_split_string_get_number_of_segments( split_string, number_of_segments, error ) \ 58 | libcsplit_narrow_split_string_get_number_of_segments( split_string, number_of_segments, error ) 59 | 60 | #define system_split_string_get_segment_by_index( split_string, segment_index, string_segment, string_segment_size, error ) \ 61 | libcsplit_narrow_split_string_get_segment_by_index( split_string, segment_index, string_segment, string_segment_size, error ) 62 | 63 | #define system_string_split( string, string_size, delimiter, split_string, error ) \ 64 | libcsplit_narrow_string_split( string, string_size, (char) delimiter, split_string, error ) 65 | 66 | #endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */ 67 | 68 | #if defined( __cplusplus ) 69 | } 70 | #endif 71 | 72 | #endif /* !defined( _ODRAWTOOLS_SYSTEM_SPLIT_STRING_H ) */ 73 | 74 | -------------------------------------------------------------------------------- /odrawtools/odrawtools_unused.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions to silence compiler warnings about unused function attributes/parameters. 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAWTOOLS_UNUSED_H ) 23 | #define _ODRAWTOOLS_UNUSED_H 24 | 25 | #include 26 | 27 | #if !defined( ODRAWTOOLS_ATTRIBUTE_UNUSED ) 28 | 29 | #if defined( __GNUC__ ) && __GNUC__ >= 3 30 | #define ODRAWTOOLS_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 31 | 32 | #else 33 | #define ODRAWTOOLS_ATTRIBUTE_UNUSED 34 | 35 | #endif /* defined( __GNUC__ ) && __GNUC__ >= 3 */ 36 | 37 | #endif /* !defined( ODRAWTOOLS_ATTRIBUTE_UNUSED ) */ 38 | 39 | #if defined( _MSC_VER ) 40 | #define ODRAWTOOLS_UNREFERENCED_PARAMETER( parameter ) \ 41 | UNREFERENCED_PARAMETER( parameter ); 42 | 43 | #else 44 | #define ODRAWTOOLS_UNREFERENCED_PARAMETER( parameter ) \ 45 | /* parameter */ 46 | 47 | #endif /* defined( _MSC_VER ) */ 48 | 49 | #endif /* !defined( _ODRAWTOOLS_UNUSED_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /odrawtools/storage_media_buffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Storage media buffer 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _STORAGE_MEDIA_BUFFER_H ) 23 | #define _STORAGE_MEDIA_BUFFER_H 24 | 25 | #include 26 | #include 27 | 28 | #include "odrawtools_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct storage_media_buffer storage_media_buffer_t; 35 | 36 | struct storage_media_buffer 37 | { 38 | /* The raw buffer 39 | */ 40 | uint8_t *raw_buffer; 41 | 42 | /* The raw buffer size 43 | */ 44 | size_t raw_buffer_size; 45 | 46 | /* The size of the data in the raw buffer 47 | */ 48 | size_t raw_buffer_data_size; 49 | }; 50 | 51 | int storage_media_buffer_initialize( 52 | storage_media_buffer_t **buffer, 53 | size_t size, 54 | libcerror_error_t **error ); 55 | 56 | int storage_media_buffer_free( 57 | storage_media_buffer_t **buffer, 58 | libcerror_error_t **error ); 59 | 60 | int storage_media_buffer_resize( 61 | storage_media_buffer_t *buffer, 62 | size_t size, 63 | libcerror_error_t **error ); 64 | 65 | int storage_media_buffer_get_data( 66 | storage_media_buffer_t *buffer, 67 | uint8_t **data, 68 | size_t *data_size, 69 | libcerror_error_t **error ); 70 | 71 | #if defined( __cplusplus ) 72 | } 73 | #endif 74 | 75 | #endif /* !defined( _STORAGE_MEDIA_BUFFER_H ) */ 76 | 77 | -------------------------------------------------------------------------------- /ossfuzz/Makefile.am: -------------------------------------------------------------------------------- 1 | if HAVE_LIB_FUZZING_ENGINE 2 | AM_CPPFLAGS = \ 3 | -I../include -I$(top_srcdir)/include \ 4 | -I../common -I$(top_srcdir)/common \ 5 | @LIBCERROR_CPPFLAGS@ \ 6 | @LIBCDATA_CPPFLAGS@ \ 7 | @LIBCLOCALE_CPPFLAGS@ \ 8 | @LIBCNOTIFY_CPPFLAGS@ \ 9 | @LIBUNA_CPPFLAGS@ \ 10 | @LIBCFILE_CPPFLAGS@ \ 11 | @LIBCPATH_CPPFLAGS@ \ 12 | @LIBBFIO_CPPFLAGS@ 13 | 14 | bin_PROGRAMS = \ 15 | handle_fuzzer 16 | 17 | handle_fuzzer_SOURCES = \ 18 | handle_fuzzer.cc \ 19 | ossfuzz_libbfio.h \ 20 | ossfuzz_libodraw.h 21 | 22 | handle_fuzzer_LDADD = \ 23 | @LIB_FUZZING_ENGINE@ \ 24 | @LIBBFIO_LIBADD@ \ 25 | @LIBCPATH_LIBADD@ \ 26 | @LIBCFILE_LIBADD@ \ 27 | @LIBUNA_LIBADD@ \ 28 | @LIBCDATA_LIBADD@ \ 29 | ../libodraw/libodraw.la \ 30 | @LIBCNOTIFY_LIBADD@ \ 31 | @LIBCLOCALE_LIBADD@ \ 32 | @LIBCERROR_LIBADD@ \ 33 | @LIBINTL@ 34 | endif 35 | 36 | DISTCLEANFILES = \ 37 | Makefile \ 38 | Makefile.in 39 | 40 | splint-local: 41 | @echo "Running splint on handle_fuzzer ..." 42 | -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(handle_fuzzer_SOURCES) 43 | 44 | -------------------------------------------------------------------------------- /ossfuzz/handle_fuzzer.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * OSS-Fuzz target for libodraw file type 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | /* Note that some of the OSS-Fuzz engines use C++ 26 | */ 27 | extern "C" { 28 | 29 | #include "ossfuzz_libbfio.h" 30 | #include "ossfuzz_libodraw.h" 31 | 32 | #if !defined( LIBODRAW_HAVE_BFIO ) 33 | 34 | /* Opens a handle using a Basic File IO (bfio) handle 35 | * Returns 1 if successful or -1 on error 36 | */ 37 | LIBODRAW_EXTERN \ 38 | int libodraw_handle_open_file_io_handle( 39 | libodraw_handle_t *handle, 40 | libbfio_handle_t *file_io_handle, 41 | int access_flags, 42 | libodraw_error_t **error ); 43 | 44 | #endif /* !defined( LIBODRAW_HAVE_BFIO ) */ 45 | 46 | int LLVMFuzzerTestOneInput( 47 | const uint8_t *data, 48 | size_t size ) 49 | { 50 | libbfio_handle_t *file_io_handle = NULL; 51 | libodraw_handle_t *handle = NULL; 52 | 53 | if( libbfio_memory_range_initialize( 54 | &file_io_handle, 55 | NULL ) != 1 ) 56 | { 57 | return( 0 ); 58 | } 59 | if( libbfio_memory_range_set( 60 | file_io_handle, 61 | (uint8_t *) data, 62 | size, 63 | NULL ) != 1 ) 64 | { 65 | goto on_error_libbfio; 66 | } 67 | if( libodraw_handle_initialize( 68 | &handle, 69 | NULL ) != 1 ) 70 | { 71 | goto on_error_libbfio; 72 | } 73 | if( libodraw_handle_open_file_io_handle( 74 | handle, 75 | file_io_handle, 76 | LIBODRAW_OPEN_READ, 77 | NULL ) != 1 ) 78 | { 79 | goto on_error_libodraw; 80 | } 81 | libodraw_handle_close( 82 | handle, 83 | NULL ); 84 | 85 | on_error_libodraw: 86 | libodraw_handle_free( 87 | &handle, 88 | NULL ); 89 | 90 | on_error_libbfio: 91 | libbfio_handle_free( 92 | &file_io_handle, 93 | NULL ); 94 | 95 | return( 0 ); 96 | } 97 | 98 | } /* extern "C" */ 99 | 100 | -------------------------------------------------------------------------------- /ossfuzz/ossfuzz_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _OSSFUZZ_LIBBFIO_H ) 23 | #define _OSSFUZZ_LIBBFIO_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio 28 | */ 29 | #if defined( HAVE_LOCAL_LIBBFIO ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT 43 | * before including libbfio.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 46 | #define LIBBFIO_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( LIBBFIO_HAVE_MULTI_THREAD_SUPPORT ) 52 | #error Multi-threading support requires libbfio with multi-threading support 53 | #endif 54 | 55 | #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ 56 | 57 | #endif /* !defined( _OSSFUZZ_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /ossfuzz/ossfuzz_libodraw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libodraw header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _OSSFUZZ_LIBODRAW_H ) 23 | #define _OSSFUZZ_LIBODRAW_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | #endif /* !defined( _OSSFUZZ_LIBODRAW_H ) */ 30 | 31 | -------------------------------------------------------------------------------- /po/ChangeLog: -------------------------------------------------------------------------------- 1 | 2016-11-09 gettextize 2 | -------------------------------------------------------------------------------- /po/Makevars.in: -------------------------------------------------------------------------------- 1 | # Makefile variables for PO directory in any package using GNU gettext. 2 | 3 | # Usually the message domain is the same as the package name. 4 | DOMAIN = @PACKAGE@ 5 | 6 | # These two variables depend on the location of this directory. 7 | subdir = po 8 | top_builddir = .. 9 | 10 | # These options get passed to xgettext. 11 | XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ 12 | 13 | # This is the copyright holder that gets inserted into the header of the 14 | # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding 15 | # package. (Note that the msgstr strings, extracted from the package's 16 | # sources, belong to the copyright holder of the package.) Translators are 17 | # expected to transfer the copyright for their translations to this person 18 | # or entity, or to disclaim their copyright. The empty string stands for 19 | # the public domain; in this case the translators are expected to disclaim 20 | # their copyright. 21 | COPYRIGHT_HOLDER = Joachim Metz 22 | 23 | # This is the email address or URL to which the translators shall report 24 | # bugs in the untranslated strings: 25 | # - Strings which are not entire sentences, see the maintainer guidelines 26 | # in the GNU gettext documentation, section 'Preparing Strings'. 27 | # - Strings which use unclear terms or require additional context to be 28 | # understood. 29 | # - Strings which make invalid assumptions about notation of date, time or 30 | # money. 31 | # - Pluralisation problems. 32 | # - Incorrect English spelling. 33 | # - Incorrect formatting. 34 | # It can be your email address, or a mailing list address where translators 35 | # can write to without being subscribed, or the URL of a web page through 36 | # which the translators can contact you. 37 | MSGID_BUGS_ADDRESS = @PACKAGE_BUGREPORT@ 38 | 39 | # This is the list of locale categories, beyond LC_MESSAGES, for which the 40 | # message catalogs shall be used. It is usually empty. 41 | EXTRA_LOCALE_CATEGORIES = 42 | 43 | # Additional make targets. 44 | sources splint: 45 | 46 | -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | # List of source files which contain translatable strings. 2 | -------------------------------------------------------------------------------- /runtests.ps1: -------------------------------------------------------------------------------- 1 | # Script that runs the tests 2 | # 3 | # Version: 20220103 4 | 5 | $ExitSuccess = 0 6 | $ExitFailure = 1 7 | $ExitIgnore = 77 8 | 9 | Set-Location -Path "tests" 10 | 11 | $Result = ${ExitSuccess} 12 | 13 | $Lines = Get-Content "Makefile.am" 14 | $InTests = $FALSE 15 | 16 | Foreach (${Line} in ${Lines}) 17 | { 18 | If (${InTests}) 19 | { 20 | If (-Not ${Line}) 21 | { 22 | ${InTests} = $FALSE 23 | 24 | Continue 25 | } 26 | ${Line} = ${Line}.TrimStart() 27 | 28 | If (${Line}.EndsWith(" \")) 29 | { 30 | ${Line} = ${Line}.Substring(0, ${Line}.Length - 2) 31 | } 32 | If (-Not (${Line}.EndsWith(".sh"))) 33 | { 34 | Continue 35 | } 36 | ${Line} = ${Line}.Substring(0, ${Line}.Length - 3) 37 | ${Line} = ".\${Line}.ps1" 38 | 39 | Try 40 | { 41 | Invoke-Expression ${Line} 42 | } 43 | Catch 44 | { 45 | $LastExitCode = ${ExitIgnore} 46 | } 47 | If (${LastExitCode} -eq ${ExitFailure}) 48 | { 49 | $Result = ${ExitFailure} 50 | Write-Host "FAIL" -foreground Red -nonewline 51 | } 52 | ElseIf (${LastExitCode} -eq ${ExitIgnore}) 53 | { 54 | Write-Host "SKIP" -foreground Cyan -nonewline 55 | } 56 | Else 57 | { 58 | Write-Host "PASS" -foreground Green -nonewline 59 | } 60 | Write-Host ": ${Line}" 61 | } 62 | ElseIf (${Line}.StartsWith("TESTS = ")) 63 | { 64 | ${InTests} = $TRUE 65 | } 66 | } 67 | 68 | Set-Location -Path ".." 69 | 70 | Exit ${Result} 71 | -------------------------------------------------------------------------------- /synclibs.ps1: -------------------------------------------------------------------------------- 1 | # Script that synchronizes the local library dependencies 2 | # 3 | # Version: 20180125 4 | 5 | Param ( 6 | [switch]$UseHead = $false 7 | ) 8 | 9 | $GitUrlPrefix = "https://github.com/libyal" 10 | $LocalLibs = "libbfio libcdata libcerror libcfile libclocale libcnotify libcpath libcsplit libcthreads libhmac libuna" 11 | $LocalLibs = ${LocalLibs} -split " " 12 | 13 | $Git = "git" 14 | $WinFlex = "..\win_flex_bison\win_flex.exe" 15 | $WinBison = "..\win_flex_bison\win_bison.exe" 16 | 17 | ForEach (${LocalLib} in ${LocalLibs}) 18 | { 19 | # Split will return an array of a single empty string when LocalLibs is empty. 20 | If (-Not (${LocalLib})) 21 | { 22 | Continue 23 | } 24 | $GitUrl = "${GitUrlPrefix}/${LocalLib}.git" 25 | 26 | # PowerShell will raise NativeCommandError if git writes to stdout or stderr 27 | # therefore 2>&1 is added and the output is stored in a variable. 28 | $Output = Invoke-Expression -Command "${Git} clone ${GitUrl} ${LocalLib}-${pid} 2>&1" 29 | 30 | Push-Location "${LocalLib}-${pid}" 31 | 32 | Try 33 | { 34 | $Output = Invoke-Expression -Command "${Git} fetch --quiet --all --tags --prune 2>&1" 35 | 36 | $LatestTag = Invoke-Expression -Command "${Git} describe --tags --abbrev=0 2>&1" 37 | 38 | If (${LatestTag} -and -not ${UseHead}) 39 | { 40 | Write-Host "Synchronizing: ${LocalLib} from ${GitUrl} tag ${LatestTag}" 41 | 42 | $Output = Invoke-Expression -Command "${Git} checkout --quiet tags/${LatestTag} 2>&1" 43 | } 44 | Else 45 | { 46 | Write-Host "Synchronizing: ${LocalLib} from ${GitUrl} HEAD" 47 | } 48 | } 49 | Finally 50 | { 51 | Pop-Location 52 | } 53 | If (Test-Path ${LocalLib}-${pid}) 54 | { 55 | $LocalLibVersion = Get-Content -Path ${LocalLib}-${pid}\configure.ac | select -skip 4 -first 1 | % { $_ -Replace " \[","" } | % { $_ -Replace "\],","" } 56 | 57 | If (Test-Path ${LocalLib}) 58 | { 59 | Remove-Item -Path ${LocalLib} -Force -Recurse 60 | } 61 | New-Item -ItemType directory -Path ${LocalLib} -Force | Out-Null 62 | 63 | If (Test-Path ${LocalLib}) 64 | { 65 | Copy-Item -Path ${LocalLib}-${pid}\${LocalLib}\*.[chly] -Destination ${LocalLib}\ 66 | Get-Content -Path ${LocalLib}-${pid}\${LocalLib}\${LocalLib}_definitions.h.in | % { $_ -Replace "@VERSION@",${LocalLibVersion} } > ${LocalLib}\${LocalLib}_definitions.h 67 | } 68 | Remove-Item -Path ${LocalLib}-${pid} -Force -Recurse 69 | 70 | $NamePrefix = "" 71 | 72 | ForEach (${DirectoryElement} in Get-ChildItem -Path "${LocalLib}\*.l") 73 | { 74 | $OutputFile = ${DirectoryElement} -Replace ".l$",".c" 75 | 76 | $NamePrefix = Split-Path -path ${DirectoryElement} -leaf 77 | $NamePrefix = ${NamePrefix} -Replace "^${LocalLib}_","" 78 | $NamePrefix = ${NamePrefix} -Replace ".l$","_" 79 | 80 | # PowerShell will raise NativeCommandError if win_flex writes to stdout or stderr 81 | # therefore 2>&1 is added and the output is stored in a variable. 82 | $Output = Invoke-Expression -Command "& '${WinFlex}' -Cf ${DirectoryElement} 2>&1" 83 | Write-Host ${Output} 84 | 85 | # Moving manually sicne win_flex -o does not provide the expected behavior. 86 | Move-Item "lex.yy.c" ${OutputFile} -force 87 | } 88 | 89 | ForEach (${DirectoryElement} in Get-ChildItem -Path "${LocalLib}\*.y") 90 | { 91 | $OutputFile = ${DirectoryElement} -Replace ".y$",".c" 92 | 93 | # PowerShell will raise NativeCommandError if win_bison writes to stdout or stderr 94 | # therefore 2>&1 is added and the output is stored in a variable. 95 | $Output = Invoke-Expression -Command "& '${WinBison}' -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement} 2>&1" 96 | Write-Host ${Output} 97 | } 98 | } 99 | } 100 | 101 | -------------------------------------------------------------------------------- /synctestdata.ps1: -------------------------------------------------------------------------------- 1 | # Script that synchronizes the local test data 2 | # 3 | # Version: 20230709 4 | 5 | $TestSet = "public" 6 | $TestInputDirectory = "tests/input" 7 | $TestFiles = "image.bin image.cue" 8 | 9 | If (-Not (Test-Path ${TestInputDirectory})) 10 | { 11 | New-Item -Name ${TestInputDirectory} -ItemType "directory" | Out-Null 12 | } 13 | If (-Not (Test-Path "${TestInputDirectory}\${TestSet}")) 14 | { 15 | New-Item -Name "${TestInputDirectory}\${TestSet}" -ItemType "directory" | Out-Null 16 | } 17 | ForEach ($TestFile in ${TestFiles} -split " ") 18 | { 19 | $Url = "https://github.com/dfirlabs/cue-specimens/blob/main/specimens/cdrdao/${TestFile}?raw=true" 20 | 21 | Invoke-WebRequest -Uri ${Url} -OutFile "${TestInputDirectory}\${TestSet}\${TestFile}" 22 | } 23 | 24 | -------------------------------------------------------------------------------- /synctestdata.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script that synchronizes the local test data 3 | # 4 | # Version: 20161009 5 | 6 | TEST_SET="public"; 7 | TEST_INPUT_DIRECTORY="tests/input"; 8 | TEST_FILES="image.bin image.cue"; 9 | 10 | mkdir -p "${TEST_INPUT_DIRECTORY}/${TEST_SET}"; 11 | 12 | for TEST_FILE in ${TEST_FILES}; 13 | do 14 | URL="https://github.com/dfirlabs/cue-specimens/blob/main/specimens/cdrdao/${TEST_FILE}?raw=true"; 15 | 16 | curl -L -o "${TEST_INPUT_DIRECTORY}/${TEST_SET}/${TEST_FILE}" ${URL}; 17 | done 18 | 19 | mkdir -p "${TEST_INPUT_DIRECTORY}/.libodraw/${TEST_SET}"; 20 | echo "image.cue" > "${TEST_INPUT_DIRECTORY}/.libodraw/${TEST_SET}/files"; 21 | 22 | mkdir -p "${TEST_INPUT_DIRECTORY}/.odrawinfo/${TEST_SET}"; 23 | echo "image.cue" > "${TEST_INPUT_DIRECTORY}/.odrawinfo/${TEST_SET}/files"; 24 | 25 | mkdir -p "${TEST_INPUT_DIRECTORY}/.odrawverify/${TEST_SET}"; 26 | echo "image.cue" > "${TEST_INPUT_DIRECTORY}/.odrawverify/${TEST_SET}/files"; 27 | 28 | -------------------------------------------------------------------------------- /syncwinflexbison.ps1: -------------------------------------------------------------------------------- 1 | # Script that synchronizes Windows versions of flex and bison. 2 | # 3 | # Version: 20230104 4 | 5 | Function ExtractZip($Filename, $Destination) 6 | { 7 | # AppVeyor does not seem to support extraction using "native ZIP" so we use 7z instead. 8 | $SevenZip = "C:\Program Files\7-Zip\7z.exe" 9 | 10 | If (-Not (Test-Path ${Destination})) 11 | { 12 | New-Item -ItemType directory -Path ${Destination} -Force | Out-Null 13 | } 14 | If (Test-Path ${SevenZip}) 15 | { 16 | # PowerShell will raise NativeCommandError if 7z writes to stdout or stderr 17 | # therefore 2>&1 is added and the output is stored in a variable. 18 | # The leading & and single quotes are necessary to compensate for the spaces in the path. 19 | $Output = Invoke-Expression -Command "& '${SevenZip}' -y -o${Destination} x ${Filename} 2>&1" 20 | } 21 | else 22 | { 23 | $Shell = New-Object -ComObject Shell.Application 24 | $Archive = ${Shell}.NameSpace(${Filename}) 25 | $Directory = ${Shell}.Namespace(${Destination}) 26 | 27 | ForEach($FileEntry in ${Archive}.items()) 28 | { 29 | ${Directory}.CopyHere(${FileEntry}) 30 | } 31 | } 32 | } 33 | 34 | $Version = "2.5.25" 35 | $Filename = "${pwd}\win_flex_bison-${Version}.zip" 36 | $Url = "https://github.com/lexxmark/winflexbison/releases/download/v${Version}/win_flex_bison-${Version}.zip" 37 | $ExtractedPath = "win_flex_bison-${Version}" 38 | $DestinationPath = "..\win_flex_bison" 39 | 40 | If (Test-Path ${Filename}) 41 | { 42 | Remove-Item -Path ${Filename} -Force 43 | } 44 | Invoke-WebRequest -Uri ${Url} -OutFile ${Filename} 45 | 46 | If (Test-Path ${ExtractedPath}) 47 | { 48 | Remove-Item -Path ${ExtractedPath} -Force -Recurse 49 | } 50 | ExtractZip -Filename ${Filename} -Destination "${pwd}\${ExtractedPath}" 51 | 52 | Remove-Item -Path ${Filename} -Force 53 | 54 | If (Test-Path ${DestinationPath}) 55 | { 56 | Remove-Item -Path ${DestinationPath} -Force -Recurse 57 | } 58 | Move-Item ${ExtractedPath} ${DestinationPath} 59 | 60 | -------------------------------------------------------------------------------- /tests/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script to build from source 3 | # 4 | # Version: 20201121 5 | 6 | set -e 7 | 8 | ./synclibs.sh --use-head 9 | ./autogen.sh 10 | ./configure "$@" 11 | make > /dev/null 12 | 13 | -------------------------------------------------------------------------------- /tests/data/cue_parser.1: -------------------------------------------------------------------------------- 1 | CD_DA 2 | TRACK AUDIO 3 | FILE "data.wav" 0 4 | -------------------------------------------------------------------------------- /tests/data/cue_parser.2: -------------------------------------------------------------------------------- 1 | CD_DA 2 | CD_TEXT { 3 | LANGUAGE_MAP { 4 | 0 : EN 5 | } 6 | 7 | LANGUAGE 0 { 8 | TITLE "CD Title" 9 | PERFORMER "Performer" 10 | DISC_ID "XY12345" 11 | UPC_EAN "" 12 | } 13 | } 14 | 15 | TRACK AUDIO 16 | ISRC "DEXXX9800001" 17 | CD_TEXT { 18 | LANGUAGE 0 { 19 | TITLE "Track Title" 20 | PERFORMER "Performer" 21 | ISRC "DE-XXX-98-00001" 22 | } 23 | } 24 | PREGAP 0:2:0 25 | FILE "data.wav" 0 26 | -------------------------------------------------------------------------------- /tests/data/cue_parser.3: -------------------------------------------------------------------------------- 1 | CD_DA 2 | TRACK AUDIO 3 | FILE "data.cdr" 0 4 | START 0:10:0 5 | -------------------------------------------------------------------------------- /tests/data/cue_parser.4: -------------------------------------------------------------------------------- 1 | CD_DA 2 | TRACK AUDIO 3 | FILE "pregapdata.wav" 0 4 | START 5 | FILE "track.cdr" 1:0:0 1:0:0 6 | SILENCE 0:2:0 7 | FILE "track.cdr" 2:0:0 8 | INDEX 2:0:0 9 | INDEX 4:0:0 10 | -------------------------------------------------------------------------------- /tests/data/cue_parser.5: -------------------------------------------------------------------------------- 1 | CD_ROM 2 | TRACK MODE1 3 | DATAFILE "data_1" 4 | ZERO 00:02:00 // post-gap 5 | 6 | TRACK AUDIO 7 | SILENCE 00:02:00 // pre-gap 8 | START 9 | FILE "data_2.wav" 0 10 | 11 | TRACK AUDIO 12 | FILE "data_3.wav" 0 13 | -------------------------------------------------------------------------------- /tests/lsan.suppressions: -------------------------------------------------------------------------------- 1 | leak:/lib*/libpython* 2 | -------------------------------------------------------------------------------- /tests/odraw_test_cue_parser.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Library cue_parser functions test program 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) 27 | #include 28 | #endif 29 | 30 | #include "odraw_test_libcerror.h" 31 | #include "odraw_test_libodraw.h" 32 | #include "odraw_test_macros.h" 33 | #include "odraw_test_memory.h" 34 | #include "odraw_test_unused.h" 35 | 36 | #include "../libodraw/libodraw_cue_parser.h" 37 | 38 | extern \ 39 | int libodraw_cue_parser_parse_buffer( 40 | libodraw_handle_t *handle, 41 | const uint8_t *buffer, 42 | size_t buffer_size, 43 | libcerror_error_t **error ); 44 | 45 | #if defined( __GNUC__ ) && !defined( LIBODRAW_DLL_IMPORT ) 46 | 47 | /* Tests the libodraw_cue_parser_parse_buffer function 48 | * Returns 1 if successful or 0 if not 49 | */ 50 | int odraw_test_cue_parser_parse_buffer( 51 | void ) 52 | { 53 | libcerror_error_t *error = NULL; 54 | int result = 0; 55 | 56 | /* Test error cases 57 | */ 58 | result = libodraw_cue_parser_parse_buffer( 59 | NULL, 60 | NULL, 61 | 0, 62 | &error ); 63 | 64 | ODRAW_TEST_ASSERT_EQUAL_INT( 65 | "result", 66 | result, 67 | -1 ); 68 | 69 | ODRAW_TEST_ASSERT_IS_NOT_NULL( 70 | "error", 71 | error ); 72 | 73 | libcerror_error_free( 74 | &error ); 75 | 76 | return( 1 ); 77 | 78 | on_error: 79 | if( error != NULL ) 80 | { 81 | libcerror_error_free( 82 | &error ); 83 | } 84 | return( 0 ); 85 | } 86 | 87 | #endif /* defined( __GNUC__ ) && !defined( LIBODRAW_DLL_IMPORT ) */ 88 | 89 | /* The main program 90 | */ 91 | #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) 92 | int wmain( 93 | int argc ODRAW_TEST_ATTRIBUTE_UNUSED, 94 | wchar_t * const argv[] ODRAW_TEST_ATTRIBUTE_UNUSED ) 95 | #else 96 | int main( 97 | int argc ODRAW_TEST_ATTRIBUTE_UNUSED, 98 | char * const argv[] ODRAW_TEST_ATTRIBUTE_UNUSED ) 99 | #endif 100 | { 101 | ODRAW_TEST_UNREFERENCED_PARAMETER( argc ) 102 | ODRAW_TEST_UNREFERENCED_PARAMETER( argv ) 103 | 104 | #if defined( __GNUC__ ) && !defined( LIBODRAW_DLL_IMPORT ) 105 | 106 | /* TODO: add tests for libodraw_cue_parser_parse_number */ 107 | 108 | /* TODO: add tests for libodraw_cue_parser_parse_msf */ 109 | 110 | /* TODO: add tests for libodraw_cue_parser_parse_track_type */ 111 | 112 | ODRAW_TEST_RUN( 113 | "libodraw_cue_parser_parse_buffer", 114 | odraw_test_cue_parser_parse_buffer ); 115 | 116 | #endif /* defined( __GNUC__ ) && !defined( LIBODRAW_DLL_IMPORT ) */ 117 | 118 | return( EXIT_SUCCESS ); 119 | 120 | #if defined( __GNUC__ ) && !defined( LIBODRAW_DLL_IMPORT ) 121 | 122 | on_error: 123 | return( EXIT_FAILURE ); 124 | 125 | #endif /* defined( __GNUC__ ) && !defined( LIBODRAW_DLL_IMPORT ) */ 126 | } 127 | 128 | -------------------------------------------------------------------------------- /tests/odraw_test_data_file.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Library data_file type test program 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) 27 | #include 28 | #endif 29 | 30 | #include "odraw_test_libcerror.h" 31 | #include "odraw_test_libodraw.h" 32 | #include "odraw_test_macros.h" 33 | #include "odraw_test_memory.h" 34 | #include "odraw_test_unused.h" 35 | 36 | #include "../libodraw/libodraw_data_file.h" 37 | 38 | /* Tests the libodraw_data_file_free function 39 | * Returns 1 if successful or 0 if not 40 | */ 41 | int odraw_test_data_file_free( 42 | void ) 43 | { 44 | libcerror_error_t *error = NULL; 45 | int result = 0; 46 | 47 | /* Test error cases 48 | */ 49 | result = libodraw_data_file_free( 50 | NULL, 51 | &error ); 52 | 53 | ODRAW_TEST_ASSERT_EQUAL_INT( 54 | "result", 55 | result, 56 | -1 ); 57 | 58 | ODRAW_TEST_ASSERT_IS_NOT_NULL( 59 | "error", 60 | error ); 61 | 62 | libcerror_error_free( 63 | &error ); 64 | 65 | return( 1 ); 66 | 67 | on_error: 68 | if( error != NULL ) 69 | { 70 | libcerror_error_free( 71 | &error ); 72 | } 73 | return( 0 ); 74 | } 75 | 76 | #if defined( __GNUC__ ) && !defined( LIBODRAW_DLL_IMPORT ) 77 | 78 | #endif /* defined( __GNUC__ ) && !defined( LIBODRAW_DLL_IMPORT ) */ 79 | 80 | /* The main program 81 | */ 82 | #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) 83 | int wmain( 84 | int argc ODRAW_TEST_ATTRIBUTE_UNUSED, 85 | wchar_t * const argv[] ODRAW_TEST_ATTRIBUTE_UNUSED ) 86 | #else 87 | int main( 88 | int argc ODRAW_TEST_ATTRIBUTE_UNUSED, 89 | char * const argv[] ODRAW_TEST_ATTRIBUTE_UNUSED ) 90 | #endif 91 | { 92 | ODRAW_TEST_UNREFERENCED_PARAMETER( argc ) 93 | ODRAW_TEST_UNREFERENCED_PARAMETER( argv ) 94 | 95 | #if defined( __GNUC__ ) && !defined( LIBODRAW_DLL_IMPORT ) 96 | 97 | /* TODO: add tests for libodraw_data_file_initialize */ 98 | 99 | #endif /* defined( __GNUC__ ) && !defined( LIBODRAW_DLL_IMPORT ) */ 100 | 101 | ODRAW_TEST_RUN( 102 | "libodraw_data_file_free", 103 | odraw_test_data_file_free ); 104 | 105 | #if defined( __GNUC__ ) && !defined( LIBODRAW_DLL_IMPORT ) 106 | 107 | /* TODO: add tests for libodraw_data_file_get_filename_size */ 108 | 109 | /* TODO: add tests for libodraw_data_file_get_filename */ 110 | 111 | /* TODO: add tests for libodraw_data_file_set_filename */ 112 | 113 | /* TODO: add tests for libodraw_data_file_get_filename_size_wide */ 114 | 115 | /* TODO: add tests for libodraw_data_file_get_filename_wide */ 116 | 117 | /* TODO: add tests for libodraw_data_file_set_filename_wide */ 118 | 119 | /* TODO: add tests for libodraw_data_file_get_type */ 120 | 121 | #endif /* defined( __GNUC__ ) && !defined( LIBODRAW_DLL_IMPORT ) */ 122 | 123 | return( EXIT_SUCCESS ); 124 | 125 | on_error: 126 | return( EXIT_FAILURE ); 127 | } 128 | 129 | -------------------------------------------------------------------------------- /tests/odraw_test_error.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Library error functions test program 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) 27 | #include 28 | #endif 29 | 30 | #include "odraw_test_libodraw.h" 31 | #include "odraw_test_macros.h" 32 | #include "odraw_test_unused.h" 33 | 34 | /* Tests the libodraw_error_free function 35 | * Returns 1 if successful or 0 if not 36 | */ 37 | int odraw_test_error_free( 38 | void ) 39 | { 40 | /* Test invocation of function only 41 | */ 42 | libodraw_error_free( 43 | NULL ); 44 | 45 | return( 1 ); 46 | } 47 | 48 | /* Tests the libodraw_error_fprint function 49 | * Returns 1 if successful or 0 if not 50 | */ 51 | int odraw_test_error_fprint( 52 | void ) 53 | { 54 | /* Test invocation of function only 55 | */ 56 | libodraw_error_fprint( 57 | NULL, 58 | NULL ); 59 | 60 | return( 1 ); 61 | } 62 | 63 | /* Tests the libodraw_error_sprint function 64 | * Returns 1 if successful or 0 if not 65 | */ 66 | int odraw_test_error_sprint( 67 | void ) 68 | { 69 | /* Test invocation of function only 70 | */ 71 | libodraw_error_sprint( 72 | NULL, 73 | NULL, 74 | 0 ); 75 | 76 | return( 1 ); 77 | } 78 | 79 | /* Tests the libodraw_error_backtrace_fprint function 80 | * Returns 1 if successful or 0 if not 81 | */ 82 | int odraw_test_error_backtrace_fprint( 83 | void ) 84 | { 85 | /* Test invocation of function only 86 | */ 87 | libodraw_error_backtrace_fprint( 88 | NULL, 89 | NULL ); 90 | 91 | return( 1 ); 92 | } 93 | 94 | /* Tests the libodraw_error_backtrace_sprint function 95 | * Returns 1 if successful or 0 if not 96 | */ 97 | int odraw_test_error_backtrace_sprint( 98 | void ) 99 | { 100 | /* Test invocation of function only 101 | */ 102 | libodraw_error_backtrace_sprint( 103 | NULL, 104 | NULL, 105 | 0 ); 106 | 107 | return( 1 ); 108 | } 109 | 110 | /* The main program 111 | */ 112 | #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) 113 | int wmain( 114 | int argc ODRAW_TEST_ATTRIBUTE_UNUSED, 115 | wchar_t * const argv[] ODRAW_TEST_ATTRIBUTE_UNUSED ) 116 | #else 117 | int main( 118 | int argc ODRAW_TEST_ATTRIBUTE_UNUSED, 119 | char * const argv[] ODRAW_TEST_ATTRIBUTE_UNUSED ) 120 | #endif 121 | { 122 | ODRAW_TEST_UNREFERENCED_PARAMETER( argc ) 123 | ODRAW_TEST_UNREFERENCED_PARAMETER( argv ) 124 | 125 | ODRAW_TEST_RUN( 126 | "libodraw_error_free", 127 | odraw_test_error_free ); 128 | 129 | ODRAW_TEST_RUN( 130 | "libodraw_error_fprint", 131 | odraw_test_error_fprint ); 132 | 133 | ODRAW_TEST_RUN( 134 | "libodraw_error_sprint", 135 | odraw_test_error_sprint ); 136 | 137 | ODRAW_TEST_RUN( 138 | "libodraw_error_backtrace_fprint", 139 | odraw_test_error_backtrace_fprint ); 140 | 141 | ODRAW_TEST_RUN( 142 | "libodraw_error_backtrace_sprint", 143 | odraw_test_error_backtrace_sprint ); 144 | 145 | return( EXIT_SUCCESS ); 146 | 147 | on_error: 148 | return( EXIT_FAILURE ); 149 | } 150 | 151 | -------------------------------------------------------------------------------- /tests/odraw_test_functions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Functions for testing 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAW_TEST_FUNCTIONS_H ) 23 | #define _ODRAW_TEST_FUNCTIONS_H 24 | 25 | #include 26 | #include 27 | 28 | #include "odraw_test_libbfio.h" 29 | #include "odraw_test_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | int odraw_test_get_narrow_source( 36 | const system_character_t *source, 37 | char *narrow_string, 38 | size_t narrow_string_size, 39 | libcerror_error_t **error ); 40 | 41 | #if defined( HAVE_WIDE_CHARACTER_TYPE ) 42 | 43 | int odraw_test_get_wide_source( 44 | const system_character_t *source, 45 | wchar_t *wide_string, 46 | size_t wide_string_size, 47 | libcerror_error_t **error ); 48 | 49 | #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ 50 | 51 | int odraw_test_open_file_io_handle( 52 | libbfio_handle_t **file_io_handle, 53 | uint8_t *data, 54 | size_t data_size, 55 | libcerror_error_t **error ); 56 | 57 | int odraw_test_close_file_io_handle( 58 | libbfio_handle_t **file_io_handle, 59 | libcerror_error_t **error ); 60 | 61 | #if defined( __cplusplus ) 62 | } 63 | #endif 64 | 65 | #endif /* !defined( _ODRAW_TEST_FUNCTIONS_H ) */ 66 | 67 | -------------------------------------------------------------------------------- /tests/odraw_test_getopt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GetOpt functions 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAW_TEST_GETOPT_H ) 23 | #define _ODRAW_TEST_GETOPT_H 24 | 25 | #include 26 | #include 27 | 28 | /* unistd.h is included here to export getopt, optarg, optind and optopt 29 | */ 30 | #if defined( HAVE_UNISTD_H ) 31 | #include 32 | #endif 33 | 34 | #if defined( __cplusplus ) 35 | extern "C" { 36 | #endif 37 | 38 | #if defined( HAVE_GETOPT ) 39 | #define odraw_test_getopt( argument_count, argument_values, options_string ) \ 40 | getopt( argument_count, argument_values, options_string ) 41 | 42 | #else 43 | 44 | #if !defined( __CYGWIN__ ) 45 | extern int optind; 46 | extern system_character_t *optarg; 47 | extern system_integer_t optopt; 48 | 49 | #else 50 | int optind; 51 | system_character_t *optarg; 52 | system_integer_t optopt; 53 | 54 | #endif /* !defined( __CYGWIN__ ) */ 55 | 56 | system_integer_t odraw_test_getopt( 57 | int argument_count, 58 | system_character_t * const argument_values[], 59 | const system_character_t *options_string ); 60 | 61 | #endif /* defined( HAVE_GETOPT ) */ 62 | 63 | #if defined( __cplusplus ) 64 | } 65 | #endif 66 | 67 | #endif /* !defined( _ODRAW_TEST_GETOPT_H ) */ 68 | 69 | -------------------------------------------------------------------------------- /tests/odraw_test_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAW_TEST_LIBBFIO_H ) 23 | #define _ODRAW_TEST_LIBBFIO_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio 28 | */ 29 | #if defined( HAVE_LOCAL_LIBBFIO ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT 43 | * before including libbfio.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 46 | #define LIBBFIO_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( LIBBFIO_HAVE_MULTI_THREAD_SUPPORT ) 52 | #error Multi-threading support requires libbfio with multi-threading support 53 | #endif 54 | 55 | #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ 56 | 57 | #endif /* !defined( _ODRAW_TEST_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /tests/odraw_test_libcerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcerror header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAW_TEST_LIBCERROR_H ) 23 | #define _ODRAW_TEST_LIBCERROR_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCERROR for local use of libcerror 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCERROR ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCERROR_DLL_IMPORT 39 | * before including libcerror.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCERROR_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCERROR ) */ 48 | 49 | #endif /* !defined( _ODRAW_TEST_LIBCERROR_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /tests/odraw_test_libclocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libclocale header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAW_TEST_LIBCLOCALE_H ) 23 | #define _ODRAW_TEST_LIBCLOCALE_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCLOCALE for local use of libclocale 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCLOCALE ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCLOCALE_DLL_IMPORT 39 | * before including libclocale.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCLOCALE_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCLOCALE ) */ 48 | 49 | #endif /* !defined( _ODRAW_TEST_LIBCLOCALE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /tests/odraw_test_libcnotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcnotify header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAW_TEST_LIBCNOTIFY_H ) 23 | #define _ODRAW_TEST_LIBCNOTIFY_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCNOTIFY for local use of libcnotify 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCNOTIFY ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCNOTIFY_DLL_IMPORT 39 | * before including libcnotify.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCNOTIFY_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCNOTIFY ) */ 48 | 49 | #endif /* !defined( _ODRAW_TEST_LIBCNOTIFY_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /tests/odraw_test_libcthreads.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal libcthreads header 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAW_TEST_LIBCTHREADS_H ) 23 | #define _ODRAW_TEST_LIBCTHREADS_H 24 | 25 | #include 26 | 27 | #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBODRAW ) 28 | 29 | /* Define HAVE_LOCAL_LIBCTHREADS for local use of libcthreads 30 | */ 31 | #if defined( HAVE_LOCAL_LIBCTHREADS ) 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | #else 45 | 46 | /* If libtool DLL support is enabled set LIBCTHREADS_DLL_IMPORT 47 | * before including libcthreads.h 48 | */ 49 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 50 | #define LIBCTHREADS_DLL_IMPORT 51 | #endif 52 | 53 | #include 54 | 55 | #endif 56 | 57 | #endif /* defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBODRAW ) */ 58 | 59 | #endif 60 | 61 | -------------------------------------------------------------------------------- /tests/odraw_test_libodraw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libodraw header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAW_TEST_LIBODRAW_H ) 23 | #define _ODRAW_TEST_LIBODRAW_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | #endif /* !defined( _ODRAW_TEST_LIBODRAW_H ) */ 30 | 31 | -------------------------------------------------------------------------------- /tests/odraw_test_libuna.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libuna header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAW_TEST_LIBUNA_H ) 23 | #define _ODRAW_TEST_LIBUNA_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBUNA for local use of libuna 28 | */ 29 | #if defined( HAVE_LOCAL_LIBUNA ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | #else 47 | 48 | /* If libtool DLL support is enabled set LIBUNA_DLL_IMPORT 49 | * before including libuna.h 50 | */ 51 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 52 | #define LIBUNA_DLL_IMPORT 53 | #endif 54 | 55 | #include 56 | 57 | #endif /* defined( HAVE_LOCAL_LIBUNA ) */ 58 | 59 | #endif /* !defined( _ODRAW_TEST_LIBUNA_H ) */ 60 | 61 | -------------------------------------------------------------------------------- /tests/odraw_test_memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Memory allocation functions for testing 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAW_TEST_MEMORY_H ) 23 | #define _ODRAW_TEST_MEMORY_H 24 | 25 | #include 26 | 27 | #if defined( __cplusplus ) 28 | extern "C" { 29 | #endif 30 | 31 | #if defined( HAVE_GNU_DL_DLSYM ) && defined( __GNUC__ ) && !defined( LIBODRAW_DLL_IMPORT ) && !defined( __arm__ ) && !defined( __clang__ ) && !defined( __CYGWIN__ ) && !defined( __hppa__ ) && !defined( __loongarch__ ) && !defined( __mips__ ) && !defined( __riscv ) && !defined( __sparc__ ) && !defined( HAVE_ASAN ) 32 | #define HAVE_ODRAW_TEST_MEMORY 1 33 | #endif 34 | 35 | #if defined( HAVE_ODRAW_TEST_MEMORY ) 36 | 37 | extern int odraw_test_malloc_attempts_before_fail; 38 | 39 | extern int odraw_test_memcpy_attempts_before_fail; 40 | 41 | extern int odraw_test_memset_attempts_before_fail; 42 | 43 | extern int odraw_test_realloc_attempts_before_fail; 44 | 45 | #endif /* defined( HAVE_ODRAW_TEST_MEMORY ) */ 46 | 47 | #if defined( __cplusplus ) 48 | } 49 | #endif 50 | 51 | #endif /* !defined( _ODRAW_TEST_MEMORY_H ) */ 52 | 53 | -------------------------------------------------------------------------------- /tests/odraw_test_unused.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions to silence compiler warnings about unused function attributes/parameters. 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _ODRAW_TEST_UNUSED_H ) 23 | #define _ODRAW_TEST_UNUSED_H 24 | 25 | #include 26 | 27 | #if !defined( ODRAW_TEST_ATTRIBUTE_UNUSED ) 28 | 29 | #if defined( __GNUC__ ) && __GNUC__ >= 3 30 | #define ODRAW_TEST_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 31 | 32 | #else 33 | #define ODRAW_TEST_ATTRIBUTE_UNUSED 34 | 35 | #endif /* defined( __GNUC__ ) && __GNUC__ >= 3 */ 36 | 37 | #endif /* !defined( ODRAW_TEST_ATTRIBUTE_UNUSED ) */ 38 | 39 | #if defined( _MSC_VER ) 40 | #define ODRAW_TEST_UNREFERENCED_PARAMETER( parameter ) \ 41 | UNREFERENCED_PARAMETER( parameter ); 42 | 43 | #else 44 | #define ODRAW_TEST_UNREFERENCED_PARAMETER( parameter ) \ 45 | /* parameter */ 46 | 47 | #endif /* defined( _MSC_VER ) */ 48 | 49 | #endif /* !defined( _ODRAW_TEST_UNUSED_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /tests/pkgbuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script to build a MacOS pkg 3 | # 4 | # Version: 20201121 5 | 6 | set -e 7 | 8 | make install DESTDIR=${PWD}/osx-pkg 9 | mkdir -p ${PWD}/osx-pkg/usr/share/doc/libodraw 10 | cp AUTHORS COPYING COPYING.LESSER NEWS README ${PWD}/osx-pkg/usr/share/doc/libodraw 11 | 12 | VERSION=`sed '5!d; s/^ \[//;s/\],$//' configure.ac` 13 | pkgbuild --root osx-pkg --identifier com.github.libyal.libodraw --version ${VERSION} --ownership recommended ../libodraw-${VERSION}.pkg 14 | 15 | -------------------------------------------------------------------------------- /tests/runtests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script to run tests 3 | # 4 | # Version: 20201121 5 | 6 | if test -f ${PWD}/libodraw/.libs/libodraw.1.dylib && test -f ./pyodraw/.libs/pyodraw.so; 7 | then 8 | install_name_tool -change /usr/local/lib/libodraw.1.dylib ${PWD}/libodraw/.libs/libodraw.1.dylib ./pyodraw/.libs/pyodraw.so; 9 | fi 10 | 11 | make check CHECK_WITH_STDERR=1; 12 | RESULT=$?; 13 | 14 | if test ${RESULT} -ne 0 && test -f tests/test-suite.log; 15 | then 16 | cat tests/test-suite.log; 17 | fi 18 | exit ${RESULT}; 19 | 20 | -------------------------------------------------------------------------------- /tests/syncsharedlibs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script that synchronizes the shared library dependencies 3 | # 4 | # Version: 20201121 5 | 6 | EXIT_SUCCESS=0; 7 | EXIT_FAILURE=1; 8 | 9 | GIT_URL_PREFIX="https://github.com/libyal"; 10 | SHARED_LIBS="libcerror libcthreads libcdata libclocale libcnotify libcsplit libuna libcfile libcpath libbfio"; 11 | 12 | USE_HEAD=""; 13 | 14 | if test "$1" = "--use-head"; 15 | then 16 | USE_HEAD="--use-head"; 17 | fi 18 | 19 | OLDIFS=$IFS; 20 | IFS=" "; 21 | 22 | for SHARED_LIB in ${SHARED_LIBS}; 23 | do 24 | GIT_URL="${GIT_URL_PREFIX}/${SHARED_LIB}.git"; 25 | 26 | git clone --quiet ${GIT_URL} ${SHARED_LIB}-$$; 27 | 28 | if ! test -d ${SHARED_LIB}-$$; 29 | then 30 | echo "Unable to git clone: ${GIT_URL}"; 31 | 32 | IFS=$OLDIFS; 33 | 34 | exit ${EXIT_FAILURE}; 35 | fi 36 | (cd ${SHARED_LIB}-$$ && git fetch --quiet --all --tags --prune) 37 | 38 | LATEST_TAG=`cd ${SHARED_LIB}-$$ && git describe --tags --abbrev=0`; 39 | 40 | if test -n ${LATEST_TAG} && test -z ${USE_HEAD}; 41 | then 42 | echo "Synchronizing: ${SHARED_LIB} from ${GIT_URL} tag ${LATEST_TAG}"; 43 | 44 | (cd ${SHARED_LIB}-$$ && git checkout --quiet tags/${LATEST_TAG}); 45 | else 46 | echo "Synchronizing: ${SHARED_LIB} from ${GIT_URL} HEAD"; 47 | fi 48 | 49 | (cd ${SHARED_LIB}-$$ && ./synclibs.sh ${USE_HEAD} && ./autogen.sh); 50 | 51 | CONFIGURE_OPTIONS=""; 52 | 53 | (cd ${SHARED_LIB}-$$ && ./configure --help | grep -- '--enable-wide-character-type' > /dev/null); 54 | 55 | if test $? -eq 0; 56 | then 57 | CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --enable-wide-character-type"; 58 | fi 59 | 60 | (cd ${SHARED_LIB}-$$ && ./configure --prefix=/usr ${CONFIGURE_OPTIONS} && make && sudo make install); 61 | 62 | rm -rf ${SHARED_LIB}-$$; 63 | done 64 | 65 | IFS=$OLDIFS; 66 | 67 | exit ${EXIT_SUCCESS}; 68 | 69 | -------------------------------------------------------------------------------- /tests/test_manpage.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Tests man pages. 3 | # 4 | # Version: 20240413 5 | 6 | EXIT_SUCCESS=0; 7 | EXIT_FAILURE=1; 8 | EXIT_IGNORE=77; 9 | 10 | run_test() 11 | { 12 | local INPUT_FILE=$1; 13 | local RESULT=0 14 | 15 | TEST_NAME=`basename ${INPUT_FILE}`; 16 | echo -n "Testing man with input: ${TEST_NAME}"; 17 | 18 | LC_ALL=en_US.UTF-8 MANROFFSEQ='' MANWIDTH=80 man --warnings -E UTF-8 -l -Tutf8 -Z ${INPUT_FILE} > /dev/null 2> ${TMPDIR}/${TEST_NAME}.warnings; 19 | RESULT=$?; 20 | 21 | # For now line break warnings are ignored. 22 | if test -f ${TMPDIR}/${TEST_NAME}.warnings; 23 | then 24 | sed "/can't break line/ d" -i ${TMPDIR}/${TEST_NAME}.warnings; 25 | fi 26 | if test -s ${TMPDIR}/${TEST_NAME}.warnings; 27 | then 28 | RESULT=${EXIT_FAILURE}; 29 | fi 30 | if test ${RESULT} -ne ${EXIT_SUCCESS}; 31 | then 32 | echo " (FAIL)"; 33 | else 34 | echo " (PASS)"; 35 | fi 36 | if test -s ${TMPDIR}/${TEST_NAME}.warnings; 37 | then 38 | cat ${TMPDIR}/${TEST_NAME}.warnings; 39 | fi 40 | return ${RESULT}; 41 | } 42 | 43 | if test "${OSTYPE}" = "msys"; 44 | then 45 | exit ${EXIT_IGNORE}; 46 | fi 47 | 48 | TEST_DIRECTORY=`dirname $0`; 49 | 50 | TEST_RUNNER="${TEST_DIRECTORY}/test_runner.sh"; 51 | 52 | if ! test -f "${TEST_RUNNER}"; 53 | then 54 | echo "Missing test runner: ${TEST_RUNNER}"; 55 | 56 | exit ${EXIT_FAILURE}; 57 | fi 58 | 59 | source ${TEST_RUNNER}; 60 | 61 | assert_availability_binary man; 62 | 63 | RESULT=${EXIT_IGNORE}; 64 | 65 | TMPDIR="tmp$$"; 66 | 67 | rm -rf ${TMPDIR}; 68 | mkdir ${TMPDIR}; 69 | 70 | MANUALS_PATH="../manuals"; 71 | 72 | if ! test -d ${MANUALS_PATH}; 73 | then 74 | MANUALS_PATH="manuals"; 75 | fi 76 | 77 | if ! test -d ${MANUALS_PATH}; 78 | then 79 | echo "Manuals directory not found."; 80 | 81 | exit ${EXIT_IGNORE}; 82 | fi 83 | 84 | for INPUT_FILE in ${MANUALS_PATH}/*.[13]; 85 | do 86 | run_test "${INPUT_FILE}"; 87 | RESULT=$?; 88 | 89 | if test ${RESULT} -ne ${EXIT_SUCCESS}; 90 | then 91 | break; 92 | fi 93 | done 94 | 95 | rm -rf ${TMPDIR}; 96 | 97 | exit ${RESULT}; 98 | 99 | --------------------------------------------------------------------------------