aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-12 20:05:14 +0000
committerlloyd <[email protected]>2010-10-12 20:05:14 +0000
commitb29e17a4ea70bcabb7d8eeb441bb70fd0c87b185 (patch)
treec297f0245d3a604fe4dea849979b84c3b4e709f9 /src/libstate
parent9abeb56f7d355b8ff86cbb465ba1e0a08257ec12 (diff)
Use size_t in SCAN_Name
Diffstat (limited to 'src/libstate')
-rw-r--r--src/libstate/get_enc.cpp2
-rw-r--r--src/libstate/scan_name.cpp32
-rw-r--r--src/libstate/scan_name.h12
3 files changed, 23 insertions, 23 deletions
diff --git a/src/libstate/get_enc.cpp b/src/libstate/get_enc.cpp
index 1176061c2..d4ca99535 100644
--- a/src/libstate/get_enc.cpp
+++ b/src/libstate/get_enc.cpp
@@ -161,7 +161,7 @@ EMSA* get_emsa(const std::string& algo_spec)
if(request.arg_count() == 3)
return new EMSA4(af.make_hash_function(request.arg(0)),
- request.arg_as_u32bit(2, 0));
+ request.arg_as_integer(2, 0));
}
#endif
diff --git a/src/libstate/scan_name.cpp b/src/libstate/scan_name.cpp
index 7c2e4b28d..a17dc4ad0 100644
--- a/src/libstate/scan_name.cpp
+++ b/src/libstate/scan_name.cpp
@@ -16,14 +16,14 @@ namespace Botan {
namespace {
std::string make_arg(
- const std::vector<std::pair<u32bit, std::string> >& name, u32bit start)
+ const std::vector<std::pair<size_t, std::string> >& name, size_t start)
{
std::string output = name[start].second;
- u32bit level = name[start].first;
+ size_t level = name[start].first;
- u32bit paren_depth = 0;
+ size_t paren_depth = 0;
- for(u32bit i = start + 1; i != name.size(); ++i)
+ for(size_t i = start + 1; i != name.size(); ++i)
{
if(name[i].first <= name[start].first)
break;
@@ -48,14 +48,14 @@ std::string make_arg(
level = name[i].first;
}
- for(u32bit i = 0; i != paren_depth; ++i)
+ for(size_t i = 0; i != paren_depth; ++i)
output += ')';
return output;
}
-std::pair<u32bit, std::string>
-deref_aliases(const std::pair<u32bit, std::string>& in)
+std::pair<size_t, std::string>
+deref_aliases(const std::pair<size_t, std::string>& in)
{
return std::make_pair(in.first,
global_state().deref_alias(in.second));
@@ -67,15 +67,15 @@ SCAN_Name::SCAN_Name(std::string algo_spec)
{
orig_algo_spec = algo_spec;
- std::vector<std::pair<u32bit, std::string> > name;
- u32bit level = 0;
- std::pair<u32bit, std::string> accum = std::make_pair(level, "");
+ std::vector<std::pair<size_t, std::string> > name;
+ size_t level = 0;
+ std::pair<size_t, std::string> accum = std::make_pair(level, "");
std::string decoding_error = "Bad SCAN name '" + algo_spec + "': ";
algo_spec = global_state().deref_alias(algo_spec);
- for(u32bit i = 0; i != algo_spec.size(); ++i)
+ for(size_t i = 0; i != algo_spec.size(); ++i)
{
char c = algo_spec[i];
@@ -116,7 +116,7 @@ SCAN_Name::SCAN_Name(std::string algo_spec)
bool in_modes = false;
- for(u32bit i = 1; i != name.size(); ++i)
+ for(size_t i = 1; i != name.size(); ++i)
{
if(name[i].first == 0)
{
@@ -137,7 +137,7 @@ std::string SCAN_Name::algo_name_and_args() const
if(arg_count())
{
out += '(';
- for(u32bit i = 0; i != arg_count(); ++i)
+ for(size_t i = 0; i != arg_count(); ++i)
{
out += arg(i);
if(i != arg_count() - 1)
@@ -150,21 +150,21 @@ std::string SCAN_Name::algo_name_and_args() const
return out;
}
-std::string SCAN_Name::arg(u32bit i) const
+std::string SCAN_Name::arg(size_t i) const
{
if(i >= arg_count())
throw std::range_error("SCAN_Name::argument - i out of range");
return args[i];
}
-std::string SCAN_Name::arg(u32bit i, const std::string& def_value) const
+std::string SCAN_Name::arg(size_t i, const std::string& def_value) const
{
if(i >= arg_count())
return def_value;
return args[i];
}
-u32bit SCAN_Name::arg_as_u32bit(u32bit i, u32bit def_value) const
+size_t SCAN_Name::arg_as_integer(size_t i, size_t def_value) const
{
if(i >= arg_count())
return def_value;
diff --git a/src/libstate/scan_name.h b/src/libstate/scan_name.h
index 3d11d54f6..0d30dc44c 100644
--- a/src/libstate/scan_name.h
+++ b/src/libstate/scan_name.h
@@ -45,35 +45,35 @@ class BOTAN_DLL SCAN_Name
/**
* @return number of arguments
*/
- u32bit arg_count() const { return args.size(); }
+ size_t arg_count() const { return args.size(); }
/**
* @param lower is the lower bound
* @param upper is the upper bound
* @return if the number of arguments is between lower and upper
*/
- bool arg_count_between(u32bit lower, u32bit upper) const
+ bool arg_count_between(size_t lower, size_t upper) const
{ return ((arg_count() >= lower) && (arg_count() <= upper)); }
/**
* @param i which argument
* @return ith argument
*/
- std::string arg(u32bit i) const;
+ std::string arg(size_t i) const;
/**
* @param i which argument
* @param def_value the default value
* @return ith argument or the default value
*/
- std::string arg(u32bit i, const std::string& def_value) const;
+ std::string arg(size_t i, const std::string& def_value) const;
/**
* @param i which argument
* @param def_value the default value
- * @return ith argument as a u32bit, or the default value
+ * @return ith argument as an integer, or the default value
*/
- u32bit arg_as_u32bit(u32bit i, u32bit def_value) const;
+ size_t arg_as_integer(size_t i, size_t def_value) const;
/**
* @return cipher mode (if any)