From f9843ac0f99b72bf713cc9a6b066945a3a428123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Capello?= Date: Thu, 12 Jan 2023 16:24:11 -0300 Subject: [PATCH] Remove ase_file_write_properties to be consistent with decoding --- src/app/file/ase_format.cpp | 39 +++++++++++++++---------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/src/app/file/ase_format.cpp b/src/app/file/ase_format.cpp index b19ab43c2..bd22cf759 100644 --- a/src/app/file/ase_format.cpp +++ b/src/app/file/ase_format.cpp @@ -205,8 +205,6 @@ static void ase_file_write_tileset_chunk(FILE* f, FileOp* fop, const dio::AsepriteExternalFiles& ext_files, const Tileset* tileset, const tileset_index si); -static void ase_file_write_properties(FILE* f, - const UserData::Properties& properties); static void ase_file_write_properties_maps(FILE* f, FileOp* fop, const dio::AsepriteExternalFiles& ext_files, size_t nmaps, @@ -1504,27 +1502,22 @@ static void ase_file_write_property_value(FILE* f, } break; } - case USER_DATA_PROPERTY_TYPE_PROPERTIES: - ase_file_write_properties(f, *std::get_if(&value)); + case USER_DATA_PROPERTY_TYPE_PROPERTIES: { + auto& properties = *std::get_if(&value); + ASSERT(properties.size() > 0); + + fputl(properties.size(), f); + for (auto property : properties) { + const std::string& name = property.first; + ase_file_write_string(f, name); + + const UserData::Variant& value = property.second; + fputw(value.type(), f); + + ase_file_write_property_value(f, value); + } break; - } -} - -static void ase_file_write_properties(FILE* f, - const UserData::Properties& properties) -{ - ASSERT(properties.size() > 0); - - fputl(properties.size(), f); - - for (auto property : properties) { - const std::string& name = property.first; - ase_file_write_string(f, name); - - const UserData::Variant& value = property.second; - fputw(value.type(), f); - - ase_file_write_property_value(f, value); + } } } @@ -1567,7 +1560,7 @@ static void ase_file_write_properties_maps(FILE* f, FileOp* fop, //continue; } fputl(extensionId, f); - ase_file_write_properties(f, properties); + ase_file_write_property_value(f, properties); } long endPos = ftell(f); // We can overwrite the properties maps size now