diff --git a/KodoTest/KodoTest.sdf b/KodoTest/KodoTest.sdf index 70a00d747b5d587a70471d80222107b7322003c4..5561900dc5016e270484a7212be9e27cd34db895 100644 Binary files a/KodoTest/KodoTest.sdf and b/KodoTest/KodoTest.sdf differ diff --git a/KodoTest/KodoTest.v12.suo b/KodoTest/KodoTest.v12.suo index 04293f6e266bbf2f4d01717c3f97f9789007f1a0..8b4ea13630ed9a2f426446ce7ae14cb99b840f92 100644 Binary files a/KodoTest/KodoTest.v12.suo and b/KodoTest/KodoTest.v12.suo differ diff --git a/KodoTest/KodoTest/KodoTest.vcxproj.user b/KodoTest/KodoTest/KodoTest.vcxproj.user new file mode 100644 index 0000000000000000000000000000000000000000..ef5ff2a1fae669e995b58fb11281de92ca5fab27 --- /dev/null +++ b/KodoTest/KodoTest/KodoTest.vcxproj.user @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup /> +</Project> \ No newline at end of file diff --git a/KodoTest/KodoTest/Source.cpp b/KodoTest/KodoTest/Source.cpp index c9f39f061ebcb75624958cfd2d2d25f38b8fcf1d..e30f77fca3753b0aa87420de9562013f86ddf4d1 100644 --- a/KodoTest/KodoTest/Source.cpp +++ b/KodoTest/KodoTest/Source.cpp @@ -50,9 +50,6 @@ std::ifstream::pos_type filesize(std::string filename) int main() { - uint32_t max_symbols = 10; - uint32_t max_symbol_size = 5000; - std::string encode_filename; std::cout << "File to encode:" << std::endl; @@ -60,6 +57,9 @@ int main() uint32_t file_size = filesize(encode_filename); + uint32_t max_symbols = 10; + uint32_t max_symbol_size = file_size / 10 + 1; + using file_encoder = kodo::object::file_encoder< kodo::shallow_full_rlnc_encoder<fifi::binary >> ; @@ -90,6 +90,18 @@ int main() } + + + + + + + + + + + + std::string decode_filename = "decoded_" + encode_filename; using file_decoder = kodo::object::file_decoder< @@ -117,16 +129,21 @@ int main() std::ifstream fragFile( fileName, std::ios::in | std::ios::binary); - std::copy(std::istreambuf_iterator<char>(fragFile), - std::istreambuf_iterator<char>(), - std::back_inserter(payload)); - fragFile.close(); - - payload.shrink_to_fit(); - d->decode(payload.data()); + if (fragFile) + { + std::copy(std::istreambuf_iterator<char>(fragFile), + std::istreambuf_iterator<char>(), + std::back_inserter(payload)); + fragFile.close(); + //remove(fileName.c_str()); + payload.shrink_to_fit(); + + d->decode(payload.data()); + + payload.clear(); + } fragNum++; - payload.clear(); } }