https://gitlab.gnome.org/GNOME/gparted/-/commit/3d4b1c1e7b33f229efd254fb0cc06660af627ea0
https://bugs.gentoo.org/838466

From: Dominika Liberda <ja@sdomi.pl>
Date: Sun, 10 Apr 2022 21:09:56 +0200
Subject: [PATCH] Fix NULL == 0 assumption in call to ped_partition_flag_next()
 (!100)

GParted fails to build on Alpine Linux Edge (development tree for the
next release) like this:

    GParted_Core.cc: In constructor 'GParted::GParted_Core::GParted_Core()':
    GParted_Core.cc:75:64: error: invalid 'static_cast' from type 'std::nullptr_t' to type 'PedPartitionFlag'
       75 |     for ( PedPartitionFlag flag = ped_partition_flag_next( static_cast<PedPartitionFlag>( NULL ) ) ;
          |                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The code is failing to compile now because musl libc 1.2.3 has became
more C++11 strict [1][2] by defining NULL [3] as nullptr [4] rather than
as 0.  The parameter to ped_partition_flag_next() [5] should always have
been numeral 0 cast to an enumeration and never the NULL pointer.

Fixes this commit [6] from 2004-12-27 which changed the parameter from 0
to NULL.

[1] define NULL as nullptr when used in C++11 or later
    https://git.musl-libc.org/cgit/musl/commit?id=98e688a9da5e7b2925dda17a2d6820dddf1fb28
[2] NULL vs nullptr (Why was it replaced?) [duplicate]
    https://stackoverflow.com/questions/20509734/null-vs-nullptr-why-was-it-replaced
[3] C++ reference, NULL
    https://en.cppreference.com/w/cpp/types/NULL
[4] C++ reference, nullptr
    https://en.cppreference.com/w/cpp/language/nullptr
[5] libparted Documentation, ped_partition_flag_next()
    https://www.gnu.org/software/parted/api/group__PedPartition.html#g0ce9ce4247b320011bc8e9d957c8cdbb
[6] Added cylsize to Device and made Operation contain a Device instead
    commit 174f0cff77c5799a713954a22b2c54306d03036c

Closes !100 - Fix NULL == 0 assumption in call to
              ped_partition_flag_next()
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -72,7 +72,7 @@ GParted_Core::GParted_Core()
 	ped_exception_set_handler( ped_exception_handler ) ; 
 
 	//get valid flags ...
-	for ( PedPartitionFlag flag = ped_partition_flag_next( static_cast<PedPartitionFlag>( NULL ) ) ;
+	for ( PedPartitionFlag flag = ped_partition_flag_next( static_cast<PedPartitionFlag>( 0 ) ) ;
 	      flag ;
 	      flag = ped_partition_flag_next( flag ) )
 		flags .push_back( flag ) ;
GitLab
