This file is indexed.

/usr/include/libktorrent/diskio/piecedata.h is in libktorrent-dev 1.3.1-5.

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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/***************************************************************************
 *   Copyright (C) 2008 by Joris Guisson and Ivan Vasic                    *
 *   joris.guisson@gmail.com                                               *
 *   ivasic@gmail.com                                                      *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program 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 General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
 ***************************************************************************/
#ifndef BTPIECEDATA_H
#define BTPIECEDATA_H

#include <ktorrent_export.h>
#include <QSharedDataPointer>
#include <util/constants.h>
#ifndef Q_WS_WIN
#include <util/signalcatcher.h>
#endif
#include <diskio/cachefile.h>


namespace bt
{

	class File;
	class Chunk;
	class SHA1Hash;
	class SHA1HashGen;

	/**
		Class which holds the data of a piece of a chunk.
		It has a reference counter.
	*/
	class KTORRENT_EXPORT PieceData : public QSharedData, public MMappeable
	{
	public:
		PieceData(Chunk* chunk, Uint32 off, Uint32 len, Uint8* ptr, CacheFile::Ptr cache_file, bool read_only);
		virtual ~PieceData();

		/// Unload the piece
		void unload();

		/// Is it a mapped into memory
		bool mapped() const {return cache_file != 0;}

		/// Is this writeable
		bool writeable() const {return !read_only;}

		/// Get the offset of the piece in the chunk
		Uint32 offset() const {return off;}

		/// Get the length of the piece
		Uint32 length() const {return len;}

		/// Get a pointer to the data
		Uint8* data() {return ptr;}

		/// Check if the data pointer is OK
		bool ok() const {return ptr != 0;}

		/// Set the data pointer
		void setData(Uint8* p) {ptr = p;}

		/// Get the parent chunk of the piece
		Chunk* parentChunk() {return chunk;}

		/**
			Write data into the PieceData. This function should always be used
			for writing into a PieceData object, as it protects against bus errors.
			@param buf The buffer to write
			@param size Size of the buffer
			@param off Offset to write
			@return The number of bytes written
			@throw BusError When writing results in a SIGBUS
		*/
		Uint32 write(const Uint8* buf, Uint32 buf_size, Uint32 off = 0);

		/**
			Read data from the PieceData. This function should always be used
			for reading from a PieceData object, as it protects against bus errors.
			@param buf The buffer to read into
			@param to_read Amount of bytes to read
			@param off Offset in the PieceData to start reading from
			@return The number of bytes read
			@throw BusError When reading results in a SIGBUS
		 */
		Uint32 read(Uint8* buf, Uint32 to_read, Uint32 off = 0);

		/**
			Save PieceData to a File. This function protects against bus errors.
			@param file The file to write to
			@param size Size to write
			@param off Offset in PieceData to write from
			@return The number of bytes written
			@throw BusError When writing results in a SIGBUS
		*/
		Uint32 writeToFile(File & file, Uint32 size, Uint32 off = 0);

		/**
			Read PieceData from a File. This function protects against bus errors.
			@param file The file to read from
			@param size Size to read
			@param off Offset in PieceData to write into
			@return The number of bytes read
			@throw BusError When reading results in a SIGBUS
		*/
		Uint32 readFromFile(File & file, Uint32 size, Uint32 off = 0);

		/**
			Update a SHA1HashGen with this PieceData. This function protects against bus errors.
			@param hg The SHA1HashGen to update
			@throw BusError When reading results in a SIGBUS
		 */
		void updateHash(SHA1HashGen & hg);

		/**
			Generate a SHA1Hash of this PieceData. This function protects against bus errors.
			@return The SHA1 hash
			@throw BusError When reading results in a SIGBUS
		 */
		SHA1Hash generateHash() const;

		typedef QExplicitlySharedDataPointer<PieceData> Ptr;

		/// Is the piece in use by somebody else then the cache
		bool inUse() const {return ref > 1;}

	private:
		virtual void unmapped();

	private:
		Chunk* chunk;
		Uint32 off;
		Uint32 len;
		Uint8* ptr;
		CacheFile::Ptr cache_file;
		bool read_only;
	};



}

#endif