summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-08-18 16:51:59 +0200
committerMorris Jobke <hey@morrisjobke.de>2020-08-18 16:51:59 +0200
commit27e7332a9c6dca6c5602b025b0880ce46b796ca4 (patch)
treeacdee2ff600074a154de43546b9dd51c4ead7977
parent92b67409fa3e9ac25da7439731b5df783f50b299 (diff)
downloadnextcloud-server-27e7332a9c6dca6c5602b025b0880ce46b796ca4.tar.gz
nextcloud-server-27e7332a9c6dca6c5602b025b0880ce46b796ca4.zip
Cast float/char to int to avoid invalid scalar argument warning
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
-rw-r--r--build/psalm-baseline.xml4
-rw-r--r--lib/private/legacy/OC_Image.php4
2 files changed, 3 insertions, 5 deletions
diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml
index 5a2d3ab43bf..2e040c3e5ea 100644
--- a/build/psalm-baseline.xml
+++ b/build/psalm-baseline.xml
@@ -6045,9 +6045,7 @@
<InvalidReturnType occurrences="1">
<code>bool</code>
</InvalidReturnType>
- <InvalidScalarArgument occurrences="19">
- <code>$bits</code>
- <code>$lastIndex</code>
+ <InvalidScalarArgument occurrences="17">
<code>$this-&gt;bitDepth</code>
<code>90</code>
<code>$imagePath</code>
diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php
index 4fdbfb3909f..1e2791f62c9 100644
--- a/lib/private/legacy/OC_Image.php
+++ b/lib/private/legacy/OC_Image.php
@@ -1175,7 +1175,7 @@ if (!function_exists('imagebmp')) {
} elseif ($bit == 32) {
$bit = 24;
}
- $bits = pow(2, $bit);
+ $bits = (int)pow(2, $bit);
imagetruecolortopalette($im, true, $bits);
$width = imagesx($im);
$height = imagesy($im);
@@ -1211,7 +1211,7 @@ if (!function_exists('imagebmp')) {
} // RLE8
elseif ($compression == 1 && $bit == 8) {
for ($j = $height - 1; $j >= 0; $j--) {
- $lastIndex = "\0";
+ $lastIndex = 0;
$sameNum = 0;
for ($i = 0; $i <= $width; $i++) {
$index = imagecolorat($im, $i, $j);