Import BSDDB 4.7.25 (as of svn r89086)

This commit is contained in:
Zachary Ware
2017-09-04 13:40:25 -05:00
parent 4b29e0458f
commit 8f590873d0
4781 changed files with 2241032 additions and 6 deletions

66
cxx/cxx_multi.cpp Normal file
View File

@@ -0,0 +1,66 @@
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1997,2008 Oracle. All rights reserved.
*
* $Id: cxx_multi.cpp 63573 2008-05-23 21:43:21Z trent.nelson $
*/
#include "db_config.h"
#include "db_int.h"
#include "db_cxx.h"
DbMultipleIterator::DbMultipleIterator(const Dbt &dbt)
: data_((u_int8_t*)dbt.get_data()),
p_((u_int32_t*)(data_ + dbt.get_ulen() - sizeof(u_int32_t)))
{
}
bool DbMultipleDataIterator::next(Dbt &data)
{
if (*p_ == (u_int32_t)-1) {
data.set_data(0);
data.set_size(0);
p_ = 0;
} else {
data.set_data(data_ + *p_--);
data.set_size(*p_--);
if (data.get_size() == 0 && data.get_data() == data_)
data.set_data(0);
}
return (p_ != 0);
}
bool DbMultipleKeyDataIterator::next(Dbt &key, Dbt &data)
{
if (*p_ == (u_int32_t)-1) {
key.set_data(0);
key.set_size(0);
data.set_data(0);
data.set_size(0);
p_ = 0;
} else {
key.set_data(data_ + *p_--);
key.set_size(*p_--);
data.set_data(data_ + *p_--);
data.set_size(*p_--);
}
return (p_ != 0);
}
bool DbMultipleRecnoDataIterator::next(db_recno_t &recno, Dbt &data)
{
if (*p_ == (u_int32_t)0) {
recno = 0;
data.set_data(0);
data.set_size(0);
p_ = 0;
} else {
recno = *p_--;
data.set_data(data_ + *p_--);
data.set_size(*p_--);
}
return (p_ != 0);
}