Skip to content

Commit

Permalink
Fix cross-compilation using mingw (#17)
Browse files Browse the repository at this point in the history
Windows file system is not case sensitive, but Linux is.
  • Loading branch information
Luthaf authored and gtauriello committed Jul 30, 2018
1 parent b4fa406 commit 63e58a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions include/mmtf/binary_decoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Licensed under the MIT License (see accompanying LICENSE file).
//
// The authors of this code are: Gerardo Tauriello
//
//
// Based on mmtf_c developed by Julien Ferte (http://www.julienferte.com/),
// Anthony Bradley, Thomas Holder with contributions from Yana Valasatava,
// Gazal Kalyan, Alexander Rose.
Expand Down Expand Up @@ -50,7 +50,7 @@ class BinaryDecoder {
* - std::vector<int32_t> (strategies: 4, 7, 8, 14, 15)
* - std::vector<std::string> (strategies: 5)
* - std::vector<char> (strategies: 6)
*
*
* @throw mmtf::DecodeError if we fail to decode.
*/
template<typename T>
Expand Down Expand Up @@ -113,7 +113,7 @@ namespace {

// byteorder functions ("ntohl" etc.)
#ifdef WIN32
#include <Winsock2.h>
#include <winsock2.h>
#else
#include <arpa/inet.h>
#endif
Expand Down
13 changes: 6 additions & 7 deletions include/mmtf/binary_encoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Licensed under the MIT License (see accompanying LICENSE file).
//
// The author of this code is: Daniel Farrell
//
//
// Based on mmtf_python, adapted to c++ standards 2018
//
// *************************************************************************
Expand All @@ -15,7 +15,7 @@

// byteorder functions
#ifdef WIN32
#include <Winsock2.h>
#include <winsock2.h>
#else
#include <arpa/inet.h>
#endif
Expand Down Expand Up @@ -160,7 +160,7 @@ inline std::vector<int32_t> deltaEncode(std::vector<int32_t> const & vec_in) {
if (vec_in.size() == 0) return vec_out;
vec_out.push_back(vec_in[0]);
for (int32_t i=1; i< (int)vec_in.size(); ++i) {
vec_out.push_back(vec_in[i]-vec_in[i-1]);
vec_out.push_back(vec_in[i]-vec_in[i-1]);
}
return vec_out;
}
Expand Down Expand Up @@ -218,7 +218,7 @@ inline std::vector<int32_t> convertCharsToInts(std::vector<char> const & vec_in)
return vec_out;
}

inline void add_header(std::stringstream & ss, uint32_t array_size, uint32_t codec, uint32_t param /* =0 */) {
inline void add_header(std::stringstream & ss, uint32_t array_size, uint32_t codec, uint32_t param /* =0 */) {
uint32_t be_codec = htonl(codec);
uint32_t be_array_size = htonl(array_size);
uint32_t be_param = htonl(param);
Expand Down Expand Up @@ -310,11 +310,11 @@ inline std::vector<char> encodeRunLengthFloat(std::vector<float> floats_in, int3
for (size_t i=0; i<int_vec.size(); ++i) {
int32_t temp = htonl(int_vec[i]);
ss.write(reinterpret_cast< char * >(&temp), sizeof(temp));
}
}
return stringstreamToCharVector(ss);
}



inline std::vector<char> encodeDeltaRecursiveFloat(std::vector<float> floats_in, int32_t multiplier) {
std::stringstream ss;
Expand All @@ -331,4 +331,3 @@ inline std::vector<char> encodeDeltaRecursiveFloat(std::vector<float> floats_in,

} // mmtf namespace
#endif

0 comments on commit 63e58a9

Please sign in to comment.