diff options
Diffstat (limited to 'debian/mp4v2/mp4v2-2.0.0~dfsg0/libplatform/io/FileSystem.cpp')
-rw-r--r-- | debian/mp4v2/mp4v2-2.0.0~dfsg0/libplatform/io/FileSystem.cpp | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/debian/mp4v2/mp4v2-2.0.0~dfsg0/libplatform/io/FileSystem.cpp b/debian/mp4v2/mp4v2-2.0.0~dfsg0/libplatform/io/FileSystem.cpp deleted file mode 100644 index 073b0261..00000000 --- a/debian/mp4v2/mp4v2-2.0.0~dfsg0/libplatform/io/FileSystem.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "libplatform/impl.h" - -namespace mp4v2 { namespace platform { namespace io { - -/////////////////////////////////////////////////////////////////////////////// - -void -FileSystem::pathnameCleanup( string& name ) -{ - string bad; - - // fold repeating directory separators - bad = DIR_SEPARATOR; - bad += DIR_SEPARATOR; - for( string::size_type pos = name.find( bad ); - pos != string::npos; - pos = name.find( bad, pos ) ) - { - name.replace( pos, bad.length(), DIR_SEPARATOR ); - } - - // replace occurances of /./ with / - bad = DIR_SEPARATOR; - bad += '.'; - bad += DIR_SEPARATOR; - for( string::size_type pos = name.find( bad ); - pos != string::npos; - pos = name.find( bad, pos ) ) - { - name.replace( pos, bad.length(), DIR_SEPARATOR ); - } -} - -/////////////////////////////////////////////////////////////////////////////// - -void -FileSystem::pathnameOnlyExtension( string& name ) -{ - // compute basename - string::size_type dot_pos = name.rfind( '.' ); - string::size_type slash_pos = name.rfind( DIR_SEPARATOR ); - - // dot_pos must be after slash_pos - if( slash_pos != string::npos && dot_pos < slash_pos ) - dot_pos = string::npos; - - // return empty-string if no dot - if( dot_pos == string::npos ) { - name.resize( 0 ); - return; - } - - name = name.substr( dot_pos + 1 ); - pathnameCleanup( name ); -} - -/////////////////////////////////////////////////////////////////////////////// - -void -FileSystem::pathnameStripExtension( string& name ) -{ - pathnameCleanup( name ); - - // compute basename - string::size_type dot_pos = name.rfind( '.' ); - string::size_type slash_pos = name.rfind( DIR_SEPARATOR ); - - // dot_pos must be after slash_pos - if( slash_pos != string::npos && dot_pos < slash_pos ) - dot_pos = string::npos; - - // chop extension - if( dot_pos != string::npos ) - name.resize( dot_pos ); -} - -/////////////////////////////////////////////////////////////////////////////// - -void -FileSystem::pathnameTemp( string& name, string dir, string prefix, string suffix ) -{ - ostringstream buf; - - if( !dir.empty() ) { - buf << dir; - - // add dir separator if needed - // TODO there's a platform specific bug here, if someone passes in a pathname ending - // in '\', which would be legitimate on Windows. - if( dir[dir.length()-1] != '/' ) - buf << '/'; - } - - buf << prefix; - buf << setfill('0') << setw(8) << number::random32(); - buf << suffix; - - name = buf.str(); -} - -/////////////////////////////////////////////////////////////////////////////// - -}}} // namespace mp4v2::platform::io |