Replace New Line with <BR>
Change-Id: Ia2571b4bcc22f4b23d823727f4cabfdd82676a9d
+livebox (0.0.7) unstable; urgency=low
+
+ * Git: slp/pkgs/l/livebox
+ * Tag: livebox_0.0.7
+
+ -- Sung-jae Park <nicesj.park@samsung.com> Mon, 06 Aug 2012 21:27:32 +0900
+
livebox (0.0.6) unstable; urgency=low
* Git: slp/pkgs/l/livebox
*/
extern int livebox_desc_del_block(struct livebox_desc *handle, int idx);
+/*!
+ * \brief Replace '\n' with '<br>'
+ * \param[in] str Source string
+ * \return char* allocated string
+ */
+extern char *livebox_util_nl2br(const char *str);
+
#ifdef __cplusplus
}
#endif
Name: liblivebox
Summary: Library for the development of a livebox
-Version: 0.0.6
+Version: 0.0.7
Release: 1
Group: main/app
License: Samsung Proprietary License
return block->idx;
}
+EAPI char *livebox_util_nl2br(const char *str)
+{
+ int len;
+ register int i;
+ char *ret;
+ char *ptr;
+
+ if (!str)
+ return NULL;
+
+ len = strlen(str);
+ if (!len)
+ return NULL;
+
+ ret = malloc(len);
+ if (!ret)
+ return NULL;
+
+ ptr = ret;
+ i = 0;
+ while (*str) {
+ switch (*str) {
+ case '\n':
+ if (len - i < 5) {
+ char *tmp;
+ len += len;
+
+ tmp = realloc(ret, len);
+ if (!tmp) {
+ free(ret);
+ return NULL;
+ }
+
+ ret = tmp;
+ ptr = tmp + i;
+ }
+
+ strcpy(ptr, "<br>");
+ ptr += 4;
+ i += 4;
+ break;
+ default:
+ *ptr++ = *str;
+ i++;
+ break;
+ }
+
+ str++;
+ }
+ *ptr = '\0';
+
+ return ret;
+}
+
/*!
* \return idx
*/