Changeset View
Changeset View
Standalone View
Standalone View
src/difference/ArcanistDiffUtils.php
Context not available. | |||||
// presence of NULL ("\0") bytes. Git only examines the first "few" bytes of | // presence of NULL ("\0") bytes. Git only examines the first "few" bytes of | ||||
// each file (8KB or so) as an optimization, but we don't have a reasonable | // each file (8KB or so) as an optimization, but we don't have a reasonable | ||||
// equivalent in PHP, so just look at all of it. | // equivalent in PHP, so just look at all of it. | ||||
return (strpos($data, "\0") !== false); | return (@strpos($data, "\0") !== false); | ||||
} | } | ||||
public static function renderDifferences( | public static function renderDifferences( | ||||
Context not available. | |||||
} | } | ||||
public static function generateIntralineDiff($o, $n) { | public static function generateIntralineDiff($o, $n) { | ||||
$ol = strlen($o); | $ol = @strlen($o); | ||||
$nl = strlen($n); | $nl = @strlen($n); | ||||
if (($o === $n) || !$ol || !$nl) { | if (($o === $n) || !$ol || !$nl) { | ||||
return array( | return array( | ||||
Context not available. | |||||
// lines. Inputs take ~200x more memory to represent as lists than as | // lines. Inputs take ~200x more memory to represent as lists than as | ||||
// strings, so we can run out of memory quickly if we try to split huge | // strings, so we can run out of memory quickly if we try to split huge | ||||
// inputs. See T11744. | // inputs. See T11744. | ||||
$ol = strlen($o); | $ol = @strlen($o); | ||||
$nl = strlen($n); | $nl = @strlen($n); | ||||
$max_glyphs = 100; | $max_glyphs = 100; | ||||
Context not available. | |||||
} | } | ||||
private static function computeIntralineEdits($o, $n, $max_glyphs) { | private static function computeIntralineEdits($o, $n, $max_glyphs) { | ||||
if (preg_match('/[\x80-\xFF]/', $o.$n)) { | if (@preg_match('/[\x80-\xFF]/', $o.$n)) { | ||||
$ov = phutil_utf8v_combined($o); | $ov = phutil_utf8v_combined($o); | ||||
$nv = phutil_utf8v_combined($n); | $nv = phutil_utf8v_combined($n); | ||||
$multibyte = true; | $multibyte = true; | ||||
Context not available. | |||||
$o_pos = 0; | $o_pos = 0; | ||||
$n_pos = 0; | $n_pos = 0; | ||||
$result_len = strlen($result); | $result_len = @strlen($result); | ||||
$o_run = array(); | $o_run = array(); | ||||
$n_run = array(); | $n_run = array(); | ||||
Context not available. | |||||
$c = $result[$ii]; | $c = $result[$ii]; | ||||
if ($multibyte) { | if ($multibyte) { | ||||
$old_char_len = strlen($ov[$o_pos]); | $old_char_len = @strlen($ov[$o_pos]); | ||||
$new_char_len = strlen($nv[$n_pos]); | $new_char_len = @strlen($nv[$n_pos]); | ||||
} | } | ||||
switch ($c) { | switch ($c) { | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0