summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2016-01-26 19:51:10 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2016-01-26 20:18:45 +0000
commit83584e504a28f0e133eca1dd39e5531f6cae5abf (patch)
tree2744dbc5cb08de6c7c7ab3abf6242130b2a14a9a
parent62c34fc9d94f15046b40cc3d488972eb3fdc8e89 (diff)
downloadswig-83584e504a28f0e133eca1dd39e5531f6cae5abf.tar.gz
Java enum and static member variable escaping fix for chars
For example: enum X { x = '\1' }; struct A { static const char a = '\n'; };
-rw-r--r--Source/Modules/java.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx
index afe8ca841..c8655a017 100644
--- a/Source/Modules/java.cxx
+++ b/Source/Modules/java.cxx
@@ -1375,7 +1375,7 @@ public:
const char *val = Equal(Getattr(n, "enumvalue"), "true") ? "1" : "0";
Setattr(n, "enumvalue", val);
} else if (swigtype == T_CHAR) {
- String *val = NewStringf("'%s'", Getattr(n, "enumvalue"));
+ String *val = NewStringf("'%(escape)s'", Getattr(n, "enumvalue"));
Setattr(n, "enumvalue", val);
Delete(val);
}
@@ -1573,7 +1573,7 @@ public:
// Alternative constant handling will use the C syntax to make a true Java constant and hope that it compiles as Java code
if (Getattr(n, "wrappedasconstant")) {
if (SwigType_type(t) == T_CHAR)
- Printf(constants_code, "\'%s\';\n", Getattr(n, "staticmembervariableHandler:value"));
+ Printf(constants_code, "\'%(escape)s\';\n", Getattr(n, "staticmembervariableHandler:value"));
else
Printf(constants_code, "%s;\n", Getattr(n, "staticmembervariableHandler:value"));
} else {