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 - mbstring/libmbfl/filters - mbfilter_byte2.c
Test: PHP Code Coverage
Date: 2009-11-19 Instrumented lines: 26
Code covered: 0.0 % Executed lines: 0
Legend: not executed executed

       1                 : /*
       2                 :  * "streamable kanji code filter and converter"
       3                 :  * Copyright (c) 1998-2002 HappySize, Inc. All rights reserved.
       4                 :  *
       5                 :  * LICENSE NOTICES
       6                 :  *
       7                 :  * This file is part of "streamable kanji code filter and converter",
       8                 :  * which is distributed under the terms of GNU Lesser General Public 
       9                 :  * License (version 2) as published by the Free Software Foundation.
      10                 :  *
      11                 :  * This software is distributed in the hope that it will be useful,
      12                 :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13                 :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14                 :  * GNU Lesser General Public License for more details.
      15                 :  *
      16                 :  * You should have received a copy of the GNU Lesser General Public
      17                 :  * License along with "streamable kanji code filter and converter";
      18                 :  * if not, write to the Free Software Foundation, Inc., 59 Temple Place,
      19                 :  * Suite 330, Boston, MA  02111-1307  USA
      20                 :  *
      21                 :  * The author of this file:
      22                 :  *
      23                 :  */
      24                 : /*
      25                 :  * The source code included in this files was separated from mbfilter.c
      26                 :  * by Moriyoshi Koizumi <moriyoshi@php.net> on 4 Dec 2002. The file
      27                 :  * mbfilter.c is included in this package .
      28                 :  *
      29                 :  */
      30                 : 
      31                 : #ifdef HAVE_CONFIG_H
      32                 : #include "config.h"
      33                 : #endif
      34                 : 
      35                 : #include "mbfilter.h"
      36                 : #include "mbfilter_byte2.h"
      37                 : 
      38                 : const mbfl_encoding mbfl_encoding_byte2be = {
      39                 :         mbfl_no_encoding_byte2be,
      40                 :         "byte2be",
      41                 :         NULL,
      42                 :         NULL,
      43                 :         NULL,
      44                 :         MBFL_ENCTYPE_SBCS
      45                 : };
      46                 : 
      47                 : const mbfl_encoding mbfl_encoding_byte2le = {
      48                 :         mbfl_no_encoding_byte2le,
      49                 :         "byte2le",
      50                 :         NULL,
      51                 :         NULL,
      52                 :         NULL,
      53                 :         MBFL_ENCTYPE_SBCS
      54                 : };
      55                 : 
      56                 : const struct mbfl_convert_vtbl vtbl_byte2be_wchar = {
      57                 :         mbfl_no_encoding_byte2be,
      58                 :         mbfl_no_encoding_wchar,
      59                 :         mbfl_filt_conv_common_ctor,
      60                 :         mbfl_filt_conv_common_dtor,
      61                 :         mbfl_filt_conv_byte2be_wchar,
      62                 :         mbfl_filt_conv_common_flush
      63                 : };
      64                 : 
      65                 : const struct mbfl_convert_vtbl vtbl_wchar_byte2be = {
      66                 :         mbfl_no_encoding_wchar,
      67                 :         mbfl_no_encoding_byte2be,
      68                 :         mbfl_filt_conv_common_ctor,
      69                 :         mbfl_filt_conv_common_dtor,
      70                 :         mbfl_filt_conv_wchar_byte2be,
      71                 :         mbfl_filt_conv_common_flush };
      72                 : 
      73                 : const struct mbfl_convert_vtbl vtbl_byte2le_wchar = {
      74                 :         mbfl_no_encoding_byte2le,
      75                 :         mbfl_no_encoding_wchar,
      76                 :         mbfl_filt_conv_common_ctor,
      77                 :         mbfl_filt_conv_common_dtor,
      78                 :         mbfl_filt_conv_byte2le_wchar,
      79                 :         mbfl_filt_conv_common_flush };
      80                 : 
      81                 : const struct mbfl_convert_vtbl vtbl_wchar_byte2le = {
      82                 :         mbfl_no_encoding_wchar,
      83                 :         mbfl_no_encoding_byte2le,
      84                 :         mbfl_filt_conv_common_ctor,
      85                 :         mbfl_filt_conv_common_dtor,
      86                 :         mbfl_filt_conv_wchar_byte2le,
      87                 :         mbfl_filt_conv_common_flush };
      88                 : 
      89                 : #define CK(statement)   do { if ((statement) < 0) return (-1); } while (0)
      90                 : 
      91                 : int mbfl_filt_conv_byte2be_wchar(int c, mbfl_convert_filter *filter)
      92               0 : {
      93                 :         int n;
      94                 : 
      95               0 :         if (filter->status == 0) {
      96               0 :                 filter->status = 1;
      97               0 :                 n = (c & 0xff) << 8;
      98               0 :                 filter->cache = n;
      99                 :         } else {
     100               0 :                 filter->status = 0;
     101               0 :                 n = (c & 0xff) | filter->cache;
     102               0 :                 CK((*filter->output_function)(n, filter->data));
     103                 :         }
     104               0 :         return c;
     105                 : }
     106                 : 
     107                 : int mbfl_filt_conv_wchar_byte2be(int c, mbfl_convert_filter *filter)
     108               0 : {
     109               0 :         CK((*filter->output_function)((c >> 8) & 0xff, filter->data));
     110               0 :         CK((*filter->output_function)(c & 0xff, filter->data));
     111               0 :         return c;
     112                 : }
     113                 : 
     114                 : int mbfl_filt_conv_byte2le_wchar(int c, mbfl_convert_filter *filter)
     115               0 : {
     116                 :         int n;
     117                 : 
     118               0 :         if (filter->status == 0) {
     119               0 :                 filter->status = 1;
     120               0 :                 n = c & 0xff;
     121               0 :                 filter->cache = n;
     122                 :         } else {
     123               0 :                 filter->status = 0;
     124               0 :                 n = ((c & 0xff) << 8) | filter->cache;
     125               0 :                 CK((*filter->output_function)(n, filter->data));
     126                 :         }
     127               0 :         return c;
     128                 : }
     129                 : 
     130                 : int mbfl_filt_conv_wchar_byte2le(int c, mbfl_convert_filter *filter)
     131               0 : {
     132               0 :         CK((*filter->output_function)(c & 0xff, filter->data));
     133               0 :         CK((*filter->output_function)((c >> 8) & 0xff, filter->data));
     134               0 :         return c;
     135                 : }
     136                 : 
     137                 : 

Generated by: LTP GCOV extension version 1.5

Generated at Thu, 19 Nov 2009 08:20:11 +0000 (5 days ago)

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