Add libidn2 and TurboJPEG sandboxes to the build

This exposed a compilation error and an incorrect TEST_FILES_DIR.  Fix
both.
This commit is contained in:
Demi Marie Obenour 2022-02-12 22:17:57 -05:00
parent 38eea151a6
commit b2f4e0068e
4 changed files with 13 additions and 9 deletions

View File

@ -16,7 +16,9 @@
set(SAPI_CONTRIB_SANDBOXES
hunspell
jsonnet
libidn2
pffft
turbojpeg
zopfli
zstd
)

View File

@ -5,13 +5,15 @@ libraries.
## Projects Sandboxed
Directory | Project | Home Page | Integration
----------- | ------------------------------------------------- | ---------------------------------------------------------------------------- | -----------
`hunspell/` | Hunspell - The most popular spellchecking library | [github.com/hunspell/hunspell](https://github.com/hunspell/hunspell) | CMake
`jsonnet/` | Jsonnet - The Data Templating Language | [github.com/google/jsonnet](https://github.com/google/jsonnet) | CMake
`pffft/` | PFFFT - a pretty fast Fourier Transform | [bitbucket.org/jpommier/pffft.git](https://bitbucket.org/jpommier/pffft.git) | CMake
`zopfli` | Zopfli - Compression Algorithm | [github.com/google/zopfli](https://github.com/google/zopfli) | CMake
`zstd/` | Zstandard - Fast real-time compression algorithm | [github.com/facebook/zstd](https://github.com/facebook/zstd) | CMake
Directory | Project | Home Page | Integration
------------ | ------------------------------------------------- | ------------------------------------------------------------------------------------ | -----------
`hunspell/` | Hunspell - The most popular spellchecking library | [github.com/hunspell/hunspell](https://github.com/hunspell/hunspell) | CMake
`jsonnet/` | Jsonnet - The Data Templating Language | [github.com/google/jsonnet](https://github.com/google/jsonnet) | CMake
`pffft/` | PFFFT - a pretty fast Fourier Transform | [bitbucket.org/jpommier/pffft.git](https://bitbucket.org/jpommier/pffft.git) | CMake
`zopfli` | Zopfli - Compression Algorithm | [github.com/google/zopfli](https://github.com/google/zopfli) | CMake
`zstd/` | Zstandard - Fast real-time compression algorithm | [github.com/facebook/zstd](https://github.com/facebook/zstd) | CMake
`libidn2/` | libidn2 - GNU IDN library | [www.gnu.org/software/libidn/#libidn2](https://www.gnu.org/software/libidn/#libidn2) | CMake
`turbojpeg/` | High-level JPEG library | [libjpeg-turbo.org/About/TurboJPEG](https://libjpeg-turbo.org/About/TurboJPEG) | CMake
## Projects Shipping with Sandboxed API Sandboxes

View File

@ -23,4 +23,4 @@ target_link_libraries(turbojpeg_sapi_test PRIVATE
gmock
)
gtest_discover_tests(turbojpeg_sapi_test PROPERTIES ENVIRONMENT "TEST_FILES_DIR=${PROJECT_SOURCE_DIR}/files")
gtest_discover_tests(turbojpeg_sapi_test PROPERTIES ENVIRONMENT "TEST_FILES_DIR=${PROJECT_SOURCE_DIR}/tests")

View File

@ -91,7 +91,7 @@ absl::StatusOr<std::vector<uint8_t>> ReadFile(const std::string& in_file,
if (expected_size != SIZE_MAX && ssize != expected_size) {
return absl::UnavailableError("Incorrect size of file");
}
std::vector<uint8_t> inbuf{ssize};
std::vector<uint8_t> inbuf((ssize));
f.read(reinterpret_cast<char*>(inbuf.data()), ssize);
if (ssize != f.gcount()) {
return absl::UnavailableError("Premature end of file");