Author: lslezak
Date: Wed Jul 11 11:33:44 2007
New Revision: 39312
URL: http://svn.opensuse.org/viewcvs/yast?rev=39312&view=rev
Log:
- use size_type for indexing vector
- added logFindAlias() for searching an alias in the known repos
Modified:
branches/REFACTORING-10_3/pkg-bindings/src/Callbacks.cc
branches/REFACTORING-10_3/pkg-bindings/src/Package.cc
branches/REFACTORING-10_3/pkg-bindings/src/PkgModuleFunctions.h
branches/REFACTORING-10_3/pkg-bindings/src/Source.cc
Modified: branches/REFACTORING-10_3/pkg-bindings/src/Callbacks.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/REFACTORING-10_3/pkg-bindings/src/Callbacks.cc?rev=39312&r1=39311&r2=39312&view=diff
==============================================================================
--- branches/REFACTORING-10_3/pkg-bindings/src/Callbacks.cc (original)
+++ branches/REFACTORING-10_3/pkg-bindings/src/Callbacks.cc Wed Jul 11 11:33:44 2007
@@ -43,7 +43,7 @@
// remember redirected URLs
// FIXME huh?
-std::map > redirect_map;
+std::mapzypp::RepoInfo::size_type, std::map > redirect_map;
///////////////////////////////////////////////////////////////////
namespace ZyppRecipients {
@@ -942,7 +942,7 @@
callback.addStr( description );
// search URL in the redirection map
- std::map >::const_iterator source_it = redirect_map.find(source.numericId());
+ std::mapzypp::RepoInfo::size_type, std::map >::const_iterator source_it = redirect_map.find(source.numericId());
bool found = false;
std::string report_url;
Modified: branches/REFACTORING-10_3/pkg-bindings/src/Package.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/REFACTORING-10_3/pkg-bindings/src/Package.cc?rev=39312&r1=39311&r2=39312&view=diff
==============================================================================
--- branches/REFACTORING-10_3/pkg-bindings/src/Package.cc (original)
+++ branches/REFACTORING-10_3/pkg-bindings/src/Package.cc Wed Jul 11 11:33:44 2007
@@ -964,8 +964,9 @@
data->add( YCPString("arch"), YCPString( pkg->arch().asString() ) );
data->add( YCPString("medianr"), YCPInteger( pkg->mediaNr() ) );
- zypp::Repository::NumericId sid = pkg->repository().numericId();
- y2debug("srcId: %ld", sid );
+ #warning FIXME: convert to Yast id (index)
+ std::vectorzypp::RepoInfo::size_type sid = pkg->repository().numericId();
+ y2debug("srcId: %d", sid );
data->add( YCPString("srcid"), YCPInteger( sid ) );
std::string status("available");
Modified: branches/REFACTORING-10_3/pkg-bindings/src/PkgModuleFunctions.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/REFACTORING-10_3/pkg-bindings/src/PkgModuleFunctions.h?rev=39312&r1=39311&r2=39312&view=diff
==============================================================================
--- branches/REFACTORING-10_3/pkg-bindings/src/PkgModuleFunctions.h (original)
+++ branches/REFACTORING-10_3/pkg-bindings/src/PkgModuleFunctions.h Wed Jul 11 11:33:44 2007
@@ -159,8 +159,11 @@
* search for a repository and in case of exception, log error
* and setLastError AND RETHROW
*/
- zypp::RepoInfo& logFindRepository(zypp::Repository::NumericId id);
- zypp::Repository::NumericId createManagedSource(const zypp::Url & url_r,
+ zypp::RepoInfo& logFindRepository(std::vectorzypp::RepoInfo::size_type id);
+
+ std::vectorzypp::RepoInfo::size_type logFindAlias(const std::string &alias);
+
+ std::vectorzypp::RepoInfo::size_type createManagedSource(const zypp::Url & url_r,
const zypp::Pathname & path_r, const bool base_source, const std::string& type);
zypp::MediaSetAccess_Ptr & logFindRepoMedia(RepoMediaVector::size_type id);
Modified: branches/REFACTORING-10_3/pkg-bindings/src/Source.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/REFACTORING-10_3/pkg-bindings/src/Source.cc?rev=39312&r1=39311&r2=39312&view=diff
==============================================================================
--- branches/REFACTORING-10_3/pkg-bindings/src/Source.cc (original)
+++ branches/REFACTORING-10_3/pkg-bindings/src/Source.cc Wed Jul 11 11:33:44 2007
@@ -122,7 +122,7 @@
* call zypp::SourceManager::sourceManager()->findSource
* and in case of exception, log error and setLastError AND RETHROW
*/
-zypp::RepoInfo& PkgModuleFunctions::logFindRepository(zypp::Repository::NumericId id)
+zypp::RepoInfo& PkgModuleFunctions::logFindRepository(std::vectorzypp::RepoInfo::size_type id)
{
try
{
@@ -130,7 +130,7 @@
}
catch (...)
{
- y2error("Cannot find source %ld", id);
+ y2error("Cannot find source %d", id);
// TODO: improve the error message
_last_error.setLastError(_("Cannot find source"));
throw;
@@ -140,6 +140,20 @@
return NOREPO;
}
+std::vectorzypp::RepoInfo::size_type PkgModuleFunctions::logFindAlias(const std::string &alias)
+{
+ std::vectorzypp::RepoInfo::size_type index = 0;
+
+ for(std::vectorzypp::RepoInfo::const_iterator it = repos.begin(); it != repos.end() ; ++it, ++index)
+ {
+ if (it->alias() == alias)
+ return index;
+ }
+
+ return -1;
+}
+
+
zypp::MediaSetAccess_Ptr & PkgModuleFunctions::logFindRepoMedia(RepoMediaVector::size_type id)
{
try
@@ -1140,7 +1154,7 @@
* \return the SourceId
* \throws Exception if Source creation fails
*/
-zypp::Repository::NumericId
+std::vectorzypp::RepoInfo::size_type
PkgModuleFunctions::createManagedSource( const zypp::Url & url_r,
const zypp::Pathname & path_r,
const bool base_source,
@@ -1337,7 +1351,7 @@
zypp::Pathname pn(pd->value ());
YCPList ids;
- zypp::Repository::NumericId id;
+ std::vectorzypp::RepoInfo::size_type id;
if ( pd->value().empty() ) {
@@ -1470,7 +1484,7 @@
YCPList ids;
- zypp::Repository::NumericId ret = -1;
+ std::vectorzypp::RepoInfo::size_type ret = -1;
const std::string type = source_type->value();
@@ -1501,7 +1515,7 @@
{
try
{
- zypp::Repository::NumericId id = createManagedSource(url, it->_dir, base, type);
+ std::vectorzypp::RepoInfo::size_type id = createManagedSource(url, it->_dir, base, type);
zypp::RepoInfo src = logFindRepository(id);
src.setEnabled(true);
@@ -1794,7 +1808,7 @@
YCPList ret;
unsigned long index = 0;
- for( std::vectorzypp::RepoInfo::const_iterator it = repos.begin(); it != repos.end(); ++it)
+ for( std::vectorzypp::RepoInfo::const_iterator it = repos.begin(); it != repos.end(); ++it, ++index)
{
YCPMap src_map;
@@ -1804,8 +1818,6 @@
src_map->add(YCPString("alias"), YCPString(it->alias()));
ret->add(src_map);
-
- ++index;
}
return ret;
@@ -1848,7 +1860,7 @@
continue;
}
- zypp::Repository::NumericId id = descr->value( YCPString("SrcId") )->asInteger()->value();
+ std::vectorzypp::RepoInfo::size_type id = descr->value( YCPString("SrcId") )->asInteger()->value();
zypp::RepoInfo src;
try
@@ -1870,7 +1882,7 @@
if (src.enabled() != enable)
{
- ycpwarning("Pkg::SourceEditSet() does not refresh the pool (src: %lu, state: %s)", id, enable ? "disabled -> enabled" : "enabled -> disabled");
+ ycpwarning("Pkg::SourceEditSet() does not refresh the pool (src: %d, state: %s)", id, enable ? "disabled -> enabled" : "enabled -> disabled");
}
src.setEnabled(enable);
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org