From 38a1ed0e6154ab43244c65940213c9b9439c08ea Mon Sep 17 00:00:00 2001 From: fgerlits Date: Thu, 25 May 2006 16:51:37 +0000 Subject: [PATCH] fixing #1690, possibly --- .../gLiveSupport/src/UploadFileWindow.cxx | 19 ++++++++++--------- .../gLiveSupport/src/UploadFileWindow.h | 8 +++++--- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/livesupport/src/products/gLiveSupport/src/UploadFileWindow.cxx b/livesupport/src/products/gLiveSupport/src/UploadFileWindow.cxx index 8c0afbde9..02425771a 100644 --- a/livesupport/src/products/gLiveSupport/src/UploadFileWindow.cxx +++ b/livesupport/src/products/gLiveSupport/src/UploadFileWindow.cxx @@ -300,10 +300,11 @@ UploadFileWindow :: onChooseFileButtonClicked(void) throw () void UploadFileWindow :: updateFileInfo(void) throw () { - std::string fileName = fileNameEntry->get_text().raw(); + Ptr::Ref fileName(new Glib::ustring( + fileNameEntry->get_text() )); // see if the file exists, and is readable - std::ifstream file(fileName.c_str()); + std::ifstream file(fileName->c_str()); if (!file.good()) { file.close(); statusBar->set_text(*getResourceUstring("couldNotOpenFileMsg")); @@ -332,11 +333,11 @@ UploadFileWindow :: updateFileInfo(void) throw () * Read the playlength and metadata info from the binary audio file. *----------------------------------------------------------------------------*/ void -UploadFileWindow :: readAudioClipInfo(const std::string & fileName) +UploadFileWindow :: readAudioClipInfo(Ptr::Ref fileName) throw () { Ptr::Ref newUri(new std::string("file://")); - newUri->append(fileName); + newUri->append(*fileName); Ptr::Ref playlength; try { @@ -487,12 +488,12 @@ UploadFileWindow :: onCloseButtonClicked(void) throw () * Determine the length of an audio file *----------------------------------------------------------------------------*/ Ptr::Ref -UploadFileWindow :: readPlaylength(const std::string & fileName) +UploadFileWindow :: readPlaylength(Ptr::Ref fileName) throw (std::invalid_argument) { // TODO: use the appropriate TagLib::X::File subclass constructors, // once we find some way of determining the MIME type. - TagLib::FileRef fileRef(fileName.c_str()); + TagLib::FileRef fileRef(fileName->c_str()); if (fileRef.isNull()) { throw std::invalid_argument("unsupported file type"); } @@ -512,15 +513,15 @@ UploadFileWindow :: readPlaylength(const std::string & fileName) * Determine the type of the given file. *----------------------------------------------------------------------------*/ UploadFileWindow::FileType -UploadFileWindow :: determineFileType(const std::string & fileName) +UploadFileWindow :: determineFileType(Ptr::Ref fileName) throw () { - unsigned int dotPosition = fileName.rfind('.'); + unsigned int dotPosition = fileName->rfind('.'); if (dotPosition == std::string::npos) { return invalidType; } - std::string extension = fileName.substr(dotPosition); + std::string extension = fileName->substr(dotPosition); if (extension == ".mp3" || extension == ".ogg") { return audioClipType; diff --git a/livesupport/src/products/gLiveSupport/src/UploadFileWindow.h b/livesupport/src/products/gLiveSupport/src/UploadFileWindow.h index 93c75eecc..2f8a0811f 100644 --- a/livesupport/src/products/gLiveSupport/src/UploadFileWindow.h +++ b/livesupport/src/products/gLiveSupport/src/UploadFileWindow.h @@ -207,7 +207,8 @@ class UploadFileWindow : public GuiWindow * binary audio file. */ void - readAudioClipInfo(const std::string & fileName) throw (); + readAudioClipInfo(Ptr::Ref fileName) + throw (); /** * Determine the length of an audio file on disk. @@ -219,7 +220,7 @@ class UploadFileWindow : public GuiWindow * format is not supported by TagLib */ Ptr::Ref - readPlaylength(const std::string & fileName) + readPlaylength(Ptr::Ref fileName) throw (std::invalid_argument); /** @@ -245,7 +246,8 @@ class UploadFileWindow : public GuiWindow * @return the type of the file. */ FileType - determineFileType(const std::string & fileName) throw (); + determineFileType(Ptr::Ref fileName) + throw (); /** * Clear all the input fields and set the fileType to 'invalidType'.