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

Commit a3316601 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Use String8/16 c_str [media]" into main

parents 5b401d3b 09977ff1
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ float TextRenderer::computeScaledStringWidth(const String8& str8) const {
    // just convert to char* -- but String8 doesn't document what it does
    // with values outside 0-255.  So just convert to char* and use strlen()
    // to see what we get.
    const char* str = str8.string();
    const char* str = str8.c_str();
    return computeScaledStringWidth(str, strlen(str));
}

@@ -180,13 +180,13 @@ float TextRenderer::computeScaledStringWidth(const char* str,

void TextRenderer::drawString(const Program& program, const float* texMatrix,
        float x, float y, const String8& str8) const {
    ALOGV("drawString %.3f,%.3f '%s' (scale=%.3f)", x, y, str8.string(),mScale);
    ALOGV("drawString %.3f,%.3f '%s' (scale=%.3f)", x, y, str8.c_str(),mScale);
    initOnce();

    // We want to draw the entire string with a single GLES call.  We
    // generate two arrays, one with screen coordinates, one with texture
    // coordinates.  Need two triangles per character.
    const char* str = str8.string();
    const char* str = str8.c_str();
    size_t len = strlen(str);       // again, unsure about String8 handling

    const size_t quadCoords =
@@ -252,7 +252,7 @@ void TextRenderer::drawString(const Program& program, const float* texMatrix,

float TextRenderer::drawWrappedString(const Program& texRender,
        float xpos, float ypos, const String8& str) {
    ALOGV("drawWrappedString %.3f,%.3f '%s'", xpos, ypos, str.string());
    ALOGV("drawWrappedString %.3f,%.3f '%s'", xpos, ypos, str.c_str());
    initOnce();

    if (mScreenWidth == 0 || mScreenHeight == 0) {
@@ -283,7 +283,7 @@ float TextRenderer::drawWrappedString(const Program& texRender,
    } else {
        // We need to break the string into pieces, ideally at whitespace
        // boundaries.
        char* mangle = strdup(str.string());
        char* mangle = strdup(str.c_str());
        char* start = mangle;
        while (start != NULL) {
            float xposAdj = (start == mangle) ? xpos : xpos + indentWidth;
+1 −1
Original line number Diff line number Diff line
@@ -989,7 +989,7 @@ static status_t notifyMediaScanner(const char* fileName) {
            "-a",
            "android.intent.action.MEDIA_SCANNER_SCAN_FILE",
            "-d",
            fileUrl.string(),
            fileUrl.c_str(),
            NULL
    };
    if (gVerbose) {
+3 −3
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ static void displayAVCProfileLevelIfPossible(const sp<MetaData>& meta) {
}

static void dumpSource(const sp<MediaSource> &source, const String8 &filename) {
    FILE *out = fopen(filename.string(), "wb");
    FILE *out = fopen(filename.c_str(), "wb");

    CHECK_EQ((status_t)OK, source->start());

@@ -538,9 +538,9 @@ static void writeSourcesToMP4(
        Vector<sp<MediaSource> > &sources, bool syncInfoPresent) {
#if 0
    sp<MPEG4Writer> writer =
        new MPEG4Writer(gWriteMP4Filename.string());
        new MPEG4Writer(gWriteMP4Filename.c_str());
#else
    int fd = open(gWriteMP4Filename.string(), O_CREAT | O_LARGEFILE | O_TRUNC | O_RDWR, S_IRUSR | S_IWUSR);
    int fd = open(gWriteMP4Filename.c_str(), O_CREAT | O_LARGEFILE | O_TRUNC | O_RDWR, S_IRUSR | S_IWUSR);
    if (fd < 0) {
        fprintf(stderr, "couldn't open file");
        return;
+2 −2
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ bool DrmSupportInfo::isSupportedMimeType(const String8& mimeType) const {
    for (size_t i = 0; i < mMimeTypeVector.size(); i++) {
        const String8 item = mMimeTypeVector.itemAt(i);

        if (!strcasecmp(item.string(), mimeType.string())) {
        if (!strcasecmp(item.c_str(), mimeType.c_str())) {
            return true;
        }
    }
@@ -61,7 +61,7 @@ bool DrmSupportInfo::isSupportedFileSuffix(const String8& fileType) const {
    for (size_t i = 0; i < mFileSuffixVector.size(); i++) {
        const String8 item = mFileSuffixVector.itemAt(i);

        if (!strcasecmp(item.string(), fileType.string())) {
        if (!strcasecmp(item.c_str(), fileType.c_str())) {
            return true;
        }
    }
+4 −4
Original line number Diff line number Diff line
@@ -303,8 +303,8 @@ DrmInfo* BpDrmManagerService::acquireDrmInfo(int uniqueId, const DrmInfoRequest*
        const String8 value = drmInforequest->get(key);
        if (key == String8("FileDescriptorKey")) {
            int fd = -1;
            if (sscanf(value.string(), "FileDescriptor[%d]", &fd) != 1) {
                sscanf(value.string(), "%d", &fd);
            if (sscanf(value.c_str(), "FileDescriptor[%d]", &fd) != 1) {
                sscanf(value.c_str(), "%d", &fd);
            }
            data.writeFileDescriptor(fd);
        } else {
@@ -1330,7 +1330,7 @@ status_t BnDrmManagerService::onTransact(
        const String8 mime = data.readString8();

        sp<DecryptHandle> handle
            = openDecryptSession(uniqueId, fd, offset, length, mime.string());
            = openDecryptSession(uniqueId, fd, offset, length, mime.c_str());

        if (NULL != handle.get()) {
            writeDecryptHandleToParcelData(handle.get(), reply);
@@ -1349,7 +1349,7 @@ status_t BnDrmManagerService::onTransact(
        const String8 uri = data.readString8();
        const String8 mime = data.readString8();

        sp<DecryptHandle> handle = openDecryptSession(uniqueId, uri.string(), mime.string());
        sp<DecryptHandle> handle = openDecryptSession(uniqueId, uri.c_str(), mime.c_str());

        if (NULL != handle.get()) {
            writeDecryptHandleToParcelData(handle.get(), reply);
Loading