Fix warnings with -Wconversion in gcc in threadexecutor

This commit is contained in:
Reijo Tomperi 2012-01-03 22:21:17 +02:00
parent 1b03667d5b
commit 1a6894fe25
2 changed files with 7 additions and 5 deletions

View File

@ -261,11 +261,11 @@ unsigned int ThreadExecutor::check()
return result;
}
void ThreadExecutor::writeToPipe(char type, const std::string &data)
void ThreadExecutor::writeToPipe(PipeSignal type, const std::string &data)
{
unsigned int len = data.length() + 1;
unsigned int len = static_cast<unsigned int>(data.length() + 1);
char *out = new char[ len + 1 + sizeof(len)];
out[0] = type;
out[0] = static_cast<char>(type);
std::memcpy(&(out[1]), &len, sizeof(len));
std::memcpy(&(out[1+sizeof(len)]), data.c_str(), len);
if (write(_wpipe, out, len + 1 + sizeof(len)) <= 0) {

View File

@ -65,6 +65,8 @@ private:
#ifdef THREADING_MODEL_FORK
private:
enum PipeSignal {REPORT_OUT='1',REPORT_ERROR='2', CHILD_END='3'};
/**
* Read from the pipe, parse and handle what ever is in there.
*@return -1 in case of error
@ -72,14 +74,14 @@ private:
* 1 if we did read something
*/
int handleRead(int rpipe, unsigned int &result);
void writeToPipe(char type, const std::string &data);
void writeToPipe(PipeSignal type, const std::string &data);
/**
* Write end of status pipe, different for each child.
* Not used in master process.
*/
int _wpipe;
std::list<std::string> _errorList;
enum PipeSignal {REPORT_OUT='1',REPORT_ERROR='2', CHILD_END='3'};
public:
/**
* @return true if support for threads exist.