Mailinglist Archive: zypp-devel (21 mails)

< Previous Next >
Re: [zypp-devel] ok to commit?
  • From: Josef Reidinger <jreidinger@xxxxxxx>
  • Date: Thu, 14 Oct 2010 15:35:51 +0200
  • Message-id: <201010141535.52096.jreidinger@xxxxxxx>
Dominik Heidler write:
Josef Reidinger write:
Dominik Heidler write:
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);
+


Why there is not parse with InputStream variant in header? I think it could
be useful, as it allows to parse stream e.g. directly from network.
Josef


It's included (don't know how it got lost in the email)
Here the complete diff:
http://gitorious.org/opensuse/libzypp/commit/9775d0e85d999835e85e87678a4210e120ff9103



Ah good. I add small hint there

--
Josef Reidinger
YaST team
maintainer of perl-Bootloader and parts of webyast
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx

< Previous Next >