[Debtags-commits] [svn] r1569 - in tagcoll/trunk: . tagcoll
Enrico Zini
enrico at costa.debian.org
Mon Feb 13 11:00:27 UTC 2006
Author: enrico
Date: Mon Feb 13 11:00:26 2006
New Revision: 1569
Modified:
tagcoll/trunk/ (props changed)
tagcoll/trunk/tagcoll/IntIndex.cc
tagcoll/trunk/tagcoll/IntIndex.h
Log:
r7231 at viaza: enrico | 2006-02-11 23:42:47 +0100
Tests pass on intindex
Modified: tagcoll/trunk/tagcoll/IntIndex.cc
==============================================================================
--- tagcoll/trunk/tagcoll/IntIndex.cc (original)
+++ tagcoll/trunk/tagcoll/IntIndex.cc Mon Feb 13 11:00:26 2006
@@ -72,7 +72,7 @@
bufsize += i->size();
// Then the int with the number of items
- return (bufsize + 1) * sizeof(int);
+ return bufsize;
}
void IntIndexer::encode(int* buf) const
@@ -85,7 +85,6 @@
for (set<int>::const_iterator j = (*this)[i].begin(); j != (*this)[i].end(); j++)
buf[pos++] = *j;
}
- buf[pos] = size();
}
void IntIndexer::write(const std::string& filename)
@@ -105,7 +104,7 @@
#else
// Enlarge the temporary file to fit the data
int size = encodedSize();
- if (lseek(fd, (size * sizeof(int)) - 1, SEEK_SET) == -1)
+ if (lseek(fd, size * sizeof(int), SEEK_SET) == -1)
{
close(fd);
unlink(name);
Modified: tagcoll/trunk/tagcoll/IntIndex.h
==============================================================================
--- tagcoll/trunk/tagcoll/IntIndex.h (original)
+++ tagcoll/trunk/tagcoll/IntIndex.h Mon Feb 13 11:00:26 2006
@@ -62,7 +62,7 @@
const int* data(unsigned int val) const { return m_buf + m_buf[val] + 1; }
unsigned int size(unsigned int val) const { return val < size() ? m_buf[m_buf[val]] : 0; }
- unsigned int size() const { return m_buf[m_size / sizeof(int) - 1]; }
+ unsigned int size() const { return m_buf[0]; }
};
/**
More information about the Debtags-commits
mailing list