We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 36ceecf commit e7042aaCopy full SHA for e7042aa
src/common.cpp
@@ -82,13 +82,10 @@ namespace bin2cpp
82
{
83
static const int DEFAULT_YEAR = 2016;
84
std::string compilationDate = __DATE__;
85
- size_t space1Pos = compilationDate.find(" ", 0);
86
- if (space1Pos == std::string::npos)
+ size_t lastSpace = compilationDate.find_last_of(" ");
+ if (lastSpace == std::string::npos)
87
return DEFAULT_YEAR;
88
- size_t space2Pos = compilationDate.find(" ", space1Pos+1);
89
- if (space2Pos == std::string::npos)
90
- return DEFAULT_YEAR;
91
- const char * yearStr = &compilationDate[space2Pos+1];
+ const char * yearStr = &compilationDate[lastSpace+1];
92
int year = atoi(yearStr);
93
return year;
94
}
0 commit comments