a few more MSVC++ tweaks for improved compatibility and fewer warnings
This commit is contained in:
@ -25,7 +25,9 @@ if(BUILD_TOOLS)
|
||||
get_filename_component(MSI2LMP_SOURCE_DIR ${LAMMPS_TOOLS_DIR}/msi2lmp/src ABSOLUTE)
|
||||
file(GLOB MSI2LMP_SOURCES ${MSI2LMP_SOURCE_DIR}/[^.]*.c)
|
||||
add_executable(msi2lmp ${MSI2LMP_SOURCES})
|
||||
target_link_libraries(msi2lmp PRIVATE ${MATH_LIBRARIES})
|
||||
if(STANDARD_MATH_LIB)
|
||||
target_link_libraries(msi2lmp PRIVATE ${STANDARD_MATH_LIB})
|
||||
endif()
|
||||
install(TARGETS msi2lmp DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(FILES ${LAMMPS_DOC_DIR}/msi2lmp.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
||||
endif()
|
||||
|
||||
@ -657,7 +657,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
|
||||
int n = plast[i] - pfirst[i];
|
||||
packargs[i] = new char*[n+1];
|
||||
for (int j=0; j < n; ++j)
|
||||
packargs[i][j] = strdup(arg[pfirst[i]+j]);
|
||||
packargs[i][j] = utils::strdup(arg[pfirst[i]+j]);
|
||||
packargs[i][n] = nullptr;
|
||||
}
|
||||
memory->destroy(pfirst);
|
||||
@ -711,7 +711,7 @@ LAMMPS::~LAMMPS()
|
||||
if (num_package) {
|
||||
for (int i = 0; i < num_package; i++) {
|
||||
for (char **ptr = packargs[i]; *ptr != nullptr; ++ptr)
|
||||
free(*ptr);
|
||||
delete[] *ptr;
|
||||
delete[] packargs[i];
|
||||
}
|
||||
delete[] packargs;
|
||||
|
||||
@ -619,7 +619,7 @@ bool platform::is_console(FILE *fp)
|
||||
{
|
||||
if (!fp) return false;
|
||||
#if defined(_WIN32)
|
||||
return (_isatty(fileno(fp)) == 1);
|
||||
return (_isatty(_fileno(fp)) == 1);
|
||||
#else
|
||||
return (isatty(fileno(fp)) == 1);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user