diff --git a/src/modules/pst/pstsdk/ltp/nameid.h b/src/modules/pst/pstsdk/ltp/nameid.h index de8d1206..5dfb71c8 100644 --- a/src/modules/pst/pstsdk/ltp/nameid.h +++ b/src/modules/pst/pstsdk/ltp/nameid.h @@ -268,8 +268,13 @@ inline std::vector pstsdk::name_id_map::get_prop_list() const std::vector props; m_entry_stream.seekg(0, std::ios_base::beg); - while(m_entry_stream.read((char*)&entry, sizeof(entry)) != 0) - props.push_back(nameid_get_prop_index(entry) + 0x8000); + while(!m_entry_stream.eof()) + { + m_entry_stream.read((char*)&entry, sizeof(entry)); + if (m_entry_stream.gcount() == 0) break; + + props.push_back(nameid_get_prop_index(entry) + 0x8000); + } m_entry_stream.clear(); @@ -312,9 +317,12 @@ inline pstsdk::prop_id pstsdk::name_id_map::lookup(const named_prop& p) const prop_stream bucket(const_cast(this)->m_bag.open_prop_stream(get_bucket_prop(hash_value))); disk::nameid_hash_entry entry; - while(bucket.read((char*)&entry, sizeof(entry)) != 0) + while(!bucket.eof()) { - if( (entry.hash_base == hash_base) && + bucket.read((char*)&entry, sizeof(entry)); + if (bucket.gcount() == 0) break; + + if( (entry.hash_base == hash_base) && (disk::nameid_is_string(entry) == p.is_string()) && (disk::nameid_get_guid_index(entry) == guid_index) )