Fix build errors on Linux

This commit is contained in:
Zeex 2018-08-11 23:41:46 +06:00
parent 6e6f37b54a
commit 357cd6f43b
2 changed files with 16 additions and 4 deletions

View File

@ -34,7 +34,7 @@ size_t AMXAPI aux_ProgramSize(char *filename)
if ((fp=fopen(filename,"rb")) == NULL)
return 0;
fread(&hdr, sizeof hdr, 1, fp);
(void)fread(&hdr, sizeof hdr, 1, fp);
fclose(fp);
amx_Align16(&hdr.magic);
@ -51,7 +51,7 @@ int AMXAPI aux_LoadProgram(AMX *amx, char *filename, void *memblock)
/* open the file, read and check the header */
if ((fp = fopen(filename, "rb")) == NULL)
return AMX_ERR_NOTFOUND;
fread(&hdr, sizeof hdr, 1, fp);
(void)fread(&hdr, sizeof hdr, 1, fp);
amx_Align16(&hdr.magic);
amx_Align32((uint32_t *)&hdr.size);
amx_Align32((uint32_t *)&hdr.stp);
@ -73,7 +73,7 @@ int AMXAPI aux_LoadProgram(AMX *amx, char *filename, void *memblock)
/* read in the file */
rewind(fp);
fread(memblock, 1, (size_t)hdr.size, fp);
(void)fread(memblock, 1, (size_t)hdr.size, fp);
fclose(fp);
/* initialize the abstract machine */

View File

@ -171,8 +171,20 @@ set(PAWNRUNS_SRCS
../amx/amxaux.c
../amx/amxaux.h
../amx/amxcons.c
../amx/amxcore.c)
../amx/amxcore.c
)
if(UNIX)
set(PAWNRUN_SRCS
${PAWNRUN_SRCS}
../linux/getch.c
../linux/getch.h
../linux/binreloc.c
)
endif()
add_executable(pawnruns ${PAWNRUNS_SRCS})
if(UNIX)
target_link_libraries(pawnruns dl)
endif()
add_subdirectory(tests)
# Generate a binary package with CPack