diff options
author | Noel Grandin <noel@peralex.com> | 2016-06-24 11:41:00 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-06-24 11:41:00 +0200 |
commit | 6247ff3fed5373a0079f899e816743909d0a62f8 (patch) | |
tree | c997243fac3dd5b17b653b0c4a32c48c2c21e935 /hwpfilter/source/formula.cxx | |
parent | loplugin:singlevalfields in codemaker (diff) | |
download | core-6247ff3fed5373a0079f899e816743909d0a62f8.tar.gz core-6247ff3fed5373a0079f899e816743909d0a62f8.zip |
loplugin:singlevalfields in hwpfilter
Change-Id: I53adaca40f0cce6c155f3e35e92809dc6b2a4ab9
Diffstat (limited to 'hwpfilter/source/formula.cxx')
-rw-r--r-- | hwpfilter/source/formula.cxx | 78 |
1 files changed, 37 insertions, 41 deletions
diff --git a/hwpfilter/source/formula.cxx b/hwpfilter/source/formula.cxx index 3b114f783f72..941922845080 100644 --- a/hwpfilter/source/formula.cxx +++ b/hwpfilter/source/formula.cxx @@ -571,57 +571,53 @@ void Formula::parse() { Node *res = nullptr; if( !eq ) return; - if( isHwpEQ ){ - MzString a; - // fprintf(stderr,"\n\n[BEFORE]\n[%s]\n",eq); - eq2latex(a,eq); - - int idx=a.find(sal::static_int_cast<char>(0xff)); - while(idx){ - //printf("idx = [%d]\n",idx); - a.replace(idx,0x20); - if((idx = a.find(sal::static_int_cast<char>(0xff),idx+1)) < 0) - break; - } - char *buf = static_cast<char *>(malloc(a.length()+1)); - bool bStart = false; - int i, j; - for( i = 0, j=0 ; i < a.length() ; i++){ // rtrim and ltrim 32 10 13 - if( bStart ){ + MzString a; + // fprintf(stderr,"\n\n[BEFORE]\n[%s]\n",eq); + eq2latex(a,eq); + + int idx=a.find(sal::static_int_cast<char>(0xff)); + while(idx){ + //printf("idx = [%d]\n",idx); + a.replace(idx,0x20); + if((idx = a.find(sal::static_int_cast<char>(0xff),idx+1)) < 0) + break; + } + + char *buf = static_cast<char *>(malloc(a.length()+1)); + bool bStart = false; + int i, j; + for( i = 0, j=0 ; i < a.length() ; i++){ // rtrim and ltrim 32 10 13 + if( bStart ){ + buf[j++] = a[i]; + } + else{ + if( a[i] != 32 && a[i] != 10 && a[i] != 13){ + bStart = true; buf[j++] = a[i]; } - else{ - if( a[i] != 32 && a[i] != 10 && a[i] != 13){ - bStart = true; - buf[j++] = a[i]; - } - } - } - buf[j] = 0; - for( i = j-1 ; i >= 0 ; i++ ){ - if( buf[i] == 32 || buf[i] == 10 || buf[i] == 13 ){ - buf[i] = 0; - } - else - break; - } - // fprintf(stderr,"\n\n[RESULT]\n[%s]\n",a.c_str()); - if( buf[0] != '\0' ) - res = mainParse( a.c_str() ); - else - res = nullptr; - free(buf); + } } - else{ - res = mainParse( eq ); + buf[j] = 0; + for( i = j-1 ; i >= 0 ; i++ ){ + if( buf[i] == 32 || buf[i] == 10 || buf[i] == 13 ){ + buf[i] = 0; + } + else + break; } + // fprintf(stderr,"\n\n[RESULT]\n[%s]\n",a.c_str()); + if( buf[0] != '\0' ) + res = mainParse( a.c_str() ); + else + res = nullptr; + free(buf); if( res ){ makeMathML( res ); } int count = nodelist.size(); - for( int i = 0 ; i < count ; i++ ){ + for( i = 0 ; i < count ; i++ ){ const Node *tmpNode = nodelist.front(); nodelist.pop_front(); delete tmpNode; |