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

Commit 35eaa661 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Use String8/16 c_str" into main am: 5af8505e am: 5accccc4 am: 83ab214b am: 093158d7

parents 747bb66d 093158d7
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -66,10 +66,10 @@ public:
         * executing boot class Java code and thereby deny ourselves access to
         * non-boot classes.
         */
        char* slashClassName = toSlashClassName(mClassName.string());
        char* slashClassName = toSlashClassName(mClassName.c_str());
        mClass = env->FindClass(slashClassName);
        if (mClass == NULL) {
            ALOGE("ERROR: could not find class '%s'\n", mClassName.string());
            ALOGE("ERROR: could not find class '%s'\n", mClassName.c_str());
        }
        free(slashClassName);

@@ -179,7 +179,7 @@ int main(int argc, char* const argv[])
        argv_String.append(argv[i]);
        argv_String.append("\" ");
      }
      ALOGV("app_process main with argv: %s", argv_String.string());
      ALOGV("app_process main with argv: %s", argv_String.c_str());
    }

    AppRuntime runtime(argv[0], computeArgBlockSize(argc, argv));
@@ -300,7 +300,7 @@ int main(int argc, char* const argv[])
            restOfArgs.append(argv_new[k]);
            restOfArgs.append("\" ");
          }
          ALOGV("Class name = %s, args = %s", className.string(), restOfArgs.string());
          ALOGV("Class name = %s, args = %s", className.c_str(), restOfArgs.c_str());
        }
    } else {
        // We're in zygote mode.
@@ -329,7 +329,7 @@ int main(int argc, char* const argv[])
    }

    if (!niceName.empty()) {
        runtime.setArgv0(niceName.string(), true /* setProcName */);
        runtime.setArgv0(niceName.c_str(), true /* setProcName */);
    }

    if (zygote) {
+8 −8
Original line number Diff line number Diff line
@@ -1135,7 +1135,7 @@ bool BootAnimation::parseAnimationDesc(Animation& animation) {
    if (!readFile(animation.zip, "desc.txt", desString)) {
        return false;
    }
    char const* s = desString.string();
    char const* s = desString.c_str();
    std::string dynamicColoringPartName = "";
    bool postDynamicColoring = false;

@@ -1144,7 +1144,7 @@ bool BootAnimation::parseAnimationDesc(Animation& animation) {
        const char* endl = strstr(s, "\n");
        if (endl == nullptr) break;
        String8 line(s, endl - s);
        const char* l = line.string();
        const char* l = line.c_str();
        int fps = 0;
        int width = 0;
        int height = 0;
@@ -1328,7 +1328,7 @@ bool BootAnimation::preloadZip(Animation& animation) {

    // If there is trimData present, override the positioning defaults.
    for (Animation::Part& part : animation.parts) {
        const char* trimDataStr = part.trimData.string();
        const char* trimDataStr = part.trimData.c_str();
        for (size_t frameIdx = 0; frameIdx < part.frames.size(); frameIdx++) {
            const char* endl = strstr(trimDataStr, "\n");
            // No more trimData for this part.
@@ -1336,7 +1336,7 @@ bool BootAnimation::preloadZip(Animation& animation) {
                break;
            }
            String8 line(trimDataStr, endl - trimDataStr);
            const char* lineStr = line.string();
            const char* lineStr = line.c_str();
            trimDataStr = ++endl;
            int width = 0, height = 0, x = 0, y = 0;
            if (sscanf(lineStr, "%dx%d+%d+%d", &width, &height, &x, &y) == 4) {
@@ -1564,7 +1564,7 @@ bool BootAnimation::playAnimation(const Animation& animation) {
                    1.0f);

            ALOGD("Playing files = %s/%s, Requested repeat = %d, playUntilComplete = %s",
                    animation.fileName.string(), part.path.string(), part.count,
                    animation.fileName.c_str(), part.path.c_str(), part.count,
                    part.playUntilComplete ? "true" : "false");

            // For the last animation, if we have progress indicator from
@@ -1785,17 +1785,17 @@ void BootAnimation::releaseAnimation(Animation* animation) const {
BootAnimation::Animation* BootAnimation::loadAnimation(const String8& fn) {
    if (mLoadedFiles.indexOf(fn) >= 0) {
        SLOGE("File \"%s\" is already loaded. Cyclic ref is not allowed",
            fn.string());
            fn.c_str());
        return nullptr;
    }
    ZipFileRO *zip = ZipFileRO::open(fn);
    if (zip == nullptr) {
        SLOGE("Failed to open animation zip \"%s\": %s",
            fn.string(), strerror(errno));
            fn.c_str(), strerror(errno));
        return nullptr;
    }

    ALOGD("%s is loaded successfully", fn.string());
    ALOGD("%s is loaded successfully", fn.c_str());

    Animation *animation =  new Animation;
    animation->fileName = fn;
+5 −5
Original line number Diff line number Diff line
@@ -83,8 +83,8 @@ StatusListener::onReportSectionStatus(int32_t section, int32_t status)
Status
StatusListener::onReportServiceStatus(const String16& service, int32_t status)
{
    fprintf(stderr, "service '%s' status %d\n", String8(service).string(), status);
    ALOGD("service '%s' status %d\n", String8(service).string(), status);
    fprintf(stderr, "service '%s' status %d\n", String8(service).c_str(), status);
    ALOGD("service '%s' status %d\n", String8(service).c_str(), status);
    return Status::ok();
}

@@ -384,7 +384,7 @@ main(int argc, char** argv)
        status = service->reportIncidentToStream(args, listener, std::move(writeEnd));

        if (!status.isOk()) {
            fprintf(stderr, "reportIncident returned \"%s\"\n", status.toString8().string());
            fprintf(stderr, "reportIncident returned \"%s\"\n", status.toString8().c_str());
            return 1;
        }

@@ -396,14 +396,14 @@ main(int argc, char** argv)
        sp<StatusListener> listener(new StatusListener());
        status = service->reportIncidentToDumpstate(std::move(writeEnd), listener);
        if (!status.isOk()) {
            fprintf(stderr, "reportIncident returned \"%s\"\n", status.toString8().string());
            fprintf(stderr, "reportIncident returned \"%s\"\n", status.toString8().c_str());
            return 1;
        }
        return listener->getExitCodeOrElse(stream_output(fds[0], STDOUT_FILENO));
    } else {
        status = service->reportIncident(args);
        if (!status.isOk()) {
            fprintf(stderr, "reportIncident returned \"%s\"\n", status.toString8().string());
            fprintf(stderr, "reportIncident returned \"%s\"\n", status.toString8().c_str());
            return 1;
        } else {
            return 0;
+4 −4
Original line number Diff line number Diff line
@@ -27,11 +27,11 @@ status_t NoopParser::Parse(const int in, const int out) const
{
    string content;
    if (!ReadFdToString(in, &content)) {
        fprintf(stderr, "[%s]Failed to read data from incidentd\n", this->name.string());
        fprintf(stderr, "[%s]Failed to read data from incidentd\n", this->name.c_str());
        return -1;
    }
    if (!WriteStringToFd(content, out)) {
        fprintf(stderr, "[%s]Failed to write data to incidentd\n", this->name.string());
        fprintf(stderr, "[%s]Failed to write data to incidentd\n", this->name.c_str());
        return -1;
    }
    return NO_ERROR;
@@ -42,13 +42,13 @@ status_t ReverseParser::Parse(const int in, const int out) const
{
    string content;
    if (!ReadFdToString(in, &content)) {
        fprintf(stderr, "[%s]Failed to read data from incidentd\n", this->name.string());
        fprintf(stderr, "[%s]Failed to read data from incidentd\n", this->name.c_str());
        return -1;
    }
    // reverse the content
    reverse(content.begin(), content.end());
    if (!WriteStringToFd(content, out)) {
        fprintf(stderr, "[%s]Failed to write data to incidentd\n", this->name.string());
        fprintf(stderr, "[%s]Failed to write data to incidentd\n", this->name.c_str());
        return -1;
    }
    return NO_ERROR;
+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ int main(int argc, char** argv) {
    fprintf(stderr, "Pasring section %d...\n", sectionID);
    TextParserBase* parser = selectParser(sectionID);
    if (parser != nullptr) {
        fprintf(stderr, "Running parser: %s\n", parser->name.string());
        fprintf(stderr, "Running parser: %s\n", parser->name.c_str());
        status_t err = parser->Parse(STDIN_FILENO, STDOUT_FILENO);
        if (err != NO_ERROR) {
            fprintf(stderr, "Parse error in section %d: %s\n", sectionID, strerror(-err));
Loading