Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use string::compare with C++ strings.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 25 Mar 2019 10:13:25 +0000 (11:13 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 25 Mar 2019 10:15:05 +0000 (11:15 +0100)
src/mc/mc_dwarf.cpp
src/plugins/file_system/s4u_FileSystem.cpp

index 40d650a..ec22c9a 100644 (file)
@@ -447,7 +447,7 @@ static uint64_t MC_dwarf_array_element_count(Dwarf_Die * die, Dwarf_Die * unit)
 static bool MC_compare_variable(
   simgrid::mc::Variable const& a, simgrid::mc::Variable const& b)
 {
 static bool MC_compare_variable(
   simgrid::mc::Variable const& a, simgrid::mc::Variable const& b)
 {
-  int cmp = strcmp(a.name.c_str(), b.name.c_str());
+  int cmp = a.name.compare(b.name);
   if (cmp < 0)
     return true;
   else if (cmp > 0)
   if (cmp < 0)
     return true;
   else if (cmp > 0)
index 74227e3..b28d3d8 100644 (file)
@@ -193,7 +193,7 @@ sg_size_t File::tell()
 void File::move(const std::string& fullpath)
 {
   /* Check if the new full path is on the same mount point */
 void File::move(const std::string& fullpath)
 {
   /* Check if the new full path is on the same mount point */
-  if (not strncmp(mount_point_.c_str(), fullpath.c_str(), mount_point_.length())) {
+  if (fullpath.compare(0, mount_point_.length(), mount_point_) == 0) {
     std::map<std::string, sg_size_t>* content = local_storage_->extension<FileSystemStorageExt>()->get_content();
     auto sz = content->find(path_);
     if (sz != content->end()) { // src file exists
     std::map<std::string, sg_size_t>* content = local_storage_->extension<FileSystemStorageExt>()->get_content();
     auto sz = content->find(path_);
     if (sz != content->end()) { // src file exists