2006-03-24 12:08:41 -07:00
|
|
|
/* Copyright (C) 2004 Bart 'plors' Hakvoort
|
2010-03-23 13:06:26 -06:00
|
|
|
* Copyright (C) 2008, 2009, 2010 Curtis Gedak
|
2006-03-24 12:08:41 -07:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2014-01-23 03:59:48 -07:00
|
|
|
* GNU General Public License for more details.
|
2006-03-24 12:08:41 -07:00
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-23 03:59:48 -07:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2006-03-24 12:08:41 -07:00
|
|
|
*/
|
|
|
|
|
2016-10-18 16:45:28 -06:00
|
|
|
#include "OperationResizeMove.h"
|
|
|
|
#include "Partition.h"
|
|
|
|
#include "PartitionVector.h"
|
2006-03-24 12:08:41 -07:00
|
|
|
|
|
|
|
namespace GParted
|
|
|
|
{
|
|
|
|
|
|
|
|
OperationResizeMove::OperationResizeMove( const Device & device,
|
|
|
|
const Partition & partition_orig,
|
|
|
|
const Partition & partition_new )
|
|
|
|
{
|
2006-07-29 09:20:32 -06:00
|
|
|
type = OPERATION_RESIZE_MOVE ;
|
2015-05-24 07:13:37 -06:00
|
|
|
|
|
|
|
this->device = device.get_copy_without_partitions();
|
2015-12-05 09:26:30 -07:00
|
|
|
this->partition_original = partition_orig.clone();
|
|
|
|
this->partition_new = partition_new.clone();
|
2015-09-20 03:50:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
OperationResizeMove::~OperationResizeMove()
|
|
|
|
{
|
|
|
|
delete partition_original;
|
|
|
|
delete partition_new;
|
C++11: Convert NULL to nullptr (!117)
In C++11, nullptr [1] is the strongly typed value to use instead of the
macro NULL [2]. Use everywhere [3][4].
[1] nullptr, the pointer literal (since C++11)
https://en.cppreference.com/w/cpp/language/nullptr
[2] NULL
https://en.cppreference.com/w/cpp/types/NULL
[3] Bjarne Stroustrup's C++ Style and Technique FAQ, Should I use NULL
or 0?
https://www.stroustrup.com/bs_faq2.html#null
"In C++, the definition of NULL is 0, so there is only an
aesthetic difference. I prefer to avoid macros, so I use 0.
Another problem with NULL is that people sometimes mistakenly
believe that it is different from 0 and/or not an integer. In
pre-standard code, NULL was/is sometimes defined to something
unsuitable and therefore had/has to be avoided. That's less
common these days.
If you have to name the null pointer, call it nullptr; that's
what it's called in C++11. Then, "nullptr" will be a keyword.
"
[4] What is nullptr in C++? Advantages, Use Cases & Examples
https://favtutor.com/blogs/nullptr-cpp
"Advantages of nullptr
...
Compatible: Null pointers are compatible with null pointer
constants in the C style (such as NULL and 0). This implies
that old C code that uses these constants and null pointers can
communicate with each other in C++.
"
Closes !117 - Require C++11 compilation
2023-08-31 14:08:59 -06:00
|
|
|
partition_original = nullptr;
|
|
|
|
partition_new = nullptr;
|
2006-03-24 12:08:41 -07:00
|
|
|
}
|
2015-05-23 13:22:37 -06:00
|
|
|
|
|
|
|
void OperationResizeMove::apply_to_visual( PartitionVector & partitions )
|
2006-03-24 12:08:41 -07:00
|
|
|
{
|
C++11: Convert NULL to nullptr (!117)
In C++11, nullptr [1] is the strongly typed value to use instead of the
macro NULL [2]. Use everywhere [3][4].
[1] nullptr, the pointer literal (since C++11)
https://en.cppreference.com/w/cpp/language/nullptr
[2] NULL
https://en.cppreference.com/w/cpp/types/NULL
[3] Bjarne Stroustrup's C++ Style and Technique FAQ, Should I use NULL
or 0?
https://www.stroustrup.com/bs_faq2.html#null
"In C++, the definition of NULL is 0, so there is only an
aesthetic difference. I prefer to avoid macros, so I use 0.
Another problem with NULL is that people sometimes mistakenly
believe that it is different from 0 and/or not an integer. In
pre-standard code, NULL was/is sometimes defined to something
unsuitable and therefore had/has to be avoided. That's less
common these days.
If you have to name the null pointer, call it nullptr; that's
what it's called in C++11. Then, "nullptr" will be a keyword.
"
[4] What is nullptr in C++? Advantages, Use Cases & Examples
https://favtutor.com/blogs/nullptr-cpp
"Advantages of nullptr
...
Compatible: Null pointers are compatible with null pointer
constants in the C style (such as NULL and 0). This implies
that old C code that uses these constants and null pointers can
communicate with each other in C++.
"
Closes !117 - Require C++11 compilation
2023-08-31 14:08:59 -06:00
|
|
|
g_assert(partition_original != nullptr); // Bug: Not initialised by constructor or reset later
|
2015-09-20 03:50:57 -06:00
|
|
|
|
|
|
|
if ( partition_original->type == TYPE_EXTENDED )
|
2006-03-24 12:08:41 -07:00
|
|
|
apply_extended_to_visual( partitions ) ;
|
|
|
|
else
|
|
|
|
apply_normal_to_visual( partitions ) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OperationResizeMove::create_description()
|
|
|
|
{
|
C++11: Convert NULL to nullptr (!117)
In C++11, nullptr [1] is the strongly typed value to use instead of the
macro NULL [2]. Use everywhere [3][4].
[1] nullptr, the pointer literal (since C++11)
https://en.cppreference.com/w/cpp/language/nullptr
[2] NULL
https://en.cppreference.com/w/cpp/types/NULL
[3] Bjarne Stroustrup's C++ Style and Technique FAQ, Should I use NULL
or 0?
https://www.stroustrup.com/bs_faq2.html#null
"In C++, the definition of NULL is 0, so there is only an
aesthetic difference. I prefer to avoid macros, so I use 0.
Another problem with NULL is that people sometimes mistakenly
believe that it is different from 0 and/or not an integer. In
pre-standard code, NULL was/is sometimes defined to something
unsuitable and therefore had/has to be avoided. That's less
common these days.
If you have to name the null pointer, call it nullptr; that's
what it's called in C++11. Then, "nullptr" will be a keyword.
"
[4] What is nullptr in C++? Advantages, Use Cases & Examples
https://favtutor.com/blogs/nullptr-cpp
"Advantages of nullptr
...
Compatible: Null pointers are compatible with null pointer
constants in the C style (such as NULL and 0). This implies
that old C code that uses these constants and null pointers can
communicate with each other in C++.
"
Closes !117 - Require C++11 compilation
2023-08-31 14:08:59 -06:00
|
|
|
g_assert(partition_original != nullptr); // Bug: Not initialised by constructor or reset later
|
|
|
|
g_assert(partition_new != nullptr); // Bug: Not initialised by constructor or reset later
|
2015-09-20 03:50:57 -06:00
|
|
|
|
2006-07-11 12:13:27 -06:00
|
|
|
//i'm not too happy with this, but i think it is the correct way from a i18n POV
|
|
|
|
enum Action
|
2006-03-24 12:08:41 -07:00
|
|
|
{
|
2006-07-11 12:13:27 -06:00
|
|
|
NONE = 0,
|
|
|
|
MOVE_RIGHT = 1,
|
|
|
|
MOVE_LEFT = 2,
|
|
|
|
GROW = 3,
|
|
|
|
SHRINK = 4,
|
|
|
|
MOVE_RIGHT_GROW = 5,
|
|
|
|
MOVE_RIGHT_SHRINK = 6,
|
|
|
|
MOVE_LEFT_GROW = 7,
|
|
|
|
MOVE_LEFT_SHRINK = 8
|
|
|
|
} ;
|
|
|
|
Action action = NONE ;
|
|
|
|
|
2015-09-20 03:50:57 -06:00
|
|
|
if ( partition_new->get_sector_length() > partition_original->get_sector_length() )
|
|
|
|
{
|
2008-06-18 12:30:19 -06:00
|
|
|
//Grow partition
|
2006-07-11 12:13:27 -06:00
|
|
|
action = GROW ;
|
2015-09-20 03:50:57 -06:00
|
|
|
if ( partition_new->sector_start > partition_original->sector_start )
|
2008-06-18 12:30:19 -06:00
|
|
|
action = MOVE_RIGHT_GROW ;
|
2015-09-20 03:50:57 -06:00
|
|
|
if ( partition_new->sector_start < partition_original->sector_start )
|
2008-06-18 12:30:19 -06:00
|
|
|
action = MOVE_LEFT_GROW ;
|
2015-09-20 03:50:57 -06:00
|
|
|
}
|
|
|
|
else if ( partition_new->get_sector_length() < partition_original->get_sector_length() )
|
|
|
|
{
|
2008-06-18 12:30:19 -06:00
|
|
|
//Shrink partition
|
2006-07-11 12:13:27 -06:00
|
|
|
action = SHRINK ;
|
2015-09-20 03:50:57 -06:00
|
|
|
if ( partition_new->sector_start > partition_original->sector_start )
|
2008-06-18 12:30:19 -06:00
|
|
|
action = MOVE_RIGHT_SHRINK ;
|
2015-09-20 03:50:57 -06:00
|
|
|
if ( partition_new->sector_start < partition_original->sector_start )
|
2008-06-18 12:30:19 -06:00
|
|
|
action = MOVE_LEFT_SHRINK ;
|
2015-09-20 03:50:57 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-06-18 12:30:19 -06:00
|
|
|
//No change in partition size
|
2015-09-20 03:50:57 -06:00
|
|
|
if ( partition_new->sector_start > partition_original->sector_start )
|
2008-06-18 12:30:19 -06:00
|
|
|
action = MOVE_RIGHT ;
|
2015-09-20 03:50:57 -06:00
|
|
|
if ( partition_new->sector_start < partition_original->sector_start )
|
2008-06-18 12:30:19 -06:00
|
|
|
action = MOVE_LEFT ;
|
|
|
|
}
|
2006-07-11 12:13:27 -06:00
|
|
|
|
|
|
|
switch ( action )
|
2006-03-24 12:08:41 -07:00
|
|
|
{
|
2006-07-11 12:13:27 -06:00
|
|
|
case NONE :
|
2019-03-25 14:41:08 -06:00
|
|
|
description = Glib::ustring::compose( _("resize/move %1"), partition_original->get_path() );
|
2006-07-11 12:13:27 -06:00
|
|
|
description += " (" ;
|
2009-10-26 15:19:04 -06:00
|
|
|
description += _("new and old partition have the same size and position. Hence continuing anyway") ;
|
2006-07-11 12:13:27 -06:00
|
|
|
description += ")" ;
|
|
|
|
break ;
|
|
|
|
case MOVE_RIGHT :
|
2019-03-25 14:41:08 -06:00
|
|
|
description = Glib::ustring::compose( _("Move %1 to the right"), partition_original->get_path() );
|
2006-07-11 12:13:27 -06:00
|
|
|
break ;
|
|
|
|
case MOVE_LEFT :
|
2019-03-25 14:41:08 -06:00
|
|
|
description = Glib::ustring::compose( _("Move %1 to the left"), partition_original->get_path() );
|
2006-07-11 12:13:27 -06:00
|
|
|
break ;
|
|
|
|
case GROW :
|
|
|
|
description = _("Grow %1 from %2 to %3") ;
|
|
|
|
break ;
|
|
|
|
case SHRINK :
|
|
|
|
description = _("Shrink %1 from %2 to %3") ;
|
|
|
|
break ;
|
|
|
|
case MOVE_RIGHT_GROW :
|
|
|
|
description = _("Move %1 to the right and grow it from %2 to %3") ;
|
|
|
|
break ;
|
|
|
|
case MOVE_RIGHT_SHRINK :
|
|
|
|
description = _("Move %1 to the right and shrink it from %2 to %3") ;
|
|
|
|
break ;
|
|
|
|
case MOVE_LEFT_GROW :
|
|
|
|
description = _("Move %1 to the left and grow it from %2 to %3") ;
|
|
|
|
break ;
|
|
|
|
case MOVE_LEFT_SHRINK :
|
|
|
|
description = _("Move %1 to the left and shrink it from %2 to %3") ;
|
|
|
|
break ;
|
2006-03-24 12:08:41 -07:00
|
|
|
}
|
2006-07-11 12:13:27 -06:00
|
|
|
|
|
|
|
if ( ! description .empty() && action != NONE && action != MOVE_LEFT && action != MOVE_RIGHT )
|
2019-03-25 14:41:08 -06:00
|
|
|
description = Glib::ustring::compose( description,
|
2015-09-20 03:50:57 -06:00
|
|
|
partition_original->get_path(),
|
|
|
|
Utils::format_size( partition_original->get_sector_length(),
|
|
|
|
partition_original->sector_size ),
|
|
|
|
Utils::format_size( partition_new->get_sector_length(),
|
|
|
|
partition_new->sector_size ) );
|
2006-03-24 12:08:41 -07:00
|
|
|
}
|
|
|
|
|
2015-05-23 13:22:37 -06:00
|
|
|
void OperationResizeMove::apply_normal_to_visual( PartitionVector & partitions )
|
2006-03-24 12:08:41 -07:00
|
|
|
{
|
C++11: Convert NULL to nullptr (!117)
In C++11, nullptr [1] is the strongly typed value to use instead of the
macro NULL [2]. Use everywhere [3][4].
[1] nullptr, the pointer literal (since C++11)
https://en.cppreference.com/w/cpp/language/nullptr
[2] NULL
https://en.cppreference.com/w/cpp/types/NULL
[3] Bjarne Stroustrup's C++ Style and Technique FAQ, Should I use NULL
or 0?
https://www.stroustrup.com/bs_faq2.html#null
"In C++, the definition of NULL is 0, so there is only an
aesthetic difference. I prefer to avoid macros, so I use 0.
Another problem with NULL is that people sometimes mistakenly
believe that it is different from 0 and/or not an integer. In
pre-standard code, NULL was/is sometimes defined to something
unsuitable and therefore had/has to be avoided. That's less
common these days.
If you have to name the null pointer, call it nullptr; that's
what it's called in C++11. Then, "nullptr" will be a keyword.
"
[4] What is nullptr in C++? Advantages, Use Cases & Examples
https://favtutor.com/blogs/nullptr-cpp
"Advantages of nullptr
...
Compatible: Null pointers are compatible with null pointer
constants in the C style (such as NULL and 0). This implies
that old C code that uses these constants and null pointers can
communicate with each other in C++.
"
Closes !117 - Require C++11 compilation
2023-08-31 14:08:59 -06:00
|
|
|
g_assert(partition_original != nullptr); // Bug: Not initialised by constructor or reset later
|
|
|
|
g_assert(partition_new != nullptr); // Bug: Not initialised by constructor or reset later
|
2015-09-20 03:50:57 -06:00
|
|
|
|
2015-09-27 02:30:13 -06:00
|
|
|
int index_extended;
|
|
|
|
int index;
|
|
|
|
|
2015-09-20 03:50:57 -06:00
|
|
|
if ( partition_original->inside_extended )
|
2006-03-24 12:08:41 -07:00
|
|
|
{
|
2016-08-21 04:56:51 -06:00
|
|
|
index_extended = find_extended_partition( partitions );
|
2006-03-24 12:08:41 -07:00
|
|
|
if ( index_extended >= 0 )
|
|
|
|
{
|
2015-09-27 02:30:13 -06:00
|
|
|
index = find_index_original( partitions[ index_extended ] .logicals ) ;
|
|
|
|
|
|
|
|
if ( index >= 0 )
|
|
|
|
{
|
2015-12-20 04:28:09 -07:00
|
|
|
partitions[index_extended].logicals.replace_at( index, partition_new );
|
2015-09-27 02:30:13 -06:00
|
|
|
remove_adjacent_unallocated( partitions[index_extended].logicals, index );
|
|
|
|
|
|
|
|
insert_unallocated( partitions[index_extended].logicals,
|
|
|
|
partitions[index_extended].sector_start,
|
|
|
|
partitions[index_extended].sector_end,
|
|
|
|
device.sector_size,
|
|
|
|
true );
|
|
|
|
}
|
2006-03-24 12:08:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
index = find_index_original( partitions ) ;
|
|
|
|
|
|
|
|
if ( index >= 0 )
|
|
|
|
{
|
2015-12-20 04:28:09 -07:00
|
|
|
partitions.replace_at( index, partition_new );
|
2006-03-24 12:08:41 -07:00
|
|
|
remove_adjacent_unallocated( partitions, index ) ;
|
|
|
|
|
2010-04-19 19:22:31 -06:00
|
|
|
insert_unallocated( partitions, 0, device .length -1, device .sector_size, false ) ;
|
2006-03-24 12:08:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-23 13:22:37 -06:00
|
|
|
void OperationResizeMove::apply_extended_to_visual( PartitionVector & partitions )
|
2006-03-24 12:08:41 -07:00
|
|
|
{
|
C++11: Convert NULL to nullptr (!117)
In C++11, nullptr [1] is the strongly typed value to use instead of the
macro NULL [2]. Use everywhere [3][4].
[1] nullptr, the pointer literal (since C++11)
https://en.cppreference.com/w/cpp/language/nullptr
[2] NULL
https://en.cppreference.com/w/cpp/types/NULL
[3] Bjarne Stroustrup's C++ Style and Technique FAQ, Should I use NULL
or 0?
https://www.stroustrup.com/bs_faq2.html#null
"In C++, the definition of NULL is 0, so there is only an
aesthetic difference. I prefer to avoid macros, so I use 0.
Another problem with NULL is that people sometimes mistakenly
believe that it is different from 0 and/or not an integer. In
pre-standard code, NULL was/is sometimes defined to something
unsuitable and therefore had/has to be avoided. That's less
common these days.
If you have to name the null pointer, call it nullptr; that's
what it's called in C++11. Then, "nullptr" will be a keyword.
"
[4] What is nullptr in C++? Advantages, Use Cases & Examples
https://favtutor.com/blogs/nullptr-cpp
"Advantages of nullptr
...
Compatible: Null pointers are compatible with null pointer
constants in the C style (such as NULL and 0). This implies
that old C code that uses these constants and null pointers can
communicate with each other in C++.
"
Closes !117 - Require C++11 compilation
2023-08-31 14:08:59 -06:00
|
|
|
g_assert(partition_new != nullptr); // Bug: Not initialised by constructor or reset later
|
2015-09-20 03:50:57 -06:00
|
|
|
|
2015-09-27 02:30:13 -06:00
|
|
|
int index_extended;
|
|
|
|
|
2006-03-24 12:08:41 -07:00
|
|
|
//stuff OUTSIDE extended partition
|
2016-08-21 04:56:51 -06:00
|
|
|
index_extended = find_extended_partition( partitions );
|
2006-03-24 12:08:41 -07:00
|
|
|
if ( index_extended >= 0 )
|
|
|
|
{
|
|
|
|
remove_adjacent_unallocated( partitions, index_extended ) ;
|
2016-08-21 04:56:51 -06:00
|
|
|
|
|
|
|
index_extended = find_extended_partition( partitions );
|
2006-04-01 07:36:16 -07:00
|
|
|
if ( index_extended >= 0 )
|
|
|
|
{
|
2015-09-20 03:50:57 -06:00
|
|
|
partitions[index_extended].sector_start = partition_new->sector_start;
|
|
|
|
partitions[index_extended].sector_end = partition_new->sector_end;
|
2006-04-01 07:36:16 -07:00
|
|
|
}
|
2006-03-24 12:08:41 -07:00
|
|
|
|
2010-04-19 19:22:31 -06:00
|
|
|
insert_unallocated( partitions, 0, device .length -1, device .sector_size, false ) ;
|
2006-03-24 12:08:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//stuff INSIDE extended partition
|
2016-08-21 04:56:51 -06:00
|
|
|
index_extended = find_extended_partition( partitions );
|
2006-03-24 12:08:41 -07:00
|
|
|
if ( index_extended >= 0 )
|
|
|
|
{
|
|
|
|
if ( partitions[ index_extended ] .logicals .size() > 0 &&
|
2018-10-14 06:27:58 -06:00
|
|
|
partitions[index_extended].logicals.front().type == TYPE_UNALLOCATED )
|
2006-03-24 12:08:41 -07:00
|
|
|
partitions[ index_extended ] .logicals .erase( partitions[ index_extended ] .logicals .begin() ) ;
|
|
|
|
|
|
|
|
if ( partitions[ index_extended ] .logicals .size() &&
|
2018-10-14 06:27:58 -06:00
|
|
|
partitions[index_extended].logicals.back().type == TYPE_UNALLOCATED )
|
2006-03-24 12:08:41 -07:00
|
|
|
partitions[ index_extended ] .logicals .pop_back() ;
|
|
|
|
|
|
|
|
insert_unallocated( partitions[ index_extended ] .logicals,
|
|
|
|
partitions[ index_extended ] .sector_start,
|
|
|
|
partitions[ index_extended ] .sector_end,
|
2010-04-19 19:22:31 -06:00
|
|
|
device .sector_size,
|
2006-03-24 12:08:41 -07:00
|
|
|
true ) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-23 13:22:37 -06:00
|
|
|
void OperationResizeMove::remove_adjacent_unallocated( PartitionVector & partitions, int index_orig )
|
2006-03-24 12:08:41 -07:00
|
|
|
{
|
|
|
|
//remove unallocated space following the original partition
|
|
|
|
if ( index_orig +1 < static_cast<int>( partitions .size() ) &&
|
2018-10-14 06:27:58 -06:00
|
|
|
partitions[index_orig+1].type == TYPE_UNALLOCATED )
|
2006-03-24 12:08:41 -07:00
|
|
|
partitions .erase( partitions .begin() + index_orig +1 );
|
2006-03-31 11:58:58 -07:00
|
|
|
|
|
|
|
//remove unallocated space preceding the original partition
|
2018-10-14 06:27:58 -06:00
|
|
|
if (index_orig-1 >= 0 && partitions[index_orig-1].type == TYPE_UNALLOCATED)
|
2006-03-31 11:58:58 -07:00
|
|
|
partitions .erase( partitions .begin() + ( index_orig -1 ) ) ;
|
2006-03-24 12:08:41 -07:00
|
|
|
}
|
|
|
|
|
2015-09-12 07:59:40 -06:00
|
|
|
bool OperationResizeMove::merge_operations( const Operation & candidate )
|
|
|
|
{
|
C++11: Convert NULL to nullptr (!117)
In C++11, nullptr [1] is the strongly typed value to use instead of the
macro NULL [2]. Use everywhere [3][4].
[1] nullptr, the pointer literal (since C++11)
https://en.cppreference.com/w/cpp/language/nullptr
[2] NULL
https://en.cppreference.com/w/cpp/types/NULL
[3] Bjarne Stroustrup's C++ Style and Technique FAQ, Should I use NULL
or 0?
https://www.stroustrup.com/bs_faq2.html#null
"In C++, the definition of NULL is 0, so there is only an
aesthetic difference. I prefer to avoid macros, so I use 0.
Another problem with NULL is that people sometimes mistakenly
believe that it is different from 0 and/or not an integer. In
pre-standard code, NULL was/is sometimes defined to something
unsuitable and therefore had/has to be avoided. That's less
common these days.
If you have to name the null pointer, call it nullptr; that's
what it's called in C++11. Then, "nullptr" will be a keyword.
"
[4] What is nullptr in C++? Advantages, Use Cases & Examples
https://favtutor.com/blogs/nullptr-cpp
"Advantages of nullptr
...
Compatible: Null pointers are compatible with null pointer
constants in the C style (such as NULL and 0). This implies
that old C code that uses these constants and null pointers can
communicate with each other in C++.
"
Closes !117 - Require C++11 compilation
2023-08-31 14:08:59 -06:00
|
|
|
g_assert(partition_new != nullptr); // Bug: Not initialised by constructor or reset later
|
2015-09-20 03:50:57 -06:00
|
|
|
|
2015-09-19 08:57:39 -06:00
|
|
|
if ( candidate.type == OPERATION_RESIZE_MOVE &&
|
2015-09-20 03:50:57 -06:00
|
|
|
*partition_new == candidate.get_partition_original() )
|
2015-09-12 07:59:40 -06:00
|
|
|
{
|
2015-09-20 03:50:57 -06:00
|
|
|
delete partition_new;
|
2015-12-05 09:26:30 -07:00
|
|
|
partition_new = candidate.get_partition_new().clone();
|
2015-09-12 07:59:40 -06:00
|
|
|
create_description();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-03-24 12:08:41 -07:00
|
|
|
} //GParted
|