Kaydet (Commit) baf04331 authored tarafından Mark Hung's avatar Mark Hung Kaydeden (comit) Michael Stahl

solenv(gcc-wrappers): remove trailing space of includepath

Change-Id: Ic14140f197a2c5e1632fd27cfae38ca4eff9bd8c
Reviewed-on: https://gerrit.libreoffice.org/34562Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
Tested-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst a438651d
...@@ -49,7 +49,7 @@ void setupccenv() { ...@@ -49,7 +49,7 @@ void setupccenv() {
} }
// Set-up include path // Set-up include path
string includepath="INCLUDE=.;"; string includepath="INCLUDE=.";
char* incbuf; char* incbuf;
size_t inclen; size_t inclen;
_dupenv_s(&incbuf,&inclen,"SOLARINC"); _dupenv_s(&incbuf,&inclen,"SOLARINC");
...@@ -61,16 +61,20 @@ void setupccenv() { ...@@ -61,16 +61,20 @@ void setupccenv() {
free(incbuf); free(incbuf);
// 3 = strlen(" -I") // 3 = strlen(" -I")
for(size_t pos=0; pos != string::npos;) { for(size_t pos=0,len=0;pos<inctmp.length();) {
size_t endpos=inctmp.find(" -I",pos+3); size_t endpos=inctmp.find(" -I",pos+1);
size_t len=endpos-pos-3;
if(endpos==string::npos) if(endpos==string::npos)
includepath.append(inctmp,pos+3,endpos); endpos=inctmp.length();
else if(len>0) { len=endpos-pos;
includepath.append(inctmp,pos+3,len);
while(len>0&&inctmp[pos+len-1]==' ')
--len;
if(len>3) {
includepath.append(";"); includepath.append(";");
includepath.append(inctmp,pos+3,len-3);
} }
pos=inctmp.find(" -I",pos+len); pos=endpos;
} }
if(_putenv(includepath.c_str())<0) { if(_putenv(includepath.c_str())<0) {
cerr << "Error: could not export INCLUDE" << endl; cerr << "Error: could not export INCLUDE" << endl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment