KhronosGroup / KhronosGroup/OpenCOLLADA

OpenCOLLADA fails to build with GCC 6

Open
#439 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C++
Stars
678
Forks
260
PR merge metrics
No merged PRs in 30d

Description

GCC uses C++11 by default and this makes OpenCOLLADA fail the build with:

[ 70s] /home/abuild/rpmbuild/BUILD/OpenCOLLADA-3335ac164e68b2512a40914b14c74db260e6ff7d/COLLADABaseUtils/src/COLLADABUURI.cpp:57:2: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]

The code in question is:

    const char HEX2DEC[256] = 
    {
        /*       0  1  2  3   4  5  6  7   8  9  A  B   C  D  E  F */
        /* 0 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,

The 'issue' is that 'char' is not defined to be signed/unsigned (it depends on arch / implementation)
(i586/x86_64 use signed char, ppc64le and arm for example uses unsigned char)

It would likely be safe to change this to
const signed char HEX2DEC[256], this having all archs behave the same.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in COLLADABaseUtils/src/COLLADABUURI.cpp at the HEX2DEC declaration and reproduce the reported GCC 6 build error. Check the relevant build on GCC 6 and confirm that the change removes the narrowing error while preserving the existing URI conversion behavior across architectures.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.