[gparted] Improve Merge_Operations method parameters and checks
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Improve Merge_Operations method parameters and checks
- Date: Thu, 13 Oct 2011 17:27:39 +0000 (UTC)
commit 03cdaed9461feed602536df0a02ab34ec0fa1cf1
Author: JÃrÃme Dumesnil <jerome dumesnil gmail com>
Date: Thu Oct 13 11:26:16 2011 -0600
Improve Merge_Operations method parameters and checks
include/Win_GParted.h | 2 +-
src/Win_GParted.cc | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/include/Win_GParted.h b/include/Win_GParted.h
index 9326c51..0e14a26 100644
--- a/include/Win_GParted.h
+++ b/include/Win_GParted.h
@@ -60,7 +60,7 @@ private:
void Fill_Label_Device_Info( bool clear = false );
void Add_Operation( Operation * operation, int index = -1 ) ;
- bool Merge_Operations( int first, int second );
+ bool Merge_Operations( unsigned int first, unsigned int second );
void Refresh_Visual();
bool Quit_Check_Operations();
void set_valid_operations() ;
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index 4ad1243..0a92c62 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -720,8 +720,11 @@ void Win_GParted::Add_Operation( Operation * operation, int index )
}
}
-bool Win_GParted::Merge_Operations( int first, int second )
+bool Win_GParted::Merge_Operations( unsigned int first, unsigned int second )
{
+ if( first >= operations .size() || second >= operations .size() )
+ return false;
+
// Two resize operations of the same partition
if ( operations[ first ]->type == OPERATION_RESIZE_MOVE &&
operations[ second ]->type == OPERATION_RESIZE_MOVE &&
@@ -766,7 +769,7 @@ bool Win_GParted::Merge_Operations( int first, int second )
else if ( operations[ first ]->type == OPERATION_FORMAT &&
operations[ second ]->type == OPERATION_FORMAT &&
operations[ first ]->partition_new == operations[ second ]->partition_original
- )
+ )
{
operations[ first ]->partition_new = operations[ second ]->partition_new;
operations[ first ]->create_description() ;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]