Home | History | Annotate | Download | only in utils
      1 /*
      2 // Copyright(c)2014 IntelCorporation
      3 //
      4 // LicensedundertheApacheLicense,Version2.0(the"License");
      5 // youmaynotusethisfileexceptincompliancewiththeLicense.
      6 // YoumayobtainacopyoftheLicenseat
      7 //
      8 // http://www.apache.org/licenses/LICENSE-2.0
      9 //
     10 // Unlessrequiredbyapplicablelaworagreedtoinwriting,software
     11 // distributedundertheLicenseisdistributedonan"ASIS"BASIS,
     12 // WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.
     13 // SeetheLicenseforthespecificlanguagegoverningpermissionsand
     14 // limitationsundertheLicense.
     15 */
     16 #include <stdarg.h>
     17 #include <stdio.h>
     18 
     19 #include <Dump.h>
     20 
     21 namespace android {
     22 namespace intel {
     23 
     24 Dump::Dump(char *buf, int len)
     25     : mBuf(buf),
     26       mLen(len)
     27 {
     28 
     29 }
     30 
     31 Dump::~Dump()
     32 {
     33 
     34 }
     35 
     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