Skip to content

Commit 27111d3

Browse files
committed
changed size of buffer handling
1 parent 367766f commit 27111d3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Configuration.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ namespace chesspp
3333
// <.app>/Contents/Resources/res/img... should be where resources are stored.
3434
std::string getResourcePath()
3535
{
36-
char buf[1024];
37-
uint32_t size = sizeof(buf);
38-
memset(buf, 0, sizeof(buf));
36+
const uint32_t SIZE = 1024;
37+
char buf[SIZE];
38+
memset(buf, 0, SIZE);
3939
std::string ret;
4040
#if defined(__linux__)
41-
if(readlink("/proc/self/exe", buf, sizeof(buf)) == -1)
41+
if(readlink("/proc/self/exe", buf, SIZE) == -1)
4242
throw chesspp::exception("Unable to determine executable path on Linux.");
4343
ret = buf;
4444
ret = ret.substr(0, ret.find_last_of('/')+1);
4545

4646
#elif defined(_WIN32)
47-
if(GetModuleFileNameA(NULL, buf, sizeof(buf)) == 0)
47+
if(GetModuleFileNameA(NULL, buf, SIZE) == 0)
4848
throw chesspp::exception("Unable to determine executable path on Windows.");
4949
ret = buf;
5050
boost::replace_all(ret, "\\", "/");

0 commit comments

Comments
 (0)