diff options
author | MyungJoo Ham <myungjoo.ham@samsung.com> | 2017-10-11 15:16:57 +0900 |
---|---|---|
committer | MyungJoo Ham <myungjoo.ham@samsung.com> | 2017-10-11 15:16:57 +0900 |
commit | 915c76ded744c0f5f151402b9fa69f3fd8452573 (patch) | |
tree | ca6a387466543248890f346847acaa8343989b22 /Tests/VSResource/main.cpp | |
parent | 317dbdb79761ef65e45c7358cfc7571c6afa54ad (diff) | |
download | cmake-915c76ded744c0f5f151402b9fa69f3fd8452573.tar.gz cmake-915c76ded744c0f5f151402b9fa69f3fd8452573.tar.bz2 cmake-915c76ded744c0f5f151402b9fa69f3fd8452573.zip |
Imported Upstream version 3.9.4upstream/3.9.4
Diffstat (limited to 'Tests/VSResource/main.cpp')
-rw-r--r-- | Tests/VSResource/main.cpp | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/Tests/VSResource/main.cpp b/Tests/VSResource/main.cpp index 7ee0c74fa..b2b5ac99c 100644 --- a/Tests/VSResource/main.cpp +++ b/Tests/VSResource/main.cpp @@ -1,9 +1,11 @@ -#include <windows.h> #include <stdio.h> +#include <windows.h> + +extern int lib(); struct x { - const char *txt; + const char* txt; }; int main(int argc, char** argv) @@ -22,35 +24,31 @@ int main(int argc, char** argv) test.txt = "*exactly* test.txt"; fprintf(stdout, "CMAKE_RCDEFINE_NO_QUOTED_STRINGS defined\n"); fprintf(stdout, "CMAKE_RCDEFINE is %s, and is *not* a string constant\n", - CMAKE_RCDEFINE); + CMAKE_RCDEFINE); #else // Expect CMAKE_RCDEFINE to be a string: fprintf(stdout, "CMAKE_RCDEFINE='%s', and is a string constant\n", - CMAKE_RCDEFINE); + CMAKE_RCDEFINE); #endif HRSRC hello = ::FindResource(NULL, MAKEINTRESOURCE(1025), "TEXTFILE"); - if(hello) - { + if (hello) { fprintf(stdout, "FindResource worked\n"); HGLOBAL hgbl = ::LoadResource(NULL, hello); - int datasize = (int) ::SizeofResource(NULL, hello); - if(hgbl && datasize>0) - { + int datasize = (int)::SizeofResource(NULL, hello); + if (hgbl && datasize > 0) { fprintf(stdout, "LoadResource worked\n"); fprintf(stdout, "SizeofResource returned datasize='%d'\n", datasize); - void *data = ::LockResource(hgbl); - if (data) - { + void* data = ::LockResource(hgbl); + if (data) { fprintf(stdout, "LockResource worked\n"); - char *str = (char *) malloc(datasize+4); - if (str) - { + char* str = (char*)malloc(datasize + 4); + if (str) { memcpy(str, data, datasize); str[datasize] = 'E'; - str[datasize+1] = 'O'; - str[datasize+2] = 'R'; - str[datasize+3] = 0; + str[datasize + 1] = 'O'; + str[datasize + 2] = 'R'; + str[datasize + 3] = 0; fprintf(stdout, "str='%s'\n", str); free(str); @@ -60,21 +58,18 @@ int main(int argc, char** argv) fprintf(stdout, "LoadString skipped\n"); #else char buf[256]; - if (::LoadString(NULL, 1026, buf, sizeof(buf)) > 0) - { + if (::LoadString(NULL, 1026, buf, sizeof(buf)) > 0) { fprintf(stdout, "LoadString worked\n"); fprintf(stdout, "buf='%s'\n", buf); - } - else - { + } else { fprintf(stdout, "LoadString failed\n"); ret = 1; - } -#endif } +#endif } } } + } - return ret; + return ret + lib(); } |