Mailinglist Archive: zypp-devel (21 mails)

< Previous Next >
[zypp-devel] ok to commit?
  • From: Dominik Heidler <dheidler@xxxxxxx>
  • Date: Wed, 13 Oct 2010 15:56:06 +0200
  • Message-id: <4CB5BA76.2080309@xxxxxxx>
diff --git a/zypp/media/MetaLinkParser.cc b/zypp/media/MetaLinkParser.cc
index 056a7f5..2c11cf6 100644
--- a/zypp/media/MetaLinkParser.cc
+++ b/zypp/media/MetaLinkParser.cc
@@ -386,16 +386,21 @@ MetaLinkParser::~MetaLinkParser()
}

void
-MetaLinkParser::parse(string filename)
+MetaLinkParser::parse(Pathname filename)
+{
+ parse(InputStream(filename));
+}
+
+void
+MetaLinkParser::parse(const InputStream &is)
{
char buf[4096];
- std::ifstream is(filename.c_str());
- if (!is)
+ if (!is.stream())
ZYPP_THROW(Exception("MetaLinkParser: no such file"));
- while (is.good())
+ while (is.stream().good())
{
- is.read(buf, sizeof(buf));
- parseBytes(buf, is.gcount());
+ is.stream().read(buf, sizeof(buf));
+ parseBytes(buf, is.stream().gcount());
}
parseEnd();
}
diff --git a/zypp/media/MetaLinkParser.h b/zypp/media/MetaLinkParser.h
index eacc486..b9073d0 100644
--- a/zypp/media/MetaLinkParser.h
+++ b/zypp/media/MetaLinkParser.h
@@ -16,6 +16,7 @@

#include "zypp/base/Exception.h"
#include "zypp/base/NonCopyable.h"
+#include "zypp/base/InputStream.h"
#include "zypp/media/MediaBlockList.h"
#include "zypp/Url.h"

@@ -33,7 +34,13 @@ public:
* parse a file consisting of metalink xml data
* \throws Exception
**/
- void parse(std::string filename);
+ void parse(Pathname filename);
+
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups