PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LTP GCOV extension - code coverage report
Current view: directory - var/php_gcov/PHP_5_3/lcov_data/ext/phar - phar_path_check.re
Test: PHP Code Coverage
Date: 2009-11-21 Instrumented lines: 35
Code covered: 62.9 % Executed lines: 22
Legend: not executed executed

       1                 : /*
       2                 :   +----------------------------------------------------------------------+
       3                 :   | phar php single-file executable PHP extension                        |
       4                 :   +----------------------------------------------------------------------+
       5                 :   | Copyright (c) 2007-2009 The PHP Group                                |
       6                 :   +----------------------------------------------------------------------+
       7                 :   | This source file is subject to version 3.01 of the PHP license,      |
       8                 :   | that is bundled with this package in the file LICENSE, and is        |
       9                 :   | available through the world-wide-web at the following url:           |
      10                 :   | http://www.php.net/license/3_01.txt.                                 |
      11                 :   | If you did not receive a copy of the PHP license and are unable to   |
      12                 :   | obtain it through the world-wide-web, please send a note to          |
      13                 :   | license@php.net so we can mail you a copy immediately.               |
      14                 :   +----------------------------------------------------------------------+
      15                 :   | Authors: Marcus Boerger <helly@php.net>                              |
      16                 :   +----------------------------------------------------------------------+
      17                 : */
      18                 : 
      19                 : /* $Id: phar_path_check.re 272369 2008-12-31 11:13:54Z sebastian $ */
      20                 : 
      21                 : #include "phar_internal.h"
      22                 : 
      23                 : phar_path_check_result phar_path_check(char **s, int *len, const char **error)
      24           12390 : {
      25           12390 :         const unsigned char *p = (const unsigned char*)*s;
      26                 :         const unsigned char *m;
      27                 : 
      28           12390 :         if (*len == 1 && *p == '.') {
      29               0 :                 *error = "current directory reference";
      30               0 :                 return pcr_err_curr_dir;
      31           12390 :         } else if (*len == 2 && p[0] == '.' && p[1] == '.') {
      32               0 :                 *error = "upper directory reference";
      33               0 :                 return pcr_err_up_dir;
      34                 :         }
      35                 : 
      36                 : #define YYCTYPE         unsigned char
      37                 : #define YYCURSOR        p
      38                 : #define YYLIMIT         p+*len
      39                 : #define YYMARKER        m
      40                 : #define YYFILL(n)
      41                 : 
      42          247876 : loop:
      43                 : /*!re2c
      44                 : END = "\x00";
      45                 : ILL = [\x01-\x19\x80-\xFF];
      46                 : EOS = "/" | END;
      47                 : ANY = .;
      48                 : "//"  {
      49               2 :                         *error = "double slash";
      50               2 :                         return pcr_err_double_slash;
      51                 :                 }
      52                 : "/.." EOS {
      53               5 :                         *error = "upper directory reference";
      54               5 :                         return pcr_err_up_dir;
      55                 :                 }
      56                 : "/." EOS {
      57               0 :                         *error = "current directory reference";
      58               0 :                         return pcr_err_curr_dir;
      59                 :                 }
      60                 : "\\" {
      61               0 :                         *error = "back-slash";
      62               0 :                         return pcr_err_back_slash;
      63                 :                 }
      64                 : "*" {
      65               0 :                         *error = "star";
      66               0 :                         return pcr_err_star;
      67                 :                 }
      68                 : "?"   {
      69               4 :                         if (**s == '/') {
      70               0 :                                 (*s)++;
      71                 :                         }
      72               4 :                         *len = (p - (const unsigned char*)*s) -1;
      73               4 :                         *error = NULL;
      74               4 :                         return pcr_use_query;
      75                 :                 }
      76                 : ILL {
      77               0 :                         *error ="illegal character";
      78               0 :                         return pcr_err_illegal_char;
      79                 :                 }
      80                 : END {
      81           12379 :                         if (**s == '/') {
      82            4585 :                                 (*s)++;
      83            4585 :                                 (*len)--;
      84                 :                         }
      85           12379 :                         if ((p - (const unsigned char*)*s) - 1 != *len)
      86                 :                         {
      87               2 :                                 *error ="illegal character";
      88               2 :                                 return pcr_err_illegal_char;
      89                 :                         }
      90           12377 :                         *error = NULL;
      91           12377 :                         return pcr_is_ok;
      92                 :                 }
      93                 : ANY {
      94          235486 :                         goto loop;
      95                 :                 }
      96                 : */
      97                 : }

Generated by: LTP GCOV extension version 1.5

Generated at Sat, 21 Nov 2009 12:27:15 +0000 (3 days ago)

Copyright © 2005-2009 The PHP Group
All rights reserved.