Skip to content

Building client under G++ 14/Alpine linux fails on NULL to nullptr_t cast for Riff_Base::Modify(ZenLib::int32u, ZenLib::int32u, ZenLib::int32u) #342

@DiegoPino

Description

@DiegoPino

Hi,

I am trying to build the main branch/only client under Alpine Linux,

This is my G++ version

g++ (Alpine 14.2.0) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

These is are the flags after configure

Configured BWF MetaEdit for 'aarch64-unknown-linux-musl'

  CXXFLAGS:  -DTIXML_USE_STL -pthread -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -DUNICODE -D_UNICODE -O2
  LIBS: 

When building (Make) I am getting the following error

../../../Source/Riff/Riff_Handler.cpp: In member function 'bool Riff_Handler::Remove_Chunk_Internal(const std::string&)':
../../../Source/Riff/Riff_Handler.cpp:1786:23: error: no matching function for call to 'Riff::Modify(const ZenLib::int32u&, const ZenLib::int32u&, std::nullptr_t)'
 1786 |         Chunks->Modify(Elements::WAVE, Elements::WAVE_ds64, NULL);
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../../Source/Riff/Riff_Handler.h:21,
                 from ../../../Source/Riff/Riff_Handler.cpp:11:
../../../Source/Riff/Riff_Base.h:542:10: note: candidate: 'void Riff_Base::Modify(ZenLib::int32u, ZenLib::int32u, ZenLib::int32u)'
  542 |     void Modify                 (int32u Chunk_Name_1, int32u Chunk_Name_2, int32u Chunk_Name_3);
      |          ^~~~~~
../../../Source/Riff/Riff_Base.h:542:83: note:   no known conversion for argument 3 from 'std::nullptr_t' to 'ZenLib::int32u' {aka 'unsigned int'}
  542 |     void Modify                 (int32u Chunk_Name_1, int32u Chunk_Name_2, int32u Chunk_Name_3);
      |                                                                            ~~~~~~~^~~~~~~~~~~~
../../../Source/Riff/Riff_Base.h:543:10: note: candidate: 'void Riff_Base::Modify()'
  543 |     void Modify                 ()                                              {Modify_Internal();};
      |          ^~~~~~
../../../Source/Riff/Riff_Base.h:543:10: note:   candidate expects 0 arguments, 3 provided
../../../Source/Riff/Riff_Handler.cpp:1787:23: error: no matching function for call to 'Riff::Modify(const ZenLib::int32u&, const ZenLib::int32u&, std::nullptr_t)'
 1787 |         Chunks->Modify(Elements::WAVE, Elements::WAVE_data, NULL);
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../Source/Riff/Riff_Base.h:542:10: note: candidate: 'void Riff_Base::Modify(ZenLib::int32u, ZenLib::int32u, ZenLib::int32u)'
  542 |     void Modify                 (int32u Chunk_Name_1, int32u Chunk_Name_2, int32u Chunk_Name_3);
      |          ^~~~~~
../../../Source/Riff/Riff_Base.h:542:83: note:   no known conversion for argument 3 from 'std::nullptr_t' to 'ZenLib::int32u' {aka 'unsigned int'}
  542 |     void Modify                 (int32u Chunk_Name_1, int32u Chunk_Name_2, int32u Chunk_Name_3);
      |                                                                            ~~~~~~~^~~~~~~~~~~~
../../../Source/Riff/Riff_Base.h:543:10: note: candidate: 'void Riff_Base::Modify()'
  543 |     void Modify                 ()                                              {Modify_Internal();};
      |          ^~~~~~
../../../Source/Riff/Riff_Base.h:543:10: note:   candidate expects 0 arguments, 3 provided

Which basically means when calling Chunks->Modify(Elements::WAVE, Elements::WAVE_ds64, NULL); NULL / "the Integer or the NULL macro (0) as one would define in C, but a nullptr_t type (the actual nullptr). But because there is no overcast Riff_Base::Modify that takes nullptr_t or pointers at all (only unsigned ints from Zenlib) it can't find a candidate.

Internally I also see there is a Modify_Internal() and depending on the internal calls also the second argument might be called with NULL as argument, which would fail later on even if i manually change line 1787 Chunks->Modify(Elements::WAVE, Elements::WAVE_data, NULL); to call with a third argument being (0?), not being what my g++ uses as a NULL (which is not an integer), which makes me believe to make this compile I would have to refactor every call to ::Modify where a NULL is being used as argument?

Grateful for any suggestions you might have,

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions