for (plist = mt->plist; plist; plist = plist->next)
{
MInterval *head = find_interval (plist, pos2);
- MInterval *tail = mt->plist->tail;
+ MInterval *tail = plist->tail;
MTextProperty *prop;
int i;
- if (head->start == pos2)
- head = head->prev;
- while (tail != head)
+ if (head)
{
- for (i = 0; i < tail->nprops; i++)
+ if (head->start == pos2)
+ head = head->prev;
+ while (tail != head)
{
- prop = tail->stack[i];
- if (prop->start == tail->start)
- prop->start += diff, prop->end += diff;
+ for (i = 0; i < tail->nprops; i++)
+ {
+ prop = tail->stack[i];
+ if (prop->start == tail->start)
+ prop->start += diff, prop->end += diff;
+ }
+ tail->start += diff;
+ tail->end += diff;
+ tail = tail->prev;
}
- tail->start += diff;
- tail->end += diff;
- tail = tail->prev;
}
for (i = 0; i < tail->nprops; i++)
tail->stack[i]->end += diff;
int n;
M_CHECK_RANGE (mt, from, to, NULL, NULL);
+ if (mt->format != MTEXT_FORMAT_US_ASCII
+ && mt->format != MTEXT_FORMAT_UTF_8)
+ mtext__adjust_format (mt, MTEXT_FORMAT_UTF_8);
+ if (MTEXT_DATA (mt)[mtext_nbytes (mt)] != 0)
+ MTEXT_DATA (mt)[mtext_nbytes (mt)] = 0;
doc = xmlParseMemory (XML_TEMPLATE, strlen (XML_TEMPLATE) + 1);
node = xmlDocGetRootElement (doc);