summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2015-09-27 03:09:53 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2015-09-27 03:09:53 -0700
commit8762082fa68f4d4b9d4005065a074cc3cfc7e8b8 (patch)
tree3b7abdf8c06f01f7a3c099006a0a8a4f806cbe29
parente57b1f91c2669a5fbc872db6ccd87a4cc6be6e6e (diff)
downloadldid-8762082fa68f4d4b9d4005065a074cc3cfc7e8b8.tar.gz
ldid-8762082fa68f4d4b9d4005065a074cc3cfc7e8b8.tar.zst
ldid-8762082fa68f4d4b9d4005065a074cc3cfc7e8b8.zip
Push few filename variables into the deeper scope.
-rw-r--r--ldid.cpp21
1 files 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);