diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2019-07-25 20:34:28 +0200 |
---|---|---|
committer | Pali Rohár <pali.rohar@gmail.com> | 2019-07-25 20:34:28 +0200 |
commit | 403b240f298d2a9f85c76299f6da8750263fd43b (patch) | |
tree | f91bf43459f6e9cc4aa84b9daa0e90add03dc7ad /test.c | |
parent | 39ff58c2754e6efb266bae5783715e181fe78a12 (diff) | |
download | dlfcn-win32-403b240f298d2a9f85c76299f6da8750263fd43b.tar.gz dlfcn-win32-403b240f298d2a9f85c76299f6da8750263fd43b.tar.bz2 dlfcn-win32-403b240f298d2a9f85c76299f6da8750263fd43b.zip |
Fix gcc warning: comparison between signed and unsigned integer expressions
GetTempPathA() returns DWORD (32/64bit unsigned integer) and not int
(32 signed integer).
Diffstat (limited to 'test.c')
-rw-r--r-- | test.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -86,6 +86,7 @@ int main() | |||
86 | char toolongfile[32767]; | 86 | char toolongfile[32767]; |
87 | DWORD code; | 87 | DWORD code; |
88 | char nonlibraryfile[MAX_PATH]; | 88 | char nonlibraryfile[MAX_PATH]; |
89 | DWORD length; | ||
89 | HANDLE tempfile; | 90 | HANDLE tempfile; |
90 | DWORD dummy; | 91 | DWORD dummy; |
91 | UINT uMode; | 92 | UINT uMode; |
@@ -99,14 +100,14 @@ int main() | |||
99 | _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT); | 100 | _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT); |
100 | #endif | 101 | #endif |
101 | 102 | ||
102 | ret = GetTempPathA( sizeof( nonlibraryfile ) - sizeof( "temp.dll" ), nonlibraryfile ); | 103 | length = GetTempPathA( sizeof( nonlibraryfile ) - sizeof( "temp.dll" ), nonlibraryfile ); |
103 | if( ret == 0 || ret > sizeof( nonlibraryfile ) - sizeof( "temp.dll" ) ) | 104 | if( length == 0 || length > sizeof( nonlibraryfile ) - sizeof( "temp.dll" ) ) |
104 | { | 105 | { |
105 | printf( "ERROR\tGetTempPath failed\n" ); | 106 | printf( "ERROR\tGetTempPath failed\n" ); |
106 | RETURN_ERROR; | 107 | RETURN_ERROR; |
107 | } | 108 | } |
108 | 109 | ||
109 | memcpy( nonlibraryfile + ret, "temp.dll", sizeof( "temp.dll" ) ); | 110 | memcpy( nonlibraryfile + length, "temp.dll", sizeof( "temp.dll" ) ); |
110 | 111 | ||
111 | tempfile = CreateFileA( (LPCSTR) nonlibraryfile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL ); | 112 | tempfile = CreateFileA( (LPCSTR) nonlibraryfile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL ); |
112 | if( tempfile == INVALID_HANDLE_VALUE ) | 113 | if( tempfile == INVALID_HANDLE_VALUE ) |