Fix increment order

This commit is contained in:
Dennis Eichhorn 2018-12-10 18:18:34 +01:00
parent 13c5562ffe
commit 2f32c9e22b
5 changed files with 9 additions and 9 deletions

View File

@ -301,7 +301,7 @@ abstract class C128Abstract
$length = \strlen($this->content);
$checksum = static::$CHECKSUM;
for ($pos = 1; $pos <= $length; $pos++) {
for ($pos = 1; $pos <= $length; ++$pos) {
$activeKey = \substr($this->content, ($pos - 1), 1);
$codeString .= static::$CODEARRAY[$activeKey];
$checksum += $values[$activeKey] * $pos;
@ -336,7 +336,7 @@ abstract class C128Abstract
$length = \strlen($codeString);
\imagefill($image, 0, 0, $white);
for ($position = 1; $position <= $length; $position++) {
for ($position = 1; $position <= $length; ++$position) {
$cur_size = $location + (int) (\substr($codeString, ($position - 1), 1));
if ($this->orientation === OrientationType::HORIZONTAL) {

View File

@ -113,8 +113,8 @@ class C25 extends C128Abstract
$arrayLength = \count(self::$CODEARRAY);
$temp = [];
for ($posX = 1; $posX <= $length; $posX++) {
for ($posY = 0; $posY < $arrayLength; $posY++) {
for ($posX = 1; $posX <= $length; ++$posX) {
for ($posY = 0; $posY < $arrayLength; ++$posY) {
if (\substr($this->content, ($posX - 1), 1) == self::$CODEARRAY[$posY]) {
$temp[$posX] = self::$CODEARRAY2[$posY];
}
@ -127,7 +127,7 @@ class C25 extends C128Abstract
$temp2 = \explode('-', $temp[($posX + 1)]);
$count = \count($temp1);
for ($posY = 0; $posY < $count; $posY++) {
for ($posY = 0; $posY < $count; ++$posY) {
$codeString .= $temp1[$posY] . $temp2[$posY];
}
}

View File

@ -87,7 +87,7 @@ class C39 extends C128Abstract
$codeString = '';
$length = \strlen($this->content);
for ($X = 1; $X <= $length; $X++) {
for ($X = 1; $X <= $length; ++$X) {
$codeString .= self::$CODEARRAY[substr($this->content, ($X - 1), 1)] . '1';
}

View File

@ -89,8 +89,8 @@ class Codebar extends C128Abstract
$length = \strlen($this->content);
$lenCodearr = \count(self::$CODEARRAY);
for ($posX = 1; $posX <= $length; $posX++) {
for ($posY = 0; $posY < $lenCodearr; $posY++) {
for ($posX = 1; $posX <= $length; ++$posX) {
for ($posY = 0; $posY < $lenCodearr; ++$posY) {
if (\substr($this->content, ($posX - 1), 1) == self::$CODEARRAY[$posY]) {
$codeString .= self::$CODEARRAY2[$posY] . '1';
}

View File

@ -56,7 +56,7 @@ final class XorEncoding
$length = \strlen($source);
$keyLength = \strlen($key) - 1;
for ($i = 0, $j = 0; $i < $length; ++$i, $j++) {
for ($i = 0, $j = 0; $i < $length; ++$i, ++$j) {
if ($j > $keyLength) {
$j = 0;
}