<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - [TAGGEDPDF] Parse the Tagged-PDF document structure tree when present"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=64815#c49">Comment # 49</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - [TAGGEDPDF] Parse the Tagged-PDF document structure tree when present"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=64815">bug 64815</a>
              from <span class="vcard"><a class="email" href="mailto:carlosgc@gnome.org" title="Carlos Garcia Campos <carlosgc@gnome.org>"> <span class="fn">Carlos Garcia Campos</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=86677" name="attach_86677" title="[PATCH v8 04/15] Tagged-PDF: Parsing of StructElem standard types and">attachment 86677</a> <a href="attachment.cgi?id=86677&action=edit" title="[PATCH v8 04/15] Tagged-PDF: Parsing of StructElem standard types and">[details]</a></span> <a href='page.cgi?id=splinter.html&bug=64815&attachment=86677'>[review]</a>
[PATCH v8 04/15] Tagged-PDF: Parsing of StructElem standard types and

Review of <span class=""><a href="attachment.cgi?id=86677" name="attach_86677" title="[PATCH v8 04/15] Tagged-PDF: Parsing of StructElem standard types and">attachment 86677</a> <a href="attachment.cgi?id=86677&action=edit" title="[PATCH v8 04/15] Tagged-PDF: Parsing of StructElem standard types and">[details]</a></span> <a href='page.cgi?id=splinter.html&bug=64815&attachment=86677'>[review]</a>:
-----------------------------------------------------------------

::: poppler/Makefile.am
@@ +299,2 @@
<span class="quote">>        StructElement.cc        \
> +  StructTreeRoot.cc       \</span >

This change looks unrelated.

::: poppler/StructElement.cc
@@ +260,5 @@
<span class="quote">> +  Object Auto;
> +  Object Start;
> +  Object None;
> +  Object Before;
> +  Object Nat1;</span >

It's weird that struct members start with a capital letter, but I guess it
looks better in the  macros below.

@@ +282,5 @@
<span class="quote">> +static const AttributeDefaults attributeDefaults;
> +
> +
> +#define ATTR_LIST_END      { Attribute::Unknown, NULL, NULL, gFalse, NULL }
> +#define ATTR_D(x, i, c, v) { Attribute::x, #x, &attributeDefaults.v, i, c }</span >

What D stand for? Default?

@@ +283,5 @@
<span class="quote">> +
> +
> +#define ATTR_LIST_END      { Attribute::Unknown, NULL, NULL, gFalse, NULL }
> +#define ATTR_D(x, i, c, v) { Attribute::x, #x, &attributeDefaults.v, i, c }
> +#define ATTR_N(x, i, c)    { Attribute::x, #x, NULL, i, c }</span >

And N? Normal? NotDefault? What about using ATTR and ATTR_WITH_DEFAULT? Also I
would use words instead of abbreviations to improve the readability type,
inheritable, check, defaultValue.

@@ +288,5 @@
<span class="quote">> +
> +static const AttributeMapEntry attributeMapCommonShared[] =
> +{
> +  ATTR_D(Placement,       gFalse, isPlacementName, Inline),
> +  ATTR_D(WritingMode,     gFalse, isWritingModeName, LrTb),</span >

WritingMode is inheritable

@@ +295,5 @@
<span class="quote">> +  ATTR_D(BorderStyle,     gFalse, isBorderStyle, None),
> +  ATTR_N(BorderThickness, gTrue,  isPositiveOrOptionalArray4),
> +  ATTR_D(Padding,         gFalse, isPositiveOrArray4, Zero),
> +  ATTR_N(Color,           gTrue,  isRGBColor),
> +  ATTR_LIST_END</span >

Do we really need this being the array statically allocated?

@@ +341,5 @@
<span class="quote">> +  ATTR_LIST_END
> +};
> +
> +static const AttributeMapEntry attributeMapCommonList[] = {
> +  ATTR_D(ListNumbering, gFalse, isListNumberingName, None),</span >

This is inheritable

@@ +740,5 @@
<span class="quote">> +      formatted->Set(formattedA);
> +    else
> +      formatted = new GooString(formattedA);
> +  } else {
> +    delete formatted;</span >

You should set formatted to NULL here

@@ +744,5 @@
<span class="quote">> +    delete formatted;
> +  }
> +}
> +
> +GBool Attribute::typeCheck(StructElement *element)</span >

checkType sounds a bit better to me

@@ +747,5 @@
<span class="quote">> +
> +GBool Attribute::typeCheck(StructElement *element)
> +{
> +  // If an element is passed, tighther type-checking can be done.
> +  if (element) {</span >

You could use an early return here, to save an indentation level.

@@ +765,5 @@
<span class="quote">> +
> +  return gTrue;
> +}
> +
> +Attribute::Type Attribute::typeForName(const char *name, StructElement *element)</span >

You are using get for all other methods, use getTypeForName here for
consistency.

@@ +936,5 @@
<span class="quote">> +{
> +  if (isContent())
> +    return parent->findAttribute(attributeType, inherit, attributeOwner);
> +
> +  if (attributeType != Attribute::Unknown && attributeType != Attribute::UserProperty) {</span >

I would return early here.

@@ +1132,5 @@
<span class="quote">> +            for (unsigned j = attrIndex; j < getNumAttributes(); j++)
> +              getAttribute(j)->setRevision(revision);
> +          } else {
> +            error(errSyntaxWarning, -1, "C item is wrong type ({0:s})", iobj.getTypeName());
> +          }</span >

iobj.free()

@@ +1133,5 @@
<span class="quote">> +              getAttribute(j)->setRevision(revision);
> +          } else {
> +            error(errSyntaxWarning, -1, "C item is wrong type ({0:s})", iobj.getTypeName());
> +          }
> +        }</span >

attr.free()

::: poppler/StructElement.h
@@ +27,2 @@
<span class="quote">>  class StructTreeRoot;
> +class TextWordList;</span >

What do you need this for?

@@ +116,5 @@
<span class="quote">> +  static Type typeForName(const char *name, StructElement *element = NULL);
> +  static Attribute *parseUserProperty(Dict *property);
> +
> +  friend class StructElement;
> +};</span >

The Attribute class implementation is huge, you might consider moving it to its
own file</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>