mirror of
https://github.com/ksherlock/profuse.git
synced 2024-06-10 17:29:32 +00:00
fix data()
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@313 aa027e90-d47c-11dd-86d7-074df07e0730
This commit is contained in:
parent
7a327fb024
commit
79d8352018
|
@ -42,11 +42,13 @@ unsigned TextWriter::blocks() const
|
||||||
void *TextWriter::data(unsigned block) const
|
void *TextWriter::data(unsigned block) const
|
||||||
{
|
{
|
||||||
unsigned offset = (block & 0x01) * 512;
|
unsigned offset = (block & 0x01) * 512;
|
||||||
if (( block >> 1 ) < _blocks.size())
|
unsigned halfBlock = block >> 1;
|
||||||
|
|
||||||
|
if (halfBlock < _blocks.size())
|
||||||
{
|
{
|
||||||
return _blocks[block >> 1] + offset;
|
return _blocks[halfBlock] + offset;
|
||||||
}
|
}
|
||||||
if (block == _blocks.size())
|
if (halfBlock == _blocks.size())
|
||||||
{
|
{
|
||||||
if (offset > _offset) return NULL;
|
if (offset > _offset) return NULL;
|
||||||
return _current + offset;
|
return _current + offset;
|
||||||
|
@ -83,8 +85,8 @@ void TextWriter::writeLine(const char *line, unsigned length)
|
||||||
text.push_back(0x0d);
|
text.push_back(0x0d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
length = text.length();
|
length = text.length();
|
||||||
|
|
||||||
if (length > 1024)
|
if (length > 1024)
|
||||||
{
|
{
|
||||||
throw ProFUSE::Exception(__METHOD__ ": String is too long.");
|
throw ProFUSE::Exception(__METHOD__ ": String is too long.");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user