* stringpool.cc (Stringpool_template::add_with_length): Set key to

array size plus one.
	(Stringpool_template::set_string_offsets): Subtract one from key
	before using it as an array index.
	(Stringpool_template::get_offset_with_length): Likewise.
	(Stringpool_template::write_to_buffer): Likewise.
	* stringpool.h (Stringpool_template::get_offset_from_key):
	Likewise.
This commit is contained in:
Ian Lance Taylor
2008-07-24 07:23:20 +00:00
parent 7f649c59d1
commit 5778530ea7
3 changed files with 19 additions and 7 deletions

View File

@@ -220,8 +220,8 @@ class Stringpool_template
section_offset_type
get_offset_from_key(Key k) const
{
gold_assert(k < this->key_to_offset_.size());
return this->key_to_offset_[k];
gold_assert(k <= this->key_to_offset_.size());
return this->key_to_offset_[k - 1];
}
// Get the size of the string table. This returns the number of