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

Commit a1e8944a authored by Elliott Hughes's avatar Elliott Hughes
Browse files

Move AString's StringPrintf out of the way.

We should come back and replace AString with std::string and switch to the
"real" StringPrintf family, but this fixes the ODR violation that was
preventing us from booting.

Bug: 19265750
Change-Id: I798eb9ca5dd634e44625af5e583439ef9f0cdc35
parent 16e8d463
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -332,7 +332,7 @@ status_t SimplePlayer::onPrepare() {

        size_t j = 0;
        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);

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

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

}  // namespace android

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

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

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

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

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

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

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

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

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

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