Fix size_t underflow (#272)
This fixes abnormal behaviour when controller without namespace is being created
This commit is contained in:
parent
f9998996a5
commit
c9076220ac
|
@ -126,11 +126,11 @@ void create_controller::newSimpleControllerHeaderFile(
|
|||
"path\",\"filter1\",\"filter2\",HttpMethod1,HttpMethod2...);\n";
|
||||
file << " PATH_LIST_END\n";
|
||||
file << "};\n";
|
||||
do
|
||||
while (namespaceCount > 0)
|
||||
{
|
||||
--namespaceCount;
|
||||
file << "}\n";
|
||||
} while (namespaceCount > 0);
|
||||
}
|
||||
}
|
||||
void create_controller::newSimpleControllerSourceFile(
|
||||
std::ofstream &file,
|
||||
|
@ -194,11 +194,11 @@ void create_controller::newWebsockControllerHeaderFile(
|
|||
file << " //WS_PATH_ADD(\"/path\",\"filter1\",\"filter2\",...);\n";
|
||||
file << " WS_PATH_LIST_END\n";
|
||||
file << "};\n";
|
||||
do
|
||||
while (namespaceCount > 0)
|
||||
{
|
||||
--namespaceCount;
|
||||
file << "}\n";
|
||||
} while (namespaceCount > 0);
|
||||
}
|
||||
}
|
||||
void create_controller::newWebsockControllerSourceFile(
|
||||
std::ofstream &file,
|
||||
|
@ -283,11 +283,11 @@ void create_controller::newHttpControllerHeaderFile(
|
|||
"std::function<void (const HttpResponsePtr &)> &&callback,double "
|
||||
"p1,int p2) const;\n";
|
||||
file << "};\n";
|
||||
do
|
||||
while (namespaceCount > 0)
|
||||
{
|
||||
--namespaceCount;
|
||||
file << "}\n";
|
||||
} while (namespaceCount > 0);
|
||||
}
|
||||
}
|
||||
void create_controller::newHttpControllerSourceFile(
|
||||
std::ofstream &file,
|
||||
|
|
8
test.sh
8
test.sh
|
@ -57,12 +57,20 @@ cd drogon_test/controllers
|
|||
drogon_ctl create controller Test::SimpleCtrl
|
||||
drogon_ctl create controller -h Test::HttpCtrl
|
||||
drogon_ctl create controller -w Test::WebsockCtrl
|
||||
drogon_ctl create controller SimpleCtrl
|
||||
drogon_ctl create controller -h HttpCtrl
|
||||
drogon_ctl create controller -w WebsockCtrl
|
||||
|
||||
if [ ! -f "Test_SimpleCtrl.h" -o ! -f "Test_SimpleCtrl.cc" -o ! -f "Test_HttpCtrl.h" -o ! -f "Test_HttpCtrl.cc" -o ! -f "Test_WebsockCtrl.h" -o ! -f "Test_WebsockCtrl.cc" ];then
|
||||
echo "Failed to create controllers"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if [ ! -f "SimpleCtrl.h" -o ! -f "SimpleCtrl.cc" -o ! -f "HttpCtrl.h" -o ! -f "HttpCtrl.cc" -o ! -f "WebsockCtrl.h" -o ! -f "WebsockCtrl.cc" ];then
|
||||
echo "Failed to create controllers"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
cd ../filters
|
||||
|
||||
drogon_ctl create filter Test::TestFilter
|
||||
|
|
Loading…
Reference in New Issue