diff options
author | lloyd <[email protected]> | 2010-10-12 19:51:32 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-10-12 19:51:32 +0000 |
commit | a85f136550c08fc878e3983866af0e6460e980da (patch) | |
tree | e495666a243affb92b8a1c5097d536b22c305580 /src/entropy | |
parent | ff2210b035a1598bf99e18a578ff075bece8fbe5 (diff) |
Use size_t in filters
This breaks API for anyone creating their own Filter types, but it had
to happen eventually.
Diffstat (limited to 'src/entropy')
-rw-r--r-- | src/entropy/unix_procs/unix_cmd.cpp | 14 | ||||
-rw-r--r-- | src/entropy/unix_procs/unix_cmd.h | 4 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/entropy/unix_procs/unix_cmd.cpp b/src/entropy/unix_procs/unix_cmd.cpp index c92c84b4c..f4ae5054c 100644 --- a/src/entropy/unix_procs/unix_cmd.cpp +++ b/src/entropy/unix_procs/unix_cmd.cpp @@ -26,14 +26,14 @@ namespace { void do_exec(const std::vector<std::string>& arg_list, const std::vector<std::string>& paths) { - const u32bit args = arg_list.size() - 1; + const size_t args = arg_list.size() - 1; const char* arg1 = (args >= 1) ? arg_list[1].c_str() : 0; const char* arg2 = (args >= 2) ? arg_list[2].c_str() : 0; const char* arg3 = (args >= 3) ? arg_list[3].c_str() : 0; const char* arg4 = (args >= 4) ? arg_list[4].c_str() : 0; - for(u32bit j = 0; j != paths.size(); j++) + for(size_t j = 0; j != paths.size(); j++) { const std::string full_path = paths[j] + "/" + arg_list[0]; const char* fsname = full_path.c_str(); @@ -59,7 +59,7 @@ struct pipe_wrapper /** * Read from the pipe */ -u32bit DataSource_Command::read(byte buf[], u32bit length) +size_t DataSource_Command::read(byte buf[], size_t length) { if(end_of_data()) return 0; @@ -85,13 +85,13 @@ u32bit DataSource_Command::read(byte buf[], u32bit length) return 0; } - return static_cast<u32bit>(got); + return static_cast<size_t>(got); } /** * Peek at the pipe contents */ -u32bit DataSource_Command::peek(byte[], u32bit, u32bit) const +size_t DataSource_Command::peek(byte[], size_t, size_t) const { if(end_of_data()) throw Invalid_State("DataSource_Command: Cannot peek when out of data"); @@ -130,7 +130,8 @@ std::string DataSource_Command::id() const void DataSource_Command::create_pipe(const std::vector<std::string>& paths) { bool found_something = false; - for(u32bit j = 0; j != paths.size(); j++) + + for(size_t j = 0; j != paths.size(); j++) { const std::string full_path = paths[j] + "/" + arg_list[0]; if(::access(full_path.c_str(), X_OK) == 0) @@ -139,6 +140,7 @@ void DataSource_Command::create_pipe(const std::vector<std::string>& paths) break; } } + if(!found_something) return; diff --git a/src/entropy/unix_procs/unix_cmd.h b/src/entropy/unix_procs/unix_cmd.h index 2dc55f6d7..a4ad0c180 100644 --- a/src/entropy/unix_procs/unix_cmd.h +++ b/src/entropy/unix_procs/unix_cmd.h @@ -49,8 +49,8 @@ struct Unix_Program class DataSource_Command : public DataSource { public: - u32bit read(byte[], u32bit); - u32bit peek(byte[], u32bit, u32bit) const; + size_t read(byte[], size_t); + size_t peek(byte[], size_t, size_t) const; bool end_of_data() const; std::string id() const; |