Commit 01057715 authored by Nigel Kukard's avatar Nigel Kukard

Initialize BigInt with 0 to get around the uninitialized warnings

Use of uninitialized value in new at xxx/lib/smradius/modules/accounting/mod_accounting_sql.pm line 411.
parent 93071e93
......@@ -408,9 +408,9 @@ sub getUsage
# Our usage hash
my %usageTotals;
$usageTotals{'TotalSessionTime'} = Math::BigInt->new();
$usageTotals{'TotalDataInput'} = Math::BigInt->new();
$usageTotals{'TotalDataOutput'} = Math::BigInt->new();
$usageTotals{'TotalSessionTime'} = Math::BigInt->new(0);
$usageTotals{'TotalDataInput'} = Math::BigInt->new(0);
$usageTotals{'TotalDataOutput'} = Math::BigInt->new(0);
# Pull in usage and add up
while (my $row = hashifyLCtoMC($sth->fetchrow_hashref(),
......@@ -443,9 +443,9 @@ sub getUsage
DBFreeRes($sth);
# Convert to bigfloat for accuracy
my $totalData = Math::BigFloat->new();
my $totalData = Math::BigFloat->new(0);
$totalData->badd($usageTotals{'TotalDataOutput'})->badd($usageTotals{'TotalDataInput'});
my $totalTime = Math::BigFloat->new();
my $totalTime = Math::BigFloat->new(0);
$totalTime->badd($usageTotals{'TotalSessionTime'});
# Rounding up
......@@ -515,10 +515,10 @@ sub acct_log
}
# Convert session total gigawords/octets into bytes
my $totalInputBytes = Math::BigInt->new();
my $totalInputBytes = Math::BigInt->new(0);
$totalInputBytes->badd($template->{'request'}->{'Acct-Input-Gigawords'})->bmul(UINT_MAX);
$totalInputBytes->badd($template->{'request'}->{'Acct-Input-Octets'});
my $totalOutputBytes = Math::BigInt->new();
my $totalOutputBytes = Math::BigInt->new(0);
$totalOutputBytes->badd($template->{'request'}->{'Acct-Output-Gigawords'})->bmul(UINT_MAX);
$totalOutputBytes->badd($template->{'request'}->{'Acct-Output-Octets'});
# Packets, no conversion
......@@ -534,10 +534,10 @@ sub acct_log
)) {
# Convert this session usage to bytes
my $sessionInputBytes = Math::BigInt->new();
my $sessionInputBytes = Math::BigInt->new(0);
$sessionInputBytes->badd($sessionPart->{'AcctInputGigawods'})->bmul(UINT_MAX);
$sessionInputBytes->badd($sessionPart->{'AcctInputOctets'});
my $sessionOutputBytes = Math::BigInt->new();
my $sessionOutputBytes = Math::BigInt->new(0);
$sessionOutputBytes->badd($sessionPart->{'AcctOutputGigawods'})->bmul(UINT_MAX);
$sessionOutputBytes->badd($sessionPart->{'AcctOutputOctets'});
# And packets
......@@ -815,9 +815,9 @@ sub cleanup
} else {
# Make BigInts for this user
$usageTotals{$row->{'Username'}}{'TotalSessionTime'} = Math::BigInt->new();
$usageTotals{$row->{'Username'}}{'TotalDataInput'} = Math::BigInt->new();
$usageTotals{$row->{'Username'}}{'TotalDataOutput'} = Math::BigInt->new();
$usageTotals{$row->{'Username'}}{'TotalSessionTime'} = Math::BigInt->new(0);
$usageTotals{$row->{'Username'}}{'TotalDataInput'} = Math::BigInt->new(0);
$usageTotals{$row->{'Username'}}{'TotalDataOutput'} = Math::BigInt->new(0);
# Look for session time
if (defined($row->{'AcctSessionTime'}) && $row->{'AcctSessionTime'} > 0) {
......
......@@ -383,8 +383,8 @@ sub cleanup
# Our usage hash
my %usageTotals;
$usageTotals{'TotalSessionTime'} = Math::BigInt->new();
$usageTotals{'TotalDataUsage'} = Math::BigInt->new();
$usageTotals{'TotalSessionTime'} = Math::BigInt->new(0);
$usageTotals{'TotalDataUsage'} = Math::BigInt->new(0);
# Pull in usage and add up
if (my $row = hashifyLCtoMC($sth->fetchrow_hashref(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment