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

LCOV - code coverage report
Current view: top level - lcov_data/ext/phar - phar_path_check.re (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 23 34 67.6 %
Date: 2014-10-24 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :   +----------------------------------------------------------------------+
       3             :   | phar php single-file executable PHP extension                        |
       4             :   +----------------------------------------------------------------------+
       5             :   | Copyright (c) 2007-2014 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$ */
      20             : 
      21             : #include "phar_internal.h"
      22             : 
      23       12648 : phar_path_check_result phar_path_check(char **s, int *len, const char **error)
      24             : {
      25       12648 :         const unsigned char *p = (const unsigned char*)*s;
      26             :         const unsigned char *m;
      27             : 
      28       12648 :         if (*len == 1 && *p == '.') {
      29           0 :                 *error = "current directory reference";
      30           0 :                 return pcr_err_curr_dir;
      31       12648 :         } 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             : loop:
      43             : /*!re2c
      44             : END = "\x00";
      45             : UTF8T   = [\x80-\xBF] ;
      46             : UTF8_1  = [\x1A-\x7F] ;
      47             : UTF8_2  = [\xC2-\xDF] UTF8T ;
      48             : UTF8_3A = "\xE0" [\xA0-\xBF] UTF8T ;
      49             : UTF8_3B = [\xE1-\xEC] UTF8T{2} ;
      50             : UTF8_3C = "\xED" [\x80-\x9F] UTF8T ;
      51             : UTF8_3D = [\xEE-\xEF] UTF8T{2} ;
      52             : UTF8_3  = UTF8_3A | UTF8_3B | UTF8_3C | UTF8_3D ;
      53             : UTF8_4A = "\xF0"[\x90-\xBF] UTF8T{2} ;
      54             : UTF8_4B = [\xF1-\xF3] UTF8T{3} ;
      55             : UTF8_4C = "\xF4" [\x80-\x8F] UTF8T{2} ;
      56             : UTF8_4  = UTF8_4A | UTF8_4B | UTF8_4C ;
      57             : UTF8    = UTF8_1 | UTF8_2 | UTF8_3 | UTF8_4 ;
      58             : EOS = "/" | END;
      59             : ANY = .;
      60             : "//"  {
      61           2 :                         *error = "double slash";
      62           2 :                         return pcr_err_double_slash;
      63             :                 }
      64             : "/.." EOS {
      65           5 :                         *error = "upper directory reference";
      66           5 :                         return pcr_err_up_dir;
      67             :                 }
      68             : "/." EOS {
      69           0 :                         *error = "current directory reference";
      70           0 :                         return pcr_err_curr_dir;
      71             :                 }
      72             : "\\" {
      73           0 :                         *error = "back-slash";
      74           0 :                         return pcr_err_back_slash;
      75             :                 }
      76             : "*" {
      77           0 :                         *error = "star";
      78           0 :                         return pcr_err_star;
      79             :                 }
      80             : "?"   {
      81           4 :                         if (**s == '/') {
      82           0 :                                 (*s)++;
      83             :                         }
      84           4 :                         *len = (p - (const unsigned char*)*s) -1;
      85           4 :                         *error = NULL;
      86           4 :                         return pcr_use_query;
      87             :                 }
      88             : UTF8 {
      89      244665 :                         goto loop;
      90             :                 }
      91             : END {
      92       12627 :                         if (**s == '/') {
      93        4587 :                                 (*s)++;
      94        4587 :                                 (*len)--;
      95             :                         }
      96       12627 :                         if ((p - (const unsigned char*)*s) - 1 != *len)
      97             :                         {
      98           2 :                                 *error ="illegal character";
      99           2 :                                 return pcr_err_illegal_char;
     100             :                         }
     101       12625 :                         *error = NULL;
     102       12625 :                         return pcr_is_ok;
     103             :                 }
     104             : ANY {
     105          10 :                         *error ="illegal character";
     106          10 :                         return pcr_err_illegal_char;
     107             :                 }
     108             : */
     109             : }

Generated by: LCOV version 1.10

Generated at Fri, 24 Oct 2014 05:22:00 +0000 (7 days ago)

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