summaryrefslogtreecommitdiffstats
path: root/simulator/app/LogMessage.cpp
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-03 18:28:16 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-03 18:28:16 -0800
commitd4aee0c0caa00aa02d4c50ed28151591ac0456b5 (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904 /simulator/app/LogMessage.cpp
parentd2f2b1d7b77d06bce8cf9340171cf6c25cd720c4 (diff)
downloadandroid_development-d4aee0c0caa00aa02d4c50ed28151591ac0456b5.tar.gz
android_development-d4aee0c0caa00aa02d4c50ed28151591ac0456b5.tar.bz2
android_development-d4aee0c0caa00aa02d4c50ed28151591ac0456b5.zip
auto import from //depot/cupcake/@135843
Diffstat (limited to 'simulator/app/LogMessage.cpp')
-rw-r--r--simulator/app/LogMessage.cpp98
1 files changed, 0 insertions, 98 deletions
diff --git a/simulator/app/LogMessage.cpp b/simulator/app/LogMessage.cpp
deleted file mode 100644
index 63cb76445..000000000
--- a/simulator/app/LogMessage.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-//
-// Copyright 2005 The Android Open Source Project
-//
-// Hold a single log message.
-//
-#include "LogMessage.h"
-#include <assert.h>
-
-/*
- * Constructor.
- *
- * Initializers here aren't necessary, since we can only create one of
- * these through Create(), which touches every field.
- */
-LogMessage::LogMessage(void)
-{
-}
-
-/*
- * Destructor.
- */
-LogMessage::~LogMessage(void)
-{
- delete[] mTag;
- delete[] mMsg;
-}
-
-/*
- * Create a new LogMessage object, and populate it with the contents of
- * "*pBundle".
- */
-/*static*/ LogMessage* LogMessage::Create(const android_LogBundle* pBundle)
-{
- LogMessage* newMsg = new LogMessage;
-
- if (newMsg == NULL)
- return NULL;
- assert(pBundle != NULL);
-
- newMsg->mWhen = pBundle->when;
- newMsg->mPriority = pBundle->priority;
- newMsg->mPid = pBundle->pid;
- newMsg->mTag = android::strdupNew(pBundle->tag);
-
- size_t len = 0;
- size_t i;
- for (i=0; i<pBundle->msgCount; i++) len += pBundle->msgVec[i].iov_len;
- newMsg->mMsg = new char[len+1];
- char* p = newMsg->mMsg;
- for (i=0; i<pBundle->msgCount; i++) {
- memcpy(p, pBundle->msgVec[i].iov_base, pBundle->msgVec[i].iov_len);
- p += pBundle->msgVec[i].iov_len;
- }
- *p = 0;
-
- newMsg->mRefCnt = 1;
- newMsg->mInternal = false;
- newMsg->mFootprint = 8 * sizeof(int) + strlen(newMsg->mTag) +
- strlen(newMsg->mMsg) + 4;
- newMsg->mTextCtrlLen = 0;
- newMsg->mpPrev = NULL;
- newMsg->mpNext = NULL;
-
- return newMsg;
-}
-
-/*
- * Create a new LogMessage object, with a simple message in it.
- *
- * Sets "mInternal" so we display it appropriately.
- */
-/*static*/ LogMessage* LogMessage::Create(const char* msg)
-{
- LogMessage* newMsg;
- android_LogBundle bundle;
-
- assert(msg != NULL);
-
- memset(&bundle, 0, sizeof(bundle));
- bundle.when = time(NULL);
- bundle.priority = ANDROID_LOG_ERROR;
- bundle.pid = getpid();
- bundle.tag = "-";
- iovec iov;
- iov.iov_base = (void*)msg;
- iov.iov_len = strlen(msg);
- bundle.msgVec = &iov;
- bundle.msgCount = 1;
-
- newMsg = Create(&bundle);
-
- if (newMsg != NULL) {
- newMsg->mInternal = true;
- }
-
- return newMsg;
-}
-