mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
backport upstream BouncyCastle fixes
aligned with bcgit/bc-java@7b094ad188
This commit is contained in:
committed by
José Rebelo
parent
3e48a41aae
commit
fde8563b4a
@@ -19,8 +19,14 @@ public abstract class DefaultMultiBlockCipher
|
||||
// TODO check if the underlying cipher supports the multiblock interface and call it directly?
|
||||
|
||||
int resultLen = 0;
|
||||
int blockSize = this.getMultiBlockSize();
|
||||
|
||||
int blockSize = this.getBlockSize();
|
||||
int len = blockCount * blockSize;
|
||||
if (in == out)
|
||||
{
|
||||
in = new byte[len];
|
||||
System.arraycopy(out, inOff, in, 0, len);
|
||||
inOff = 0;
|
||||
}
|
||||
for (int i = 0; i != blockCount; i++)
|
||||
{
|
||||
resultLen += this.processBlock(in, inOff, out, outOff + resultLen);
|
||||
|
||||
@@ -803,9 +803,7 @@ public final class Arrays
|
||||
int newLength = to - from;
|
||||
if (newLength < 0)
|
||||
{
|
||||
StringBuffer sb = new StringBuffer(from);
|
||||
sb.append(" > ").append(to);
|
||||
throw new IllegalArgumentException(sb.toString());
|
||||
throw new IllegalArgumentException(from + " > " + to);
|
||||
}
|
||||
return newLength;
|
||||
}
|
||||
|
||||
@@ -23,16 +23,32 @@ public final class Strings {
|
||||
}
|
||||
}
|
||||
|
||||
public static String toLowerCase(String str) {
|
||||
char[] charArray = str.toCharArray();
|
||||
boolean z = false;
|
||||
for (int i = 0; i != charArray.length; i++) {
|
||||
char c = charArray[i];
|
||||
if ('A' <= c && 'Z' >= c) {
|
||||
charArray[i] = (char) ((c - 'A') + 97);
|
||||
z = true;
|
||||
/**
|
||||
* A locale independent version of toLowerCase.
|
||||
*
|
||||
* @param string input to be converted
|
||||
* @return a US ASCII lowercase version
|
||||
*/
|
||||
public static String toLowerCase(String string)
|
||||
{
|
||||
boolean changed = false;
|
||||
char[] chars = string.toCharArray();
|
||||
|
||||
for (int i = 0; i != chars.length; i++)
|
||||
{
|
||||
char ch = chars[i];
|
||||
if ('A' <= ch && 'Z' >= ch)
|
||||
{
|
||||
changed = true;
|
||||
chars[i] = (char)(ch - 'A' + 'a');
|
||||
}
|
||||
}
|
||||
return z ? new String(charArray) : str;
|
||||
|
||||
if (changed)
|
||||
{
|
||||
return new String(chars);
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user