printpkgicon: check if package has Changelog instead of segfaulting if not
printpkgicon: use new function htmlcleanNoBr() to work correctly as title= descriptions
This commit is contained in:
parent
b1d3e0b22d
commit
452fcef5f0
@ -262,6 +262,31 @@ char *htmlclean(char *source,char *dest,unsigned int max)
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *htmlcleanNoBr(char *source,char *dest,unsigned int max)
|
||||||
|
{
|
||||||
|
unsigned int i=0,j=0;
|
||||||
|
char subst[10];
|
||||||
|
|
||||||
|
while (source[i] && i<max) {
|
||||||
|
switch (source[i]) {
|
||||||
|
case '<': strcpy(subst,"<"); break;
|
||||||
|
case '>': strcpy(subst,">"); break;
|
||||||
|
case '&': strcpy(subst,"&"); break;
|
||||||
|
case '"': strcpy(subst,"""); break;
|
||||||
|
default: subst[0]=source[i]; subst[1]='\0'; break;
|
||||||
|
}
|
||||||
|
if (j+strlen(subst)<max) {
|
||||||
|
strcpy((char*)&dest[j],subst);
|
||||||
|
j+=strlen(subst);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr,"Warning: can't tidy HTML string due to limited buffer.\n");
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
scansdir is like scandir with the difference that it uses stat()
|
scansdir is like scandir with the difference that it uses stat()
|
||||||
to get entry file types
|
to get entry file types
|
||||||
|
@ -31,6 +31,7 @@ humanDate *simpleTimeToHuman(long calendartime, humanDate * strdate);
|
|||||||
char *humanSize(long long sbytes, sizeString *s);
|
char *humanSize(long long sbytes, sizeString *s);
|
||||||
void fprintf_depstable_filtered_var(FILE* f,char* st);
|
void fprintf_depstable_filtered_var(FILE* f,char* st);
|
||||||
char *htmlclean(char *source,char *dest,unsigned int max);
|
char *htmlclean(char *source,char *dest,unsigned int max);
|
||||||
|
char *htmlcleanNoBr(char *source,char *dest,unsigned int max);
|
||||||
int scansdir(const char *dir, struct dirent ***namelist,
|
int scansdir(const char *dir, struct dirent ***namelist,
|
||||||
int (*select)(const struct dirent *),
|
int (*select)(const struct dirent *),
|
||||||
int (*compar)(const struct dirent **, const struct dirent **));
|
int (*compar)(const struct dirent **, const struct dirent **));
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
int comparePackagers(const void *ptr1, const void *ptr2);
|
int comparePackagers(const void *ptr1, const void *ptr2);
|
||||||
int generateMaintainersPages(struct configTag *configtag);
|
int generateMaintainersPages(struct configTag *configtag);
|
||||||
int printHTMLWarnings(FILE *fout,struct configTag *configtag, struct headerSourceList* pkg, int mode);
|
int printHTMLWarnings(FILE *fout,struct configTag *configtag, struct headerSourceList* pkg, int mode);
|
||||||
void printpkgicon(FILE *fout, struct configTag *configtag, struct headerSourceList *s, int descr );
|
void printpkgicon(FILE *fout, struct configTag *configtag, struct headerSourceList *s);
|
||||||
int generateStats(struct configTag *configtag,int arch);
|
int generateStats(struct configTag *configtag,int arch);
|
||||||
int cleanHTMLFilesInc(char* dir);
|
int cleanHTMLFilesInc(char* dir);
|
||||||
int cleanHTMLFiles(struct configTag *ct);
|
int cleanHTMLFiles(struct configTag *ct);
|
||||||
|
@ -147,12 +147,12 @@ printHTMLWarnings(FILE *fout,struct configTag *configtag, struct headerSourceLis
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void printpkgicon(FILE *fout, struct configTag *configtag, struct headerSourceList *s, int descr ) {
|
void printpkgicon(FILE *fout, struct configTag *configtag, struct headerSourceList *s) {
|
||||||
|
|
||||||
char buffer[PATH_MAX];
|
char buffer[PATH_MAX];
|
||||||
char strdate[16];
|
char strdate[16];
|
||||||
|
|
||||||
if (descr) {
|
if (s->changelog) {
|
||||||
simpleTimeToHuman(s->changelog->time, (humanDate *) & strdate);
|
simpleTimeToHuman(s->changelog->time, (humanDate *) & strdate);
|
||||||
if (s->updrepository >= 0) {
|
if (s->updrepository >= 0) {
|
||||||
fprintf(fout,
|
fprintf(fout,
|
||||||
@ -161,7 +161,7 @@ void printpkgicon(FILE *fout, struct configTag *configtag, struct headerSourceLi
|
|||||||
strdate,
|
strdate,
|
||||||
s->changelog->pkg->name,
|
s->changelog->pkg->name,
|
||||||
s->changelog->release,
|
s->changelog->release,
|
||||||
htmlclean(s->changelog->text,buffer,PATH_MAX),
|
htmlcleanNoBr(s->changelog->text,buffer,PATH_MAX),
|
||||||
configtag->repository[s->updrepository]->tag);
|
configtag->repository[s->updrepository]->tag);
|
||||||
} else {
|
} else {
|
||||||
fprintf(fout,
|
fprintf(fout,
|
||||||
@ -170,16 +170,17 @@ void printpkgicon(FILE *fout, struct configTag *configtag, struct headerSourceLi
|
|||||||
strdate,
|
strdate,
|
||||||
s->changelog->pkg->name,
|
s->changelog->pkg->name,
|
||||||
s->changelog->release,
|
s->changelog->release,
|
||||||
htmlclean(s->changelog->text,buffer,PATH_MAX));
|
htmlcleanNoBr(s->changelog->text,buffer,PATH_MAX));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (s->updrepository >= 0) {
|
if (s->updrepository >= 0) {
|
||||||
fprintf(fout,
|
fprintf(fout,
|
||||||
"<img src=\"%s/pkgup.png\">",
|
"<img src=\"%s/pkgup.png\" title=\"WARNING: missing changelog\n\nUpdates package in %s\">",
|
||||||
configtag->configdefaults->url_dir);
|
configtag->configdefaults->url_dir,
|
||||||
|
configtag->repository[s->updrepository]->tag);
|
||||||
} else {
|
} else {
|
||||||
fprintf(fout,
|
fprintf(fout,
|
||||||
"<img src=\"%s/pkg.png\">",
|
"<img src=\"%s/pkg.png\" title=\"WARNING: missing changelog\">",
|
||||||
configtag->configdefaults->url_dir);
|
configtag->configdefaults->url_dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -548,7 +549,7 @@ generateStats(struct configTag *configtag,int arch)
|
|||||||
}
|
}
|
||||||
if (i < HTMLSTATS_NUM) {
|
if (i < HTMLSTATS_NUM) {
|
||||||
// HTML statistics
|
// HTML statistics
|
||||||
printpkgicon(htmlout, configtag, (configtag->stats.headersourcelistvec)[i],1);
|
printpkgicon(htmlout, configtag, (configtag->stats.headersourcelistvec)[i]);
|
||||||
fprintf(htmlout,
|
fprintf(htmlout,
|
||||||
"<a href=\"%stag=%s&pkg=%s.source\" title=\"%s\">%s %s %s-%s</a> ",
|
"<a href=\"%stag=%s&pkg=%s.source\" title=\"%s\">%s %s %s-%s</a> ",
|
||||||
configtag->configdefaults->url_prefix,
|
configtag->configdefaults->url_prefix,
|
||||||
@ -1083,7 +1084,7 @@ generateHTML_SRPMSFiles(struct configTag *configtag)
|
|||||||
fprintf(findexout[idx],"</td></tr>");
|
fprintf(findexout[idx],"</td></tr>");
|
||||||
}
|
}
|
||||||
fprintf(findexout[idx],"<tr><td>");
|
fprintf(findexout[idx],"<tr><td>");
|
||||||
printpkgicon(findexout[idx], configtag, currheadersourcelist,1);
|
printpkgicon(findexout[idx], configtag, currheadersourcelist);
|
||||||
fprintf(findexout[idx],"</td><td><b>%s</b>: <i>%s</i>",currheadersourcelist->name,htmlclean(currheadersourcelist->summary,buffer,PATH_MAX));
|
fprintf(findexout[idx],"</td><td><b>%s</b>: <i>%s</i>",currheadersourcelist->name,htmlclean(currheadersourcelist->summary,buffer,PATH_MAX));
|
||||||
st=strstr(currheadersourcelist->url,"://");
|
st=strstr(currheadersourcelist->url,"://");
|
||||||
if (st) {
|
if (st) {
|
||||||
|
Loading…
Reference in New Issue
Block a user