Maximilien Siavelis
2018-01-06 13d183dd22c2929db8230a20151020b636273e8d
fix MSVC build
4个文件已修改
35 ■■■■ 已修改文件
CMakeLists.txt 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/pc-identifiers.c 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tools/base_lib/win/CryptoHelperWindows.cpp 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
test/functional/volid_test.cpp 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CMakeLists.txt
@@ -29,7 +29,6 @@
endif(CMAKE_BUILD_TYPE)
if(MSVC)
    SET(PLATFORM_LIBS "")
    include(target_arch)
    target_architecture( TARGET_ARCHITECTURE )
@@ -68,6 +67,7 @@
  SET(HAVE_64BIT_SIZE_T 0)
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set( Boost_USE_STATIC_LIBS ON )
find_package(Boost 1.55.0 COMPONENTS date_time unit_test_framework program_options system filesystem)
#set below in case of dynamic linking in debug.
#set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:BOOST_TEST_DYN_LINK>)
@@ -125,8 +125,3 @@
  message( STATUS "Build type: " ${CMAKE_BUILD_TYPE})
endif(CMAKE_BUILD_TYPE)
message( STATUS "Install prefix: " ${CMAKE_INSTALL_PREFIX})
if(DOXYGEN_FOUND)
  message(STATUS "Doxygen: " ${DOXYGEN_EXECUTABLE})
else(DOXYGEN_FOUND)
  message(STATUS "Doxygen: not found.")
endif(DOXYGEN_FOUND)
src/library/pc-identifiers.c
@@ -84,7 +84,11 @@
            }
        }
end:
        *num_identifiers = cmin(*num_identifiers, adapter_num * disk_num);
#ifdef _MSC_VER
        *num_identifiers = min(*num_identifiers, adapter_num * disk_num);
#else
        *num_identifiers = cmin(*num_identifiers, adapter_num * disk_num);
#endif
        free(diskInfoPtr);
        free(adapterInfoPtr);
    }
src/tools/base_lib/win/CryptoHelperWindows.cpp
@@ -62,7 +62,7 @@
    KEYLENGTH | CRYPT_EXPORTABLE, &m_hCryptKey)) {
        dwErrCode = GetLastError();
        throw logic_error(
                string("Error generating keys ") + to_string(dwErrCode));
                string("Error generating keys ") + to_string(static_cast<long long>(dwErrCode)));
    }
}
@@ -86,7 +86,7 @@
        dwErrCode = GetLastError();
        throw logic_error(
                string("Error calculating size of public key ")
                        + to_string(dwErrCode));
                        + to_string(static_cast<long long>(dwErrCode)));
    }
    // Allocate memory for the pbKeyBlob.
    if ((pbKeyBlob = new BYTE[dwBlobLen]) == NULL) {
@@ -98,7 +98,7 @@
        delete pbKeyBlob;
        dwErrCode = GetLastError();
        throw logic_error(
                string("Error exporting public key ") + to_string(dwErrCode));
                string("Error exporting public key ") + to_string(static_cast<long long>(dwErrCode)));
    } else {
        ss << "\t";
        for (unsigned int i = 0; i < dwBlobLen; i++) {
@@ -108,7 +108,7 @@
                    ss << "\\" << endl << "\t";
                }
            }
            ss << to_string(pbKeyBlob[i]);
            ss << to_string(static_cast<long long>(pbKeyBlob[i]));
        }
        delete pbKeyBlob;
    }
@@ -146,7 +146,7 @@
        dwErrCode = GetLastError();
        throw logic_error(
                string("Error calculating size of private key ")
                        + to_string(dwErrCode));
                        + to_string(static_cast<long long>(dwErrCode)));
    }
    // Allocate memory for the pbKeyBlob.
    if ((pbKeyBlob = new BYTE[dwBlobLen]) == NULL) {
@@ -159,7 +159,7 @@
        delete pbKeyBlob;
        dwErrCode = GetLastError();
        throw logic_error(
                string("Error exporting private key ") + to_string(dwErrCode));
                string("Error exporting private key ") + to_string(static_cast<long long>(dwErrCode)));
    } else {
        ss << "\t";
        for (unsigned int i = 0; i < dwBlobLen; i++) {
@@ -169,7 +169,7 @@
                    ss << "\\" << endl << "\t";
                }
            }
            ss << to_string(pbKeyBlob[i]);
            ss << to_string(static_cast<long long>(pbKeyBlob[i]));
        }
        delete pbKeyBlob;
    }
@@ -216,7 +216,7 @@
            &hKey)) {
        throw logic_error(
                string("Error in importing the PrivateKey ")
                        + to_string(GetLastError()));
                        + to_string(static_cast<long long>(GetLastError())));
    }
    //-------------------------------------------------------------------
test/functional/volid_test.cpp
@@ -27,7 +27,9 @@
            strategy);
    BOOST_ASSERT(generate_ok == FUNCTION_RETURN::FUNC_RET_OK);
    cout << "Identifier:" << identifier_out << endl;
    vector<string> extraArgs = { "-s", identifier_out };
    vector<string> extraArgs;
    extraArgs.push_back("-s");
    extraArgs.push_back(identifier_out);
    generate_license(licLocation, extraArgs);
    LicenseInfo license;
@@ -109,7 +111,7 @@
                    sizeof(PcSignature));
            EVENT_TYPE val_result = validate_pc_signature(pcsig);
            string message = string("pc signature verification strategy:")
                    + to_string(i) + " generated: [" + generated_identifier
                    + to_string(static_cast<long long>(i)) + " generated: [" + generated_identifier
                    + "] reference: [" + reference_signatures[i] + "]";
            BOOST_TEST_CHECKPOINT("Verifying signature: ");
            BOOST_CHECK_EQUAL(val_result, LICENSE_OK);