This file is indexed.

/usr/include/OpenSP/StringOf.cxx is in libosp-dev 1.5.2-13+b1.

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
// Copyright (c) 1994, 1996 James Clark
// See the file COPYING for copying permission.

#ifndef StringOf_DEF_INCLUDED
#define StringOf_DEF_INCLUDED 1

#include <string.h>
#include <stddef.h>

#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif

template<class T>
String<T>::String(const T *ptr, size_t length)
: length_(length), alloc_(length)
{
  if (length) {
    ptr_ = new T[length];
    memcpy(ptr_, ptr, length*sizeof(T));
  }
  else
    ptr_ = 0;
}

template<class T>
String<T>::String()
: ptr_(0), length_(0), alloc_(0)
{
}

template<class T>
String<T>::String(const String<T> &s)
: length_(s.length_), alloc_(s.length_)
{
  if (length_) {
    ptr_ = new T[length_];
    memcpy(ptr_, s.ptr_, length_*sizeof(T));
  }
  else
    ptr_ = 0;
}

template<class T>
String<T> &String<T>::operator=(const String<T> &s)
{
  if (&s != this) {
    if (s.length_ > alloc_) {
      T *oldPtr = ptr_;
      ptr_ = new T[alloc_ = s.length_];
      if (oldPtr)
	delete [] oldPtr;
    }
    memcpy(ptr_, s.ptr_, s.length_*sizeof(T));
    length_ = s.length_;
  }
  return *this;
}

template<class T>
String<T> &String<T>::insert(size_t i, const String<T> &s)
{
  if (length_ + s.length_ > alloc_)
    grow(s.length_);
  for (size_t n = length_ - i; n > 0; n--)
    ptr_[i + n - 1 + s.length_] = ptr_[i + n - 1];
  length_ += s.length_;
  memcpy(ptr_ + i, s.ptr_, s.length_*sizeof(T));
  return *this;
}

template<class T>
String<T> &String<T>::append(const T *p, size_t length)
{
  if (length_ + length > alloc_)
    grow(length);
  memcpy(ptr_ + length_, p, length*sizeof(T));
  length_ += length;
  return *this;
}

template<class T>
void String<T>::grow(size_t n)
{
  size_t newAlloc = alloc_;
  if (alloc_ < n)
    newAlloc += n + 16;
  else
    newAlloc += alloc_;
  T *s = new T[newAlloc];
  memcpy(s, ptr_, length_*sizeof(T));
  delete [] ptr_;
  ptr_ = s;
  alloc_ = newAlloc;
}

template<class T>
void String<T>::swap(String<T> &to)
{
  {
    T *tem = to.ptr_;
    to.ptr_ = ptr_;
    ptr_ = tem;
  }
  {
    size_t tem = to.length_;
    to.length_ = length_;
    length_ = tem;
  }
  {
    size_t tem = to.alloc_;
    to.alloc_ = alloc_;
    alloc_ = tem;
  }
}

template<class T>
String<T> &String<T>::assign(const T *p, size_t n)
{
  if (alloc_ < n) {
    T *oldPtr = ptr_;
    ptr_ = new T[n];
    alloc_ = n;
    if (oldPtr)
      delete [] oldPtr;
  }
  length_ = n;
  for(T *to = ptr_; n > 0; n--, to++, p++)
    *to = *p;
  return *this;
}

template<class T>
void String<T>::resize(size_t n)
{
  if (alloc_ < n) {
    T *oldPtr = ptr_;
    ptr_ = new T[n];
    alloc_ = n;
    if (length_ > 0) {
      memcpy(ptr_, oldPtr, length_*sizeof(T));
      delete [] oldPtr;
    }
  }
  length_ = n;
}

#ifdef SP_NAMESPACE
}
#endif

#endif /* not StringOf_DEF_INCLUDED */