static struct tdb_lock_type *find_nestlock(struct tdb_context *tdb,
tdb_off_t offset)
{
- unsigned int i;
+ int i;
for (i=0; i<tdb->num_lockrecs; i++) {
if (tdb->lockrecs[i].off == offset) {
static bool have_data_locks(const struct tdb_context *tdb)
{
- unsigned int i;
+ int i;
for (i = 0; i < tdb->num_lockrecs; i++) {
if (tdb->lockrecs[i].off >= lock_offset(-1))
return -1;
}
- if (tdb->allrecord_lock.count && tdb->allrecord_lock.ltype == ltype) {
+ if (tdb->allrecord_lock.count &&
+ tdb->allrecord_lock.ltype == (uint32_t)ltype) {
tdb->allrecord_lock.count++;
return 0;
}
}
/* Upgradable locks are marked as write locks. */
- if (tdb->allrecord_lock.ltype != ltype
+ if (tdb->allrecord_lock.ltype != (uint32_t)ltype
&& (!tdb->allrecord_lock.off || ltype != F_RDLCK)) {
tdb->ecode = TDB_ERR_LOCK;
return -1;
/* The transaction code uses this to remove all locks. */
void tdb_release_transaction_locks(struct tdb_context *tdb)
{
- unsigned int i, active = 0;
+ int i;
+ unsigned int active = 0;
if (tdb->allrecord_lock.count != 0) {
tdb_allrecord_unlock(tdb, tdb->allrecord_lock.ltype, false);