From: SourceForge.net <no...@so...> - 2008-03-12 22:15:21
|
Bugs item #1878285, was opened at 2008-01-23 15:56 Message generated for change (Comment added) made by wsfulton You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=1878285&group_id=1645 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. >Category: code generation (general) Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Hendrik Maryns (hamaryns) Assigned to: William Fulton (wsfulton) Summary: double cast in generated code for Java constructor Initial Comment: When wrapping a C struct, a default constructor without arguments is made. The corresponding C function looks like this: SWIGEXPORT jlong JNICALL Java_package_ModuleJNI_new_1structName(JNIEnv *jenv, jclass jcls) { jlong jresult = 0 ; struct structName *result = 0 ; (void)jenv; (void)jcls; result = (struct structName *)(struct structName *) calloc(1, sizeof(struct structName)); *(struct structName **)&jresult = result; return jresult; } Note the double cast to (struct structName *). This is unnecessary. Generated by e.g. struct structName { int i; }; ---------------------------------------------------------------------- >Comment By: William Fulton (wsfulton) Date: 2008-03-12 22:15 Message: Logged In: YES user_id=242951 Originator: NO Applies to all languages. Fixed for swig-1.3.35. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=1878285&group_id=1645 |