* @param rating rating of pseudonym
*/
static void
-internal_notify (const GNUNET_HashCode * id,
+internal_notify (const struct GNUNET_HashCode * id,
const struct GNUNET_CONTAINER_MetaData *md, int rating)
{
struct DiscoveryCallback *pos;
*/
static char *
get_data_filename (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const char *prefix, const GNUNET_HashCode * psid)
+ const char *prefix, const struct GNUNET_HashCode * psid)
{
struct GNUNET_CRYPTO_HashAsciiEncoded enc;
*/
static void
write_pseudonym_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * nsid,
+ const struct GNUNET_HashCode * nsid,
const struct GNUNET_CONTAINER_MetaData *meta,
int32_t ranking, const char *ns_name)
{
*/
static int
read_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * nsid,
+ const struct GNUNET_HashCode * nsid,
struct GNUNET_CONTAINER_MetaData **meta, int32_t * ranking,
char **ns_name)
{
fn = get_data_filename (cfg, PS_METADATA_DIR, nsid);
GNUNET_assert (fn != NULL);
+ if (GNUNET_YES !=
+ GNUNET_DISK_file_test (fn))
+ {
+ GNUNET_free (fn);
+ return GNUNET_SYSERR;
+ }
fileR = GNUNET_BIO_read_open (fn);
if (fileR == NULL)
{
*/
char *
GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * nsid, const char *name, unsigned int *suffix)
+ const struct GNUNET_HashCode * nsid, const char *name, unsigned int *suffix)
{
- GNUNET_HashCode nh;
+ struct GNUNET_HashCode nh;
uint64_t len;
char *fn;
struct GNUNET_DISK_FileHandle *fh;
len = 0;
if (0 == STAT (fn, &sbuf))
- GNUNET_break (GNUNET_OK == GNUNET_DISK_file_size (fn, &len, GNUNET_YES));
+ GNUNET_break (GNUNET_OK == GNUNET_DISK_file_size (fn, &len, GNUNET_YES, GNUNET_YES));
fh = GNUNET_DISK_file_open (fn,
GNUNET_DISK_OPEN_CREATE |
GNUNET_DISK_OPEN_READWRITE,
GNUNET_DISK_PERM_USER_WRITE);
i = 0;
idx = -1;
- while ((len >= sizeof (GNUNET_HashCode)) &&
- (sizeof (GNUNET_HashCode) ==
- GNUNET_DISK_file_read (fh, &nh, sizeof (GNUNET_HashCode))))
+ while ((len >= sizeof (struct GNUNET_HashCode)) &&
+ (sizeof (struct GNUNET_HashCode) ==
+ GNUNET_DISK_file_read (fh, &nh, sizeof (struct GNUNET_HashCode))))
{
- if (0 == memcmp (&nh, nsid, sizeof (GNUNET_HashCode)))
+ if (0 == memcmp (&nh, nsid, sizeof (struct GNUNET_HashCode)))
{
idx = i;
break;
}
i++;
- len -= sizeof (GNUNET_HashCode);
+ len -= sizeof (struct GNUNET_HashCode);
}
if (idx == -1)
{
idx = i;
- if (sizeof (GNUNET_HashCode) !=
- GNUNET_DISK_file_write (fh, nsid, sizeof (GNUNET_HashCode)))
+ if (sizeof (struct GNUNET_HashCode) !=
+ GNUNET_DISK_file_write (fh, nsid, sizeof (struct GNUNET_HashCode)))
LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "write", fn);
}
GNUNET_DISK_file_close (fh);
*/
int
GNUNET_PSEUDONYM_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * nsid, struct GNUNET_CONTAINER_MetaData **ret_meta,
+ const struct GNUNET_HashCode * nsid, struct GNUNET_CONTAINER_MetaData **ret_meta,
int32_t *ret_rank, char **ret_name, int *name_is_a_dup)
{
struct GNUNET_CONTAINER_MetaData *meta;
*/
int
GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const char *ns_uname, GNUNET_HashCode * nsid)
+ const char *ns_uname, struct GNUNET_HashCode * nsid)
{
size_t slen;
uint64_t len;
unsigned int idx;
char *name;
- GNUNET_HashCode nh;
+ struct GNUNET_HashCode nh;
char *fn;
struct GNUNET_DISK_FileHandle *fh;
GNUNET_assert (fn != NULL);
if ((GNUNET_OK != GNUNET_DISK_file_test (fn) ||
- (GNUNET_OK != GNUNET_DISK_file_size (fn, &len, GNUNET_YES))) ||
- ((idx + 1) * sizeof (GNUNET_HashCode) > len))
+ (GNUNET_OK != GNUNET_DISK_file_size (fn, &len, GNUNET_YES, GNUNET_YES))) ||
+ ((idx + 1) * sizeof (struct GNUNET_HashCode) > len))
{
GNUNET_free (fn);
return GNUNET_SYSERR;
GNUNET_DISK_PERM_USER_READ |
GNUNET_DISK_PERM_USER_WRITE);
GNUNET_free (fn);
- GNUNET_DISK_file_seek (fh, idx * sizeof (GNUNET_HashCode),
- GNUNET_DISK_SEEK_SET);
- if (sizeof (GNUNET_HashCode) !=
- GNUNET_DISK_file_read (fh, nsid, sizeof (GNUNET_HashCode)))
+ if (GNUNET_SYSERR ==
+ GNUNET_DISK_file_seek (fh, idx * sizeof (struct GNUNET_HashCode),
+ GNUNET_DISK_SEEK_SET))
+ {
+ GNUNET_DISK_file_close (fh);
+ return GNUNET_SYSERR;
+ }
+ if (sizeof (struct GNUNET_HashCode) !=
+ GNUNET_DISK_file_read (fh, nsid, sizeof (struct GNUNET_HashCode)))
{
GNUNET_DISK_file_close (fh);
return GNUNET_SYSERR;
{
struct ListPseudonymClosure *c = cls;
int ret;
- GNUNET_HashCode id;
+ struct GNUNET_HashCode id;
int32_t rating;
struct GNUNET_CONTAINER_MetaData *meta;
const char *fn;
- char *str, *name_unique;
+ char *str;
+ char *name_unique;
if (strlen (fullname) < sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded))
return GNUNET_OK;
*/
int
GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * nsid, int delta)
+ const struct GNUNET_HashCode * nsid, int delta)
{
struct GNUNET_CONTAINER_MetaData *meta;
int ret;
*/
int
GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * nsid, const char *name,
+ const struct GNUNET_HashCode * nsid, const char *name,
const struct GNUNET_CONTAINER_MetaData *md, int rank)
{
GNUNET_assert (cfg != NULL);
*/
void
GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const GNUNET_HashCode * id,
+ const struct GNUNET_HashCode * id,
const struct GNUNET_CONTAINER_MetaData *meta)
{
char *name;