summaryrefslogtreecommitdiff
path: root/tests/giomm_simple/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/giomm_simple/main.cc')
-rw-r--r--tests/giomm_simple/main.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/giomm_simple/main.cc b/tests/giomm_simple/main.cc
index 175cadf3..7b1e8767 100644
--- a/tests/giomm_simple/main.cc
+++ b/tests/giomm_simple/main.cc
@@ -2,10 +2,10 @@
#include <iostream>
#include <string.h>
-//Use this line if you want debug output:
-//std::ostream& ostr = std::cout;
+// Use this line if you want debug output:
+// std::ostream& ostr = std::cout;
-//This seems nicer and more useful than putting an ifdef around the use of ostr:
+// This seems nicer and more useful than putting an ifdef around the use of ostr:
std::stringstream debug;
std::ostream& ostr = debug;
@@ -15,7 +15,8 @@ std::ostream& ostr = debug;
#define TEST_FILE "/etc/fstab"
#endif
-int main(int, char**)
+int
+main(int, char**)
{
Glib::init();
Gio::init();
@@ -23,37 +24,36 @@ int main(int, char**)
try
{
auto file = Gio::File::create_for_path(TEST_FILE);
- if(!file)
+ if (!file)
{
std::cerr << "Gio::File::create_for_path() returned an empty RefPtr." << std::endl;
- return EXIT_FAILURE;
+ return EXIT_FAILURE;
}
auto stream = file->read();
- if(!stream)
+ if (!stream)
{
std::cerr << "Gio::File::read() returned an empty RefPtr." << std::endl;
- return EXIT_FAILURE;
+ return EXIT_FAILURE;
}
- gchar buffer[1000]; //TODO: This is unpleasant.
+ gchar buffer[1000]; // TODO: This is unpleasant.
memset(buffer, 0, sizeof buffer);
const gsize bytes_read = stream->read(buffer, sizeof buffer - 1);
- if(bytes_read)
+ if (bytes_read)
ostr << "File contents read: " << buffer << std::endl;
else
{
std::cerr << "Gio::InputStream::read() read 0 bytes." << std::endl;
- return EXIT_FAILURE;
+ return EXIT_FAILURE;
}
}
- catch(const Glib::Exception& ex)
+ catch (const Glib::Exception& ex)
{
std::cerr << "Exception caught: " << ex.what() << std::endl;
- return EXIT_FAILURE;
+ return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
-