1 /*
2 // Copyright (c) 2014 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16 #include <stdarg.h>
17 #include <stdio.h>
18
19 #include <common/utils/Dump.h>
20
21 namespace android {
22 namespace intel {
23
Dump(char * buf,int len)24 Dump::Dump(char *buf, int len)
25 : mBuf(buf),
26 mLen(len)
27 {
28
29 }
30
~Dump()31 Dump::~Dump()
32 {
33
34 }
35
append(const char * fmt,...)36 void Dump::append(const char *fmt, ...)
37 {
38 int len;
39
40 if (!mBuf || !mLen)
41 return;
42
43 va_list ap;
44 va_start(ap, fmt);
45 len = vsnprintf(mBuf, mLen, fmt, ap);
46 va_end(ap);
47
48 mLen -= len;
49 mBuf += len;
50 }
51
52 } // namespace intel
53 } // namespace android
54