Hi folks,
I looked again at the UT_convert issues, and found several problems:
* It seems somewhat unsure about its return type; it is declared
as returning bool, but at one point actually returns NULL
* Though it does compute its result (pDest) and allocates it, this
pointer is nowhere returned (at the moment, it is actually a memory
leak)
* It is only used in pspell_checker.cpp, in the utf16_to_utf8 and
utf8_to_utf16 functions. At those places, a totally different semantics
is assumed: the fifth parameter is treated as the result parameter,
and it is assumed some kind of string is returned through it, even
though in fact it is a pointer to a single integer which is set to
the number of characters processed.
Though I did not commit anything (because I am still a bit unsure of
the semantics intended), I suggest the following changes:
* Change UT_convert to return a (char *), instead of a boolean.
This should be NULL on error, and contain a freshly allocated buffer
of character on succes. Perhaps it should be a slightly different
type though.
I have this change attached as abiword-UT_convert-1.diff
* Change the pspell functions to reflect this change, and to take
into account that it handles newly allocated memory.
I have this change attached as abiword-UT_convert-2.diff
At this moment, pspell still does not work, but I would like to know
whether I am heading in the right direction.
The reason I need to use pspell: I want to use my extensive catalog
of ispell dictionaries, but they are in a slightly different format
than expected by AbiWord; using ispell directly does not work, but
it used to work fine through pspell.
Thanks,
Frodo
--
Frodo Looijaard <[EMAIL PROTECTED]> PGP key and more: http://huizen.dds.nl/~frodol
Defenestration n. (formal or joc.):
The act of removing Windows from your computer in disgust, usually followed
by the installation of Linux or some other Unix-like operating system.
Index: src/wp/impexp/xp/ie_exp_RTF_listenerWriteDoc.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_exp_RTF_listenerWriteDoc.cpp,v
retrieving revision 1.28
diff -r1.28 ie_exp_RTF_listenerWriteDoc.cpp
634c634
< if (!pBlockAP || !pBlockAP->getAttribute("listid", szListid))
---
> if (!pBlockAP || !pBlockAP->getAttribute((const XML_Char*)"listid", szListid))
636c636
< if (!pBlockAP || !pBlockAP->getAttribute("parentid", szParentid))
---
> if (!pBlockAP || !pBlockAP->getAttribute((const XML_Char*)"parentid",
>szParentid))
638c638
< if (!pBlockAP || !pBlockAP->getAttribute("level", szLevel))
---
> if (!pBlockAP || !pBlockAP->getAttribute((const XML_Char*)"level", szLevel))
640c640
< if (!pBlockAP || !pBlockAP->getAttribute("style", szListStyle))
---
> if (!pBlockAP || !pBlockAP->getAttribute((const XML_Char*)"style",
>szListStyle))
666,669c666,669
< m_pie->_rtf_keyword_ifnotdefault("abilistid",szListid,-1);
< m_pie->_rtf_keyword_ifnotdefault("abilistparentid",szParentid,-1);
< m_pie->_rtf_keyword_ifnotdefault("abilistlevel",szLevel,-1);
< m_pie->_rtf_keyword_ifnotdefault("abistartat",szAbiStartValue,-1);
---
> m_pie->_rtf_keyword_ifnotdefault("abilistid",(char *) szListid,-1);
> m_pie->_rtf_keyword_ifnotdefault("abilistparentid",(char *)
>szParentid,-1);
> m_pie->_rtf_keyword_ifnotdefault("abilistlevel",(char *) szLevel,-1);
> m_pie->_rtf_keyword_ifnotdefault("abistartat",(char *)
>szAbiStartValue,-1);
674c674
< m_pie->_rtf_chardata( szAbiFieldFont ,strlen(szAbiFieldFont));
---
> m_pie->_rtf_chardata( (const char *) szAbiFieldFont
>,strlen(szAbiFieldFont));
681c681
< m_pie->_rtf_chardata( szAbiListDecimal ,strlen(szAbiListDecimal));
---
> m_pie->_rtf_chardata((const char *) szAbiListDecimal
>,strlen(szAbiListDecimal));
688c688
< m_pie->_rtf_chardata( szAbiListDelim ,strlen( szAbiListDelim));
---
> m_pie->_rtf_chardata((const char *) szAbiListDelim ,strlen(
>szAbiListDelim));
695c695
< m_pie->_rtf_chardata( szListStyle ,strlen( szListStyle));
---
> m_pie->_rtf_chardata((const char *) szListStyle ,strlen(
>szListStyle));
Index: src/wp/impexp/xp/ie_imp_RTF.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_imp_RTF.cpp,v
retrieving revision 1.34
diff -r1.34 ie_imp_RTF.cpp
1534c1534
< pAuto = new fl_AutoNum(id, pid, lType,
startValue, m_currentRTFState.m_paraProps.m_pszListDelim,
m_currentRTFState.m_paraProps.m_pszListDecimal, m_pDocument);
---
> pAuto = new fl_AutoNum(id, pid, lType,
>startValue,(XML_Char *) m_currentRTFState.m_paraProps.m_pszListDelim,(XML_Char *)
>m_currentRTFState.m_paraProps.m_pszListDecimal, m_pDocument);
Index: src/af/util/xp/ut_iconv.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/util/xp/ut_iconv.cpp,v
retrieving revision 1.5
diff -u -2 -r1.5 ut_iconv.cpp
--- src/af/util/xp/ut_iconv.cpp 2001/06/25 16:53:27 1.5
+++ src/af/util/xp/ut_iconv.cpp 2001/07/06 20:25:47
@@ -85,5 +85,5 @@
*/
extern "C"
-bool UT_convert(const char* str,
+char *UT_convert(const char* str,
UT_uint32 len,
const char* to_codeset,
@@ -94,5 +94,5 @@
if (!str || !to_codeset || !from_codeset)
{
- return 0;
+ return NULL;
}
@@ -198,4 +198,4 @@
}
- return have_error;
+ return have_error?NULL:pDest;
}
Index: src/af/util/xp/ut_iconv.h
===================================================================
RCS file: /cvsroot/abi/src/af/util/xp/ut_iconv.h,v
retrieving revision 1.4
diff -u -2 -r1.4 ut_iconv.h
--- src/af/util/xp/ut_iconv.h 2001/06/21 16:33:30 1.4
+++ src/af/util/xp/ut_iconv.h 2001/07/06 20:25:47
@@ -49,5 +49,5 @@
int UT_iconv_close( UT_iconv_t cd );
-bool UT_convert (const char *str,
+char * UT_convert (const char *str,
UT_uint32 len,
const char *to_codeset,