This file is indexed.

/usr/include/claw/impl/buffered_ostream.tpp is in libclaw-dev 1.7.3-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
/*
  CLAW - a C++ Library Absolutely Wonderful

  CLAW is a free library without any particular aim but being useful to 
  anyone.

  Copyright (C) 2005-2011 Julien Jorge

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

  contact: julien.jorge@gamned.org
*/
/**
 * \file buffered_ostream.tpp
 * \brief Implementation of the claw::buffered_ostream class.
 * \author Julien Jorge
 */
#include <cassert>

/*----------------------------------------------------------------------------*/
/**
 * \brief Constructor.
 * \param f The file associated to the stream.
 * \param buffer_size The size of the buffer.
 */
template< typename Stream >
claw::buffered_ostream<Stream>::buffered_ostream
( stream_type& f, unsigned int buffer_size )
  : m_stream(f), m_begin(new char[buffer_size]), m_end(m_begin+buffer_size),
    m_current(m_begin)
{

} // buffered_ostream::buffered_ostream()

/*----------------------------------------------------------------------------*/
/**
 * \brief Destructor.
 */
template< typename Stream >
claw::buffered_ostream<Stream>::~buffered_ostream()
{
  flush();
  delete[] m_begin;
} // buffered_ostream::~buffered_ostream()

/*----------------------------------------------------------------------------*/
/**
 * \brief Write somethnig in the buffer.
 * \param v The value to write.
 */
template< typename Stream >
template<typename T>
void claw::buffered_ostream<Stream>::write( T v )
{
  write( reinterpret_cast<const char*>(&v), sizeof(v) );
} // buffered_ostream::read_more()

/*----------------------------------------------------------------------------*/
/**
 * \brief Write a range of data in the buffer.
 * \param p The begining of the range to write.
 * \param n The length of the buffer pointed by p.
 */
template< typename Stream >
void claw::buffered_ostream<Stream>::write(const char* p, unsigned int n )
{
  while (n > 0)
    {
      unsigned int q = std::min( n, (unsigned int)(m_end - m_current) );
      const char* end = p+q;

      for ( ; p!=end ; ++p, ++m_current )
        *m_current = *p;

      n -= q;

      if (m_current == m_end)
        flush();
    }
} // buffered_ostream::write()

/*----------------------------------------------------------------------------*/
/**
 * \brief Write the data from the buffer in the stream.
 */
template< typename Stream >
void claw::buffered_ostream<Stream>::flush()
{
  if (m_current != m_begin)
    {
      m_stream.write( m_begin, m_current - m_begin );
      m_current = m_begin;
    }
} // buffered_ostream::flush()