remove trailing white spaces and a commented code line
Test: mma
Change-Id: Ie2b8605066dcbc58bc78beb00301b3b4e5e87a5c
diff --git a/BufferedTextOutput.cpp b/BufferedTextOutput.cpp
index 8252994..36f212b 100644
--- a/BufferedTextOutput.cpp
+++ b/BufferedTextOutput.cpp
@@ -47,7 +47,7 @@
~BufferState() {
free(buffer);
}
-
+
status_t append(const char* txt, size_t len) {
if ((len+bufferPos) > bufferSize) {
size_t newSize = ((len+bufferPos)*3)/2;
@@ -62,7 +62,7 @@
bufferPos += len;
return NO_ERROR;
}
-
+
void restart() {
bufferPos = 0;
atFront = true;
@@ -74,7 +74,7 @@
}
}
}
-
+
const int32_t seq;
char* buffer;
size_t bufferPos;
@@ -114,9 +114,9 @@
static int32_t allocBufferIndex()
{
int32_t res = -1;
-
+
mutex_lock(&gMutex);
-
+
if (gFreeBufferIndex >= 0) {
res = gFreeBufferIndex;
gFreeBufferIndex = gTextBuffers[res];
@@ -128,7 +128,7 @@
}
mutex_unlock(&gMutex);
-
+
return res;
}
@@ -150,7 +150,7 @@
mGlobalState = new BufferState(mSeq);
if (mGlobalState) mGlobalState->incStrong(this);
}
-
+
BufferedTextOutput::~BufferedTextOutput()
{
if (mGlobalState) mGlobalState->decStrong(this);
@@ -159,23 +159,19 @@
status_t BufferedTextOutput::print(const char* txt, size_t len)
{
- //printf("BufferedTextOutput: printing %d\n", len);
-
AutoMutex _l(mLock);
BufferState* b = getBuffer();
-
const char* const end = txt+len;
-
status_t err;
while (txt < end) {
// Find the next line.
const char* first = txt;
while (txt < end && *txt != '\n') txt++;
-
+
// Include this and all following empty lines.
while (txt < end && *txt == '\n') txt++;
-
+
// Special cases for first data on a line.
if (b->atFront) {
if (b->indent > 0) {
@@ -183,12 +179,11 @@
const char* prefix = stringForIndent(b->indent);
err = b->append(prefix, strlen(prefix));
if (err != NO_ERROR) return err;
-
} else if (*(txt-1) == '\n' && !b->bundle) {
// Fast path: if we are not indenting or bundling, and
// have been given one or more complete lines, just write
// them out without going through the buffer.
-
+
// Slurp up all of the lines.
const char* lastLine = txt+1;
while (txt < end) {
@@ -203,12 +198,12 @@
continue;
}
}
-
+
// Append the new text to the buffer.
err = b->append(first, txt-first);
if (err != NO_ERROR) return err;
b->atFront = *(txt-1) == '\n';
-
+
// If we have finished a line and are not bundling, write
// it out.
//printf("Buffer is now %d bytes\n", b->bufferPos);
@@ -221,7 +216,7 @@
b->restart();
}
}
-
+
return NO_ERROR;
}
@@ -248,7 +243,7 @@
LOG_FATAL_IF(b->bundle < 0,
"TextOutput::popBundle() called more times than pushBundle()");
if (b->bundle < 0) b->bundle = 0;
-
+
if (b->bundle == 0) {
// Last bundle, write out data if it is complete. If it is not
// complete, don't write until the last line is done... this may
@@ -271,13 +266,13 @@
while (ts->states.size() <= (size_t)mIndex) ts->states.add(NULL);
BufferState* bs = ts->states[mIndex].get();
if (bs != NULL && bs->seq == mSeq) return bs;
-
+
ts->states.editItemAt(mIndex) = new BufferState(mIndex);
bs = ts->states[mIndex].get();
if (bs != NULL) return bs;
}
}
-
+
return mGlobalState;
}