[Libreoffice-commits] core.git: hwpfilter/source
Noel Grandin
noel at peralex.com
Fri Jun 24 09:42:24 UTC 2016
hwpfilter/source/formula.cxx | 78 ++++++++++++++++++++-----------------------
hwpfilter/source/formula.h | 2 -
hwpfilter/source/hgzip.cxx | 29 +--------------
hwpfilter/source/hgzip.h | 8 ----
4 files changed, 39 insertions(+), 78 deletions(-)
New commits:
commit 6247ff3fed5373a0079f899e816743909d0a62f8
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 24 11:41:00 2016 +0200
loplugin:singlevalfields in hwpfilter
Change-Id: I53adaca40f0cce6c155f3e35e92809dc6b2a4ab9
diff --git a/hwpfilter/source/formula.cxx b/hwpfilter/source/formula.cxx
index 3b114f7..9419228 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;
diff --git a/hwpfilter/source/formula.h b/hwpfilter/source/formula.h
index 7d371ec..9ca8469 100644
--- a/hwpfilter/source/formula.h
+++ b/hwpfilter/source/formula.h
@@ -38,7 +38,6 @@ public:
: pList(nullptr)
{
eq = _eq;
- isHwpEQ = 1;
trim();
}
virtual ~Formula(){ }
@@ -77,7 +76,6 @@ private:
Reference< XAttributeList > rList;
AttributeListImpl *pList;
char *eq;
- int isHwpEQ;
};
#endif
diff --git a/hwpfilter/source/hgzip.cxx b/hwpfilter/source/hgzip.cxx
index 24b58d3..53ec16b 100644
--- a/hwpfilter/source/hgzip.cxx
+++ b/hwpfilter/source/hgzip.cxx
@@ -65,14 +65,13 @@ gz_stream *gz_open(HStream & _stream)
s->stream.zfree = nullptr;
s->stream.opaque = nullptr;
s->stream.next_in = s->inbuf = Z_NULL;
- s->stream.next_out = s->outbuf = Z_NULL;
+ s->stream.next_out = Z_NULL;
s->stream.avail_in = s->stream.avail_out = 0;
//s->_inputstream = NULL;
s->z_err = Z_OK;
s->z_eof = 0;
s->crc = crc32(0L, Z_NULL, 0);
s->msg = nullptr;
- s->transparent = 0;
s->mode = 'r';
@@ -142,7 +141,6 @@ local int destroy(gz_stream * s)
err = s->z_err;
TRYFREE(s->inbuf);
- TRYFREE(s->outbuf);
TRYFREE(s);
return err;
}
@@ -173,29 +171,6 @@ int gz_read(gz_stream * file, voidp buf, unsigned len)
while (s->stream.avail_out != 0)
{
- if (s->transparent)
- {
-/* Copy first the lookahead bytes: */
- uInt n = s->stream.avail_in;
-
- if (n > s->stream.avail_out)
- n = s->stream.avail_out;
- if (n > 0)
- {
- memcpy(s->stream.next_out, s->stream.next_in, n);
- next_out += n;
- s->stream.next_out = next_out;
- s->stream.next_in += n;
- s->stream.avail_out -= n;
- s->stream.avail_in -= n;
- }
- if (s->stream.avail_out > 0)
- {
- s->stream.avail_out -=
- s->_inputstream->readBytes(next_out, s->stream.avail_out);
- }
- return (int) (len - s->stream.avail_out);
- }
if (s->stream.avail_in == 0 && !s->z_eof)
{
@@ -261,7 +236,7 @@ int gz_flush(gz_stream * file, int flush)
return Z_ERRNO;
}
*/
- s->stream.next_out = s->outbuf;
+ s->stream.next_out = nullptr;
s->stream.avail_out = Z_BUFSIZE;
}
if (done)
diff --git a/hwpfilter/source/hgzip.h b/hwpfilter/source/hgzip.h
index 140146c..4cff263 100644
--- a/hwpfilter/source/hgzip.h
+++ b/hwpfilter/source/hgzip.h
@@ -46,10 +46,6 @@ struct gz_stream
*/
Byte *inbuf;
/**
- * Output buffer
- */
- Byte *outbuf;
-/**
* Crc32 of uncompressed data
*/
uLong crc;
@@ -58,10 +54,6 @@ struct gz_stream
*/
char *msg;
/**
- * It becomes one when the input file type is not gz file
- */
- int transparent;
-/**
* 'w' or 'r'
*/
char mode;
More information about the Libreoffice-commits
mailing list