update deps and dont try to load files >50mib as images
This commit is contained in:
2
external/solanaceae_message3
vendored
2
external/solanaceae_message3
vendored
Submodule external/solanaceae_message3 updated: d2d6cfbf53...53d65a0685
2
external/solanaceae_tox
vendored
2
external/solanaceae_tox
vendored
Submodule external/solanaceae_tox updated: 70a234cdae...dd596bdad8
2
external/solanaceae_toxcore
vendored
2
external/solanaceae_toxcore
vendored
Submodule external/solanaceae_toxcore updated: b49db892f6...dfa5a501ec
@ -76,6 +76,8 @@ Screen* MainScreen::poll(bool& quit) {
|
|||||||
|
|
||||||
quit = !tc.iterate();
|
quit = !tc.iterate();
|
||||||
|
|
||||||
|
tcm.iterate(time_delta);
|
||||||
|
|
||||||
pm.tick(time_delta);
|
pm.tick(time_delta);
|
||||||
|
|
||||||
mts.iterate();
|
mts.iterate();
|
||||||
|
@ -25,6 +25,15 @@ void MediaMetaInfoLoader::handleMessage(const Message3Handle& m) {
|
|||||||
|
|
||||||
std::ifstream file(fil.file_list.front(), std::ios::binary);
|
std::ifstream file(fil.file_list.front(), std::ios::binary);
|
||||||
if (file.is_open()) {
|
if (file.is_open()) {
|
||||||
|
// figure out size
|
||||||
|
file.seekg(0, file.end);
|
||||||
|
if (file.tellg() > 50*1024*1024) {
|
||||||
|
// TODO: conf
|
||||||
|
// dont try load files larger 50mb
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
file.seekg(0, file.beg);
|
||||||
|
|
||||||
std::vector<uint8_t> tmp_buffer;
|
std::vector<uint8_t> tmp_buffer;
|
||||||
while (file.good()) {
|
while (file.good()) {
|
||||||
auto ch = file.get();
|
auto ch = file.get();
|
||||||
@ -38,6 +47,7 @@ void MediaMetaInfoLoader::handleMessage(const Message3Handle& m) {
|
|||||||
bool could_load {false};
|
bool could_load {false};
|
||||||
// try all loaders after another
|
// try all loaders after another
|
||||||
for (auto& il : _image_loaders) {
|
for (auto& il : _image_loaders) {
|
||||||
|
// TODO: impl callback based load
|
||||||
auto res = il->loadInfoFromMemory(tmp_buffer.data(), tmp_buffer.size());
|
auto res = il->loadInfoFromMemory(tmp_buffer.data(), tmp_buffer.size());
|
||||||
if (res.height == 0 || res.width == 0) {
|
if (res.height == 0 || res.width == 0) {
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user