mirror of
https://github.com/taglib/taglib.git
synced 2025-07-14 02:54:27 -04:00
fixed mod property names and added unit test for xm
This commit is contained in:
@ -9,7 +9,9 @@
|
||||
#include <sys/fcntl.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -45,6 +47,35 @@ inline void deleteFile(const string &filename)
|
||||
remove(filename.c_str());
|
||||
}
|
||||
|
||||
inline bool fileEqual(const string &filename1, const string &filename2)
|
||||
{
|
||||
char buf1[BUFSIZ];
|
||||
char buf2[BUFSIZ];
|
||||
|
||||
ifstream stream1(filename1.c_str(), ios_base::in | ios_base::binary);
|
||||
ifstream stream2(filename2.c_str(), ios_base::in | ios_base::binary);
|
||||
|
||||
if(!stream1 && !stream2) return true;
|
||||
if(!stream1 || !stream2) return false;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
stream1.read(buf1, BUFSIZ);
|
||||
stream2.read(buf2, BUFSIZ);
|
||||
|
||||
streamsize n1 = stream1.gcount();
|
||||
streamsize n2 = stream2.gcount();
|
||||
|
||||
if(n1 != n2) return false;
|
||||
|
||||
if(n1 == 0) break;
|
||||
|
||||
if(memcmp(buf1, buf2, n1) != 0) return false;
|
||||
}
|
||||
|
||||
return stream1.good() == stream2.good();
|
||||
}
|
||||
|
||||
class ScopedFileCopy
|
||||
{
|
||||
public:
|
||||
|
Reference in New Issue
Block a user