diff options
author | Emanuel Schorsch <emschorsch@google.com> | 2021-10-03 17:43:39 -0700 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-10-15 09:59:16 +0200 |
commit | 88375fd36899d21d3309cf8333712e02a87d3a91 (patch) | |
tree | a284b86cb99043d271dc8e216f95e02e61ea1b8b | |
parent | 8c55fc357cf0bb0608be23098b9d3d565dae2b48 (diff) |
NoOp refactor to make elif clearer
Change-Id: I05be42fde3f2b66d20c337583d8f8f92143bcb58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123032
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | sal/rtl/bootstrap.cxx | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx index 4f7a827fd77b..fc551c8ce933 100644 --- a/sal/rtl/bootstrap.cxx +++ b/sal/rtl/bootstrap.cxx @@ -905,10 +905,26 @@ OUString expandMacros( seg[j] = expandMacros(file, seg[j], mode, requestStack); } + if (n == 3 && seg[0] != ".override" && seg[1].isEmpty()) + { + // For backward compatibility, treat ${file::key} the + // same as just ${file:key}: + seg[1] = seg[2]; + n = 2; + } + if (n == 1) { buf.append(lookup(file, mode, false, seg[0], requestStack)); } + else if (n == 2) + { + buf.append( + lookup( + static_cast< Bootstrap_Impl * >( + rtl::Bootstrap(seg[0]).getHandle()), + mode, false, seg[1], requestStack)); + } else if (n == 3 && seg[0] == ".override") { rtl::Bootstrap b(seg[1]); @@ -917,38 +933,19 @@ OUString expandMacros( } else { - if (n == 3 && seg[1].isEmpty()) - { - // For backward compatibility, treat ${file::key} the - // same as just ${file:key}: - seg[1] = seg[2]; - n = 2; - } - - if (n == 2) - { - buf.append( - lookup( - static_cast< Bootstrap_Impl * >( - rtl::Bootstrap(seg[0]).getHandle()), - mode, false, seg[1], requestStack)); - } - else - { - // Going through osl::Profile, this code erroneously - // does not recursively expand macros in the resulting - // replacement text (and if it did, it would fail to - // detect cycles that pass through here): - buf.append( - OStringToOUString( - osl::Profile(seg[0]).readString( - OUStringToOString( - seg[1], RTL_TEXTENCODING_UTF8), - OUStringToOString( - seg[2], RTL_TEXTENCODING_UTF8), - OString()), - RTL_TEXTENCODING_UTF8)); - } + // Going through osl::Profile, this code erroneously + // does not recursively expand macros in the resulting + // replacement text (and if it did, it would fail to + // detect cycles that pass through here): + buf.append( + OStringToOUString( + osl::Profile(seg[0]).readString( + OUStringToOString( + seg[1], RTL_TEXTENCODING_UTF8), + OUStringToOString( + seg[2], RTL_TEXTENCODING_UTF8), + OString()), + RTL_TEXTENCODING_UTF8)); } } else |