BHttpRequest: Small fixes

* Allow BString to find a semicolon more efficiently.
 * Replace a dynamic stack allocated array with BStackOrHeapArray
   in one more place.
This commit is contained in:
Stephan Aßmus
2014-02-13 10:12:55 +01:00
parent 3e358c1fca
commit 6aeaeade6b
+3 -4
View File
@@ -652,7 +652,7 @@ BHttpRequest::_MakeRequest()
} else {
// Format of a chunk header:
// <chunk size in hex>[; optional data]
int32 semiColonIndex = chunkHeader.FindFirst(";", 0);
int32 semiColonIndex = chunkHeader.FindFirst(';', 0);
// Cut-off optional data if present
if (semiColonIndex != -1) {
@@ -670,8 +670,7 @@ BHttpRequest::_MakeRequest()
}
}
// A chunk of 0 bytes indicates the end of the chunked
// transfer
// A chunk of 0 bytes indicates the end of the chunked transfer
if (bytesRead == 0)
receiveEnd = true;
} else {
@@ -719,7 +718,7 @@ BHttpRequest::_MakeRequest()
if (decompress) {
decompressor.Finish();
ssize_t size = decompressorStorage.Size();
char buffer[size];
BStackOrHeapArray<char, 4096> buffer(size);
size = decompressorStorage.Read(buffer, size);
if (fListener != NULL && size > 0) {
fListener->DataReceived(this, buffer, size);