Fix remaining warnings on Windows.

develop
Ben Lubar 2018-04-06 21:22:48 -05:00
parent 67de61a1fe
commit afc2c476bb
No known key found for this signature in database
GPG Key ID: 018BAB45DB2D2B24
12 changed files with 50 additions and 46 deletions

@ -53,13 +53,18 @@ if(MSVC)
add_definitions( "/wd4819" )
# Disable use of POSIX name warnings
add_definitions ( "/D_CRT_NONSTDC_NO_WARNINGS")
add_definitions ( "/D_CRT_NONSTDC_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS")
# supress C4503 - VC++ dislikes if a name is too long. If you get
# weird and mysterious linking errors, you can disable this, but you'll have to
# deal with a LOT of compiler noise over it
# see https://msdn.microsoft.com/en-us/library/074af4b6.aspx
add_definitions( "/wd4503")
# suppress C4267 - VC++ complains whenever we implicitly convert an integer to
# a smaller type, and most of the time this is just conversion from 64 to 32 bits
# for things like vector sizes, which are never that big anyway.
add_definitions( "/wd4267")
endif()
# Automatically detect architecture based on Visual Studio generator

@ -7,7 +7,7 @@ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DLUA_USE_
ADD_DEFINITIONS(-DLUA_COMPAT_BITLIB)
IF(WIN32)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE )
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE /wd4334 )
ELSE()
ADD_DEFINITIONS ( -DLUA_USE_POSIX -DLUA_USE_DLOPEN )
SET ( LIBS m dl )

@ -16,10 +16,6 @@
* Petr Mrázek
*/
#if defined(_MSC_VER) && _MSC_VER >= 1400
#define _CRT_SECURE_NO_WARNINGS
#endif
//----------------------------------------------------------------------
//basic includes
#include <algorithm>

@ -78,14 +78,6 @@ MACRO(DFHACK_PLUGIN)
LIST(APPEND PLUGIN_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/proto/${pbuf}.proto)
ENDFOREACH()
ADD_LIBRARY(${PLUGIN_NAME} MODULE ${PLUGIN_SOURCES})
IDE_FOLDER(${PLUGIN_NAME} "Plugins")
ADD_DEPENDENCIES(${PLUGIN_NAME} dfhack-version)
# Make sure the source is generated before the executable builds.
ADD_DEPENDENCIES(${PLUGIN_NAME} generate_proto)
LIST(LENGTH PLUGIN_PROTOS NUM_PROTO)
IF(NUM_PROTO)
STRING(REPLACE ".proto" ".pb.cc" PLUGIN_PROTO_SRCS "${PLUGIN_PROTOS}")
@ -106,7 +98,7 @@ MACRO(DFHACK_PLUGIN)
ADD_CUSTOM_COMMAND(
OUTPUT ${PLUGIN_PROTO_TMP_FILES}
COMMAND protoc-bin -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/
--cpp_out=dllexport_decl=DFHACK_EXPORT:${CMAKE_CURRENT_SOURCE_DIR}/proto/tmp/
--cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/proto/tmp/
${PLUGIN_PROTOS}
COMMAND ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/depends/copy-if-different.pl
${PLUGIN_PROTO_TMP_FILES}
@ -120,23 +112,34 @@ MACRO(DFHACK_PLUGIN)
ENDIF()
ADD_CUSTOM_TARGET(generate_proto_${PLUGIN_NAME} DEPENDS ${PLUGIN_PROTO_TMP_FILES})
ADD_DEPENDENCIES(${PLUGIN_NAME} generate_proto_${PLUGIN_NAME})
# Merge headers into sources
SET_SOURCE_FILES_PROPERTIES( ${PLUGIN_PROTO_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE )
LIST(APPEND PLUGIN_SOURCES ${PLUGIN_PROTO_HDRS})
LIST(APPEND PLUGIN_SOURCES ${PLUGIN_PROTO_SRCS})
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} dfhack protobuf-lite dfhack-version ${PLUGIN_LINK_LIBRARIES})
IF(UNIX)
SET(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} -include Export.h")
ELSE()
SET(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} /FI\"Export.h\"")
ENDIF()
ENDIF()
ADD_LIBRARY(${PLUGIN_NAME} MODULE ${PLUGIN_SOURCES})
IDE_FOLDER(${PLUGIN_NAME} "Plugins")
IF(NUM_PROTO)
ADD_DEPENDENCIES(${PLUGIN_NAME} generate_proto_${PLUGIN_NAME})
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} dfhack protobuf-lite dfhack-version ${PLUGIN_LINK_LIBRARIES})
ELSE()
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} dfhack dfhack-version ${PLUGIN_LINK_LIBRARIES})
ENDIF()
ADD_DEPENDENCIES(${PLUGIN_NAME} dfhack-version)
# Make sure the source is generated before the executable builds.
ADD_DEPENDENCIES(${PLUGIN_NAME} generate_proto)
IF(UNIX)
SET(PLUGIN_COMPILE_FLAGS "${PLUGIN_COMPILE_FLAGS} ${PLUGIN_COMPILE_FLAGS_GCC}")
ELSE()

@ -286,7 +286,7 @@ protected:
// Used for event handling
int prev_x;
int prev_y;
bool prev_lbut;
int8_t prev_lbut;
// Used for controls
bool base_max_x;
bool base_max_y;
@ -306,7 +306,7 @@ protected:
return in_local_move || in_local_edge_resize_x || in_local_edge_resize_y ||
in_local_corner_resize;
}
void lbut_press(start_sitest* screen, bool pressed, int x, int y)
void lbut_press(start_sitest* screen, int8_t pressed, int x, int y)
{
GET_EMBARK_POS(screen, x1, x2, y1, y2, width, height);
in_local_move = in_local_edge_resize_x = in_local_edge_resize_y =
@ -462,7 +462,7 @@ public:
:EmbarkTool(),
prev_x(0),
prev_y(0),
prev_lbut(false),
prev_lbut(0),
base_max_x(false),
base_max_y(false),
in_local_move(false),

@ -165,7 +165,7 @@ command_result fortplan(color_ostream &out, vector<string> & params) {
con.print("Loading file '%s'...\n",filename.c_str());
try {
layout = tokenizeFile(filename);
} catch (int e) {
} catch (int) {
con.print("Could not open the file.\n");
return CR_FAILURE;
}

@ -42,4 +42,4 @@ ELSE(UNIX)
)
ENDIF(UNIX)
# this makes sure all the stuff is put in proper places and linked to dfhack
DFHACK_PLUGIN(RemoteFortressReader ${PROJECT_SRCS} LINK_LIBRARIES ${PROJECT_LIBS} COMPILE_FLAGS_MSVC "/FI\"Export.h\"" COMPILE_FLAGS_GCC "-include Export.h -Wno-misleading-indentation" )
DFHACK_PLUGIN(RemoteFortressReader ${PROJECT_SRCS} LINK_LIBRARIES protobuf-lite ${PROJECT_LIBS} COMPILE_FLAGS_MSVC "/FI\"Export.h\"" COMPILE_FLAGS_GCC "-include Export.h -Wno-misleading-indentation" )

@ -957,14 +957,14 @@ class animal_trainer_search : public animal_trainer_search_base
public:
void render() const
{
Screen::paintTile(Screen::Pen(186, 8, 0), 14, 2);
Screen::paintTile(Screen::Pen(186, 8, 0), gps->dimx - 14, 2);
Screen::paintTile(Screen::Pen(201, 8, 0), 14, 1);
Screen::paintTile(Screen::Pen(187, 8, 0), gps->dimx - 14, 1);
Screen::paintTile(Screen::Pen('\xBA', 8, 0), 14, 2);
Screen::paintTile(Screen::Pen('\xBA', 8, 0), gps->dimx - 14, 2);
Screen::paintTile(Screen::Pen('\xC9', 8, 0), 14, 1);
Screen::paintTile(Screen::Pen('\xBB', 8, 0), gps->dimx - 14, 1);
for (int x = 15; x <= gps->dimx - 15; ++x)
{
Screen::paintTile(Screen::Pen(205, 8, 0), x, 1);
Screen::paintTile(Screen::Pen(0, 0, 0), x, 2);
Screen::paintTile(Screen::Pen('\xCD', 8, 0), x, 1);
Screen::paintTile(Screen::Pen('\x00', 0, 0), x, 2);
}
print_search_option(16, 2);
}

@ -71,8 +71,8 @@ void OrganicMatLookup::food_build_map ( std::ostream &out )
df::world_raws &raws = world->raws;
df::special_mat_table table = raws.mat_table;
using df::enums::organic_mat_category::organic_mat_category;
df::enum_traits<organic_mat_category> traits;
for ( int32_t mat_category = traits.first_item_value; mat_category <= traits.last_item_value; ++mat_category )
using traits = df::enum_traits<organic_mat_category>;
for ( int32_t mat_category = traits::first_item_value; mat_category <= traits::last_item_value; ++mat_category )
{
for ( size_t i = 0; i < table.organic_indexes[mat_category].size(); ++i )
{

@ -227,14 +227,14 @@ void StockpileSerializer::unserialize_list_organic_mat ( FuncReadImport get_valu
void StockpileSerializer::serialize_list_item_type ( FuncItemAllowed is_allowed, FuncWriteExport add_value, const std::vector<char> &list )
{
using df::enums::item_type::item_type;
df::enum_traits<item_type> type_traits;
debug() << "item_type size = " << list.size() << " size limit = " << type_traits.last_item_value << " typecasted: " << ( size_t ) type_traits.last_item_value << endl;
for ( size_t i = 0; i <= ( size_t ) type_traits.last_item_value; ++i )
using type_traits = df::enum_traits<item_type>;
debug() << "item_type size = " << list.size() << " size limit = " << type_traits::last_item_value << " typecasted: " << ( size_t ) type_traits::last_item_value << endl;
for ( size_t i = 0; i <= ( size_t ) type_traits::last_item_value; ++i )
{
if ( list.at ( i ) )
{
const item_type type = ( item_type ) ( ( df::enum_traits<item_type>::base_type ) i );
std::string r_type ( type_traits.key_table[i+1] );
std::string r_type ( type_traits::key_table[i+1] );
if ( !is_allowed ( type ) ) continue;
add_value ( r_type );
debug() << "item_type key_table[" << i+1 << "] type[" << ( int16_t ) type << "] is " << r_type <<endl;
@ -321,12 +321,12 @@ void StockpileSerializer::unserialize_list_material ( FuncMaterialAllowed is_all
void StockpileSerializer::serialize_list_quality ( FuncWriteExport add_value, const bool ( &quality_list ) [7] )
{
using df::enums::item_quality::item_quality;
df::enum_traits<item_quality> quality_traits;
using quality_traits = df::enum_traits<item_quality>;
for ( size_t i = 0; i < 7; ++i )
{
if ( quality_list[i] )
{
const std::string f_type ( quality_traits.key_table[i] );
const std::string f_type ( quality_traits::key_table[i] );
add_value ( f_type );
debug() << " quality: " << i << " is " << f_type <<endl;
}
@ -756,12 +756,12 @@ void StockpileSerializer::write_food()
food->set_prepared_meals ( mPile->settings.food.prepared_meals );
using df::enums::organic_mat_category::organic_mat_category;
df::enum_traits<organic_mat_category> traits;
for ( int32_t mat_category = traits.first_item_value; mat_category <traits.last_item_value; ++mat_category )
using traits = df::enum_traits<organic_mat_category>;
for ( int32_t mat_category = traits::first_item_value; mat_category <traits::last_item_value; ++mat_category )
{
food_pair p = food_map ( ( organic_mat_category ) mat_category );
if ( !p.valid ) continue;
debug() << " food: " << traits.key_table[mat_category] << endl;
debug() << " food: " << traits::key_table[mat_category] << endl;
serialize_list_organic_mat ( p.set_value, p.stockpile_values, ( organic_mat_category ) mat_category );
}
}
@ -770,7 +770,7 @@ void StockpileSerializer::write_food()
void StockpileSerializer::read_food()
{
using df::enums::organic_mat_category::organic_mat_category;
df::enum_traits<organic_mat_category> traits;
using traits = df::enum_traits<organic_mat_category>;
if ( mBuffer.has_food() )
{
mPile->settings.flags.bits.food = 1;
@ -784,7 +784,7 @@ void StockpileSerializer::read_food()
debug() << " prepared_meals: " << mPile->settings.food.prepared_meals << endl;
for ( int32_t mat_category = traits.first_item_value; mat_category <traits.last_item_value; ++mat_category )
for ( int32_t mat_category = traits::first_item_value; mat_category <traits::last_item_value; ++mat_category )
{
food_pair p = food_map ( ( organic_mat_category ) mat_category );
if ( !p.valid ) continue;
@ -793,7 +793,7 @@ void StockpileSerializer::read_food()
}
else
{
for ( int32_t mat_category = traits.first_item_value; mat_category <traits.last_item_value; ++mat_category )
for ( int32_t mat_category = traits::first_item_value; mat_category <traits::last_item_value; ++mat_category )
{
food_pair p = food_map ( ( organic_mat_category ) mat_category );
if ( !p.valid ) continue;
@ -830,12 +830,12 @@ void StockpileSerializer::write_furniture()
// FURNITURE type
using df::enums::furniture_type::furniture_type;
df::enum_traits<furniture_type> type_traits;
using type_traits = df::enum_traits<furniture_type>;
for ( size_t i = 0; i < mPile->settings.furniture.type.size(); ++i )
{
if ( mPile->settings.furniture.type.at ( i ) )
{
std::string f_type ( type_traits.key_table[i] );
std::string f_type ( type_traits::key_table[i] );
furniture->add_type ( f_type );
debug() << "furniture_type " << i << " is " << f_type <<endl;
}

@ -1 +1 @@
Subproject commit 9724981c4c3ed5ce308bdde716877ef94cd52f02
Subproject commit 9bc7acc114e25c7399f4b85c95d544fe7e7c3d8e

@ -1874,7 +1874,7 @@ command_result df_zone (color_ostream &out, vector <string> & parameters)
if (p == "race") {
race_filter_set = true;
}
} catch (const exception& err) {
} catch (const exception&) {
return CR_FAILURE;
}
}