Mercurial > hg > xemacs-beta
changeset 4956:3461165c79be
fix compile errors due to mismatched string pointer types
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-01-28 Ben Wing <ben@xemacs.org>
* device-x.c (x_init_device):
* emodules.c (emodules_load):
* emodules.c (emodules_doc_subr):
* emodules.c (emodules_doc_sym):
* emodules.h:
Make the externally-called functions emodules_doc_sym() and
emodules_doc_subr() take Ascbyte * pointers since they're usually
passed string constants and we can't guarantee the encoding if
it's not ASCII. Fix pointer type in calls to dll_variable(), etc.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Thu, 28 Jan 2010 01:15:10 -0600 |
parents | de64354ffcbf |
children | db2db229ee82 |
files | src/ChangeLog src/device-x.c src/emodules.c src/emodules.h |
diffstat | 4 files changed, 51 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Wed Jan 27 00:45:06 2010 -0600 +++ b/src/ChangeLog Thu Jan 28 01:15:10 2010 -0600 @@ -1,3 +1,15 @@ +2010-01-28 Ben Wing <ben@xemacs.org> + + * device-x.c (x_init_device): + * emodules.c (emodules_load): + * emodules.c (emodules_doc_subr): + * emodules.c (emodules_doc_sym): + * emodules.h: + Make the externally-called functions emodules_doc_sym() and + emodules_doc_subr() take Ascbyte * pointers since they're usually + passed string constants and we can't guarantee the encoding if + it's not ASCII. Fix pointer type in calls to dll_variable(), etc. + 2010-01-27 Ben Wing <ben@xemacs.org> * lread.c (vars_of_lread):
--- a/src/device-x.c Wed Jan 27 00:45:06 2010 -0600 +++ b/src/device-x.c Thu Jan 28 01:15:10 2010 -0600 @@ -585,7 +585,8 @@ { /* Look for the Xaw3d function */ dll_func xaw_function_handle = - dll_function (xaw_dll_handle, "Xaw3dComputeTopShadowRGB"); + dll_function (xaw_dll_handle, + (const Ibyte *) "Xaw3dComputeTopShadowRGB"); /* If we found it, warn the user in big, nasty, unfriendly letters */ if (xaw_function_handle != NULL)
--- a/src/emodules.c Wed Jan 27 00:45:06 2010 -0600 +++ b/src/emodules.c Thu Jan 28 01:15:10 2010 -0600 @@ -375,13 +375,15 @@ signal_error (Qdll_error, "Opening dynamic module", dll_error ()); } - ellcc_rev = (const long *) dll_variable (dlhandle, "emodule_compiler"); + ellcc_rev = (const long *) dll_variable (dlhandle, + (const Ibyte *) "emodule_compiler"); if (ellcc_rev == NULL || *ellcc_rev <= 0L) signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_compiler'", Qunbound); if (*ellcc_rev > EMODULES_REVISION) signal_ferror (Qdll_error, "Invalid dynamic module: Unsupported version `%ld(%ld)'", *ellcc_rev, EMODULES_REVISION); - f = (const Extbyte **) dll_variable (dlhandle, "emodule_name"); + f = (const Extbyte **) dll_variable (dlhandle, + (const Ibyte *) "emodule_name"); if (f == NULL || *f == NULL) signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_name'", Qunbound); @@ -393,7 +395,8 @@ if (mname[0] == '\0') signal_error (Qdll_error, "Invalid dynamic module: Empty value for `emodule_name'", Qunbound); - f = (const Extbyte **) dll_variable (dlhandle, "emodule_version"); + f = (const Extbyte **) dll_variable (dlhandle, + (const Ibyte *) "emodule_version"); if (f == NULL || *f == NULL) signal_error (Qdll_error, "Missing symbol `emodule_version': Invalid dynamic module", Qunbound); @@ -402,7 +405,8 @@ code did so */ IBYTE_STRING_TO_ALLOCA (mver, mver); - f = (const Extbyte **) dll_variable (dlhandle, "emodule_title"); + f = (const Extbyte **) dll_variable (dlhandle, + (const Ibyte *) "emodule_title"); if (f == NULL || *f == NULL) signal_error (Qdll_error, "Invalid dynamic module: Missing symbol `emodule_title'", Qunbound); @@ -528,12 +532,23 @@ } void -emodules_doc_subr (const Ibyte *symname, const Ibyte *doc) +emodules_doc_subr (const Ascbyte *symname, const Ascbyte *doc) { - Bytecount len = qxestrlen (symname); - Lisp_Object sym = oblookup (Vobarray, symname, len); + Bytecount len; + Lisp_Object sym; Lisp_Subr *subr; + ASSERT_ASCTEXT_ASCII (symname); + len = strlen (symname); + sym = oblookup (Vobarray, (const Ibyte *) symname, len); + + /* We do this assert to avoid the possibility of externally formatted + text ending up in the doc string, where it could cause crashes. + It you need to have a non-ASCII doc string, create another version + emodules_doc_subr_istring() that accepts an Ibyte * and doesn't + assert, or create an emodules_doc_subr_extstring() that takes + an externally_formatted string and a coding system name. */ + ASSERT_ASCTEXT_ASCII (doc); /* Skip autoload cookies */ if (SYMBOLP (sym) && SUBRP (XSYMBOL (sym)->function)) { @@ -549,16 +564,23 @@ } void -emodules_doc_sym (const Ibyte *symname, const Ibyte *doc) +emodules_doc_sym (const Ascbyte *symname, const Ascbyte *doc) { - Bytecount len = qxestrlen (symname); - Lisp_Object sym = oblookup (Vobarray, symname, len); + Bytecount len; + Lisp_Object sym; Lisp_Object docstr; struct gcpro gcpro1; + ASSERT_ASCTEXT_ASCII (symname); + len = strlen (symname); + sym = oblookup (Vobarray, (const Ibyte *) symname, len); + + /* See comments above in emodules_doc_subr() about why we assert like + this. */ + ASSERT_ASCTEXT_ASCII (doc); if (SYMBOLP (sym)) { - docstr = build_istring (doc); + docstr = build_ascstring (doc); GCPRO1 (docstr); Fput (sym, Qvariable_documentation, docstr); UNGCPRO;
--- a/src/emodules.h Wed Jan 27 00:45:06 2010 -0600 +++ b/src/emodules.h Thu Jan 28 01:15:10 2010 -0600 @@ -71,10 +71,10 @@ * into the right place. These functions will be called by the module * init code, generated by ellcc during initialization mode. */ -EXTERN_C MODULE_API void emodules_doc_subr (const Ibyte *objname, - const Ibyte *docstr); -EXTERN_C MODULE_API void emodules_doc_sym (const Ibyte *objname, - const Ibyte *docstr); +EXTERN_C MODULE_API void emodules_doc_subr (const Ascbyte *objname, + const Ascbyte *docstr); +EXTERN_C MODULE_API void emodules_doc_sym (const Ascbyte *objname, + const Ascbyte *docstr); #define CDOCSUBR(Fname, DOC) emodules_doc_subr (Fname, DOC) #define CDOCSYM(Sname, DOC) emodules_doc_sym (Sname, DOC)