Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/55fadc802ac80286e4f7266866ad789c78f57483
...commit
http://git.netsurf-browser.org/netsurf.git/commit/55fadc802ac80286e4f7266866ad789c78f57483
...tree
http://git.netsurf-browser.org/netsurf.git/tree/55fadc802ac80286e4f7266866ad789c78f57483
The branch, master has been updated
via 55fadc802ac80286e4f7266866ad789c78f57483 (commit)
from 3b57deb046a35a8e88fb0db672adf9aac6899aea (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=55fadc802ac80286e4f7266866ad789c78f57483
commit 55fadc802ac80286e4f7266866ad789c78f57483
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
html: list counter style: Revert to string for {pre|post}fix.
diff --git a/content/handlers/html/list_counter_style.c
b/content/handlers/html/list_counter_style.c
index e864c9b..81d9aa3 100644
--- a/content/handlers/html/list_counter_style.c
+++ b/content/handlers/html/list_counter_style.c
@@ -41,8 +41,8 @@ struct list_counter_style {
const unsigned int length;
const symbol_t value;
} pad;
- const symbol_t prefix;
- const symbol_t postfix;
+ const char *prefix;
+ const char *postfix;
const symbol_t *symbols; /**< array of symbols which represent this
style */
const int *weights; /**< symbol weights for additive schemes */
const size_t items; /**< items in symbol and weight table */
@@ -50,6 +50,32 @@ struct list_counter_style {
};
/**
+ * Copy a null-terminated UTF-8 string to buffer at offset, if there is space
+ *
+ * \param[in] buf The output buffer
+ * \param[in] buflen The length of \a buf
+ * \param[in] pos Current position in \a buf
+ * \param[in] str The string to copy into \a buf
+ * \return The number of bytes needed in the output buffer which may be
+ * larger than \a buflen but the buffer will not be overrun
+ */
+static inline size_t
+copy_string(char *buf, const size_t buflen, size_t pos, const char *str)
+{
+ size_t sidx = 0; /* current string index */
+
+ while (str[sidx] != '\0') {
+ if (pos < buflen) {
+ buf[pos] = str[sidx];
+ }
+ pos++;
+ sidx++;
+ }
+
+ return sidx;
+}
+
+/**
* Copy a UTF-8 symbol to buffer at offset, if there is space
*
* \param[in] buf The output buffer
@@ -115,8 +141,8 @@ map_aval_to_symbols(char *buf, const size_t buflen,
}
/* postfix */
- oidx += copy_symbol(buf, buflen, oidx,
- (cstyle->postfix[0] != '\0') ?
+ oidx += copy_string(buf, buflen, oidx,
+ (cstyle->postfix != NULL) ?
cstyle->postfix : postfix);
return oidx;
-----------------------------------------------------------------------
Summary of changes:
content/handlers/html/list_counter_style.c | 34 ++++++++++++++++++++++++----
1 file changed, 30 insertions(+), 4 deletions(-)
diff --git a/content/handlers/html/list_counter_style.c
b/content/handlers/html/list_counter_style.c
index e864c9b..81d9aa3 100644
--- a/content/handlers/html/list_counter_style.c
+++ b/content/handlers/html/list_counter_style.c
@@ -41,8 +41,8 @@ struct list_counter_style {
const unsigned int length;
const symbol_t value;
} pad;
- const symbol_t prefix;
- const symbol_t postfix;
+ const char *prefix;
+ const char *postfix;
const symbol_t *symbols; /**< array of symbols which represent this
style */
const int *weights; /**< symbol weights for additive schemes */
const size_t items; /**< items in symbol and weight table */
@@ -50,6 +50,32 @@ struct list_counter_style {
};
/**
+ * Copy a null-terminated UTF-8 string to buffer at offset, if there is space
+ *
+ * \param[in] buf The output buffer
+ * \param[in] buflen The length of \a buf
+ * \param[in] pos Current position in \a buf
+ * \param[in] str The string to copy into \a buf
+ * \return The number of bytes needed in the output buffer which may be
+ * larger than \a buflen but the buffer will not be overrun
+ */
+static inline size_t
+copy_string(char *buf, const size_t buflen, size_t pos, const char *str)
+{
+ size_t sidx = 0; /* current string index */
+
+ while (str[sidx] != '\0') {
+ if (pos < buflen) {
+ buf[pos] = str[sidx];
+ }
+ pos++;
+ sidx++;
+ }
+
+ return sidx;
+}
+
+/**
* Copy a UTF-8 symbol to buffer at offset, if there is space
*
* \param[in] buf The output buffer
@@ -115,8 +141,8 @@ map_aval_to_symbols(char *buf, const size_t buflen,
}
/* postfix */
- oidx += copy_symbol(buf, buflen, oidx,
- (cstyle->postfix[0] != '\0') ?
+ oidx += copy_string(buf, buflen, oidx,
+ (cstyle->postfix != NULL) ?
cstyle->postfix : postfix);
return oidx;
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]