summaryrefslogtreecommitdiff
path: root/src/cstore/unionfs
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2010-08-13 10:56:03 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2010-08-13 10:56:03 -0700
commit5ed312ef6122c7f652c0c07e4357721b4dda8f4f (patch)
tree2f9e6f44104056bf6ee51ef80f5d0ff9adc8b650 /src/cstore/unionfs
parent2aa6d8c6b022f6702437be126eacbe75be5d10aa (diff)
downloadvyatta-cfg-5ed312ef6122c7f652c0c07e4357721b4dda8f4f.tar.gz
vyatta-cfg-5ed312ef6122c7f652c0c07e4357721b4dda8f4f.zip
change all vector/string size to size_t just to be safe.
* would have been a problem if template tree becomes more than 2^32 levels deep or if value strings longer than 2^32 characters are allowed.
Diffstat (limited to 'src/cstore/unionfs')
-rw-r--r--src/cstore/unionfs/cstore-unionfs.cpp14
-rw-r--r--src/cstore/unionfs/cstore-unionfs.hpp2
2 files changed, 8 insertions, 8 deletions
diff --git a/src/cstore/unionfs/cstore-unionfs.cpp b/src/cstore/unionfs/cstore-unionfs.cpp
index 1cfccd4..860d553 100644
--- a/src/cstore/unionfs/cstore-unionfs.cpp
+++ b/src/cstore/unionfs/cstore-unionfs.cpp
@@ -101,7 +101,7 @@ _escape_path_name(const string& path)
// special case for empty string
string npath = (path.size() == 0) ? _fs_escape_chars[-1] : "";
- for (unsigned int i = 0; i < path.size(); i++) {
+ for (size_t i = 0; i < path.size(); i++) {
npath += _escape_char(path[i]);
}
@@ -123,7 +123,7 @@ _unescape_path_name(const string& path)
// assume all escape patterns are 3-char
string npath = "";
- for (unsigned int i = 0; i < path.size(); i++) {
+ for (size_t i = 0; i < path.size(); i++) {
if ((path.size() - i) < 3) {
npath += path.substr(i);
break;
@@ -514,7 +514,7 @@ UnionfsCstore::read_value_vec(vector<string>& vvec, bool active_cfg)
* be writing it any more.
*/
// separate values using newline as delimiter
- unsigned int start_idx = 0, idx = 0;
+ size_t start_idx = 0, idx = 0;
for (; idx < ostr.size(); idx++) {
if (ostr[idx] == '\n') {
// got a value
@@ -547,7 +547,7 @@ UnionfsCstore::write_value_vec(const vector<string>& vvec, bool active_cfg)
}
string ostr = "";
- for (unsigned int i = 0; i < vvec.size(); i++) {
+ for (size_t i = 0; i < vvec.size(); i++) {
if (i > 0) {
// subsequent values require delimiter
ostr += "\n";
@@ -734,7 +734,7 @@ UnionfsCstore::unmark_deactivated_descendants()
}
markers.push_back(di->path());
}
- for (unsigned int i = 0; i < markers.size(); i++) {
+ for (size_t i = 0; i < markers.size(); i++) {
b_fs::remove(markers[i]);
}
} catch (...) {
@@ -828,11 +828,11 @@ UnionfsCstore::discard_changes(unsigned long long& num_removed)
// remove and count
num_removed = 0;
- for (unsigned int i = 0; i < files.size(); i++) {
+ for (size_t i = 0; i < files.size(); i++) {
b_fs::remove(files[i]);
num_removed++;
}
- for (unsigned int i = 0; i < directories.size(); i++) {
+ for (size_t i = 0; i < directories.size(); i++) {
num_removed += b_fs::remove_all(directories[i]);
}
} catch (...) {
diff --git a/src/cstore/unionfs/cstore-unionfs.hpp b/src/cstore/unionfs/cstore-unionfs.hpp
index b0e7201..9e49064 100644
--- a/src/cstore/unionfs/cstore-unionfs.hpp
+++ b/src/cstore/unionfs/cstore-unionfs.hpp
@@ -107,7 +107,7 @@ private:
return pop_path(mutable_cfg_path);
};
void append_cfg_path(const vector<string>& path_comps) {
- for (unsigned int i = 0; i < path_comps.size(); i++) {
+ for (size_t i = 0; i < path_comps.size(); i++) {
push_cfg_path(path_comps[i]);
}
};