poppler/Sound.cc | 10 +++------- poppler/Sound.h | 6 +++--- qt5/src/poppler-sound.cc | 5 ++--- 3 files changed, 8 insertions(+), 13 deletions(-)
New commits: commit d81d5ccfd29e12cadbd70642f65ca1516b4e5d04 Author: Albert Astals Cid <[email protected]> Date: Fri Jan 3 16:55:36 2020 +0100 Make Sound::fileName a std::string Makes the code a bit simpler diff --git a/poppler/Sound.cc b/poppler/Sound.cc index db74713e..fb7c4344 100644 --- a/poppler/Sound.cc +++ b/poppler/Sound.cc @@ -1,6 +1,6 @@ /* Sound.cc - an object that holds the sound structure * Copyright (C) 2006-2007, Pino Toscano <[email protected]> - * Copyright (C) 2009, 2017-2019, Albert Astals Cid <[email protected]> + * Copyright (C) 2009, 2017-2020, Albert Astals Cid <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -51,7 +51,6 @@ Sound::Sound(const Object *obj, bool readAttrs) { streamObj = obj->copy(); - fileName = nullptr; samplingRate = 0.0; channels = 1; bitsPerSample = 8; @@ -66,7 +65,7 @@ Sound::Sound(const Object *obj, bool readAttrs) kind = soundExternal; Object obj1 = getFileSpecNameForPlatform (&tmp); if (obj1.isString()) { - fileName = obj1.getString()->copy(); + fileName = obj1.getString()->toStr(); } } else { // no file specification, then the sound data have to be @@ -105,7 +104,6 @@ Sound::Sound(const Object *obj, bool readAttrs) Sound::~Sound() { - delete fileName; } Stream *Sound::getStream() @@ -118,9 +116,7 @@ Sound *Sound::copy() const Sound *newsound = new Sound(&streamObj, false); newsound->kind = kind; - if (fileName) { - newsound->fileName = fileName->copy(); - } + newsound->fileName = fileName; newsound->samplingRate = samplingRate; newsound->channels = channels; newsound->bitsPerSample = bitsPerSample; diff --git a/poppler/Sound.h b/poppler/Sound.h index 809b0a30..c23fd0e1 100644 --- a/poppler/Sound.h +++ b/poppler/Sound.h @@ -1,6 +1,6 @@ /* Sound.h - an object that holds the sound structure * Copyright (C) 2006-2007, Pino Toscano <[email protected]> - * Copyright (C) 2017-2019, Albert Astals Cid <[email protected]> + * Copyright (C) 2017-2020, Albert Astals Cid <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -54,7 +54,7 @@ public: Stream *getStream(); SoundKind getSoundKind() const { return kind; } - const GooString *getFileName() const { return fileName; } + const std::string &getFileName() const { return fileName; } double getSamplingRate() const { return samplingRate; } int getChannels() const { return channels; } int getBitsPerSample() const { return bitsPerSample; } @@ -68,7 +68,7 @@ private: Object streamObj; SoundKind kind; - GooString *fileName; + std::string fileName; double samplingRate; int channels; int bitsPerSample; diff --git a/qt5/src/poppler-sound.cc b/qt5/src/poppler-sound.cc index 0728ebb8..5df1f9cb 100644 --- a/qt5/src/poppler-sound.cc +++ b/qt5/src/poppler-sound.cc @@ -1,6 +1,6 @@ /* poppler-sound.cc: qt interface to poppler * Copyright (C) 2006-2007, Pino Toscano <[email protected]> - * Copyright (C) 2008, 2018, Albert Astals Cid <[email protected]> + * Copyright (C) 2008, 2018, 2020, Albert Astals Cid <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -78,8 +78,7 @@ QString SoundObject::url() const if ( m_soundData->m_type != SoundObject::External ) return QString(); - const GooString * goo = m_soundData->m_soundObj->getFileName(); - return goo ? QString( goo->c_str() ) : QString(); + return QString( m_soundData->m_soundObj->getFileName().c_str() ); } QByteArray SoundObject::data() const _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
