From: Armin Novak Date: Tue, 29 Oct 2019 11:57:19 +0000 (+0100) Subject: Fixed warnings from TestEnvironmentGetEnvironmentStrings X-Git-Tag: 2.0.0~275^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b06efc78ecb688bd172a7d9da9e84e091c9a053e;p=platform%2Fupstream%2Ffreerdp.git Fixed warnings from TestEnvironmentGetEnvironmentStrings --- diff --git a/winpr/libwinpr/environment/test/TestEnvironmentGetEnvironmentStrings.c b/winpr/libwinpr/environment/test/TestEnvironmentGetEnvironmentStrings.c index 238e5a2..b037a9d 100644 --- a/winpr/libwinpr/environment/test/TestEnvironmentGetEnvironmentStrings.c +++ b/winpr/libwinpr/environment/test/TestEnvironmentGetEnvironmentStrings.c @@ -6,23 +6,33 @@ int TestEnvironmentGetEnvironmentStrings(int argc, char* argv[]) { + int r = -1; TCHAR* p; - int length; + size_t length; LPTCH lpszEnvironmentBlock; + WINPR_UNUSED(argc); + WINPR_UNUSED(argv); + lpszEnvironmentBlock = GetEnvironmentStrings(); p = (TCHAR*) lpszEnvironmentBlock; while (p[0] && p[1]) { - _tprintf(_T("%s\n"), p); + const int rc = _tprintf(_T("%s\n"), p); + if (rc < 1) + goto fail; length = _tcslen(p); + if (length != (size_t)(rc - 1)) + goto fail; p += (length + 1); } + r = 0; +fail: FreeEnvironmentStrings(lpszEnvironmentBlock); - return 0; + return r; }