Minor fixes:
* the "state" variable was reset for each loop cycle. * since the inner loop tested for "bytes" instead of "bytesLeft", convert_to_utf8() was called twice for each chunk read. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19846 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d0fc29af1f
commit
691e54b4ab
@ -1180,6 +1180,7 @@ translate_from_text(BPositionIO* source, const char* encoding, bool forceEncodin
|
||||
|
||||
off_t outputSize = 0;
|
||||
ssize_t bytesRead;
|
||||
int32 state = 0;
|
||||
|
||||
// output the actual text part of the data
|
||||
do {
|
||||
@ -1205,7 +1206,6 @@ translate_from_text(BPositionIO* source, const char* encoding, bool forceEncodin
|
||||
// decode text file to UTF-8
|
||||
char* pos = (char*)buffer;
|
||||
int32 encodingLength = encodingIO.BufferLength();
|
||||
int32 state = 0;
|
||||
int32 bytesLeft = bytesRead;
|
||||
int32 bytes;
|
||||
do {
|
||||
@ -1229,7 +1229,7 @@ translate_from_text(BPositionIO* source, const char* encoding, bool forceEncodin
|
||||
pos += bytes;
|
||||
bytesLeft -= bytes;
|
||||
outputSize += encodingLength;
|
||||
} while (encodingLength > 0 && bytes > 0);
|
||||
} while (encodingLength > 0 && bytesLeft > 0);
|
||||
}
|
||||
} while (bytesRead > 0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user