Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec0472ba authored by Elliott Hughes's avatar Elliott Hughes Committed by Gerrit Code Review
Browse files

Merge "Move AString's StringPrintf out of the way."

parents 16e8d463 a1e8944a
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -332,7 +332,7 @@ status_t SimplePlayer::onPrepare() {


        size_t j = 0;
        size_t j = 0;
        sp<ABuffer> buffer;
        sp<ABuffer> buffer;
        while (format->findBuffer(StringPrintf("csd-%d", j).c_str(), &buffer)) {
        while (format->findBuffer(AStringPrintf("csd-%d", j).c_str(), &buffer)) {
            state->mCSD.push_back(buffer);
            state->mCSD.push_back(buffer);


            ++j;
            ++j;
+1 −1
Original line number Original line Diff line number Diff line
@@ -102,7 +102,7 @@ private:
    void makeMutable();
    void makeMutable();
};
};


AString StringPrintf(const char *format, ...);
AString AStringPrintf(const char *format, ...);


}  // namespace android
}  // namespace android


+2 −2
Original line number Original line Diff line number Diff line
@@ -1685,7 +1685,7 @@ void MediaCodec::extractCSD(const sp<AMessage> &format) {
    size_t i = 0;
    size_t i = 0;
    for (;;) {
    for (;;) {
        sp<ABuffer> csd;
        sp<ABuffer> csd;
        if (!format->findBuffer(StringPrintf("csd-%u", i).c_str(), &csd)) {
        if (!format->findBuffer(AStringPrintf("csd-%u", i).c_str(), &csd)) {
            break;
            break;
        }
        }


@@ -2208,7 +2208,7 @@ status_t MediaCodec::amendOutputFormatWithCodecSpecificData(
            memcpy(csd->data() + 4, nalStart, nalSize);
            memcpy(csd->data() + 4, nalStart, nalSize);


            mOutputFormat->setBuffer(
            mOutputFormat->setBuffer(
                    StringPrintf("csd-%u", csdIndex).c_str(), csd);
                    AStringPrintf("csd-%u", csdIndex).c_str(), csd);


            ++csdIndex;
            ++csdIndex;
        }
        }
+15 −15
Original line number Original line Diff line number Diff line
@@ -426,19 +426,19 @@ AString AMessage::debugString(int32_t indent) const {


    AString tmp;
    AString tmp;
    if (isFourcc(mWhat)) {
    if (isFourcc(mWhat)) {
        tmp = StringPrintf(
        tmp = AStringPrintf(
                "'%c%c%c%c'",
                "'%c%c%c%c'",
                (char)(mWhat >> 24),
                (char)(mWhat >> 24),
                (char)((mWhat >> 16) & 0xff),
                (char)((mWhat >> 16) & 0xff),
                (char)((mWhat >> 8) & 0xff),
                (char)((mWhat >> 8) & 0xff),
                (char)(mWhat & 0xff));
                (char)(mWhat & 0xff));
    } else {
    } else {
        tmp = StringPrintf("0x%08x", mWhat);
        tmp = AStringPrintf("0x%08x", mWhat);
    }
    }
    s.append(tmp);
    s.append(tmp);


    if (mTarget != 0) {
    if (mTarget != 0) {
        tmp = StringPrintf(", target = %d", mTarget);
        tmp = AStringPrintf(", target = %d", mTarget);
        s.append(tmp);
        s.append(tmp);
    }
    }
    s.append(") = {\n");
    s.append(") = {\n");
@@ -448,37 +448,37 @@ AString AMessage::debugString(int32_t indent) const {


        switch (item.mType) {
        switch (item.mType) {
            case kTypeInt32:
            case kTypeInt32:
                tmp = StringPrintf(
                tmp = AStringPrintf(
                        "int32_t %s = %d", item.mName, item.u.int32Value);
                        "int32_t %s = %d", item.mName, item.u.int32Value);
                break;
                break;
            case kTypeInt64:
            case kTypeInt64:
                tmp = StringPrintf(
                tmp = AStringPrintf(
                        "int64_t %s = %lld", item.mName, item.u.int64Value);
                        "int64_t %s = %lld", item.mName, item.u.int64Value);
                break;
                break;
            case kTypeSize:
            case kTypeSize:
                tmp = StringPrintf(
                tmp = AStringPrintf(
                        "size_t %s = %d", item.mName, item.u.sizeValue);
                        "size_t %s = %d", item.mName, item.u.sizeValue);
                break;
                break;
            case kTypeFloat:
            case kTypeFloat:
                tmp = StringPrintf(
                tmp = AStringPrintf(
                        "float %s = %f", item.mName, item.u.floatValue);
                        "float %s = %f", item.mName, item.u.floatValue);
                break;
                break;
            case kTypeDouble:
            case kTypeDouble:
                tmp = StringPrintf(
                tmp = AStringPrintf(
                        "double %s = %f", item.mName, item.u.doubleValue);
                        "double %s = %f", item.mName, item.u.doubleValue);
                break;
                break;
            case kTypePointer:
            case kTypePointer:
                tmp = StringPrintf(
                tmp = AStringPrintf(
                        "void *%s = %p", item.mName, item.u.ptrValue);
                        "void *%s = %p", item.mName, item.u.ptrValue);
                break;
                break;
            case kTypeString:
            case kTypeString:
                tmp = StringPrintf(
                tmp = AStringPrintf(
                        "string %s = \"%s\"",
                        "string %s = \"%s\"",
                        item.mName,
                        item.mName,
                        item.u.stringValue->c_str());
                        item.u.stringValue->c_str());
                break;
                break;
            case kTypeObject:
            case kTypeObject:
                tmp = StringPrintf(
                tmp = AStringPrintf(
                        "RefBase *%s = %p", item.mName, item.u.refValue);
                        "RefBase *%s = %p", item.mName, item.u.refValue);
                break;
                break;
            case kTypeBuffer:
            case kTypeBuffer:
@@ -486,18 +486,18 @@ AString AMessage::debugString(int32_t indent) const {
                sp<ABuffer> buffer = static_cast<ABuffer *>(item.u.refValue);
                sp<ABuffer> buffer = static_cast<ABuffer *>(item.u.refValue);


                if (buffer != NULL && buffer->data() != NULL && buffer->size() <= 64) {
                if (buffer != NULL && buffer->data() != NULL && buffer->size() <= 64) {
                    tmp = StringPrintf("Buffer %s = {\n", item.mName);
                    tmp = AStringPrintf("Buffer %s = {\n", item.mName);
                    hexdump(buffer->data(), buffer->size(), indent + 4, &tmp);
                    hexdump(buffer->data(), buffer->size(), indent + 4, &tmp);
                    appendIndent(&tmp, indent + 2);
                    appendIndent(&tmp, indent + 2);
                    tmp.append("}");
                    tmp.append("}");
                } else {
                } else {
                    tmp = StringPrintf(
                    tmp = AStringPrintf(
                            "Buffer *%s = %p", item.mName, buffer.get());
                            "Buffer *%s = %p", item.mName, buffer.get());
                }
                }
                break;
                break;
            }
            }
            case kTypeMessage:
            case kTypeMessage:
                tmp = StringPrintf(
                tmp = AStringPrintf(
                        "AMessage %s = %s",
                        "AMessage %s = %s",
                        item.mName,
                        item.mName,
                        static_cast<AMessage *>(
                        static_cast<AMessage *>(
@@ -505,7 +505,7 @@ AString AMessage::debugString(int32_t indent) const {
                                indent + strlen(item.mName) + 14).c_str());
                                indent + strlen(item.mName) + 14).c_str());
                break;
                break;
            case kTypeRect:
            case kTypeRect:
                tmp = StringPrintf(
                tmp = AStringPrintf(
                        "Rect %s(%d, %d, %d, %d)",
                        "Rect %s(%d, %d, %d, %d)",
                        item.mName,
                        item.mName,
                        item.u.rectValue.mLeft,
                        item.u.rectValue.mLeft,
+3 −3
Original line number Original line Diff line number Diff line
@@ -187,7 +187,7 @@ ANetworkSession::Session::Session(
        CHECK_GE(res, 0);
        CHECK_GE(res, 0);


        in_addr_t addr = ntohl(localAddr.sin_addr.s_addr);
        in_addr_t addr = ntohl(localAddr.sin_addr.s_addr);
        AString localAddrString = StringPrintf(
        AString localAddrString = AStringPrintf(
                "%d.%d.%d.%d",
                "%d.%d.%d.%d",
                (addr >> 24),
                (addr >> 24),
                (addr >> 16) & 0xff,
                (addr >> 16) & 0xff,
@@ -195,7 +195,7 @@ ANetworkSession::Session::Session(
                addr & 0xff);
                addr & 0xff);


        addr = ntohl(remoteAddr.sin_addr.s_addr);
        addr = ntohl(remoteAddr.sin_addr.s_addr);
        AString remoteAddrString = StringPrintf(
        AString remoteAddrString = AStringPrintf(
                "%d.%d.%d.%d",
                "%d.%d.%d.%d",
                (addr >> 24),
                (addr >> 24),
                (addr >> 16) & 0xff,
                (addr >> 16) & 0xff,
@@ -301,7 +301,7 @@ status_t ANetworkSession::Session::readMore() {
                uint32_t ip = ntohl(remoteAddr.sin_addr.s_addr);
                uint32_t ip = ntohl(remoteAddr.sin_addr.s_addr);
                notify->setString(
                notify->setString(
                        "fromAddr",
                        "fromAddr",
                        StringPrintf(
                        AStringPrintf(
                            "%u.%u.%u.%u",
                            "%u.%u.%u.%u",
                            ip >> 24,
                            ip >> 24,
                            (ip >> 16) & 0xff,
                            (ip >> 16) & 0xff,
Loading