From 8762082fa68f4d4b9d4005065a074cc3cfc7e8b8 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 27 Sep 2015 03:09:53 -0700 Subject: Push few filename variables into the deeper scope. --- ldid.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/ldid.cpp b/ldid.cpp index 6207304..12e31ed 100644 --- a/ldid.cpp +++ b/ldid.cpp @@ -1564,28 +1564,29 @@ int main(int argc, char *argv[]) { size_t filei(0), filee(0); _foreach (file, files) try { const char *path(file.c_str()); - const char *base = strrchr(path, '/'); - - std::string dir; - if (base != NULL) - dir.assign(path, base++ - path + 1); - else - base = path; - - const char *name(flag_I ?: base); std::string temp; if (flag_S || flag_r) { Map input(path, O_RDONLY, PROT_READ, MAP_PRIVATE); + std::string dir; + const char *base = strrchr(path, '/'); + + if (base != NULL) + dir.assign(path, base++ - path + 1); + else + base = path; + temp = dir + "." + base + ".cs"; std::filebuf output; _assert(output.open(temp.c_str(), std::ios::out | std::ios::trunc | std::ios::binary) == &output); if (flag_r) resign(input.data(), input.size(), output); - else + else { + const char *name(flag_I ?: base); resign(input.data(), input.size(), output, name, entitlements, key, slots); + } } Map mapping(!temp.empty() ? temp.c_str() : path, flag_T || flag_s); -- cgit v1.2.3-56-ge451