@@ -738,12 +738,12 @@ bool DorisRAMFSDirectory::list(std::vector<std::string>* names) const {
738738
739739bool DorisRAMFSDirectory::fileExists (const char * name) const {
740740 std::lock_guard<std::mutex> wlock (_this_lock);
741- return filesMap->exists (( char *) name);
741+ return filesMap->exists (name);
742742}
743743
744744int64_t DorisRAMFSDirectory::fileModified (const char * name) const {
745745 std::lock_guard<std::mutex> wlock (_this_lock);
746- auto * f = filesMap->get (( char *) name);
746+ auto * f = filesMap->get (name);
747747 DBUG_EXECUTE_IF (" DorisRAMFSDirectory::fileModified_file_not_found" , { f = nullptr ; })
748748 if (f == nullptr ) {
749749 _CLTHROWA (CL_ERR_IO, fmt::format (" NOT FOUND File {}." , name).c_str ());
@@ -755,7 +755,7 @@ void DorisRAMFSDirectory::touchFile(const char* name) {
755755 lucene::store::RAMFile* file = nullptr ;
756756 {
757757 std::lock_guard<std::mutex> wlock (_this_lock);
758- file = filesMap->get (( char *) name);
758+ file = filesMap->get (name);
759759 DBUG_EXECUTE_IF (" DorisRAMFSDirectory::touchFile_file_not_found" , { file = nullptr ; })
760760 if (file == nullptr ) {
761761 _CLTHROWA (CL_ERR_IO, fmt::format (" NOT FOUND File {}." , name).c_str ());
@@ -775,7 +775,7 @@ void DorisRAMFSDirectory::touchFile(const char* name) {
775775
776776int64_t DorisRAMFSDirectory::fileLength (const char * name) const {
777777 std::lock_guard<std::mutex> wlock (_this_lock);
778- auto * f = filesMap->get (( char *) name);
778+ auto * f = filesMap->get (name);
779779 DBUG_EXECUTE_IF (" DorisRAMFSDirectory::fileLength_file_not_found" , { f = nullptr ; })
780780 if (f == nullptr ) {
781781 _CLTHROWA (CL_ERR_IO, fmt::format (" NOT FOUND File {}." , name).c_str ());
@@ -786,7 +786,7 @@ int64_t DorisRAMFSDirectory::fileLength(const char* name) const {
786786bool DorisRAMFSDirectory::openInput (const char * name, lucene::store::IndexInput*& ret,
787787 CLuceneError& error, int32_t bufferSize) {
788788 std::lock_guard<std::mutex> wlock (_this_lock);
789- auto * file = filesMap->get (( char *) name);
789+ auto * file = filesMap->get (name);
790790 DBUG_EXECUTE_IF (" DorisRAMFSDirectory::openInput_file_not_found" , { file = nullptr ; })
791791 if (file == nullptr ) {
792792 error.set (CL_ERR_IO,
@@ -805,7 +805,7 @@ void DorisRAMFSDirectory::close() {
805805
806806bool DorisRAMFSDirectory::doDeleteFile (const char * name) {
807807 std::lock_guard<std::mutex> wlock (_this_lock);
808- auto itr = filesMap->find (( char *) name);
808+ auto itr = filesMap->find (name);
809809 if (itr != filesMap->end ()) {
810810 SCOPED_LOCK_MUTEX (this ->THIS_LOCK );
811811 sizeInBytes -= itr->second ->sizeInBytes ;
@@ -821,15 +821,15 @@ bool DorisRAMFSDirectory::deleteDirectory() {
821821
822822void DorisRAMFSDirectory::renameFile (const char * from, const char * to) {
823823 std::lock_guard<std::mutex> wlock (_this_lock);
824- auto itr = filesMap->find (( char *) from);
824+ auto itr = filesMap->find (from);
825825
826826 /* DSR:CL_BUG_LEAK:
827827 ** If a file named $to already existed, its old value was leaked.
828828 ** My inclination would be to prevent this implicit deletion with an
829829 ** exception, but it happens routinely in CLucene's internals (e.g., during
830830 ** IndexWriter.addIndexes with the file named 'segments'). */
831- if (filesMap->exists (( char *) to)) {
832- auto itr1 = filesMap->find (( char *) to);
831+ if (filesMap->exists (to)) {
832+ auto itr1 = filesMap->find (to);
833833 SCOPED_LOCK_MUTEX (this ->THIS_LOCK );
834834 sizeInBytes -= itr1->second ->sizeInBytes ;
835835 filesMap->removeitr (itr1);
@@ -855,8 +855,8 @@ lucene::store::IndexOutput* DorisRAMFSDirectory::createOutput(const char* name)
855855 std::lock_guard<std::mutex> wlock (_this_lock);
856856
857857 // get the actual pointer to the output name
858- char * n = nullptr ;
859- auto itr = filesMap->find (const_cast < char *>( name) );
858+ const char * n = nullptr ;
859+ auto itr = filesMap->find (name);
860860 DBUG_EXECUTE_IF (" DorisRAMFSDirectory::createOutput_itr_filesMap_end" ,
861861 { itr = filesMap->end (); })
862862 if (itr != filesMap->end ()) {
0 commit comments