Commit e5fc9124 authored by Per Cederqvist's avatar Per Cederqvist

patch foutput-text_stat-override.patch

parent 376bd657
use-nettle
text-stat-sha256
From: Per Cederqvist <ceder@lysator.liu.se>
Subject: patch text-stat-sha256.patch
Subject: patch foutput-text_stat-override.patch
......@@ -229,6 +229,12 @@ struct generation_position {
long file_size;
};
struct location_override {
Text_no text_no;
struct generation_position loc;
unsigned char sha256_sum[256/8];
};
/* Struct for text status */
typedef struct {
Time creation_time;
......
......@@ -698,7 +698,7 @@ cache_sync_all(void)
else
{
fprintf(fp->fp, "+ ");
foutput_text_stat(fp, text_arr[it]);
foutput_text_stat(fp, text_arr[it], NULL);
}
foutput_newline(fp);
break;
......@@ -708,7 +708,7 @@ cache_sync_all(void)
if (text_arr[it] != NULL)
{
fprintf(fp->fp, "T %lu", it);
foutput_text_stat(fp, text_arr[it]);
foutput_text_stat(fp, text_arr[it], NULL);
foutput_newline(fp);
}
break;
......
......@@ -38,6 +38,7 @@
# include <config.h>
#endif
#include <assert.h>
#include <stdio.h>
#include "timewrap.h"
#include <sys/types.h>
......@@ -402,19 +403,35 @@ foutput_text_stat_2(struct dbfile *fp,
static void
foutput_text_stat_3(struct dbfile *fp,
Text_stat *t_stat)
Text_stat *t_stat,
const struct location_override *override)
{
Generation generation;
int i;
foutput_time(fp, t_stat->creation_time);
foutput_ulong((unsigned long) t_stat->author, fp);
if (override != NULL)
{
generation = override->loc.generation;
foutput_ulong((unsigned long) override->loc.generation, fp);
foutput_ulong((unsigned long) override->loc.file_pos, fp);
foutput_ulong((unsigned long) override->loc.file_size, fp);
}
else
{
generation = t_stat->text_store.generation;
foutput_ulong((unsigned long) t_stat->text_store.generation, fp);
foutput_ulong((unsigned long) t_stat->text_store.file_pos, fp);
foutput_ulong((unsigned long) t_stat->text_store.file_size, fp);
}
if (t_stat->text_store.generation > 0)
foutput_sha256_sum(t_stat->sha256_sum, fp);
else if (generation > 0)
foutput_sha256_sum(override->sha256_sum, fp);
else
{
foutput_string(fp, s_fcrea_str("unknown"));
......@@ -442,19 +459,22 @@ foutput_text_stat_3(struct dbfile *fp,
void
foutput_text_stat(struct dbfile *fp,
Text_stat *t_stat)
Text_stat *t_stat,
const struct location_override *override)
{
switch (fp->format)
{
case 0:
case 1:
assert(override == NULL);
foutput_text_stat_0(fp, t_stat);
break;
case 2:
assert(override == NULL);
foutput_text_stat_2(fp, t_stat);
break;
case 3:
foutput_text_stat_3(fp, t_stat);
foutput_text_stat_3(fp, t_stat, override);
break;
default:
restart_kom("unknown database format: %d\n", fp->format);
......
......@@ -50,7 +50,8 @@ foutput_conference(struct dbfile *fp,
extern void
foutput_text_stat(struct dbfile *fp,
Text_stat *t_stat);
Text_stat *t_stat,
const struct location_override *override);
/* Needed by debug code in membership.c. */
extern void
......
......@@ -2276,7 +2276,7 @@ write_text(struct dbfile *fp,
int text_no)
{
fprintf(fp->fp, "T %d", text_no);
foutput_text_stat(fp, t);
foutput_text_stat(fp, t, NULL);
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment