Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Commit

Permalink
Fix old cast style use in generated file and support lib.
Browse files Browse the repository at this point in the history
  • Loading branch information
Damien Merenne committed Oct 18, 2019
1 parent 3aa304c commit d73142c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/source/JNIGenerator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,9 @@ class JNIGenerator(spec: Spec) extends Generator(spec) {
def toJniCall(ty: TypeRef, f: String => String): String = toJniCall(ty.resolved, f, false)
def toJniCall(m: MExpr, f: String => String, needRef: Boolean): String = m.base match {
case p: MPrimitive => f(if (needRef) "Object" else IdentStyle.camelUpper(p.jName))
case MString => "(jstring)" + f("Object")
case MString => "reinterpret_cast<jstring>(" + f("Object") + ")"
case MOptional => toJniCall(m.args.head, f, true)
case MBinary => "(jbyteArray)" + f("Object")
case MBinary => "reinterpret_cast<jbyteArray>(" + f("Object") + ")"
case _ => f("Object")
}

Expand Down
2 changes: 1 addition & 1 deletion support-lib/objc/DJIMarshal+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ struct WString {
assert(string);
NSStringEncoding encoding = getWCharEncoding<sizeof(wchar_t)>();
NSData* data = [string dataUsingEncoding:encoding];
return std::wstring((wchar_t*)[data bytes], [data length] / sizeof (wchar_t));
return std::wstring(reinterpret_cast<wchar_t*>([data bytes]), [data length] / sizeof (wchar_t));
}

static ObjcType fromCpp(const CppType& string) {
Expand Down

0 comments on commit d73142c

Please sign in to comment.