From c10918dd8d06bbb7d0152330cf6240da788a45c9 Mon Sep 17 00:00:00 2001 From: Wojciech Lukowicz Date: Tue, 19 Dec 2023 13:37:31 +0000 Subject: [PATCH] change return type of EngineConfiguration.replayIndexFileCapacityToBytes() to long It's easy to overflow an int there. --- .../uk/co/real_logic/artio/engine/EngineConfiguration.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/artio-core/src/main/java/uk/co/real_logic/artio/engine/EngineConfiguration.java b/artio-core/src/main/java/uk/co/real_logic/artio/engine/EngineConfiguration.java index a4ceb77599..697f8fea39 100644 --- a/artio-core/src/main/java/uk/co/real_logic/artio/engine/EngineConfiguration.java +++ b/artio-core/src/main/java/uk/co/real_logic/artio/engine/EngineConfiguration.java @@ -490,15 +490,15 @@ public EngineConfiguration replayIndexSegmentRecordCapacity(final int indexSegme /** * Convert the number of records in a replay index file to a file size. Note: because replay index file sizes must - * be a power of two this method can return a file size greater than the requested number of methods but never less. + * be a power of two this method can return a file size greater than the requested number of records but never less. * * @param requestedNumberOfRecordsToStore the number of records to store in the replay index. * @return the replay index file size in bytes */ - public static int replayIndexFileCapacityToBytes(final int requestedNumberOfRecordsToStore) + public static long replayIndexFileCapacityToBytes(final int requestedNumberOfRecordsToStore) { return HEADER_FILE_SIZE + ReplayIndexDescriptor.RECORD_LENGTH * - findNextPositivePowerOfTwo(requestedNumberOfRecordsToStore); + (long)findNextPositivePowerOfTwo(requestedNumberOfRecordsToStore); } /**