summaryrefslogtreecommitdiffstats
path: root/fec_create.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2025-01-14 10:07:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2025-01-14 10:07:23 +0000
commit6dfefd5ef7a4101ac9baa6add4ef6d3b3f7a22ec (patch)
tree74a10d66b5b6db789df8ff720f7bb4e425d29194 /fec_create.cc
parentAdding upstream version 1.25~rc1. (diff)
downloadlziprecover-6dfefd5ef7a4101ac9baa6add4ef6d3b3f7a22ec.tar.xz
lziprecover-6dfefd5ef7a4101ac9baa6add4ef6d3b3f7a22ec.zip
Adding upstream version 1.25.upstream/1.25upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--fec_create.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/fec_create.cc b/fec_create.cc
index 90b79e1..14033f9 100644
--- a/fec_create.cc
+++ b/fec_create.cc
@@ -1,5 +1,5 @@
/* Lziprecover - Data recovery tool for the lzip format
- Copyright (C) 2023-2024 Antonio Diaz Diaz.
+ Copyright (C) 2023-2025 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -279,11 +279,10 @@ unsigned compute_fec_blocks( const unsigned long prodata_size,
}
-// return random number between 0 and 32767
unsigned my_rand( unsigned long & state )
{
state = state * 1103515245 + 12345;
- return ( state / 65536 ) % 32768;
+ return ( state / 65536 ) % 32768; // random number from 0 to 32767
}
void random_fbn_vector( const unsigned fec_blocks, const bool gf16,
@@ -297,7 +296,7 @@ void random_fbn_vector( const unsigned fec_blocks, const bool gf16,
for( unsigned i = 0; i < fec_blocks; ++i )
{
again: const unsigned fbn =
- gf16 ? my_rand( state ) : my_rand( state ) % 128;
+ gf16 ? my_rand( state ) % max_k16 : my_rand( state ) % max_k8;
for( unsigned j = 0; j < fbn_vector.size(); ++j )
if( fbn == fbn_vector[j] ) goto again;
fbn_vector.push_back( fbn );
@@ -387,8 +386,8 @@ bool write_fec( const char * const input_filename,
return true;
}
fail:
- show_file_error( printable_name( output_filename, false ), write_error_msg,
- errno ); return false;
+ show_file_error( printable_name( output_filename, false ), wr_err_msg, errno );
+ return false;
}