X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=nucleus%2Flibrary%2Ffilesystem%2Fheavy_file_ops.cpp;h=6c4765e9243fb83c88773f1e8cdd8c50ee8ba6dd;hb=51d71c226be424b6a698c7474d237e8c69661af5;hp=3ddd76648930cee349a1d8f2b6dd467bd19ca7af;hpb=cdf68a53cff76449796a3aa0222e2d0afff97c7c;p=feisty_meow.git diff --git a/nucleus/library/filesystem/heavy_file_ops.cpp b/nucleus/library/filesystem/heavy_file_ops.cpp index 3ddd7664..6c4765e9 100644 --- a/nucleus/library/filesystem/heavy_file_ops.cpp +++ b/nucleus/library/filesystem/heavy_file_ops.cpp @@ -40,6 +40,11 @@ namespace filesystem { ////////////// +// the smallest we let the packing area's available space get before we stop filling it. +const int MINIMUM_ARRAY_SIZE = 1024; + +////////////// + file_transfer_header::file_transfer_header(const file_time &time_stamp) : _filename(), _byte_start(0), @@ -167,9 +172,7 @@ outcome heavy_file_operations::write_file_chunk(const astring &target, double byte_start, const byte_array &chunk, bool truncate, int copy_chunk_factor) { -#ifdef DEBUG_HEAVY_FILE_OPS -// FUNCDEF("write_file_chunk"); -#endif + FUNCDEF("write_file_chunk"); if (byte_start < 0) return BAD_INPUT; filename targ_name(target); @@ -247,7 +250,7 @@ outcome heavy_file_operations::buffer_files(const astring &source_root, while (storage.length() < maximum_bytes) { double remaining_in_array = maximum_bytes - storage.length() - last_action.packed_size(); - if (remaining_in_array < 128) { + if (remaining_in_array < MINIMUM_ARRAY_SIZE) { // ensure that we at least have a reasonable amount of space left // for storing into the array. break; @@ -273,15 +276,15 @@ outcome heavy_file_operations::buffer_files(const astring &source_root, huge_file current(full_file, "rb"); if (!current.good()) { // we need to skip this file. -LOG(astring("skipping bad file: ") + full_file); + LOG(astring("skipping bad file: ") + full_file); to_return = advance(to_transfer, last_action); if (to_return != OKAY) break; continue; } if (last_action._byte_start + last_action._length >= current.length()) { -LOG(astring("finished stuffing file: ") + full_file); // this file is done now. go to the next one. + LOG(astring("finished stuffing file: ") + full_file); to_return = advance(to_transfer, last_action); if (to_return != OKAY) break; continue;