LP1923076: Add cast to int in more places
authorJason Stephenson <jason@sigio.com>
Fri, 9 Apr 2021 17:41:40 +0000 (13:41 -0400)
committerMike Rylander <mrylander@gmail.com>
Fri, 13 Aug 2021 22:39:20 +0000 (18:39 -0400)
Add cast to int of scalar used on arrays in more places where it seems
necessary.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Container.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Z3950.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/storage.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/container.pm

index 46b9888..28c269d 100644 (file)
@@ -1191,7 +1191,7 @@ sub batch_edit {
     $fieldset = $e->create_action_fieldset($fieldset);
 
     my @keys = keys %$edits;
-    $max = scalar(@keys);
+    $max = int(scalar(@keys));
     $count = 0;
     $client->respond({ ord => $stage, count=> $count, max => $max, stage => 'FIELDSET_EDITS_CREATE' });
     for my $key (@keys) {
index d0b5136..1a8667a 100644 (file)
@@ -3994,7 +3994,7 @@ sub clear_shelf_process {
         }
 
         push(@holds, $hold);
-        $client->respond({maximum => scalar(@holds), progress => $counter}) if ( (++$counter % $chunk_size) == 0);
+        $client->respond({maximum => int(scalar(@holds)), progress => $counter}) if ( (++$counter % $chunk_size) == 0);
     }
 
     if ($e->commit) {
index 9fe2500..ab372c8 100644 (file)
@@ -1147,7 +1147,7 @@ sub staged_search {
         return {count => 0} unless (
             $search_hash and 
             $search_hash->{searches} and 
-            scalar( keys %{$search_hash->{searches}} ));
+            int(scalar( keys %{$search_hash->{searches}} )));
     }
 
     my $search_duration;
@@ -2410,7 +2410,7 @@ sub biblio_search_isbn_batch {
             }
         }
     }
-    return { ids => \@recs, count => scalar(@recs) };
+    return { ids => \@recs, count => int(scalar(@recs)) };
 }
 
 foreach my $issn_method (qw/
index cff8c6f..743abcd 100644 (file)
@@ -743,7 +743,7 @@ sub send_and_queue_bucket_searches {
     # parallel, so we need to cacluate summary values up front.
     my %bre_uniq;
     $bre_uniq{$_->{bre_id}} = 1 for @$z_searches;
-    $response->{bre_count} = scalar(keys %bre_uniq);
+    $response->{bre_count} = int(scalar(keys %bre_uniq));
     $response->{search_count} += scalar(@$z_searches);
 
     # let the caller know searches are on their way out
index 157aa7c..01f17e2 100644 (file)
             $dbh->pg_putline($line."\n");
         }
 
-        return scalar(@fm_nodes);
+        return int(scalar(@fm_nodes));
     }
 
     sub copy_create_finish {
         copy_create_push(   $self => $client => @fm_nodes );
         copy_create_finish( $self => $client );
 
-        return scalar(@fm_nodes);
+        return int(scalar(@fm_nodes));
     }
 
     sub autoprimary {
index b921e6c..e8b8efb 100644 (file)
@@ -2473,7 +2473,7 @@ SELECT  h.id, h.request_time, h.capture_time, h.fulfillment_time, h.checkin_time
     $sth->execute();
 
     my @list = $sth->fetchall_hash;
-    $client->respond(scalar(@list)); # send the row count first, for progress tracking
+    $client->respond(int(scalar(@list))); # send the row count first, for progress tracking
     $client->respond( $_ ) for (@list);
 
     $client->respond_complete;
index 93ce1f7..0907d49 100644 (file)
@@ -169,7 +169,7 @@ sub refresh_container_from_carousel_definition {
     foreach my $bib (@bibs) {
         container::biblio_record_entry_bucket_item->create({ bucket => $bucket, target_biblio_record_entry => $bib, pos => $i++ });
     }
-    return scalar(@bibs);
+    return int(scalar(@bibs));
 }
 
 __PACKAGE__->register_method(