From 8dc5316bec97fe71f141cde5f34c471eff02c689 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 4 Apr 2011 23:19:43 +0000 Subject: [PATCH] - Added a helper script to ease applying patches - Fixed naming of a variable $deg->dec - Hexadecimal strings are now prepended with a '0' if the length cannot be devided by 2 --- inc/classes/main/class_BaseFrameworkSystem.php | 14 +++++++++++--- patch_i.sh | 5 +++++ 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100755 patch_i.sh diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index c5b4ebe0..aa64808e 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -1649,6 +1649,15 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $dec /= 16; } while ($dec >= 1); + /* + * We need hexadecimal strings with leading zeros if the length cannot + * be divided by 2 + */ + if ((strlen($hex) % 2) != 0) { + // Prepend a zero + $hex = '0' . $hex; + } // END - if + // Return the hexadecimal string return $sign . $hex; } @@ -1676,9 +1685,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @param $dec Decimal number * @return $asc An ASCII string */ - public final function dec2asc ($deg) { + public final function dec2asc ($dec) { // First convert the number into a hexadecimal string - $hex = $this->dec2hex($deg); + $hex = $this->dec2hex($dec); // Then convert it into the ASCII string $asc = $this->hex2asc($hex); @@ -1703,7 +1712,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { for ($idx = 0; $idx < strlen($hex); $idx+=2) { // Get the decimal number of the chunk $part = hexdec(substr($hex, $idx, 2)); - $this->debugOutput(__FUNCTION__ . ': part(' . strlen($part) . ')=' . $part); // Add it to the final string $asc .= chr($part); diff --git a/patch_i.sh b/patch_i.sh new file mode 100755 index 00000000..725fc72a --- /dev/null +++ b/patch_i.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +patch -p0 < i || exit 10 +svn commit || exit 10 +rm i -- 2.30.2