Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid implicit const cast in GDALPDFObjectPoppler::GetString() #573

Closed
wants to merge 1 commit into from

Conversation

Algunenano
Copy link
Contributor

Just pleasing the compiler (gcc 7.3.1)

@rouault
Copy link
Member

rouault commented May 5, 2018

This breaks with older version of Poppler

pdfobject.cpp:1060:93: error: passing ‘const GooString’ as ‘this’ argument of ‘int GooString::getLength()’ discards qualifiers [-fpermissive]
                                                       static_cast<int>(gooString->getLength())));

Probably this should be conditionalized by the appropriate version of Poppler where getLength() has been tagged as const

Or simpler, but less elegant, do

GooString* gooString = const_cast<GooString*>(m_po->getString());

@rouault rouault closed this in 124f034 May 5, 2018
rouault added a commit that referenced this pull request May 5, 2018
@Algunenano
Copy link
Contributor Author

Works for me too. Thanks a lot!

knedlsepp added a commit to knedlsepp/nixpkgs that referenced this pull request Jun 4, 2018
This fixes:
  error: cannot initialize a variable of type 'GooString *' with an rvalue of type 'const GooString *'
which occurs with recent clang or gcc-7.
See OSGeo/gdal#573
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants