Changeset 615 for branches/1.3


Ignore:
Timestamp:
2009-07-05T08:22:22+02:00 (5 years ago)
Author:
moo
Message:

merged r461,r462,r463,r464 from trunk

Location:
branches/1.3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3

  • branches/1.3/coverager.c

    r593 r615  
    521521 
    522522    for (; len >= sizeof(long) * 2; len -= sizeof(long) * 2, p += 2) { 
    523         add_index_long(return_value, p[0], p[1]); 
     523        add_index_long(return_value, p[0], p[1] < 0 ? 0 : p[1]); 
    524524    } 
    525525} 
  • branches/1.3/coverager/coverager.css

    r614 r615  
    11h1 { text-align: center; display: block; } 
    22input, table { font-family: sans-serif; font-size: 11px; } 
     3th { font-size: 12px; } 
    34table { border-collapse: collapse; } 
    45table.cycles { border: 1px solid black; margin-top: 5px; margin-bottom: 5px; } 
  • branches/1.3/coverager/coverager.php

    r614 r615  
    108108                ob_start(); 
    109109                highlight_string($source); 
    110                 $lines = explode('<br />', str_replace("\n", "", ob_get_clean())); 
     110                $lines = str_replace("\n", "", ob_get_clean()); 
     111                $lines = str_replace('<code>', '', $lines); 
     112                $lines = str_replace('</code>', '', $lines); 
     113                $lines = preg_replace('(^<span[^>]*>|</span>$)', '', $lines); 
     114                $lines = explode('<br />', $lines); 
    111115                $last = array_pop($lines); 
    112116                $filecov = sprint_cov($fileinfo['cov'], $lines, false); 
     
    295299function sprint_cov($cov, $lines, $encode = true) 
    296300{ 
     301    $lastattr = null; 
    297302    foreach ($lines as $l => $line) { 
    298303        $offs = $l + 1; 
    299304        if ($encode) { 
    300305            $line = str_replace("\n", "", htmlspecialchars($line)); 
     306        } 
     307        else if ($line !== "") { 
     308            if (substr($line, 0, 7) == '</span>') { 
     309                $lastattr = null; 
     310                $line = substr($line, 7); 
     311            } 
     312            else if (isset($lastattr)) { 
     313                $line = $lastattr . $line; 
     314            } 
     315 
     316            if (preg_match('!(<span[^>]+>|</span>)[^<>]*$!', $line, $m)) { 
     317                if ($m[1] == '</span>') { 
     318                    $lastattr = null; 
     319                } 
     320                else { 
     321                    $line .= '</span>'; 
     322                    $lastattr = $m[1]; 
     323                } 
     324            } 
    301325        } 
    302326        if (isset($cov[$offs])) { 
     
    312336    return implode('', $lines); 
    313337} 
     338 
    314339if (!function_exists('xcache_coverager_decode')) { 
    315340    function xcache_coverager_decode($bytes) 
Note: See TracChangeset for help on using the changeset viewer.