Skip to content

Commit

Permalink
Remove a level of indirection to access compatible index version
Browse files Browse the repository at this point in the history
Should fix cygwin
  • Loading branch information
milot-mirdita committed Jan 26, 2022
1 parent 922e269 commit fcf5260
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/linclust/LinsearchIndexReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#define SIZE_T_MAX ((size_t) -1)
#endif

extern const char* index_version_compatible;

template <int TYPE>
size_t LinsearchIndexReader::pickCenterKmer(KmerPosition<short> *hashSeqPair, size_t splitKmerCount) {
Expand Down Expand Up @@ -241,7 +242,7 @@ bool LinsearchIndexReader::checkIfIndexFile(DBReader<unsigned int> *pReader) {
if(version == NULL){
return false;
}
return (strncmp(version, PrefilteringIndexReader::CURRENT_VERSION, strlen(PrefilteringIndexReader::CURRENT_VERSION)) == 0 ) ? true : false;
return (strncmp(version, index_version_compatible, strlen(index_version_compatible)) == 0 ) ? true : false;
}

void LinsearchIndexReader::writeKmerIndexToDisk(std::string fileName, KmerPosition<short> *kmers, size_t kmerCnt){
Expand Down
3 changes: 2 additions & 1 deletion src/linclust/kmerindexdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#endif

extern const char* version;
extern const char* index_version_compatible;

int kmerindexdb(int argc, const char **argv, const Command &command) {
MMseqsMPI::init(argc, argv);
Expand Down Expand Up @@ -169,7 +170,7 @@ int kmerindexdb(int argc, const char **argv, const Command &command) {
dbw.open();

Debug(Debug::INFO) << "Write VERSION (" << PrefilteringIndexReader::VERSION << ")\n";
dbw.writeData((char *) PrefilteringIndexReader::CURRENT_VERSION, strlen(PrefilteringIndexReader::CURRENT_VERSION) * sizeof(char), PrefilteringIndexReader::VERSION, 0);
dbw.writeData((char *) index_version_compatible, strlen(index_version_compatible) * sizeof(char), PrefilteringIndexReader::VERSION, 0);
dbw.alignToPageSize();

Debug(Debug::INFO) << "Write META (" << PrefilteringIndexReader::META << ")\n";
Expand Down
5 changes: 2 additions & 3 deletions src/prefiltering/PrefilteringIndexReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "Parameters.h"

extern const char* index_version_compatible;
const char* PrefilteringIndexReader::CURRENT_VERSION = index_version_compatible;
unsigned int PrefilteringIndexReader::VERSION = 0;
unsigned int PrefilteringIndexReader::META = 1;
unsigned int PrefilteringIndexReader::SCOREMATRIXNAME = 2;
Expand Down Expand Up @@ -41,7 +40,7 @@ bool PrefilteringIndexReader::checkIfIndexFile(DBReader<unsigned int>* reader) {
if(version == NULL){
return false;
}
return (strncmp(version, CURRENT_VERSION, strlen(CURRENT_VERSION)) == 0 ) ? true : false;
return (strncmp(version, index_version_compatible, strlen(index_version_compatible)) == 0 ) ? true : false;
}

std::string PrefilteringIndexReader::indexName(const std::string &outDB) {
Expand All @@ -67,7 +66,7 @@ void PrefilteringIndexReader::createIndexFile(const std::string &outDB,
writer.open();

Debug(Debug::INFO) << "Write VERSION (" << VERSION << ")\n";
writer.writeData((char *) CURRENT_VERSION, strlen(CURRENT_VERSION) * sizeof(char), VERSION, SPLIT_META);
writer.writeData((char *) index_version_compatible, strlen(index_version_compatible) * sizeof(char), VERSION, SPLIT_META);
writer.alignToPageSize(SPLIT_META);

Debug(Debug::INFO) << "Write META (" << META << ")\n";
Expand Down
1 change: 0 additions & 1 deletion src/prefiltering/PrefilteringIndexReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ struct PrefilteringIndexData {

class PrefilteringIndexReader {
public:
static const char* CURRENT_VERSION;
static unsigned int VERSION;
static unsigned int ENTRIES;
static unsigned int ENTRIESOFFSETS;
Expand Down

0 comments on commit fcf5260

Please sign in to comment.