Section: devel
Priority: extra
Maintainer: Hyoyoung Chang <hyoyoung.chang@samsung.com>
-Build-Depends: debhelper (>= 5), libeina-dev, libelm-dev, libappcore-efl-dev, libappcore-common-dev, libx11-dev, libecore-dev, libslp-utilx-dev, x11-xserver-utils-ex
+Build-Depends: debhelper (>= 5), libelm-dev, libappcore-efl-dev, libappcore-common-dev, libx11-dev, libecore-dev, libslp-utilx-dev, x11-xserver-utils-ex
Standards-Version: 0.1.1
Package: cbhm
#define STORAGE_FILEPATH "/opt/var/.savecbh"
#define STORAGE_MAX_ITEMS HISTORY_QUEUE_MAX_TXT_ITEMS
#define HEADER_ITEM_SIZE (sizeof(int))
-#define BODY_ITEM_SIZE (4 * 1024) // 4Kilo
+#define BODY_ITEM_SIZE HISTORY_QUEUE_TXT_ITEM_SIZE
#define STORAGE_HEADER_SIZE (STORAGE_MAX_ITEMS * HEADER_ITEM_SIZE)
#define STORAGE_BODY_SIZE (STORAGE_MAX_ITEMS * BODY_ITEM_SIZE)
#define TOTAL_STORAGE_SIZE (STORAGE_HEADER_SIZE+STORAGE_BODY_SIZE)
if (len <= 0)
return -1;
+ // FIXME: replace magic number to a define
if (g_lastest_content == NULL)
- g_lastest_content = malloc(sizeof(char)*(4*1024));
+ g_lastest_content = malloc(sizeof(char)*(HISTORY_QUEUE_TXT_ITEM_SIZE));
if (g_history_pos >= HISTORY_QUEUE_MAX_TXT_ITEMS)
g_history_pos = 0;
// FIXME: remove g_lasteset_content
- strcpy(g_lastest_content, src);
+ //strcpy(g_lastest_content, src);
+ memcpy(g_lastest_content, src, len);
+ g_lastest_content[len] = '\0';
adding_item_to_storage(g_history_pos, g_lastest_content);
increment_current_history_position();
unsigned char *cbbuf;
struct appdata *ad = data;
const char *unesc;
+ size_t unesc_len = 0;
+ int i;
XGetWindowProperty(g_disp, g_evtwin, atomCBOut, 0, 0, False,
AnyPropertyType, &cbtype, &cbformat, &cbitems, &cbsize, &cbbuf);
XDeleteProperty(g_disp, g_evtwin, atomCBOut);
unesc = clipdrawer_get_plain_string_from_escaped(cbbuf);
+ if (unesc != NULL)
+ unesc_len = strlen(unesc);
+ else
+ unesc_len = 0;
+
+ fprintf(stderr, "## unesc len = %d\n", unesc_len);
+
+ // FIXME: invent more clever way to right trim the string
+ for (i = unesc_len-1; i > 0; i--)
+ {
+ fprintf(stderr, "## unesc[%d] = 0x%x\n", i, unesc[i]);
+ if (unesc[i] >= 0x01 && unesc[i] <= 0x1F)
+ continue;
+ else
+ {
+ unesc_len = i+1;
+ break;
+ }
+ }
+
+ fprintf(stderr, "## unesc len = %d\n", unesc_len);
+
// add_to_storage_buffer(ad, cbbuf, cbitems);
// DTRACE("len = %ld, data = %s\n", cbitems, cbbuf);
clipdrawer_add_image_item(unesc);
}
else
- add_to_storage_buffer(ad, unesc, strlen(unesc));
- DTRACE("len = %ld, data = %s\n", strlen(unesc), unesc);
+ add_to_storage_buffer(ad, unesc, unesc_len);
+ DTRACE("len = %ld, data = %s\n", unesc_len, unesc);
free(unesc);
DTRACE("\n");