Code Cleanup
- Working toward a clean build on Ubuntu.
This commit is contained in:
12
src/TDB.cpp
12
src/TDB.cpp
@@ -380,7 +380,9 @@ int TDB::commit ()
|
|||||||
// Write out all pending.
|
// Write out all pending.
|
||||||
if (fseek (mLocations[0].pending, 0, SEEK_SET) == 0)
|
if (fseek (mLocations[0].pending, 0, SEEK_SET) == 0)
|
||||||
{
|
{
|
||||||
(void)ftruncate (fileno (mLocations[0].pending), 0);
|
if (ftruncate (fileno (mLocations[0].pending), 0))
|
||||||
|
throw std::string ("Failed to truncate pending.data file ");
|
||||||
|
|
||||||
foreach (task, allPending)
|
foreach (task, allPending)
|
||||||
fputs (task->composeF4 ().c_str (), mLocations[0].pending);
|
fputs (task->composeF4 ().c_str (), mLocations[0].pending);
|
||||||
}
|
}
|
||||||
@@ -464,14 +466,18 @@ int TDB::gc ()
|
|||||||
{
|
{
|
||||||
if (fseek (tdb.mLocations[0].pending, 0, SEEK_SET) == 0)
|
if (fseek (tdb.mLocations[0].pending, 0, SEEK_SET) == 0)
|
||||||
{
|
{
|
||||||
(void)ftruncate (fileno (tdb.mLocations[0].pending), 0);
|
if (ftruncate (fileno (tdb.mLocations[0].pending), 0))
|
||||||
|
throw std::string ("Failed to truncate pending.data file ");
|
||||||
|
|
||||||
foreach (task, pending)
|
foreach (task, pending)
|
||||||
fputs (task->composeF4 ().c_str (), tdb.mLocations[0].pending);
|
fputs (task->composeF4 ().c_str (), tdb.mLocations[0].pending);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fseek (tdb.mLocations[0].completed, 0, SEEK_SET) == 0)
|
if (fseek (tdb.mLocations[0].completed, 0, SEEK_SET) == 0)
|
||||||
{
|
{
|
||||||
(void)ftruncate (fileno (tdb.mLocations[0].completed), 0);
|
if (ftruncate (fileno (tdb.mLocations[0].completed), 0))
|
||||||
|
throw std::string ("Failed to truncate completed.data file ");
|
||||||
|
|
||||||
foreach (task, completed)
|
foreach (task, completed)
|
||||||
fputs (task->composeF4 ().c_str (), tdb.mLocations[0].completed);
|
fputs (task->composeF4 ().c_str (), tdb.mLocations[0].completed);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -557,8 +557,10 @@ std::string handleEdit ()
|
|||||||
ARE_THESE_REALLY_HARMFUL:
|
ARE_THESE_REALLY_HARMFUL:
|
||||||
// Launch the editor.
|
// Launch the editor.
|
||||||
std::cout << "Launching '" << editor << "' now..." << std::endl;
|
std::cout << "Launching '" << editor << "' now..." << std::endl;
|
||||||
(void)system (editor.c_str ());
|
if (-1 == system (editor.c_str ()))
|
||||||
std::cout << "Editing complete." << std::endl;
|
std::cout << "No editing performed." << std::endl;
|
||||||
|
else
|
||||||
|
std::cout << "Editing complete." << std::endl;
|
||||||
|
|
||||||
// Slurp file.
|
// Slurp file.
|
||||||
std::string after;
|
std::string after;
|
||||||
|
|||||||
Reference in New Issue
Block a user