}
+/**
+ * Create an SKS URI from a namespace and an identifier.
+ *
+ * @param ns namespace
+ * @param id identifier
+ * @param emsg where to store an error message
+ * @return an FS URI for the given namespace and identifier
+ */
+struct GNUNET_FS_Uri *
+GNUNET_FS_uri_sks_create (struct GNUNET_FS_Namespace *ns,
+ const char *id,
+ char **emsg)
+{
+ struct GNUNET_FS_Uri *ns_uri;
+ struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pk;
+
+ ns_uri = GNUNET_malloc (sizeof (struct GNUNET_FS_Uri));
+ ns_uri->type = sks;
+ GNUNET_CRYPTO_rsa_key_get_public (ns->key,
+ &pk);
+ GNUNET_CRYPTO_hash (&pk,
+ sizeof (pk),
+ &ns_uri->data.sks.namespace);
+ ns_uri->data.sks.identifier = GNUNET_strdup (id);
+ return ns_uri;
+}
+
+
/**
* Canonicalize a keyword.
*
rpos = in;
while ('\0' != *rpos)
{
- switch (tolower(*rpos))
+ switch (tolower( (unsigned char) *rpos))
{
case 'a':
case 'e':
case 'y':
case 'z':
/* convert characters listed above to lower case */
- *wpos = tolower(*rpos);
+ *wpos = tolower( (unsigned char)*rpos);
wpos++;
case '!':
case '.':
const char *kp;
char **kl;
+ if ( (u1 == NULL) && (u2 == NULL) )
+ return NULL;
+ if (u1 == NULL)
+ return GNUNET_FS_uri_dup (u2);
+ if (u2 == NULL)
+ return GNUNET_FS_uri_dup (u1);
if ( (u1->type != ksk) ||
(u2->type != ksk) )
{
pos = searchString;
while ('\0' != *pos)
{
- if ((saw_quote == 0) && (isspace (*pos)))
+ if ((saw_quote == 0) && (isspace ((unsigned char) *pos)))
{
inWord = 0;
}
pos = searchString;
while ('\0' != *pos)
{
- if ((saw_quote == 0) && (isspace (*pos)))
+ if ((saw_quote == 0) && (isspace ( (unsigned char) *pos)))
{
inWord = 0;
*pos = '\0';
static int
needs_percent (char c)
{
- return (!((isalnum (c)) ||
+ return (!((isalnum ( (unsigned char) c)) ||
(c == '-') || (c == '_') || (c == '.') || (c == '~')));
}
}
}
if (hbits > 0)
- ret[len++] = tbl[bits & 63];
+ ret[len] = tbl[bits & 63];
return ret;
}