summaryrefslogtreecommitdiff
path: root/src/KM_fileio.cpp
diff options
context:
space:
mode:
authorjhurst <jhurst@cinecert.com>2007-06-13 22:15:44 +0000
committerjhurst <>2007-06-13 22:15:44 +0000
commitc8a8baa243132a938fe4bbfc06a7afe980aa07e6 (patch)
tree32171e08df96bb496ccd1a75d2840fce7d0b8781 /src/KM_fileio.cpp
parent6c4db45a3a01b25d9ba3cd4c78210559d7131c60 (diff)
oops
Diffstat (limited to 'src/KM_fileio.cpp')
-rw-r--r--src/KM_fileio.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/KM_fileio.cpp b/src/KM_fileio.cpp
index 50e01d6..e94525e 100644
--- a/src/KM_fileio.cpp
+++ b/src/KM_fileio.cpp
@@ -53,33 +53,33 @@ struct iovec {
typedef struct stat fstat_t;
#endif
+//
static void
split(const std::string& str, char separator, std::list<std::string>& components)
{
const char* pstr = str.c_str();
const char* r = strchr(pstr, separator);
- while( r != NULL )
+ while ( r != 0 )
{
- char* cp = new char[(r-pstr)+1];
- memcpy(cp, pstr, (r-pstr));
- cp[(r-pstr)] = '\0';
-
- if( strlen(cp) > 0 )
+ assert(r >= pstr);
+ if ( r > pstr )
{
- std::string s(cp);
- components.push_back(s);
+ std::string tmp_str;
+ assert(r - pstr < 100);
+ tmp_str.assign(pstr, (r - pstr));
+ components.push_back(tmp_str);
}
- delete[] cp;
pstr = r + 1;
r = strchr(pstr, separator);
}
if( strlen(pstr) > 0 )
- components.push_back(std::string(pstr));
+ components.push_back(std::string(pstr));
}
+
//
static Kumu::Result_t
do_stat(const char* path, fstat_t* stat_info)