[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Texmacs-dev] character encoding
From: |
Felix Breuer |
Subject: |
Re: [Texmacs-dev] character encoding |
Date: |
28 Jan 2003 14:08:47 +0100 |
On Tue, 2003-01-28 at 13:11, Joris van der Hoeven wrote:
> Oh, and don't forget that 'as_charp' uses new. The created string
> should therefore be deleted when you do no longer need it.
I know. When I tried to delete a previously allocated char* what I got
was a segfault:
#0 0x4035cac7 in _int_free () from /lib/libc.so.6
#1 0x4035b98f in free () from /lib/libc.so.6
#2 0x080549ba in operator delete(void*) (ptr=0x865f5db)
at Basic/Types/basic.cc:48
#3 0x080aec6a in convert_using_iconv(string, string, string) (input=
{rep = 0xe020e120}, from={rep = 0x1231e4}, to=Cannot access memory at
address 0x3c20e220
)
at Resource/Converters/converter.cc:161
#4 0x080ae706 in convert_from_cork(string, string) (input=Cannot access memory
at address 0x4486d7f3
)
at Resource/Converters/converter.cc:119
#5 0x080ae414 in convert(string, string, string) (input={rep = 0x860594c},
from={rep = 0x8602b20}, to={rep = 0x8605398})
at Resource/Converters/converter.cc:98
Any idea why?
This is the chunk of code I am referring to:
while (inbytesleft > 0) {
size_t out_buf_len = max(inbytesleft,10);
size_t outbytesleft = out_buf_len;
char* out_buf = new char[out_buf_len];
char* start_out_buf = out_buf;
size_t flag = iconv (cd, &in_buf, &inbytesleft, &out_buf, &outbytesleft);
if(flag==(size_t)-1 && errno != E2BIG) { system_error("String conversion
using iconv failed!"); return "";}
result << string(start_out_buf, out_buf_len - outbytesleft);
delete out_buf;
}
- [Texmacs-dev] character encoding, Felix Breuer, 2003/01/27
- Re: [Texmacs-dev] character encoding, Joris van der Hoeven, 2003/01/28
- Re: [Texmacs-dev] character encoding,
Felix Breuer <=
- Re: [Texmacs-dev] character encoding, Joris van der Hoeven, 2003/01/28
- Re: [Texmacs-dev] character encoding, Felix Breuer, 2003/01/28
- Re: [Texmacs-dev] character encoding, Joris van der Hoeven, 2003/01/28
- Re: [Texmacs-dev] character encoding, david, 2003/01/28
- Re: [Texmacs-dev] character encoding, Felix Breuer, 2003/01/28
- Re: [Texmacs-dev] character encoding, david, 2003/01/29
Re: [Texmacs-dev] character encoding, david, 2003/01/28
Re: [Texmacs-dev] character encoding, Joris van der Hoeven, 2003/01/28