Naming inconsistencies.

This commit is contained in:
2022-09-09 19:40:22 +10:00
parent fa7025f774
commit ff466c154d
3 changed files with 9 additions and 10 deletions

View File

@@ -14,7 +14,7 @@ int main(void) {
errno_t ret = 0; errno_t ret = 0;
// Read in the esp file // Read in the esp file
struct sized_buf esp_buf = { 0 }; SizedBuf esp_buf = { 0 };
{ {
FILE *fp; FILE *fp;
ret = fopen_s(&fp, "Skyrim.esm", "rb"); ret = fopen_s(&fp, "Skyrim.esm", "rb");
@@ -38,10 +38,10 @@ int main(void) {
} }
// Calculate esp stats // Calculate esp stats
struct esp_stats stats = espr_stats(esp_buf); ESPStats stats = espr_stats(esp_buf);
// Decompress the esp file // Decompress the esp file
struct sized_buf decom_buf = { 0 }; SizedBuf decom_buf = { 0 };
{ {
decom_buf.size = stats.decompressed_size; decom_buf.size = stats.decompressed_size;
decom_buf.data = malloc(decom_buf.size); decom_buf.data = malloc(decom_buf.size);
@@ -54,7 +54,7 @@ int main(void) {
} }
// Construct the meta tree // Construct the meta tree
struct sized_buf tree_buf = { 0 }; SizedBuf tree_buf = { 0 };
MetaTree tree = { 0 }; MetaTree tree = { 0 };
{ {
tree_buf.size = espr_tree_size(stats); tree_buf.size = espr_tree_size(stats);
@@ -67,7 +67,7 @@ int main(void) {
} }
// Serialize and write out the uncompressed esp // Serialize and write out the uncompressed esp
struct sized_buf serialized_buf = { 0 }; SizedBuf serialized_buf = { 0 };
{ {
serialized_buf.size = tree.size; serialized_buf.size = tree.size;
serialized_buf.data = malloc(serialized_buf.size); serialized_buf.data = malloc(serialized_buf.size);

View File

@@ -2,7 +2,6 @@
#undef NDBEUG #undef NDBEUG
#include <assert.h> #include <assert.h>
#define NDEBUG
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>

View File

@@ -357,21 +357,21 @@ extern "C" {
* the size of the esp/esm if all of the compressed records were * the size of the esp/esm if all of the compressed records were
* decompressed. * decompressed.
*/ */
struct esp_stats espr_stats(SizedBuf esp); ESPStats espr_stats(SizedBuf esp);
// Calculates the number of formid's in an esm/esp from the stats // Calculates the number of formid's in an esm/esp from the stats
inline uint32_t espr_formid_count(struct esp_stats stats) { inline uint32_t espr_formid_count(ESPStats stats) {
return stats.record_count; return stats.record_count;
} }
// Calculates the number of nodes in the esp/esm from the stats // Calculates the number of nodes in the esp/esm from the stats
inline uint32_t espr_node_count(struct esp_stats stats) { inline uint32_t espr_node_count(ESPStats stats) {
return stats.record_count + stats.group_count; return stats.record_count + stats.group_count;
} }
// Calculates the size of a MetaNode tree constructed over the esp/esm // Calculates the size of a MetaNode tree constructed over the esp/esm
// for which the stats were generated. // for which the stats were generated.
inline size_t espr_tree_size(struct esp_stats stats) { inline size_t espr_tree_size(ESPStats stats) {
return sizeof(MetaNode) * ((size_t)espr_node_count(stats) + 1); return sizeof(MetaNode) * ((size_t)espr_node_count(stats) + 1);
} }