Skip to content

Commit

Permalink
Add WIN macro for non-win function (#360)
Browse files Browse the repository at this point in the history
* Add WIN macro for non-win funtion

* fix vc16 compile issue

* fix compile issue

* fix compile issue

* fix compile issue

* clean up code
  • Loading branch information
Sanhaoji2 authored Jun 29, 2023
1 parent 132b62a commit 775a9e9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions include/filter_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ DISKANN_DLLEXPORT tsl::robin_map<std::string, std::vector<uint32_t>> generate_la
* Each data file is saved under the following format:
* input_data_path + "_" + label
*/
#ifndef _WINDOWS
template <typename T>
inline tsl::robin_map<std::string, std::vector<uint32_t>> generate_label_specific_vector_files(
path input_data_path, tsl::robin_map<std::string, uint32_t> labels_to_number_of_points,
Expand Down Expand Up @@ -181,6 +182,7 @@ inline tsl::robin_map<std::string, std::vector<uint32_t>> generate_label_specifi
return label_id_to_orig_id;
#endif
}
#endif

inline std::vector<uint32_t> loadTags(const std::string &tags_file, const std::string &base_file)
{
Expand Down
15 changes: 12 additions & 3 deletions src/windows_aligned_file_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "windows_aligned_file_reader.h"
#include <iostream>
#include "utils.h"
#include <stdlib.h>

#define SECTOR_LEN 4096

Expand Down Expand Up @@ -43,9 +44,17 @@ void WindowsAlignedFileReader::register_thread()
FILE_ATTRIBUTE_READONLY | FILE_FLAG_NO_BUFFERING | FILE_FLAG_OVERLAPPED | FILE_FLAG_RANDOM_ACCESS, NULL);
if (ctx.fhandle == INVALID_HANDLE_VALUE)
{
std::stringstream ss;
ss << m_filename.c_str();
diskann::cout << "Error opening " << ss.str() << " -- error=" << GetLastError() << std::endl;
const size_t c_max_filepath_len = 256;
size_t actual_len = 0;
char filePath[c_max_filepath_len];
if (wcstombs_s(&actual_len, filePath, c_max_filepath_len, m_filename.c_str(), m_filename.length()) == 0)
{
diskann::cout << "Error opening " << filePath << " -- error=" << GetLastError() << std::endl;
}
else
{
diskann::cout << "Error converting wchar to char -- error=" << GetLastError() << std::endl;
}
}

// create IOCompletionPort
Expand Down

0 comments on commit 775a9e9

Please sign in to comment.