Skip to content

Commit 49d560b

Browse files
committed
Fixed compiler error
1 parent 895e58b commit 49d560b

14 files changed

Lines changed: 44 additions & 38 deletions

File tree

src/basic/shape_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ShapeConfig
4646
}
4747
}
4848

49-
unsigned count() const
49+
int count() const
5050
{ return n_; }
5151

5252
const Shape& operator[](size_t i) const

src/cluster/external/cluster.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ string cluster_bidirectional(Job& job, const vector<string>& edges, const Volume
190190
if (lock.fetch_add() == 0) {
191191
job.log("Computing clustering (bi-directional coverage)");
192192
vector<uint32_t> degree(volumes.records(), 0);
193-
for (int bucket = 0; bucket < edges.size(); ++bucket) {
193+
for (int bucket = 0; bucket < (int)edges.size(); ++bucket) {
194194
VolumedFile file(edges[bucket]);
195195
InputBuffer<Edge> data(file);
196196
job.log("Getting node degrees. Bucket=%lli/%lli Records=%s Size=%s", bucket + 1, edges.size(), format(data.size()).c_str(), format(data.byte_size()).c_str());

src/cluster/external/external.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ static void build_chunks(Job& job, const VolumedFile& db, const vector<string>&
365365

366366
string round(Job& job, const VolumedFile& volumes) {
367367
::shapes = ShapeConfig(Search::shape_codes.at(config.sensitivity), 0);
368-
job.log("Starting round %i sensitivity %s %i shapes\n", job.round(), to_string(config.sensitivity), ::shapes.count());
368+
job.log("Starting round %i sensitivity %s %i shapes\n", job.round(), to_string(config.sensitivity).c_str(), ::shapes.count());
369369
job.set_round(volumes.size(), volumes.records());
370370
const std::string pair_table_base = job.base_dir() + PATH_SEPARATOR + "pair_table";
371371
mkdir(pair_table_base);

src/cluster/external/external.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ struct Job {
137137

138138
void log(const char* format, ...) {
139139
char buffer[1024];
140-
char* ptr = buffer + sprintf(buffer, "[%i, %lli] ", worker_id_, std::chrono::duration_cast<std::chrono::duration<long long int>>(std::chrono::system_clock::now() - start_).count());
140+
char* ptr = buffer + snprintf(buffer, 1024, "[%i, %lli] ", worker_id_, std::chrono::duration_cast<std::chrono::duration<long long int>>(std::chrono::system_clock::now() - start_).count());
141141
va_list args;
142142
va_start(args, format);
143-
int i = vsprintf(ptr, format, args);
143+
int i = vsnprintf(ptr, 1024 - (ptr - buffer), format, args);
144144
#ifdef WIN32
145145
ptr[i++] = '\r';
146146
#endif

src/cluster/external/output.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <inttypes.h>
12
#include "external.h"
23

34
using std::vector;
@@ -47,11 +48,7 @@ void output(Job& job) {
4748
for (int64_t i = 0; i < (int64_t)inner.size(); ++i) {
4849
if (inner[i] == i)
4950
++n;
50-
#ifdef _MSC_VER
51-
fprintf(out, "%lli\t%lli\n", inner[i], i);
52-
#else
53-
fprintf(out, "%li\t%li\n", inner[i], i);
54-
#endif
51+
fprintf(out, PRId64 "\t" PRId64 "\n", inner[i], i);
5552
}
5653
fclose(out);
5754
job.log("Cluster count = %lli", n);

src/data/index.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ void makeindex() {
2828
out.write(SEED_INDEX_VERSION);
2929
out.write((uint32_t)shapes.count());
3030

31-
for (unsigned i = 0; i < shapes.count(); ++i)
31+
for (int i = 0; i < shapes.count(); ++i)
3232
out.write(index.table(i).size());
3333

34-
for (unsigned i = 0; i < shapes.count(); ++i) {
34+
for (int i = 0; i < shapes.count(); ++i) {
3535
out.write(index.table(i).data(), index.table(i).size() + HashedSeedSet::Table::PADDING);
3636
}
3737

src/data/seed_histogram.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ size_t SeedHistogram::max_chunk_size(const int index_chunks) const
3939
{
4040
size_t max = 0;
4141
::Partition<int> p(seedp(), index_chunks);
42-
for (unsigned shape = 0; shape < shapes.count(); ++shape)
42+
for (int shape = 0; shape < shapes.count(); ++shape)
4343
for (int chunk = 0; chunk < p.parts; ++chunk)
4444
max = std::max(max, hst_size(data_[shape], SeedPartitionRange(p.begin(chunk), p.end(chunk))));
4545
return max;
@@ -54,7 +54,7 @@ SeedHistogram::SeedHistogram(Block& seqs, bool serial, const Filter* filter, Enu
5454
Callback(size_t seqp, int seedp_bits, vector<ShapeHistogram>& data):
5555
seedp_mask(::seedp_mask(seedp_bits))
5656
{
57-
for (unsigned s = 0; s < shapes.count(); ++s)
57+
for (int s = 0; s < shapes.count(); ++s)
5858
ptr.push_back(data[s][seqp].data());
5959
}
6060
bool operator()(PackedSeed seed, uint64_t pos, uint32_t block_id, size_t shape)
@@ -74,7 +74,7 @@ SeedHistogram::SeedHistogram(Block& seqs, bool serial, const Filter* filter, Enu
7474
cb.push_back(new Callback(i, seedp_bits, data_));
7575
enum_cfg.partition = &p_;
7676
if (serial)
77-
for (unsigned s = 0; s < shapes.count(); ++s) {
77+
for (int s = 0; s < shapes.count(); ++s) {
7878
enum_cfg.shape_begin = s;
7979
enum_cfg.shape_end = s + 1;
8080
enum_seeds(seqs, cb, filter, enum_cfg);

src/data/seed_set.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ HashedSeedSet::HashedSeedSet(const string& index_file):
132132
const size_t* size_ptr = (const size_t*)(buf + SEED_INDEX_HEADER_SIZE);
133133
uint8_t* data_ptr = (uint8_t*)(buf + SEED_INDEX_HEADER_SIZE + sizeof(size_t) * shape_count);
134134

135-
for (unsigned i = 0; i < shapes.count(); ++i) {
135+
for (int i = 0; i < shapes.count(); ++i) {
136136
data_.push_back(new Table(data_ptr, *size_ptr));
137137
log_stream << "MMAPED Shape=" << i << " Hash_table_size=" << data_[i].size() << " load=" << (double)data_[i].load() / data_[i].size() << endl;
138138
data_ptr += *size_ptr + Table::PADDING;

src/lib/Eigen/src/Core/util/Meta.h

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#ifndef EIGEN_META_H
1212
#define EIGEN_META_H
1313

14+
#include <utility>
15+
1416
#if defined(__CUDA_ARCH__)
1517
#include <cfloat>
1618
#include <math_constants.h>
@@ -315,12 +317,19 @@ class noncopyable
315317
* upcoming next STL generation (using a templated result member).
316318
* If none of these members is provided, then the type of the first argument is returned. FIXME, that behavior is a pretty bad hack.
317319
*/
318-
#if EIGEN_HAS_STD_RESULT_OF
319-
template<typename T> struct result_of {
320-
typedef typename std::result_of<T>::type type1;
320+
//#if EIGEN_HAS_STD_RESULT_OF
321+
template <typename T>
322+
struct result_of;
323+
324+
template<typename T, typename... Args> struct result_of<T(Args...)> {
325+
#if __cplusplus >= 201703L
326+
using type1 = typename std::invoke_result<T, Args...>::type;
327+
#else
328+
typedef typename std::result_of<T(Args...)>::type type1;
329+
#endif
321330
typedef typename remove_all<type1>::type type;
322331
};
323-
#else
332+
/*#else
324333
template<typename T> struct result_of { };
325334
326335
struct has_none {int a[1];};
@@ -396,7 +405,7 @@ struct result_of<Func(ArgType0,ArgType1,ArgType2)> {
396405
enum {FunctorType = sizeof(testFunctor(static_cast<Func*>(0)))};
397406
typedef typename ternary_result_of_select<Func, ArgType0, ArgType1, ArgType2, FunctorType>::type type;
398407
};
399-
#endif
408+
#endif*/
400409

401410
struct meta_yes { char a[1]; };
402411
struct meta_no { char a[2]; };

src/lib/blast/blastn_score.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,10 @@ BlastScoreBlkProteinMatrixRead(BlastScoreBlk* sbp, FILE *fp)
437437

438438
/* Use the C scores for U and X scores for O characters;
439439
if this is not done then they will never align to non-gap residues */
440-
x_index = AMINOACID_TO_NCBISTDAA['X'];
441-
u_index = AMINOACID_TO_NCBISTDAA['U'];
442-
o_index = AMINOACID_TO_NCBISTDAA['O'];
443-
c_index = AMINOACID_TO_NCBISTDAA['C'];
440+
x_index = AMINOACID_TO_NCBISTDAA[(int)'X'];
441+
u_index = AMINOACID_TO_NCBISTDAA[(int)'U'];
442+
o_index = AMINOACID_TO_NCBISTDAA[(int)'O'];
443+
c_index = AMINOACID_TO_NCBISTDAA[(int)'C'];
444444
for (index1 = 0; index1 < sbp->alphabet_size; index1++) {
445445
matrix[u_index][index1] = matrix[c_index][index1];
446446
matrix[index1][u_index] = matrix[index1][c_index];
@@ -924,12 +924,12 @@ const SNCBIPackedScoreMatrix* NCBISM_GetStandardMatrix(const char* name) {
924924
for (i = 0; i < sbp->alphabet_size; i++) {
925925
for (j = 0; j < sbp->alphabet_size; j++) {
926926
/* skip special characters */
927-
if (i == AMINOACID_TO_NCBISTDAA['U'] ||
928-
i == AMINOACID_TO_NCBISTDAA['O'] ||
929-
i == AMINOACID_TO_NCBISTDAA['-'] ||
930-
j == AMINOACID_TO_NCBISTDAA['U'] ||
931-
j == AMINOACID_TO_NCBISTDAA['O'] ||
932-
j == AMINOACID_TO_NCBISTDAA['-']) {
927+
if (i == AMINOACID_TO_NCBISTDAA[(int)'U'] ||
928+
i == AMINOACID_TO_NCBISTDAA[(int)'O'] ||
929+
i == AMINOACID_TO_NCBISTDAA[(int)'-'] ||
930+
j == AMINOACID_TO_NCBISTDAA[(int)'U'] ||
931+
j == AMINOACID_TO_NCBISTDAA[(int)'O'] ||
932+
j == AMINOACID_TO_NCBISTDAA[(int)'-']) {
933933
continue;
934934
}
935935
matrix[i][j] = NCBISM_GetScore((const SNCBIPackedScoreMatrix *) psm,

0 commit comments

Comments
 (0)