This file is indexed.

/usr/include/libkomparediff2/difference.h is in libkomparediff2-dev 4:4.13.0-0ubuntu1.

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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/***************************************************************************
                                difference.h
                                ------------
        begin                   : Sun Mar 4 2001
        Copyright 2001-2004,2009 Otto Bruggeman <bruggie@gmail.com>
        Copyright 2001-2003 John Firebaugh <jfirebaugh@kde.org>
****************************************************************************/

/***************************************************************************
**
**   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.
**
***************************************************************************/

#ifndef DIFFERENCE_H
#define DIFFERENCE_H

#include <qvector.h>

#include <kdebug.h>
#include "diff2export.h"
#include "marker.h"

class QString;

namespace Diff2
{

class DIFF2_EXPORT DifferenceString
{
public:
	DifferenceString()
	{
//		kDebug(8101) << "DifferenceString::DifferenceString()" << endl;
	}
	explicit DifferenceString( const QString& string, const MarkerList& markerList = MarkerList() ) :
		m_string( string ),
		m_markerList( markerList )
	{
//		kDebug(8101) << "DifferenceString::DifferenceString( " << string << ", " << markerList << " )" << endl;
		calculateHash();
	}
	DifferenceString( const DifferenceString& ds ) :
		m_string( ds.m_string ),
		m_conflict( ds.m_conflict ),
		m_hash( ds.m_hash ),
		m_markerList( ds.m_markerList )
	{
//		kDebug(8101) << "DifferenceString::DifferenceString( const DifferenceString& " << ds << " )" << endl;
	}
	~DifferenceString()
	{
		qDeleteAll( m_markerList );
	}

public:
	const QString& string() const
	{
		return m_string;
	}
	const QString& conflictString() const
	{
		return m_conflict;
	}
	const MarkerList& markerList()
	{
		return m_markerList;
	}
	void setString( const QString& string )
	{
		m_string = string;
		calculateHash();
	}
	void setConflictString( const QString& conflict )
	{
		m_conflict = conflict;
	}
	void setMarkerList( const MarkerList& markerList )
	{
		m_markerList = markerList;
	}
	void prepend( Marker* marker )
	{
		m_markerList.prepend( marker );
	}
	bool operator==( const DifferenceString& ks )
	{
		if ( m_hash != ks.m_hash )
			return false;
		return m_string == ks.m_string;
	}

protected:
	void calculateHash()
	{
		unsigned short const* str = reinterpret_cast<unsigned short const*>( m_string.unicode() );
		const unsigned int len = m_string.length();

		m_hash = 1315423911;

		for ( unsigned int i = 0; i < len; i++ )
		{
			m_hash ^= ( m_hash << 5 ) + str[i] + ( m_hash >> 2 );
		}
	}

private:
	QString      m_string;
	QString      m_conflict;
	unsigned int m_hash;
	MarkerList   m_markerList;
};

typedef QVector<DifferenceString*> DifferenceStringList;
typedef QVector<DifferenceString*>::iterator DifferenceStringListIterator;
typedef QVector<DifferenceString*>::const_iterator DifferenceStringListConstIterator;

class DIFF2_EXPORT Difference : public QObject
{
	Q_OBJECT
public:
	enum Type { Change, Insert, Delete, Unchanged };

public:
	Difference( int sourceLineNo, int destinationLineNo, int type = Difference::Unchanged );
	~Difference();

public:
	int type() const { return m_type; };

	int sourceLineNumber() const { return m_sourceLineNo; }
	int destinationLineNumber() const { return m_destinationLineNo; }

	int sourceLineCount() const;
	int destinationLineCount() const;

	int sourceLineEnd() const;
	int destinationLineEnd() const;

	/// Destination line number that tracks applying/unapplying of other differences
	/// Essentially a line number in a patch consisting of applied diffs only
	int trackingDestinationLineNumber() const { return m_trackingDestinationLineNo; }
	int trackingDestinationLineEnd() const;
	void setTrackingDestinationLineNumber( int i ) { m_trackingDestinationLineNo = i; }

	DifferenceString* sourceLineAt( int i ) const { return m_sourceLines[ i ]; }
	DifferenceString* destinationLineAt( int i ) const { return m_destinationLines[ i ]; }

	const DifferenceStringList sourceLines() const { return m_sourceLines; }
	const DifferenceStringList destinationLines() const { return m_destinationLines; }

	bool hasConflict() const
	{
		return m_conflicts;
	}
	void setConflict( bool conflicts )
	{
		m_conflicts = conflicts;
	}

	bool isUnsaved() const
	{
		return m_unsaved;
	}
	void setUnsaved( bool unsaved )
	{
		m_unsaved = unsaved;
	}

	void apply( bool apply );
	/// Apply without emitting any signals
	void applyQuietly( bool apply );
	bool applied() const { return m_applied; }

	void setType( int type ) { m_type = type; }

	void addSourceLine( QString line );
	void addDestinationLine( QString line );

	/** This method will calculate the differences between the individual strings and store them as Markers */
	void determineInlineDifferences();

	QString recreateDifference() const;

signals:
	void differenceApplied( Difference* );

private:
	int                   m_type;

	int                   m_sourceLineNo;
	int                   m_destinationLineNo;
	int                   m_trackingDestinationLineNo;

	DifferenceStringList  m_sourceLines;
	DifferenceStringList  m_destinationLines;

	bool                  m_applied;
	bool                  m_conflicts;
	bool                  m_unsaved;
};

typedef QList<Difference*> DifferenceList;
typedef QList<Difference*>::iterator DifferenceListIterator;
typedef QList<Difference*>::const_iterator DifferenceListConstIterator;

} // End of namespace Diff2

#endif