]> git.tdb.fi Git - builder.git/blobdiff - source/analyzer.cpp
Fix compile errors on 64-bit systems
[builder.git] / source / analyzer.cpp
index 6664477598d653aa3d4a05950a08c62a808e6a42..eae9de75a182c5c83c4b36850464634e4b19e11b 100644 (file)
@@ -5,10 +5,8 @@ Copyright © 2006-2009  Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
-#include <iomanip>
-#include <iostream>
-#include <sstream>
 #include <msp/fs/utils.h>
+#include <msp/io/print.h>
 #include "analyzer.h"
 #include "builder.h"
 #include "install.h"
@@ -29,6 +27,8 @@ Analyzer::Analyzer(Builder &b):
 
 void Analyzer::analyze()
 {
+       table.clear();
+
        TableRow row;
        row.push_back("Name");
        row.push_back("Package");
@@ -95,7 +95,7 @@ void Analyzer::build_depend_table(Target &tgt, unsigned depth)
 
 void Analyzer::print_table() const
 {
-       vector<unsigned> col_width;
+       vector<string::size_type> col_width;
 
        // Determine column widths
        for(Table::const_iterator i=table.begin(); i!=table.end(); ++i)
@@ -108,15 +108,14 @@ void Analyzer::print_table() const
 
        for(Table::const_iterator i=table.begin(); i!=table.end(); ++i)
        {
-               ostringstream ss;
-               ss<<left;
+               string line;
                for(unsigned j=0; j<i->size(); ++j)
                {
                        if(j>0)
-                               ss<<"  ";
-                       ss<<setw(col_width[j])<<(*i)[j];
+                               line+="  ";
+                       line+=lexical_cast((*i)[j], Fmt("%-s").width(col_width[j]));
                }
-               cout<<ss.str()<<'\n';
+               IO::print("%s\n", line);
        }
 }