Skip to content

Commit

Permalink
kram - turn off libCompression
Browse files Browse the repository at this point in the history
It's failing on too many files and archives.
  • Loading branch information
alecazam committed Jun 5, 2024
1 parent 30e7e18 commit 47e9132
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
28 changes: 28 additions & 0 deletions kramv/KramViewerBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2095,6 +2095,34 @@ void Data::setLoadedText(string& text)
}
}

void Data::setFailedText(const string& filename, string& text)
{
text = "Failed ";

// This doesn't advance with failure
//string filename = _showSettings->lastFilename;

text += toFilenameShort(filename.c_str());

// archives and file systems have folders, split that off
string folderName;
const char* slashPos = strrchr(filename.c_str(), '/');
if (slashPos != nullptr) {
folderName = filename.substr(0, slashPos - filename.c_str());
}

if (!folderName.empty()) {
text += " in folder ";
text += folderName;
}

if (!_archiveName.empty()) {
text += " from archive ";
text += _archiveName;
}

}

void Data::initActions()
{
// Don't reorder without also matching actionPtrs below
Expand Down
3 changes: 2 additions & 1 deletion kramv/KramViewerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,8 @@ struct Data {
const Action* actionFromKey(uint32_t keyCodes) const;

void setLoadedText(string& text);

void setFailedText(const string& filename, string& text);

void initActions();
vector<Action>& actions() { return _actions; }
void initDisabledButtons();
Expand Down
4 changes: 2 additions & 2 deletions kramv/KramViewerMain.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1579,8 +1579,8 @@ -(BOOL)loadFile
setErrorLogCapture(false);

string finalErrorText;
append_sprintf(finalErrorText, "Could not load from file:\n %s\n",
filename);
// this does have previous filename set
_data.setFailedText(file.name.c_str(), finalErrorText);
finalErrorText += errorText;

[self setHudText:finalErrorText.c_str()];
Expand Down
2 changes: 1 addition & 1 deletion libkram/kram/KTXImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "zstd.h"

#ifndef USE_LIBCOMPRESSION
#define USE_LIBCOMPRESSION (KRAM_MAC || KRAM_IOS)
#define USE_LIBCOMPRESSION 0 // (KRAM_MAC || KRAM_IOS)
#endif

#if USE_LIBCOMPRESSION
Expand Down
3 changes: 2 additions & 1 deletion libkram/kram/KramZipHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
// test for perf of this compared to one in miniz also see
// comments about faster algs.
// libcompress can only encode lvl 5, but here it's only decompress.
// This is failing on various ktx2 files in the mac archive
#ifndef USE_LIBCOMPRESSION
#define USE_LIBCOMPRESSION (KRAM_MAC || KRAM_IOS)
#define USE_LIBCOMPRESSION 0 // (KRAM_MAC || KRAM_IOS)
#endif

#if USE_LIBCOMPRESSION
Expand Down

0 comments on commit 47e9132

Please sign in to comment.