diff options
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/lldarray.h | 19 | ||||
-rw-r--r-- | indra/llcommon/llstreamtools.h | 2 | ||||
-rw-r--r-- | indra/llcommon/llstring.h | 4 |
3 files changed, 18 insertions, 7 deletions
diff --git a/indra/llcommon/lldarray.h b/indra/llcommon/lldarray.h index c8b5b7fb14..2ebca78c98 100644 --- a/indra/llcommon/lldarray.h +++ b/indra/llcommon/lldarray.h @@ -169,16 +169,17 @@ public: void reset() { mVector.resize(0); mIndexMap.resize(0); } bool empty() const { return mVector.empty(); } - size_type size() const { return mVector.empty(); } + size_type size() const { return mVector.size(); } Type& operator[](const Key& k) { - typename std::map<Key, U32>::iterator iter = mIndexMap.find(k); + typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); if (iter == mIndexMap.end()) { U32 n = mVector.size(); mIndexMap[k] = n; mVector.resize(n+1); + llassert(mVector.size() == mIndexMap.size()); return mVector[n]; } else @@ -186,7 +187,19 @@ public: return mVector[iter->second]; } } - + + const_iterator find(const Key& k) const + { + typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); + if(iter == mIndexMap.end()) + { + return mVector.end(); + } + else + { + return mVector.begin() + iter->second; + } + } }; #endif diff --git a/indra/llcommon/llstreamtools.h b/indra/llcommon/llstreamtools.h index e4099aac57..3a3ce5d7b1 100644 --- a/indra/llcommon/llstreamtools.h +++ b/indra/llcommon/llstreamtools.h @@ -40,11 +40,13 @@ bool skip_to_end_of_next_keyword(const char* keyword, std::istream& input_stream //bool skip_to_start_of_next_keyword(const char* keyword, std::istream& input_stream); // characters are pulled out of input_stream and appended to output_string +// returns result of input_stream.good() after characters are pulled bool get_word(std::string& output_string, std::istream& input_stream); bool get_line(std::string& output_string, std::istream& input_stream); // characters are pulled out of input_stream (up to a max of 'n') // and appended to output_string +// returns result of input_stream.good() after characters are pulled bool get_word(std::string& output_string, std::istream& input_stream, int n); bool get_line(std::string& output_string, std::istream& input_stream, int n); diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 3c798b25aa..c958e08415 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -1054,9 +1054,6 @@ BOOL LLStringBase<T>::isHead( const std::basic_string<T>& string, const T* s ) template<class T> BOOL LLStringBase<T>::read(std::basic_string<T>& string, const char* filename) /*Flawfinder: ignore*/ { -#ifdef LL_LINUX - printf("STUBBED: LLStringBase<T>::read at %s:%d\n", __FILE__, __LINE__); -#else llifstream ifs(filename, llifstream::binary); if (!ifs.is_open()) { @@ -1071,7 +1068,6 @@ BOOL LLStringBase<T>::read(std::basic_string<T>& string, const char* filename) string = oss.str(); ifs.close(); -#endif return TRUE; } |