X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=gui.cpp;h=84fd4c26df98c12f175f67d3d6264ae710247ad9;hb=ce9eb5d4646a0e279eae2909a18fccb1197e15fb;hp=3d51236ab26b143abe39a7d32173f41c0234a130;hpb=f6cbc7a59312a00b30f5469b34a783859492d125;p=nssm.git diff --git a/gui.cpp b/gui.cpp index 3d51236..84fd4c2 100644 --- a/gui.cpp +++ b/gui.cpp @@ -154,8 +154,8 @@ int remove(HWND window) { void browse(HWND window) { if (! window) return; - unsigned long bufsize = 256; - unsigned long len = bufsize; + size_t bufsize = 256; + size_t len = bufsize; OPENFILENAME ofn; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); @@ -164,18 +164,18 @@ void browse(HWND window) { if (ofn.lpstrFilter) { ZeroMemory((void *) ofn.lpstrFilter, bufsize); char *localised = message_string(NSSM_GUI_BROWSE_FILTER_APPLICATIONS); - _snprintf((char *) ofn.lpstrFilter, bufsize, localised); + _snprintf_s((char *) ofn.lpstrFilter, bufsize, _TRUNCATE, localised); /* "Applications" + NULL + "*.exe" + NULL */ len = strlen(localised) + 1; LocalFree(localised); - _snprintf((char *) ofn.lpstrFilter + len, bufsize - len, "*.exe"); + _snprintf_s((char *) ofn.lpstrFilter + len, bufsize - len, _TRUNCATE, "*.exe"); /* "All files" + NULL + "*.*" + NULL */ len += 6; localised = message_string(NSSM_GUI_BROWSE_FILTER_ALL_FILES); - _snprintf((char *) ofn.lpstrFilter + len, bufsize - len, localised); + _snprintf_s((char *) ofn.lpstrFilter + len, bufsize - len, _TRUNCATE, localised); len += strlen(localised) + 1; LocalFree(localised); - _snprintf((char *) ofn.lpstrFilter + len, bufsize - len, "*.*"); + _snprintf_s((char *) ofn.lpstrFilter + len, bufsize - len, _TRUNCATE, "*.*"); /* Remainder of the buffer is already zeroed */ } ofn.lpstrFile = new char[MAX_PATH];