LCOV - code coverage report
Current view: top level - sc/source/filter/qpro - biff.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 22 23 95.7 %
Date: 2012-08-25 Functions: 3 3 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 7 10 70.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : 
      21                 :            : #include <sal/config.h>
      22                 :            : #include <stdio.h>
      23                 :            : #include <sfx2/docfile.hxx>
      24                 :            : 
      25                 :            : #include "global.hxx"
      26                 :            : #include "scerrors.hxx"
      27                 :            : #include "docpool.hxx"
      28                 :            : #include "patattr.hxx"
      29                 :            : #include "filter.hxx"
      30                 :            : #include "document.hxx"
      31                 :            : #include "cell.hxx"
      32                 :            : #include "biff.hxx"
      33                 :            : 
      34                 :          9 : ScBiffReader::ScBiffReader( SfxMedium & rMedium ) :
      35                 :            :     mnId(0),
      36                 :            :     mnLength(0),
      37                 :          9 :     mnOffset(0)
      38                 :            : {
      39                 :          9 :     mpStream = rMedium.GetInStream();
      40         [ +  - ]:          9 :     if( mpStream )
      41                 :            :     {
      42                 :          9 :         mpStream->SetBufferSize( 65535 );
      43                 :          9 :         mpStream->SetStreamCharSet( RTL_TEXTENCODING_MS_1252 );
      44                 :            :     }
      45                 :          9 : }
      46                 :            : 
      47                 :          9 : ScBiffReader::~ScBiffReader()
      48                 :            : {
      49         [ +  - ]:          9 :     if( mpStream )
      50                 :          9 :         mpStream->SetBufferSize( 0 );
      51                 :          9 : }
      52                 :            : 
      53                 :      30030 : bool ScBiffReader::nextRecord()
      54                 :            : {
      55         [ +  + ]:      30030 :     if( !recordsLeft() )
      56                 :          6 :         return false;
      57                 :            : 
      58         [ -  + ]:      30024 :     if( IsEndOfFile() )
      59                 :          0 :         return false;
      60                 :            : 
      61                 :      30024 :     sal_uInt32 nPos = mpStream->Tell();
      62         [ +  + ]:      30024 :     if( nPos != mnOffset + mnLength )
      63                 :          6 :         mpStream->Seek( mnOffset + mnLength );
      64                 :            : 
      65                 :      30024 :     mnLength = mnId = 0;
      66                 :      30024 :     *mpStream >> mnId >> mnLength;
      67                 :            : 
      68                 :      30024 :     mnOffset = mpStream->Tell();
      69                 :            : #if OSL_DEBUG_LEVEL > 1
      70                 :            :     fprintf( stderr, "Read record 0x%x length 0x%x at offset 0x%x\n",
      71                 :            :         (unsigned)mnId, (unsigned)mnLength, (unsigned)mnOffset );
      72                 :            : 
      73                 :            : #if 1  // rather verbose
      74                 :            :     int len = mnLength;
      75                 :            :     while (len > 0) {
      76                 :            :         int i, chunk = len < 16 ? len : 16;
      77                 :            :         unsigned char data[16];
      78                 :            :         mpStream->Read( data, chunk );
      79                 :            : 
      80                 :            :         for (i = 0; i < chunk; i++)
      81                 :            :             fprintf( stderr, "%.2x ", data[i] );
      82                 :            :         fprintf( stderr, "| " );
      83                 :            :         for (i = 0; i < chunk; i++)
      84                 :            :             fprintf( stderr, "%c", data[i] < 127 && data[i] > 30 ? data[i] : '.' );
      85                 :            :         fprintf( stderr, "\n" );
      86                 :            : 
      87                 :            :         len -= chunk;
      88                 :            :     }
      89                 :            :     mpStream->Seek( mnOffset );
      90                 :            : #endif
      91                 :            : #endif
      92                 :      30030 :     return true;
      93                 :            : }
      94                 :            : 
      95                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10