mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-12-06 00:30:25 +01:00
2023-05-08 Fred Gleason <fredg@paravelsystems.com>
* Added a 'FEEDS.SHA1_HASH' field to the database. * Incremented the database version to 368. * Added 'RDFeed::sha1Hash()' and 'RDFeed::setSha1Hash()' methods. * Added a 'RDSha1HashData()' function. * Optimized the podcasting subsystem so as to upload feed XML only when the XML contents have actually changed. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -62,12 +62,27 @@ MainObject::MainObject(QObject *parent)
|
||||
exit(256);
|
||||
}
|
||||
|
||||
if(!filename.isEmpty()) { // Hash the specified file
|
||||
hash=RDSha1HashFile(filename);
|
||||
if(hash.isEmpty()) {
|
||||
fprintf(stderr,"test_hash: unable to open \"%s\"\n",
|
||||
filename.toUtf8().constData());
|
||||
exit(256);
|
||||
if(!filename.isEmpty()) {
|
||||
if(filename=="-") { // Read from stdin
|
||||
char data[1024];
|
||||
ssize_t n;
|
||||
QByteArray bytes;
|
||||
while((n=read(0,data,1024))>0) {
|
||||
bytes+=QByteArray(data,n);
|
||||
}
|
||||
if(n<0) {
|
||||
fprintf(stderr,"test_hash: %s\n",strerror(errno));
|
||||
exit(256);
|
||||
}
|
||||
hash=RDSha1HashData(bytes);
|
||||
}
|
||||
else { // Hash the specified file
|
||||
hash=RDSha1HashFile(filename);
|
||||
if(hash.isEmpty()) {
|
||||
fprintf(stderr,"test_hash: unable to open \"%s\"\n",
|
||||
filename.toUtf8().constData());
|
||||
exit(256);
|
||||
}
|
||||
}
|
||||
printf("%s\n",hash.toUtf8().constData());
|
||||
exit(0);
|
||||
|
||||
Reference in New Issue
Block a user