static int feed_generate(struct torrent *torrent) {
FILE *fp;
- char *path;
struct rss_channel_info info;
+ char *path;
path = feed_path(PREFIX FEED_DIRECTORY,torrent->name);
if(NULL==path) { return -1; }
if(torrent_file(PREFIX TORRENT_FILE_DIRECTORY,torrent)<0) { goto clean; }
if(rss_header(fp)<0) { goto clean; }
- if(rss_info(fp,&info)<0) { goto clean; }
+ if(feed_info(torrent,&info)<0) { goto clean; }
+ if(rss_info(fp,&info)<0) { return -1; }
if(feed_entries(fp,torrent)<0) { goto clean; }
return -1;
}
+static int feed_info(struct torrent *torrent_p, struct rss_channel_info *info) {
+ return -1;
+}
+
static char *feed_path(const char *directory, const char *name) {
return NULL;
}
static int rss_info_last_build_date(FILE *fp, const struct tm *date) {
char buf[40];
- size_t buf_size = 40;
+ size_t len, buf_size = 40;
const char start[] = RSS_TAG_LASTBUILDDATE_START;
if(fwrite(start,sizeof(char),sizeof(start)-1,fp)!=sizeof(start)-1) { return -1; }
if(!(strftime(buf,buf_size, "%a, %d %b %Y %H:%M:%S %z", date))) { return -1; }
+ len = strlen(buf);
+ if(fwrite(buf,sizeof(char),len,fp)!=len) { return -1; }
const char end[] = RSS_TAG_LASTBUILDDATE_END;
if(fwrite(end,sizeof(char),sizeof(end)-1,fp)!=sizeof(end)-1) { return -1; }
static void rss_header_correctness_test() {
FILE *fp;
unsigned char hash[crypto_hash_sha256_BYTES];
- unsigned char expected[crypto_hash_sha256_BYTES] = {251 199 202 195 224 186 198 234
-0x7fffffffe158: 41 214 110 130 12 238 175 97
-0x7fffffffe160: 31 7 105 99 201 7 250 79
-0x7fffffffe168: 182 57 225 209 120 28 212 179};
+ unsigned char expected[crypto_hash_sha256_BYTES] = {251,199,202,195,224,186,198,234,41,214,110,130,12,238,175,97,31,7,105,99,201,7,250,79,182,57,225,209,120,28,212,179};
fp = setup_file_pointer();
FILE *fp;
struct rss_channel_info p;
unsigned char hash[crypto_hash_sha256_BYTES];
- unsigned char expected[crypto_hash_sha256_BYTES] = {252,1,77,6,36,221,191,114,180,137,47,54,77,39,151,196,0,85,115,184,127,210,230,152,114,130,36,140,33,239,194,30};
+ unsigned char expected[crypto_hash_sha256_BYTES] = {175,238,191,8,225,134,109,105,86,61,240,232,31,206,163,165,243,43,229,34,169,83,166,18,54,229,225,99,110,47,38,243};
memset(&p,0,sizeof(struct rss_channel_info));