Compile error ModSys.cpp:125/127
--------------------------------

                 Key: SEMS-66
                 URL: http://tracker.iptel.org/browse/SEMS-66
             Project: SEMS
          Issue Type: Bug
          Components: DSM
         Environment: gcc 4.4
         Assigned To: Raphael Coeffic


C++'s cstring: strrchr(char*), so need const_cast<>():
bool sys_get_parent_dir(const char* path, char* parentPath) {

  //size_t pos = strcspn(dirPath, "/\\");
  char* ptr = strrchr(const_cast<char*>(path), '/'); // search char from end 
reverse
  if (ptr == NULL) {
    ptr = strrchr(const_cast<char*>(path), '\\'); // search char from end 
reverse
    if (ptr == NULL) {
      return false;
    }
  }

  // copy the parent substring to parentPath
  unsigned int i;
  for (i = 0; &(path[i+1]) != ptr; i++) {
    parentPath[i] = path[i];
  }
  parentPath[i] = '\0';

  return true;
}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.iptel.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to