Skip to content

Commit

Permalink
delete spaces at the end of lines
Browse files Browse the repository at this point in the history
  • Loading branch information
masajiro committed Jul 19, 2023
1 parent dcdb156 commit 5a5a32b
Show file tree
Hide file tree
Showing 46 changed files with 4,297 additions and 4,297 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ if(${UNIX})
find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)
endif()
endif()
endif()

add_subdirectory("${PROJECT_SOURCE_DIR}/lib")
add_subdirectory("${PROJECT_SOURCE_DIR}/bin")
Expand Down
2 changes: 1 addition & 1 deletion bin/ngt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if( ${UNIX} )

add_executable(ngt_exe ngt.cpp)
add_dependencies(ngt_exe ngt)
set_target_properties(ngt_exe PROPERTIES OUTPUT_NAME ngt)
set_target_properties(ngt_exe PROPERTIES OUTPUT_NAME ngt)
if(CMAKE_VERSION VERSION_LESS 3.1)
target_link_libraries(ngt_exe ngt pthread)
else()
Expand Down
24 changes: 12 additions & 12 deletions lib/NGT/ArrayFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class ArrayFile {

struct RecordStruct {
bool deleteFlag;
uint64_t extraData; // reserve
uint64_t extraData; // reserve
};

bool _isOpen;
bool _isOpen;
std::fstream _stream;
FileHeadStruct _fileHead;

Expand All @@ -65,7 +65,7 @@ class ArrayFile {
};


// constructor
// constructor
template <class TYPE>
ArrayFile<TYPE>::ArrayFile()
: _isOpen(false), _mutex((pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER){
Expand All @@ -82,7 +82,7 @@ ArrayFile<TYPE>::~ArrayFile() {
template <class TYPE>
bool ArrayFile<TYPE>::create(const std::string &file, size_t recordSize) {
std::fstream tmpstream;
tmpstream.open(file.c_str());
tmpstream.open(file.c_str());
if(tmpstream){
return false;
}
Expand All @@ -98,9 +98,9 @@ bool ArrayFile<TYPE>::create(const std::string &file, size_t recordSize) {

template <class TYPE>
bool ArrayFile<TYPE>::open(const std::string &file) {
_stream.open(file.c_str(), std::ios::in | std::ios::out);
_stream.open(file.c_str(), std::ios::in | std::ios::out);
if(!_stream){
_isOpen = false;
_isOpen = false;
return false;
}
_isOpen = true;
Expand All @@ -112,7 +112,7 @@ bool ArrayFile<TYPE>::open(const std::string &file) {
template <class TYPE>
void ArrayFile<TYPE>::close(){
_stream.close();
_isOpen = false;
_isOpen = false;
}

template <class TYPE>
Expand Down Expand Up @@ -140,7 +140,7 @@ void ArrayFile<TYPE>::put(const size_t id, TYPE &data, NGT::ObjectSpace *objectS
_stream.seekp(offset_pos, std::ios::beg);

for(size_t i = 0; i < _fileHead.recordSize; i++) { _stream.write("", 1); }
_stream.seekp(offset_pos, std::ios::beg);
_stream.seekp(offset_pos, std::ios::beg);
data.serialize(_stream, objectSpace);
}

Expand All @@ -149,12 +149,12 @@ bool ArrayFile<TYPE>::get(const size_t id, TYPE &data, NGT::ObjectSpace *objectS
pthread_mutex_lock(&_mutex);

if( size() <= id ){
pthread_mutex_unlock(&_mutex);
pthread_mutex_unlock(&_mutex);
return false;
}

uint64_t offset_pos = (id * (sizeof(RecordStruct) + _fileHead.recordSize)) + sizeof(FileHeadStruct);
offset_pos += sizeof(RecordStruct);
offset_pos += sizeof(RecordStruct);
_stream.seekg(offset_pos, std::ios::beg);
if (!_stream.fail()) {
data.deserialize(_stream, objectSpace);
Expand Down Expand Up @@ -185,7 +185,7 @@ bool ArrayFile<TYPE>::get(const size_t id, TYPE &data, NGT::ObjectSpace *objectS

template <class TYPE>
void ArrayFile<TYPE>::remove(const size_t id) {
uint64_t offset_pos = (id * (sizeof(RecordStruct) + _fileHead.recordSize)) + sizeof(FileHeadStruct);
uint64_t offset_pos = (id * (sizeof(RecordStruct) + _fileHead.recordSize)) + sizeof(FileHeadStruct);
_stream.seekp(offset_pos, std::ios::beg);
RecordStruct recordHead = {1, 0};
_stream.write((char *)(&recordHead), sizeof(RecordStruct));
Expand All @@ -205,7 +205,7 @@ size_t ArrayFile<TYPE>::size()
offset_pos -= sizeof(FileHeadStruct);
size_t num = offset_pos / (sizeof(RecordStruct) + _fileHead.recordSize);

return num;
return num;
}

template <class TYPE>
Expand Down
8 changes: 4 additions & 4 deletions lib/NGT/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ if( ${UNIX} )
file(GLOB NGTQ_HEADER_FILES NGTQ/*.h NGTQ/*.hpp)

add_library(ngtstatic STATIC ${NGT_SOURCES})
set_target_properties(ngtstatic PROPERTIES OUTPUT_NAME ngt)
set_target_properties(ngtstatic PROPERTIES OUTPUT_NAME ngt)
set_target_properties(ngtstatic PROPERTIES COMPILE_FLAGS "-fPIC")
target_link_libraries(ngtstatic)
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_link_libraries(ngtstatic OpenMP::OpenMP_CXX)
endif()

add_library(ngt SHARED ${NGT_SOURCES})
set_target_properties(ngt PROPERTIES VERSION ${ngt_VERSION})
set_target_properties(ngt PROPERTIES SOVERSION ${ngt_SOVERSION})
add_dependencies(ngt ngtstatic)
set_target_properties(ngt PROPERTIES VERSION ${ngt_VERSION})
set_target_properties(ngt PROPERTIES SOVERSION ${ngt_SOVERSION})
add_dependencies(ngt ngtstatic)
if(${APPLE})
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_link_libraries(ngt lapack blas OpenMP::OpenMP_CXX)
Expand Down
8 changes: 4 additions & 4 deletions lib/NGT/Capi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ float* ngt_get_object_as_float(NGTObjectSpace object_space, ObjectID id, NGTErro
auto os = static_cast<NGT::ObjectSpace*>(object_space);
if (os->getObjectType() != typeid(float)) {
std::stringstream ss;
ss << "Capi : " << __FUNCTION__ << "() : Error: Not available for the object type of the index. "
ss << "Capi : " << __FUNCTION__ << "() : Error: Not available for the object type of the index. "
<< os->getObjectType().name();
operate_error_string_(ss, error);
return NULL;
Expand All @@ -942,7 +942,7 @@ NGTFloat16* ngt_get_object_as_float16(NGTObjectSpace object_space, ObjectID id,
auto os = static_cast<NGT::ObjectSpace*>(object_space);
if (os->getObjectType() != typeid(NGT::float16)) {
std::stringstream ss;
ss << "Capi : " << __FUNCTION__ << "() : Error: Not available for the object type of the index. "
ss << "Capi : " << __FUNCTION__ << "() : Error: Not available for the object type of the index. "
<< os->getObjectType().name();
operate_error_string_(ss, error);
return NULL;
Expand All @@ -954,7 +954,7 @@ uint8_t* ngt_get_object_as_integer(NGTObjectSpace object_space, ObjectID id, NGT
auto os = static_cast<NGT::ObjectSpace*>(object_space);
if (os->getObjectType() != typeid(uint8_t)) {
std::stringstream ss;
ss << "Capi : " << __FUNCTION__ << "() : Error: Not available for the object type of the index. "
ss << "Capi : " << __FUNCTION__ << "() : Error: Not available for the object type of the index. "
<< os->getObjectType().name();
operate_error_string_(ss, error);
return NULL;
Expand All @@ -974,7 +974,7 @@ float* ngt_get_allocated_object_as_float(NGTObjectSpace object_space, ObjectID i
return NULL;
}
auto sizeOfObject = sizeof(float) * v.size();
auto fv = static_cast<float*>(malloc(sizeOfObject));
auto fv = static_cast<float*>(malloc(sizeOfObject));
if (fv == NULL) {
std::stringstream ss;
ss << "Capi : " << __FUNCTION__ << "() : Error: Cannot allocate a vector.";
Expand Down
Loading

0 comments on commit 5a5a32b

Please sign in to comment.