This file is indexed.

/usr/include/CLucene/util/Array.h is in libclucene-dev 2.3.3.4-4build1.

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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
/*------------------------------------------------------------------------------
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
*
* Distributable under the terms of either the Apache License (Version 2.0) or
* the GNU Lesser General Public License, as specified in the COPYING file.
------------------------------------------------------------------------------*/
#ifndef _lucene_util_Array_
#define _lucene_util_Array_

#include <stdlib.h>
#include <string.h>

CL_NS_DEF(util)

template<typename T>
class CLUCENE_INLINE_EXPORT ArrayBase: LUCENE_BASE{
public:
	T* values;
	size_t length;

  /**
  * Delete's the values in the array.
  * This won't do anything if deleteArray or takeArray is called first.
  * This is overridden in various implementations to provide the appropriate deletor function.
  */
  virtual void deleteValues(){
    if ( this->values == NULL )
      return;
	  for (size_t i=0;i<this->length;i++){
		  deleteValue(this->values[i]);
		}
  }
  /**
  * Delete's a single value. Used when resizing...
  */
  virtual void deleteValue(T) = 0;

  /**
  * Delete's the values in the array and then calls deleteArray().
  * This won't do anything if deleteArray or takeArray is called first.
  * This is overridden in various implementations to provide the appropriate deletor function.
  */
	void deleteAll(){
    this->deleteValues();
    this->deleteArray();
  }

	/**
	* Deletes the array holding the values. Do this if you want to take
	* ownership of the array's values, but not the array containing the values.
	*/
	void deleteArray(){
		free(this->values);
    this->values = NULL;
	}
	/**
	* Empties the array. Do this if you want to take ownership of the array
	* and the array's values.
	*/
	T* takeArray(){
	    T* ret = values;
	    values = NULL;
	    return ret;
	}

    ArrayBase(const size_t initialLength = 0)
        : values(NULL), length(initialLength)
    {
        if (initialLength > 0)
        {
            this->values = (T*)malloc(sizeof(T)*length);
            memset(this->values,0,sizeof(T)*length);
        }
    }
	ArrayBase(T* _values, const size_t _length)
        : values(_values), length(_length)
    {
	}
	virtual ~ArrayBase(){
	}

	const T& operator[](const size_t _Pos) const
	{
		if (length <= _Pos){
			_CLTHROWA(CL_ERR_IllegalArgument,"vector subscript out of range");
		}
		return (*(values + _Pos));
	}
	T& operator[](const size_t _Pos)
	{
		if (length <= _Pos){
			_CLTHROWA(CL_ERR_IllegalArgument,"vector subscript out of range");
		}
		return (*(values + _Pos));
	}

  /**
  * Resize the array
  * @param deleteValues if shrinking, delete the values that are lost.
  */
  void resize(const size_t newSize, const bool deleteValues=false){
    if ( length == newSize ) return;

    if ( values == NULL )
    {
        values = (T*)malloc(sizeof(T)*newSize);
        memset(values,0,sizeof(T) * newSize);
        length = newSize;
        return;
    }

    if (length < newSize)
    {
        values = (T*)realloc(values, sizeof(T) * newSize);
        memset(values + length,0,sizeof(T) * (newSize-length));
    }
    else // length > newSize, including newSize == 0
    {
        if ( deleteValues ){
            for ( size_t i=newSize;i<length;i++ ){
                deleteValue(values[i]);
            }
        }

        if ( newSize == 0 )
        {
            free(values);
            values = NULL;
        }else{
            // TODO: alternatively, we could store the actual array length without really shrinking it and
            // by that save the deallocation process + possibly another realloc later
            values = (T*)realloc(values, sizeof(T) * newSize);
        }
    }
    
    length = newSize;
  }
};

/**
* An array of objects. _CLDELETE is called on every contained object.
*/
template<typename T>
class CLUCENE_INLINE_EXPORT ObjectArray: public ArrayBase<T*>{
public:
  ObjectArray():ArrayBase<T*>(){}
	ObjectArray(T** values, size_t length):ArrayBase<T*>(values,length){}
	ObjectArray(size_t length):ArrayBase<T*>(length){}

  void deleteValues(){
      if ( this->values == NULL )
        return;
		  for (size_t i=0;i<this->length;++i){
			    _CLLDELETE(this->values[i]);
		  }
	    this->deleteArray();
	}
  void deleteUntilNULL(){
      if ( this->values == NULL )
        return;
		  for (size_t i=0;i<this->length && this->values[i] != NULL;++i){
			    _CLLDELETE(this->values[i]);
		  }
	    this->deleteArray();
	}
  void deleteValue(T* v){
     _CLLDELETE(v);
	}
	virtual ~ObjectArray(){
	    deleteValues();
	}

	/* Initializes all cells in the array with a NULL value */
	void initArray(){
		for (size_t i=0;i<this->length;i++){
			this->values[i]=NULL;
		}
	}
};

/**
* Legacy code... don't use, remove all instances of this!
*/
template<typename T>
class CLUCENE_INLINE_EXPORT Array: public ArrayBase<T>{
public:
  _CL_DEPRECATED(ObjectArray or ValueArray) Array():ArrayBase<T>(){}
	_CL_DEPRECATED(ObjectArray or ValueArray) Array(T* values, size_t length):ArrayBase<T>(values,length){}
	_CL_DEPRECATED(ObjectArray or ValueArray) Array(size_t length):ArrayBase<T>(length){}
  void deleteValues(){
    if ( this->values == NULL )
        return;
    this->deleteArray();
	}
  void deleteValue(T v){} //nothing to do...
	virtual ~Array(){
	}
};

/**
* An array where the values do not need to be deleted
*/
template<typename T>
class CLUCENE_INLINE_EXPORT ValueArray: public ArrayBase<T>{
public:
  ValueArray():ArrayBase<T>(){}
	ValueArray(T* values, size_t length):ArrayBase<T>(values,length){}
	ValueArray(size_t length):ArrayBase<T>(length){}

  void deleteValues(){
    if ( this->values == NULL )
        return;
    this->deleteArray();
	}
  void deleteValue(T /*v*/){} //nothing to do...
  virtual ~ValueArray(){
    deleteValues();
  }
};

/** A value array for const values (never deleted) */
template<typename T>
class CLUCENE_INLINE_EXPORT ConstValueArray: public ArrayBase<T>{
public:
  ConstValueArray():ArrayBase<T>(){}
	ConstValueArray(T* values, size_t length):ArrayBase<T>(values,length){}
	ConstValueArray(size_t length):ArrayBase<T>(length){}

  void deleteValues(){}
  void deleteValue(T /*v*/){} //nothing to do...
  virtual ~ConstValueArray(){}
};


/**
* An array of TCHAR strings
*/
class CLUCENE_INLINE_EXPORT TCharArray: public ArrayBase<TCHAR*>{
public:
  TCharArray():ArrayBase<TCHAR*>(){}
	TCharArray(size_t length):ArrayBase<TCHAR*>(length){}

  void deleteValues(){
    if ( this->values == NULL )
        return;
	  for (size_t i=0;i<this->length;i++)
		  _CLDELETE_CARRAY(this->values[i]);
    this->deleteArray();
	}
  void deleteValue(TCHAR* v){
		  _CLDELETE_LCARRAY(v);
  }
	virtual ~TCharArray(){
	    deleteValues();
	}
};

/**
* An array of char strings
*/
class CLUCENE_INLINE_EXPORT CharArray: public ArrayBase<char*>{
public:
  CharArray():ArrayBase<char*>(){}
	CharArray(size_t length):ArrayBase<char*>(length){}

    void deleteValues(){
      if ( this->values == NULL )
          return;
		  for (size_t i=0;i<this->length;i++)
			  _CLDELETE_CaARRAY(this->values[i]);
	    this->deleteArray();
	}
	virtual ~CharArray(){
	    deleteValues();
	}
};

/**
* An array of const TCHAR strings
*/
class CLUCENE_INLINE_EXPORT TCharConstArray: public ArrayBase<const TCHAR*>{
public:
  TCharConstArray():ArrayBase<const TCHAR*>(){}
	TCharConstArray(size_t length):ArrayBase<const TCHAR*>(length){}

    void deleteValues(){
        if ( this->values == NULL )
            return;
	    this->deleteArray();
	}
	virtual ~TCharConstArray(){
	    deleteValues();
	}
};

/**
* An array of const char strings
*/
class CLUCENE_INLINE_EXPORT CharConstArray: public ArrayBase<const char*>{
public:
    CharConstArray():ArrayBase<const char*>(){}
	CharConstArray(size_t length):ArrayBase<const char*>(length){}

    void deleteValues(){
        if ( this->values == NULL )
            return;
	    this->deleteArray();
	}
	virtual ~CharConstArray(){
	    deleteValues();
	}
};

/** An array that uses _CLDECDELETE for deletion */
template<typename T>
class CLUCENE_INLINE_EXPORT RefCountArray: public ArrayBase<T>{
public:
  RefCountArray():ArrayBase<T>(){}
  RefCountArray(T* values, size_t length):ArrayBase<T>(values,length){}
  RefCountArray(size_t length):ArrayBase<T>(length){}

  void deleteValues(){
    if ( this->values == NULL )
        return;
    ArrayBase<T>::deleteValues();
    this->deleteArray();
    }
  void deleteValue(T v){
    _CLDECDELETE(v);
  } //nothing to do...
  virtual ~RefCountArray(){
    deleteValues();
  }
};


CL_NS_END
#endif