From 7dabb672e3940f6935ac080083c4ee619041a002 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 28 Jan 2015 02:58:49 +0000 Subject: [PATCH] changed a few variable names --- codepot/src/codepot/views/code_diff.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/codepot/src/codepot/views/code_diff.php b/codepot/src/codepot/views/code_diff.php index d343ef86..237d859f 100644 --- a/codepot/src/codepot/views/code_diff.php +++ b/codepot/src/codepot/views/code_diff.php @@ -135,12 +135,14 @@ function format_diff ($a, $b, $css_class) { if ($b == '') return htmlspecialchars($a); + // TODO: word by word comparison to be less position dependent + $cc = ''; $diffstart = -1; - $aalen = strlen($a); - $bblen = strlen($b); + $alen = strlen($a); + $blen = strlen($b); - for ($i = 0; $i < $aalen && $i < $bblen; $i++) + for ($i = 0; $i < $alen && $i < $blen; $i++) { if ($a[$i] == $b[$i]) { @@ -162,14 +164,14 @@ function format_diff ($a, $b, $css_class) if ($diffstart >= 0) { $cc .= sprintf ('', $css_class); - $cc .= htmlspecialchars(substr($a, $diffstart, $aalen - $diffstart)); + $cc .= htmlspecialchars(substr($a, $diffstart, $alen - $diffstart)); $cc .= ''; } else { - if ($aalen > $bblen) + if ($alen > $blen) { - $cc .= htmlspecialchars(substr ($a, $aalen, $aalen - $bblen)); + $cc .= htmlspecialchars(substr ($a, $alen, $alen - $blen)); } }