elementary/elm_entry : Fix some wrong logics when getting long string
authorwoohyun <woohyun@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 10 Apr 2012 08:08:40 +0000 (08:08 +0000)
committerwoohyun <woohyun@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 10 Apr 2012 08:08:40 +0000 (08:08 +0000)
(over CHUNK_SIZE) from entry.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@69987 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/elm_entry.c

index 1043343..cdf5f31 100644 (file)
@@ -2375,8 +2375,8 @@ _elm_entry_text_get(const Evas_Object *obj, const char *item)
      {
         char *tmpbuf;
         size_t tlen;
-        tlen = strlen(text);
-        tmpbuf = malloc(tlen + wd->append_text_len + 1);
+        tlen = wd->append_text_position;
+        tmpbuf = malloc(wd->append_text_len + 1);
         if (!tmpbuf)
           {
              ERR("Failed to allocate memory for entry's text %p", obj);
@@ -2384,8 +2384,8 @@ _elm_entry_text_get(const Evas_Object *obj, const char *item)
           }
         memcpy(tmpbuf, text, tlen);
         if (wd->append_text_left)
-          memcpy(tmpbuf + tlen, wd->append_text_left, wd->append_text_len);
-        tmpbuf[tlen + wd->append_text_len] = '\0';
+          memcpy(tmpbuf + tlen, wd->append_text_left + wd->append_text_position, wd->append_text_len - tlen);
+        tmpbuf[wd->append_text_len + 1] = '\0';
         eina_stringshare_replace(&wd->text, tmpbuf);
         free(tmpbuf);
      }