Commit 80e510d4 authored by GUYOT DOMINIQUE's avatar GUYOT DOMINIQUE
Browse files

Convert some C-casts to C++-casts

parent ff758afb
......@@ -61,10 +61,11 @@ struct Cline{
*/
int main(int argc, char** argv)
{
Cline* cline = new Cline(argc,argv);
cout << cline->input << endl;
cout << cline->output << endl;
cout << cline->conf << endl;
//Cline* cline = new Cline(argc,argv);
Cline cline = Cline(argc,argv);
cout << cline.input << endl;
cout << cline.output << endl;
cout << cline.conf << endl;
//delete(cline);
return 0;
}
......@@ -69,10 +69,10 @@ struct Parser{
/*
int main(int argc, char** argv){
Parser* P = new Parser(string(argv[1]), string(">"));
cout << P->get_chunk(0);
delete(P);
}
*/
......@@ -81,9 +81,9 @@ struct Process{
struct timeval rtimer;
if ((gettimeofday(&rtimer, NULL) == 0) && (getrusage(RUSAGE_CHILDREN,&timer) == 0)){
rtime = UINT64_C(1000000) * (uint64_t)rtimer.tv_sec + (uint64_t)rtimer.tv_usec;
utime = UINT64_C(1000000) * (uint64_t)timer.ru_utime.tv_sec + (uint64_t)timer.ru_utime.tv_usec;
ktime = UINT64_C(1000000) * (uint64_t)timer.ru_stime.tv_sec + (uint64_t)timer.ru_stime.tv_usec;
rtime = UINT64_C(1000000) * static_cast<uint64_t>(rtimer.tv_sec) + static_cast<uint64_t>(rtimer.tv_usec);
utime = UINT64_C(1000000) * static_cast<uint64_t>(timer.ru_utime.tv_sec) + static_cast<uint64_t>(timer.ru_utime.tv_usec);
ktime = UINT64_C(1000000) * static_cast<uint64_t>(timer.ru_stime.tv_sec) + static_cast<uint64_t>(timer.ru_stime.tv_usec);
}
else{
timerok = 0;
......@@ -92,9 +92,9 @@ struct Process{
rcode = static_cast<uint64_t>(system(cmd.c_str()));
if ((gettimeofday(&rtimer, NULL) == 0) && (getrusage(RUSAGE_CHILDREN,&timer) == 0)){
rtime = UINT64_C(1000000) * (uint64_t)rtimer.tv_sec + (uint64_t)rtimer.tv_usec - rtime;
utime = UINT64_C(1000000) * (uint64_t)timer.ru_utime.tv_sec + (uint64_t)timer.ru_utime.tv_usec - utime;
ktime = UINT64_C(1000000) * (uint64_t)timer.ru_stime.tv_sec + (uint64_t)timer.ru_stime.tv_usec - ktime;
rtime = UINT64_C(1000000) * static_cast<uint64_t>(rtimer.tv_sec) + static_cast<uint64_t>(rtimer.tv_usec) - rtime;
utime = UINT64_C(1000000) * static_cast<uint64_t>(timer.ru_utime.tv_sec) + static_cast<uint64_t>(timer.ru_utime.tv_usec) - utime;
ktime = UINT64_C(1000000) * static_cast<uint64_t>(timer.ru_stime.tv_sec) + static_cast<uint64_t>(timer.ru_stime.tv_usec )- ktime;
}
else{
timerok = 0;
......@@ -139,7 +139,7 @@ struct Process{
int main(int argc, char** argv){
Process* pr = new Process("cat #chunkin# > #chunkout# && sleep 1", "/dev/shm/");
Parser* pa = new Parser(argv);
Parser* pa = new Parser(string(argv[1]), string(">"));
pr->write_chunkin(pa->get_chunk(4));
pr->run();
cout << pr->rtime << endl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment