Merge pull request #6181 from shujunqiao/console-std

modify const char* to std::string in CCConsole.
This commit is contained in:
James Chen 2014-04-09 13:21:27 +08:00
commit 5fae622209
2 changed files with 5 additions and 5 deletions

View File

@ -414,13 +414,13 @@ void Console::commandHelp(int fd, const std::string &args)
for(auto it=_commands.begin();it!=_commands.end();++it)
{
auto cmd = it->second;
mydprintf(fd, "\t%s", cmd.name);
ssize_t tabs = strlen(cmd.name) / 8;
mydprintf(fd, "\t%s", cmd.name.c_str());
ssize_t tabs = strlen(cmd.name.c_str()) / 8;
tabs = 3 - tabs;
for(int j=0;j<tabs;j++){
mydprintf(fd, "\t");
}
mydprintf(fd,"%s\n", cmd.help);
mydprintf(fd,"%s\n", cmd.help.c_str());
}
}

View File

@ -74,8 +74,8 @@ class CC_DLL Console
{
public:
struct Command {
const char* name;
const char* help;
std::string name;
std::string help;
std::function<void(int, const std::string&)> callback;
};