mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
Backport of 4dcf0b41c687292e7b1263a679921c157ae2c22a b01f45e141afa6a89aea319a2783f177e202fa1d https://github.com/taglib/taglib/pull/77 Tested with files larger than 2GB which have been created using sox -n -r 44100 -C 320 large.mp3 synth 58916 sine 440 channels 2 sox -n -r 44100 -C 0 large.flac synth 25459 sine 440 channels 2 sox -n -r 44100 -C 10 large.ogg synth 229806 sine 440 channels 2 sox -n -r 44100 large.wav synth 6692 sine 440 channels 2 ffmpeg -f lavfi -i "sine=frequency=440:duration=244676" -y large.m4a The only file which was readable with the tagreader example before this commit was large.ogg. The problem is that long on Windows is only 32-bit (also in LLP64 data model of 64-bit compilation target) and all the file offsets using long are too small for large files. Now long is replaced by offset_t (defined to be long long on Windows and off_t on UNIX) for such cases and some unsigned long are now size_t, which has the correct size even on Windows.
51 lines
2.2 KiB
C++
51 lines
2.2 KiB
C++
/***************************************************************************
|
|
copyright : (C) 2015 by Tsuda Kageyu
|
|
email : tsuda.kageyu@gmail.com
|
|
***************************************************************************/
|
|
|
|
/***************************************************************************
|
|
* This library is free software; you can redistribute it and/or modify *
|
|
* it under the terms of the GNU Lesser General Public License version *
|
|
* 2.1 as published by the Free Software Foundation. *
|
|
* *
|
|
* This library is distributed in the hope that it will be useful, but *
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
|
* Lesser General Public License for more details. *
|
|
* *
|
|
* You should have received a copy of the GNU Lesser General Public *
|
|
* License along with this library; if not, write to the Free Software *
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
|
|
* 02110-1301 USA *
|
|
* *
|
|
* Alternatively, this file is available under the Mozilla Public *
|
|
* License Version 1.1. You may obtain a copy of the License at *
|
|
* http://www.mozilla.org/MPL/ *
|
|
***************************************************************************/
|
|
|
|
#ifndef TAGLIB_PLAINFILE_H
|
|
#define TAGLIB_PLAINFILE_H
|
|
|
|
#include <tfile.h>
|
|
|
|
using namespace TagLib;
|
|
|
|
//! File subclass that gives tests access to filesystem operations
|
|
class PlainFile : public File {
|
|
public:
|
|
explicit PlainFile(FileName name) : File(name) { }
|
|
Tag *tag() const { return NULL; }
|
|
AudioProperties *audioProperties() const { return NULL; }
|
|
bool save() { return false; }
|
|
void truncate(long length) { File::truncate(length); }
|
|
|
|
ByteVector readAll() {
|
|
seek(0, End);
|
|
offset_t end = tell();
|
|
seek(0);
|
|
return readBlock(end);
|
|
}
|
|
};
|
|
|
|
#endif
|