[poppler] poppler/Sound.cc

2019-10-30 Thread GitLab Mirror
 poppler/Sound.cc |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 280c096521d92f6c165f53021110828ad0174c12
Author: Albert Astals Cid 
Date:   Wed Oct 30 23:04:09 2019 +0100

Update (C) of previous commits

diff --git a/poppler/Sound.cc b/poppler/Sound.cc
index c42051c8..db74713e 100644
--- a/poppler/Sound.cc
+++ b/poppler/Sound.cc
@@ -1,6 +1,6 @@
 /* Sound.cc - an object that holds the sound structure
  * Copyright (C) 2006-2007, Pino Toscano 
- * Copyright (C) 2009, 2017, 2018, Albert Astals Cid 
+ * Copyright (C) 2009, 2017-2019, Albert Astals Cid 
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler

[poppler] qt5/src

2019-10-30 Thread GitLab Mirror
 qt5/src/poppler-annotation-helper.h |  118 
 1 file changed, 118 deletions(-)

New commits:
commit 4c42f03f26dc9ceb31bcd8bf7c290f3bc87fd862
Author: Albert Astals Cid 
Date:   Wed Oct 30 23:01:40 2019 +0100

qt5: remove a bunch of unused internal functions

diff --git a/qt5/src/poppler-annotation-helper.h 
b/qt5/src/poppler-annotation-helper.h
index b1f61bb0..d1d222c6 100644
--- a/qt5/src/poppler-annotation-helper.h
+++ b/qt5/src/poppler-annotation-helper.h
@@ -41,129 +41,11 @@ namespace Poppler {
 class XPDFReader
 {
 public:
-// find named symbol and parse it
-static inline void lookupName( Dict *, char *, QString & dest );
-static inline void lookupString( Dict *, char *, QString & dest );
-static inline void lookupBool( Dict *, char *, bool & dest );
-static inline void lookupInt( Dict *, char *, int & dest );
-static inline void lookupNum( Dict *, char *, double & dest );
-static inline int lookupNumArray( Dict *, char *, double * dest, int 
len );
-static inline void lookupColor( Dict *, char *, QColor & color );
-static inline void lookupIntRef( Dict *, char *, int & dest );
-static inline void lookupDate( Dict *, char *, QDateTime & dest );
 // transform from user coords to normalized ones using the matrix M
 static inline void transform( double * M, double x, double y, QPointF 
 );
 static inline void invTransform( const double * M, const QPointF p, 
double , double  );
 };
 
-void XPDFReader::lookupName( Dict * dict, char * type, QString & dest )
-{
-Object nameObj = dict->lookup( type );
-if ( nameObj.isNull() )
-return;
-if ( nameObj.isName() )
-dest = nameObj.getName();
-else
-qDebug() << type << " is not Name." << endl;
-}
-
-void XPDFReader::lookupString( Dict * dict, char * type, QString & dest )
-{
-Object stringObj = dict->lookup( type );
-if ( stringObj.isNull() )
-return;
-if ( stringObj.isString() )
-dest = stringObj.getString()->c_str();
-else
-qDebug() << type << " is not String." << endl;
-}
-
-void XPDFReader::lookupBool( Dict * dict, char * type, bool & dest )
-{
-Object boolObj = dict->lookup( type );
-if ( boolObj.isNull() )
-return;
-if ( boolObj.isBool() )
-dest = boolObj.getBool() == true;
-else
-qDebug() << type << " is not Bool." << endl;
-}
-
-void XPDFReader::lookupInt( Dict * dict, char * type, int & dest )
-{
-Object intObj = dict->lookup( type );
-if ( intObj.isNull() )
-return;
-if ( intObj.isInt() )
-dest = intObj.getInt();
-else
-qDebug() << type << " is not Int." << endl;
-}
-
-void XPDFReader::lookupNum( Dict * dict, char * type, double & dest )
-{
-Object numObj = dict->lookup( type );
-if ( numObj.isNull() )
-return;
-if ( numObj.isNum() )
-dest = numObj.getNum();
-else
-qDebug() << type << " is not Num." << endl;
-}
-
-int XPDFReader::lookupNumArray( Dict * dict, char * type, double * dest, int 
len )
-{
-Object arrObj = dict->lookup( type );
-if ( arrObj.isNull() )
-return 0;
-if ( arrObj.isArray() )
-{
-len = qMin( len, arrObj.arrayGetLength() );
-for ( int i = 0; i < len; i++ )
-{
-Object numObj = arrObj.arrayGet( i );
-dest[i] = numObj.getNum();
-}
-}
-else
-{
-len = 0;
-qDebug() << type << "is not Array." << endl;
-}
-return len;
-}
-
-void XPDFReader::lookupColor( Dict * dict, char * type, QColor & dest )
-{
-double c[3];
-if ( XPDFReader::lookupNumArray( dict, type, c, 3 ) == 3 )
-dest = QColor( (int)(c[0]*255.0), (int)(c[1]*255.0), 
(int)(c[2]*255.0));
-}
-
-void XPDFReader::lookupIntRef( Dict * dict, char * type, int & dest )
-{
-const Object  = dict->lookupNF( type );
-if ( refObj.isNull() )
-return;
-if ( refObj.isRef() )
-dest = refObj.getRefNum();
-else
-qDebug() << type << " is not Ref." << endl;
-}
-
-void XPDFReader::lookupDate( Dict * dict, char * type, QDateTime & dest )
-{
-Object dateObj = dict->lookup( type );
-if ( dateObj.isNull() )
-return;
-if ( dateObj.isString() )
-{
-dest = convertDate( dateObj.getString()->c_str() );
-}
-else
-qDebug() << type << " is not Date" << endl;
-}
-
 void XPDFReader::transform( double * M, double x, double y, QPointF  )
 {
 res.setX( M[0] * x + M[2] * y + M[4] );
___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler

[poppler] poppler/Annot.cc poppler/Gfx.cc poppler/GfxState.cc poppler/Object.h poppler/Sound.cc

2019-10-30 Thread GitLab Mirror
 poppler/Annot.cc|   97 +++
 poppler/Gfx.cc  |4 
 poppler/GfxState.cc |  214 +---
 poppler/Object.h|7 +
 poppler/Sound.cc|5 -
 5 files changed, 111 insertions(+), 216 deletions(-)

New commits:
commit 647274f118222cce978b3a79a50ad222d003d133
Author: Albert Astals Cid 
Date:   Sun Oct 27 17:37:58 2019 +0100

Introduce Object::getNumWithDefaultValue

Is like getNum but instead of asserting if Object is not a num it
returns the given default value

I find it much easier to read
rect->x1 = obj1.arrayGet(0).getNumWithDefaultValue(0);
than
(obj2 = obj1.arrayGet(0), obj2.isNum() ? rect->x1 = obj2.getNum() : 
rect->x1 = 0);

On top of it has the benefit of being slightly faster

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 8b718d97..5ce75a8b 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -187,11 +187,10 @@ static AnnotExternalDataType parseAnnotExternalData(Dict* 
dict) {
 static std::unique_ptr parseDiffRectangle(Array *array, 
PDFRectangle *rect) {
   if (array->getLength() == 4) {
 // deltas
-Object obj1;
-double dx1 = (obj1 = array->get(0), obj1.isNum() ? obj1.getNum() : 0);
-double dy1 = (obj1 = array->get(1), obj1.isNum() ? obj1.getNum() : 0);
-double dx2 = (obj1 = array->get(2), obj1.isNum() ? obj1.getNum() : 0);
-double dy2 = (obj1 = array->get(3), obj1.isNum() ? obj1.getNum() : 0);
+const double dx1 = array->get(0).getNumWithDefaultValue(0);
+const double dy1 = array->get(1).getNumWithDefaultValue(0);
+const double dx2 = array->get(2).getNumWithDefaultValue(0);
+const double dy2 = array->get(3).getNumWithDefaultValue(0);
 
 // checking that the numbers are valid (i.e. >= 0),
 // and that applying the differences still give us a valid rect
@@ -260,9 +259,8 @@ AnnotBorderEffect::AnnotBorderEffect(Dict *dict) {
 effectType = borderEffectNoEffect;
   }
 
-  obj1 = dict->lookup("I");
-  if (obj1.isNum() && effectType == borderEffectCloudy) {
-intensity = obj1.getNum();
+  if (effectType == borderEffectCloudy) {
+intensity = dict->lookup("I").getNumWithDefaultValue(0);
   } else {
 intensity = 0;
   }
@@ -844,9 +842,8 @@ AnnotIconFit::AnnotIconFit(Dict* dict) {
 
   obj1 = dict->lookup("A");
   if (obj1.isArray() && obj1.arrayGetLength() == 2) {
-Object obj2;
-(obj2 = obj1.arrayGet(0), obj2.isNum() ? left = obj2.getNum() : left = 0);
-(obj2 = obj1.arrayGet(1), obj2.isNum() ? bottom = obj2.getNum() : bottom = 
0);
+left = obj1.arrayGet(0).getNumWithDefaultValue(0);
+bottom = obj1.arrayGet(1).getNumWithDefaultValue(0);
 
 if (left < 0 || left > 1)
   left = 0.5;
@@ -1185,11 +1182,10 @@ void Annot::initialize(PDFDoc *docA, Dict *dict) {
   rect = std::make_unique();
   obj1 = dict->lookup("Rect");
   if (obj1.isArray() && obj1.arrayGetLength() == 4) {
-Object obj2;
-(obj2 = obj1.arrayGet(0), obj2.isNum() ? rect->x1 = obj2.getNum() : 
rect->x1 = 0);
-(obj2 = obj1.arrayGet(1), obj2.isNum() ? rect->y1 = obj2.getNum() : 
rect->y1 = 0);
-(obj2 = obj1.arrayGet(2), obj2.isNum() ? rect->x2 = obj2.getNum() : 
rect->x2 = 1);
-(obj2 = obj1.arrayGet(3), obj2.isNum() ? rect->y2 = obj2.getNum() : 
rect->y2 = 1);
+rect->x1 = obj1.arrayGet(0).getNumWithDefaultValue(0);
+rect->y1 = obj1.arrayGet(1).getNumWithDefaultValue(0);
+rect->x2 = obj1.arrayGet(2).getNumWithDefaultValue(1);
+rect->y2 = obj1.arrayGet(3).getNumWithDefaultValue(1);
 
 if (rect->x1 > rect->x2) {
   double t = rect->x1;
@@ -1980,12 +1976,7 @@ void AnnotMarkup::initialize(PDFDoc *docA, Dict *dict) {
 popup = std::make_unique(docA, std::move(popupObj), );
   }
 
-  obj1 = dict->lookup("CA");
-  if (obj1.isNum()) {
-opacity = obj1.getNum();
-  } else {
-opacity = 1.0;
-  }
+  opacity = dict->lookup("CA").getNumWithDefaultValue(1.0);
 
   obj1 = dict->lookup("CreationDate");
   if (obj1.isString()) {
@@ -2666,18 +2657,14 @@ void AnnotFreeText::initialize(PDFDoc *docA, Dict 
*dict) {
 
   obj1 = dict->lookup("CL");
   if (obj1.isArray() && obj1.arrayGetLength() >= 4) {
-double x1, y1, x2, y2;
-Object obj2;
-
-(obj2 = obj1.arrayGet(0), obj2.isNum() ? x1 = obj2.getNum() : x1 = 0);
-(obj2 = obj1.arrayGet(1), obj2.isNum() ? y1 = obj2.getNum() : y1 = 0);
-(obj2 = obj1.arrayGet(2), obj2.isNum() ? x2 = obj2.getNum() : x2 = 0);
-(obj2 = obj1.arrayGet(3), obj2.isNum() ? y2 = obj2.getNum() : y2 = 0);
+const double x1 = obj1.arrayGet(0).getNumWithDefaultValue(0);
+const double y1 = obj1.arrayGet(1).getNumWithDefaultValue(0);
+const double x2 = obj1.arrayGet(2).getNumWithDefaultValue(0);
+const double y2 = obj1.arrayGet(3).getNumWithDefaultValue(0);
 
 if (obj1.arrayGetLength() == 6) {
-  double x3, y3;
-  (obj2 = obj1.arrayGet(4), obj2.isNum() ? x3 = obj2.getNum() : x3 = 0);
-  (obj2 = obj1.arrayGet(5), 

[poppler] .gitlab-ci.yml

2019-10-30 Thread GitLab Mirror
 .gitlab-ci.yml |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit aa7827ab29377ef00c2dfbb16082617690375513
Author: Albert Astals Cid 
Date:   Wed Oct 30 22:21:04 2019 +0100

Use Fedora 30 for clazy while they fix Fedora 31

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 635e9bf0..461a1b85 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -69,7 +69,7 @@ build_mingw64_fedora:
 
 build_clazy:
   stage: build
-  image: fedora
+  image: fedora:30
   before_script:
 - dnf install -y 'dnf-command(builddep)'
 - dnf builddep -y poppler
___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler

Re: [poppler] Removing 0. from the version number

2019-10-30 Thread Albert Astals Cid
El dimecres, 30 d’octubre de 2019, a les 22:28:24 CET, Alex Korobkin va 
escriure:
> Perhaps it could be 1.00?

Calling it 1.0 is weird because to some people it signals "it's done", why 
we're far from done.

Cheers,
  Albert

> 
> On Wed, Oct 30, 2019 at 5:18 PM Albert Astals Cid  wrote:
> 
> > At some point in the not so far future we will end up in a version number
> > 0.99 and next would be 0.100 ?
> >
> > I'm suggesting we just drop the 0. for the next release and just call it
> > poppler-83.0.tar.xz
> >
> > Opinions?
> >
> > Cheers,
> >   Albert
> >
> >
> > ___
> > poppler mailing list
> > poppler@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/poppler
> 
> 
> 
> 




___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler

Re: [poppler] Removing 0. from the version number

2019-10-30 Thread Alex Korobkin
Perhaps it could be 1.00?

On Wed, Oct 30, 2019 at 5:18 PM Albert Astals Cid  wrote:

> At some point in the not so far future we will end up in a version number
> 0.99 and next would be 0.100 ?
>
> I'm suggesting we just drop the 0. for the next release and just call it
> poppler-83.0.tar.xz
>
> Opinions?
>
> Cheers,
>   Albert
>
>
> ___
> poppler mailing list
> poppler@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/poppler



-- 
-Alex
___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler

[poppler] Removing 0. from the version number

2019-10-30 Thread Albert Astals Cid
At some point in the not so far future we will end up in a version number 0.99 
and next would be 0.100 ?

I'm suggesting we just drop the 0. for the next release and just call it 
poppler-83.0.tar.xz

Opinions?

Cheers,
  Albert


___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler