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:
@@ -1180,6 +1180,7 @@ translate_from_text(BPositionIO* source, const char* encoding, bool forceEncodin
|
|||||||
|
|
||||||
off_t outputSize = 0;
|
off_t outputSize = 0;
|
||||||
ssize_t bytesRead;
|
ssize_t bytesRead;
|
||||||
|
int32 state = 0;
|
||||||
|
|
||||||
// output the actual text part of the data
|
// output the actual text part of the data
|
||||||
do {
|
do {
|
||||||
@@ -1205,7 +1206,6 @@ translate_from_text(BPositionIO* source, const char* encoding, bool forceEncodin
|
|||||||
// decode text file to UTF-8
|
// decode text file to UTF-8
|
||||||
char* pos = (char*)buffer;
|
char* pos = (char*)buffer;
|
||||||
int32 encodingLength = encodingIO.BufferLength();
|
int32 encodingLength = encodingIO.BufferLength();
|
||||||
int32 state = 0;
|
|
||||||
int32 bytesLeft = bytesRead;
|
int32 bytesLeft = bytesRead;
|
||||||
int32 bytes;
|
int32 bytes;
|
||||||
do {
|
do {
|
||||||
@@ -1229,7 +1229,7 @@ translate_from_text(BPositionIO* source, const char* encoding, bool forceEncodin
|
|||||||
pos += bytes;
|
pos += bytes;
|
||||||
bytesLeft -= bytes;
|
bytesLeft -= bytes;
|
||||||
outputSize += encodingLength;
|
outputSize += encodingLength;
|
||||||
} while (encodingLength > 0 && bytes > 0);
|
} while (encodingLength > 0 && bytesLeft > 0);
|
||||||
}
|
}
|
||||||
} while (bytesRead > 0);
|
} while (bytesRead > 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user