summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-01-19 16:48:45 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-01-19 18:35:32 +0100
commit19de52a0a66323eefd9f82f148ff1751dc6af08e (patch)
tree631992f7cb0aaee34725495bca019b248ee59bc9 /solenv
parent89790beaf8464d890bcb000ee0c784b86732c355 (diff)
Fix processing of first path in SOLARINC
...which does not have a space before the -I, so copying starting at pos+3 dropped the leading character from the path. This was apparently never a problem in practice, as the first path in SOLARINC happens to always be SRCDIR/include, which should not be needed anyway when building external projects with this GCC wrapper on Windows. (So this commit is a change in behavior, making SRCDIR/include available to those external project builds on Windows, but the follow-up commit <https://gerrit.libreoffice.org/c/core/+/128615> "Decouple SRCDIR/include from SOLARINC" will change the behavior back again.) Change-Id: I3f82a83683ed381b791d221fe1da78b9797aea94 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128621 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'solenv')
-rw-r--r--solenv/gcc-wrappers/wrapper.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/solenv/gcc-wrappers/wrapper.cxx b/solenv/gcc-wrappers/wrapper.cxx
index fbf3f5378ae5..c97b57808be9 100644
--- a/solenv/gcc-wrappers/wrapper.cxx
+++ b/solenv/gcc-wrappers/wrapper.cxx
@@ -60,8 +60,11 @@ void setupccenv() {
std::string inctmp(incbuf);
free(incbuf);
- // 3 = strlen(" -I")
+ // 2 = strlen("-I")
for(size_t pos=0,len=0;pos<inctmp.length();) {
+ while (pos != inctmp.length() && inctmp[pos] == ' ') {
+ ++pos;
+ }
size_t endpos=inctmp.find(" -I",pos+1);
if(endpos==std::string::npos)
endpos=inctmp.length();
@@ -70,9 +73,9 @@ void setupccenv() {
while(len>0&&inctmp[pos+len-1]==' ')
--len;
- if(len>3) {
+ if(len>2) {
includepath.append(";");
- includepath.append(inctmp,pos+3,len-3);
+ includepath.append(inctmp,pos+2,len-2);
}
pos=endpos;
}