Fix create torrent out-of-range piece size (#4145)

This commit is contained in:
A Cœur 2022-11-14 03:53:25 +08:00 committed by GitHub
parent ff2e544a6b
commit b322971f6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -270,7 +270,7 @@ Gw
</textField>
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bbO-nc-7cI">
<rect key="frame" x="672" y="81" width="19" height="28"/>
<stepperCell key="cell" alignment="left" minValue="1" maxValue="1000" doubleValue="1" autorepeat="NO" id="53C-Ri-3gc"/>
<stepperCell key="cell" alignment="left" minValue="14" maxValue="31" doubleValue="14" autorepeat="NO" id="53C-Ri-3gc"/>
<connections>
<action selector="incrementOrDecrementPieceSize:" target="-2" id="YDm-9R-hMY"/>
</connections>

View File

@ -360,7 +360,7 @@ NSMutableSet* creatorWindowControllerSet = nil;
- (IBAction)incrementOrDecrementPieceSize:(id)sender
{
auto const piece_size = static_cast<uint32_t>(pow(2.0, [sender intValue]));
uint32_t const piece_size = 1U << [(NSStepper*)sender intValue];
if (self.fBuilder->setPieceSize(piece_size))
{