CFFI - Fix some string constants are incorrect

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13963 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2012-12-14 08:00:22 +00:00
commit 04b60a1508
3 changed files with 11 additions and 1 deletions

View file

@ -6,6 +6,9 @@ Version 2.0.9 (in progress)
===========================
2012-12-14: wsfulton
[CFFI] Fix #3161614 - Some string constants are incorrect
2012-12-13: wsfulton
[CFFI] Fix #3529690 - Fix incorrect constant names.

View file

@ -39,6 +39,7 @@
#define CONST_CHAR 'x'
#define CONST_STRING1 "const string"
#define CONST_STRING2 "const" " string"
#define CONST_STRING3 "log-revprops"
// Expressions - runtime tests check the type for any necessary type promotions of the expressions

View file

@ -565,7 +565,13 @@ void CFFI::emit_defun(Node *n, String *name) {
int CFFI::constantWrapper(Node *n) {
String *type = Getattr(n, "type");
String *converted_value = convert_literal(Getattr(n, "value"), type);
String *converted_value;
if (SwigType_type(type) == T_STRING) {
converted_value = NewString(Getattr(n, "rawval"));
} else {
converted_value = convert_literal(Getattr(n, "value"), type);
}
String *name = lispify_name(n, Getattr(n, "sym:name"), "'constant");
if (Strcmp(name, "t") == 0 || Strcmp(name, "T") == 0)