Skip to content

Commit

Permalink
- move some functions to YaST namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
aschnell committed Jun 22, 2012
1 parent 22f4ce8 commit 4ce7407
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
10 changes: 5 additions & 5 deletions libycp/src/YCPBuiltinString.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,7 @@ s_crypt (const YCPString &s)
string unencrypted = s->value();
string encrypted;

if (crypt_pass (unencrypted, CRYPT, &encrypted))
if (YaST::crypt_pass(unencrypted, YaST::CRYPT, &encrypted))
return YCPString (encrypted);
else
{
Expand Down Expand Up @@ -1291,7 +1291,7 @@ s_cryptmd5 (const YCPString &s)
string unencrypted = s->value();
string encrypted;

if (crypt_pass (unencrypted, MD5, &encrypted))
if (YaST::crypt_pass(unencrypted, YaST::MD5, &encrypted))
return YCPString (encrypted);
else
{
Expand Down Expand Up @@ -1322,7 +1322,7 @@ s_cryptblowfish(const YCPString& original)
string unencrypted = original->value();
string encrypted;

if (crypt_pass (unencrypted, BLOWFISH, &encrypted))
if (YaST::crypt_pass(unencrypted, YaST::BLOWFISH, &encrypted))
return YCPString (encrypted);
else
{
Expand Down Expand Up @@ -1353,7 +1353,7 @@ s_cryptsha256(const YCPString& original)
string unencrypted = original->value();
string encrypted;

if (crypt_pass (unencrypted, SHA256, &encrypted))
if (YaST::crypt_pass(unencrypted, YaST::SHA256, &encrypted))
return YCPString (encrypted);
else
{
Expand Down Expand Up @@ -1384,7 +1384,7 @@ s_cryptsha512(const YCPString& original)
string unencrypted = original->value();
string encrypted;

if (crypt_pass (unencrypted, SHA512, &encrypted))
if (YaST::crypt_pass(unencrypted, YaST::SHA512, &encrypted))
return YCPString (encrypted);
else
{
Expand Down
6 changes: 3 additions & 3 deletions libycp/src/YCPString.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ YCPStringRep::YCPStringRep(const string& s)
YCPStringRep::YCPStringRep(const wstring& s)
: v(), is_ascii(false)
{
wchar2utf8(s, &v);
YaST::wchar2utf8(s, &v);
is_ascii = all_of(v.begin(), v.end(), isascii);
}

Expand All @@ -63,7 +63,7 @@ wstring
YCPStringRep::wvalue() const
{
std::wstring ret;
utf82wchar(v, &ret);
YaST::utf82wchar(v, &ret);
return ret;
}

Expand All @@ -87,7 +87,7 @@ YCPOrder YCPStringRep::compare(const YCPString& s, bool rl) const

std::wstring wa, wb;

if (utf82wchar (a, &wa) && utf82wchar (b, &wb))
if (YaST::utf82wchar (a, &wa) && YaST::utf82wchar (b, &wb))
tmp = wcscoll (wa.c_str (), wb.c_str ());
else
tmp = strcoll (a, b);
Expand Down
4 changes: 4 additions & 0 deletions libycp/src/include/ycp/y2string.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#include <string>


namespace YaST
{

bool
recode (iconv_t cd, const std::string& in, std::string* out);

Expand Down Expand Up @@ -56,5 +59,6 @@ utf82wchar (const std::string& in, std::wstring* out);
bool
wchar2utf8 (const std::wstring& in, std::string* out);

}

#endif
4 changes: 4 additions & 0 deletions libycp/src/y2crypt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ extern "C" {
#include "y2log.h"
#include "y2crypt.h"

namespace YaST
{

static int
read_loop (int fd, char* buffer, int count)
Expand Down Expand Up @@ -182,3 +184,5 @@ crypt_pass (string unencrypted, crypt_t use_crypt, string* encrypted)
*encrypted = string (newencrypted);
return true;
}

}
3 changes: 3 additions & 0 deletions libycp/src/y2crypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@

using std::string;

namespace YaST
{

enum crypt_t { CRYPT, MD5, BLOWFISH, SHA256, SHA512 };

bool
crypt_pass (string unencrypted, crypt_t use_crypt, string* encrypted);

}

#endif
5 changes: 5 additions & 0 deletions libycp/src/y2string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include "y2string.h"


namespace YaST
{

template <class In, class Out> void
recode_errors(const In& in, const Out* out)
{
Expand Down Expand Up @@ -159,3 +162,5 @@ wchar2utf8 (const std::wstring& in, std::string* out)

return recode (cd, in, out);
}

}

0 comments on commit 4ce7407

Please sign in to comment.