Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=228a04814f2faab351d027ab9c2b1ec6128a89d4

commit 228a04814f2faab351d027ab9c2b1ec6128a89d4
Author: James Buren <[email protected]>
Date:   Mon Aug 27 20:10:18 2012 -0500

Remove trailing whitespace

diff --git a/Device.hh b/Device.hh
index 5a4e7bf..d12d205 100644
--- a/Device.hh
+++ b/Device.hh
@@ -36,14 +36,14 @@ private:
{
if((sector % _alignment) == 0)
return sector;
-
+
return sector + (_alignment - (sector % _alignment));
}
unsigned long long alignDown(unsigned long long sector)
{
if((sector % _alignment) == 0)
return sector;
-
+
return sector - (sector % _alignment);
}
unsigned long long getUsableSectors()
@@ -55,11 +55,11 @@ private:
reserved = 512;
else if(_table->getLabelType() == "gpt")
reserved = 512 + 512 + 128 * 128;
-
+
// Now, round it up to the closest sector.
if((reserved % _sectorsize) != 0)
reserved += _sectorsize - (reserved % _sectorsize);
-
+
// Now, convert it to a sector count.
reserved = sizeToSectors(reserved);

diff --git a/DosPartitionTable.cc b/DosPartitionTable.cc
index 93b0891..89f3d01 100644
--- a/DosPartitionTable.cc
+++ b/DosPartitionTable.cc
@@ -23,7 +23,7 @@ DosPartitionTable::~DosPartitionTable()
{
size_t i = 0;
DosPartition *part = 0;
-
+
while(i < _table.size())
{
part = (DosPartition *) _table.at(i);
@@ -119,7 +119,7 @@ bool DosPartitionTable::write(const string &path)
if(!zapLabel(path))
return false;

-  cmd << "echo -n -e '";
+  cmd << "echo -n -e '";

while(i < _table.size())
{
@@ -154,7 +154,7 @@ bool DosPartitionTable::write(const string &path)

if((pid == execute(cmd.str())) == -1 || waitpid(pid,&status,0) == -1)
{
-    logfile << __func__ << ": " << strerror(errno) << endl;
+    logfile << __func__ << ": " << strerror(errno) << endl;
return false;
}

diff --git a/GptPartition.hh b/GptPartition.hh
index 384f0cf..bfe3297 100644
--- a/GptPartition.hh
+++ b/GptPartition.hh
@@ -31,7 +31,7 @@ public:
string getType() { return _gpt_type; }
string getName() { return _gpt_name; }
string getUUID() { return _gpt_uuid; }
-  unsigned long long getFlags() { return _gpt_flags; }
+  unsigned long long getFlags() { return _gpt_flags; }
virtual bool getActive() { return (_gpt_flags & 4) ? true : false; }
virtual string getPurpose()
{
diff --git a/GptPartitionTable.cc b/GptPartitionTable.cc
index 8c6a832..50ce5b6 100644
--- a/GptPartitionTable.cc
+++ b/GptPartitionTable.cc
@@ -55,7 +55,7 @@ GptPartitionTable::~GptPartitionTable()
{
size_t i = 0;
GptPartition *part = 0;
-
+
while(i < _table.size())
{
part = (GptPartition *) _table.at(i);
@@ -156,10 +156,10 @@ bool GptPartitionTable::write(const string &path)

if(_table.empty())
return false;
-
+
if(!zapLabel(path))
return false;
-
+
cmd << "sgdisk --clear --disk-guid='" << _uuid << "'";

while(i < _table.size())
@@ -169,12 +169,12 @@ bool GptPartitionTable::write(const string &path)
cmd << dec;

cmd << " --new=" << part->getNumber() << ":" << part->getStart() << ":" << 
part->getEnd();
-
+
cmd << " --change-name=" << part->getNumber() << ":'" << part->getName() << "'";
-
+
cmd << " --partition-guid=" << part->getNumber() << ":'" << part->getUUID() << 
"'";
-
-    cmd << " --typecode=" << part->getNumber() << ":'" << part->getType() << 
"'";
+
+    cmd << " --typecode=" << part->getNumber() << ":'" << part->getType() << 
"'";

cmd << " --attributes=" << part->getNumber() << ":=:0x" << hex << 
part->getFlags();

@@ -187,7 +187,7 @@ bool GptPartitionTable::write(const string &path)

if((pid == execute(cmd.str())) == -1 || waitpid(pid,&status,0) == -1)
{
-    logfile << __func__ << ": " << strerror(errno) << endl;
+    logfile << __func__ << ": " << strerror(errno) << endl;
return false;
}

diff --git a/GptPartitionTable.hh b/GptPartitionTable.hh
index 0304563..f56a7d2 100644
--- a/GptPartitionTable.hh
+++ b/GptPartitionTable.hh
@@ -9,7 +9,7 @@ public:
GptPartitionTable();
virtual ~GptPartitionTable();
virtual bool read(const string &path);
-  virtual bool write(const string &path);
+  virtual bool write(const string &path);
virtual Partition *newPartition();

protected:
diff --git a/Main.cc b/Main.cc
index 15e5a0c..1ceb879 100644
--- a/Main.cc
+++ b/Main.cc
@@ -12,7 +12,7 @@ int main(int argc,char **argv)
if(setlocale(LC_ALL,"") == 0)
return EXIT_FAILURE;

-  if(!ui.initialize(argc,argv))
+  if(!ui.initialize(argc,argv))
return EXIT_FAILURE;

return EXIT_SUCCESS;
diff --git a/SConstruct b/SConstruct
index 08a6a6e..9d2ed73 100644
--- a/SConstruct
+++ b/SConstruct
@@ -43,4 +43,4 @@ env.Program('fwsetup',[
'Device.cc',
'UserInterface.cc',
'Utility.cc'
-])
\ No newline at end of file
+])
diff --git a/UserInterface.cc b/UserInterface.cc
index 2db3915..5e87e7b 100644
--- a/UserInterface.cc
+++ b/UserInterface.cc
@@ -8,15 +8,15 @@
UserInterface::UserInterface()
{
_s_width = 0;
-
+
_s_height = 0;
-
+
_w_width = 0;
-
+
_w_height = 0;

_x = 0;
-
+
_y = 0;

_initialized = false;
@@ -41,11 +41,11 @@ bool UserInterface::initialize(int argc,char **argv)
newtGetScreenSize(&_s_width,&_s_height);

_w_width = (_s_width - 2) * 9 / 10;
-
+
_w_height = (_s_height - 2) * 9 / 10;
-
+
_x = (_s_width - _w_width) / 2;
-
+
_y = (_s_height - _w_height) / 2;
#endif

@@ -67,49 +67,49 @@ bool UserInterface::getTextSize(const string &text,int 
&width,int &height)
int i = 0;

memset(&mbs,0,sizeof(mbstate_t));
-
+
while(true)
{
n = mbrtowc(&wc,text.c_str()+off,text.length()-off,&mbs);
-
+
if(n == (size_t) -1 || n == (size_t) -2)
return false;
-
+
if(n == 0)
break;
-
+
switch(wc)
{
case L'\t':
cw += 8;
break;
-
+
case L'\n':
if(cw > w)
w = cw;
cw = 0;
++h;
break;
-
+
default:
if((i = wcwidth(wc)) > 0)
cw += i;
break;
}
-
+
off += n;
}
-
+
if(w == 0)
w = (cw > 0) ? cw : 1;
-
+
if(h == 0)
h = 1;
-
+
width = w;
-
+
height = h;
-
+
return true;
}

diff --git a/Utility.cc b/Utility.cc
index a6807b8..6a8ea60 100644
--- a/Utility.cc
+++ b/Utility.cc
@@ -33,9 +33,9 @@ pid_t execute(const string &cmd)
dup2(fd,STDERR_FILENO);

close(fd);
-
+
execl("/bin/sh","/bin/sh","-c",cmd.c_str(),(void *) 0);
-
+
_exit(250);
}

@@ -54,7 +54,7 @@ bool zapLabel(const string &path)

if((pid == execute(cmd)) == -1 || waitpid(pid,&status,0) == -1)
{
-    logfile << __func__ << ": " << strerror(errno) << endl;
+    logfile << __func__ << ": " << strerror(errno) << endl;
return false;
}

@@ -66,7 +66,7 @@ bool zapLabel(const string &path)

logfile << "Finished executing command: " << cmd << endl;

-  return true;
+  return true;
}

unsigned long long string_to_size(const string &text)
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to