]> granicus.if.org Git - p11-kit/commitdiff
Fix up documentation
authorStef Walter <stefw@collabora.co.uk>
Tue, 7 Jun 2011 13:06:51 +0000 (13:06 +0000)
committerStef Walter <stefw@collabora.co.uk>
Tue, 7 Jun 2011 13:06:51 +0000 (13:06 +0000)
doc/p11-kit-sections.txt
p11-kit/util.c

index c82d6e342e206d34ac944d3be3e066dfe97cebaf..db1f4f7d16df4603832b084d9be347e1222907e5 100644 (file)
@@ -43,7 +43,8 @@ p11_kit_finalize_module
 <SECTION>
 <FILE>p11-kit-util</FILE>
 p11_kit_strerror
-p11_kit_uri_space_strlen
+p11_kit_space_strdup
+p11_kit_space_strlen
 <SUBSECTION Private>
 CK_FUNCTION_LIST_PTR
 CK_RV
@@ -52,4 +53,6 @@ CK_ATTRIBUTE_TYPE
 CK_INFO_PTR
 CK_TOKEN_INFO_PTR
 CK_ULONG
+p11_kit_uri_result_t
+p11_kit_uri_type_t
 </SECTION>
index ead18cc6b98dc9b015edfeea235c8d301820b97f..e4b0f49978f9079c0f4be76c374136a1e05003ce 100644 (file)
@@ -52,6 +52,27 @@ xrealloc (void *memory, size_t length)
        return allocated;
 }
 
+/**
+ * p11_kit_space_strlen:
+ * @string: Pointer to string block
+ * @max_length: Maximum length of string block
+ *
+ * In PKCS\#11 structures many strings are encoded in a strange way. The string
+ * is placed in a fixed length buffer and then padded with spaces.
+ *
+ * This function determines the actual length of the string. Since the string
+ * is not null-terminated you need to pass in the size of buffer as max_length.
+ * The string will never be longer than this buffer.
+ *
+ * <informalexample><programlisting>
+ * CK_INFO info;
+ * size_t length;
+ *    ...
+ * length = p11_kit_space_strlen (info->libraryDescription, sizeof (info->libraryDescription));
+ * </programlisting></informalexample>
+ *
+ * Returns: The length of the space padded string.
+ */
 size_t
 p11_kit_space_strlen (const unsigned char *string, size_t max_length)
 {
@@ -64,6 +85,26 @@ p11_kit_space_strlen (const unsigned char *string, size_t max_length)
        return i + 1;
 }
 
+/**
+ * p11_kit_space_strdup:
+ * @string: Pointer to string block
+ * @max_length: Maximum length of string block
+ *
+ * In PKCS\#11 structures many strings are encoded in a strange way. The string
+ * is placed in a fixed length buffer and then padded with spaces.
+ *
+ * This function copies the space padded string into a normal null-terminated
+ * string. The result is owned by the caller.
+ *
+ * <informalexample><programlisting>
+ * CK_INFO info;
+ * char *description;
+ *    ...
+ * description = p11_kit_space_strdup (info->libraryDescription, sizeof (info->libraryDescription));
+ * </programlisting></informalexample>
+ *
+ * Returns: The newly allocated string, or %NULL if memory could not be allocated.
+ */
 char*
 p11_kit_space_strdup (const unsigned char *string, size_t max_length)
 {