mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
tvg_saver: fixing file opening mode
Opening files in text mode on windows can cause issues. Fixed by changeing the mode to binary. @Issue: https://github.com/thorvg/thorvg/issues/957 @Issue: https://github.com/thorvg/thorvg/issues/1380
This commit is contained in:
parent
84012651cc
commit
bce5aef068
1 changed files with 2 additions and 2 deletions
|
@ -170,7 +170,7 @@ bool TvgSaver::saveEncoding(const std::string& path)
|
||||||
memcpy(uncompressed, &compressedSizeBits, TVG_HEADER_COMPRESSED_SIZE_BITS);
|
memcpy(uncompressed, &compressedSizeBits, TVG_HEADER_COMPRESSED_SIZE_BITS);
|
||||||
|
|
||||||
//Good optimization, flush to file.
|
//Good optimization, flush to file.
|
||||||
auto fp = _fopen(path.c_str(), "w+");
|
auto fp = _fopen(path.c_str(), "wb+");
|
||||||
if (!fp) goto fail;
|
if (!fp) goto fail;
|
||||||
|
|
||||||
//write header
|
//write header
|
||||||
|
@ -193,7 +193,7 @@ fail:
|
||||||
|
|
||||||
bool TvgSaver::flushTo(const std::string& path)
|
bool TvgSaver::flushTo(const std::string& path)
|
||||||
{
|
{
|
||||||
auto fp = _fopen(path.c_str(), "w+");
|
auto fp = _fopen(path.c_str(), "wb+");
|
||||||
if (!fp) return false;
|
if (!fp) return false;
|
||||||
|
|
||||||
if (fwrite(buffer.data, SIZE(uint8_t), buffer.count, fp) == 0) {
|
if (fwrite(buffer.data, SIZE(uint8_t), buffer.count, fp) == 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue