Static cast floats in atof usages where the datatype is actually float to avoid windows compiler warnings

This commit is contained in:
Akkadius
2020-07-12 17:25:50 -05:00
parent 758a30a080
commit 6a7a78af29
26 changed files with 418 additions and 409 deletions
@@ -17,6 +17,11 @@ use DBD::mysql;
use JSON;
my $json = new JSON();
if (!$ARGV[0]) {
print "\@example perl ~/code/utils/scripts/generators/repository-generator.pl ~/server/ [table|all] [base|extended|all]\n";
exit;
}
#############################################
# args
#############################################
@@ -277,7 +282,11 @@ foreach my $table_to_generate (@tables) {
$all_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = atoi(row[%s]);\n", $column_name, $index);
$find_one_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = atoi(row[%s]);\n", $column_name, $index);
}
elsif ($data_type =~ /float|double|decimal/) {
elsif ($data_type =~ /float/) {
$all_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = static_cast<float>(atof(row[%s]));\n", $column_name, $index);
$find_one_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = static_cast<float>(atof(row[%s]));\n", $column_name, $index);
}
elsif ($data_type =~ /double|decimal/) {
$all_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = atof(row[%s]);\n", $column_name, $index);
$find_one_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = atof(row[%s]);\n", $column_name, $index);
}