Skip to content

Commit 6b31802

Browse files
viruscampkohsuke
authored andcommitted
commit dll and pdb files
fix errors last commit imported pass simple tests: HRESULT _stdcall Write( [in] SAFEARRAY(unsigned char)* buffer, [in] long count, [out, retval] long* pRetCount); HRESULT _stdcall FindRsrc( [in] BSTR expr, [out, retval] SAFEARRAY(BSTR)* pFindList);
1 parent c48219e commit 6b31802

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

native/invoke.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ jobject Environment::invoke( void* pComObject, ComMethod method, jobjectArray ar
395395
break;
396396

397397
case cvSAFEARRAY_byRef:
398-
SAFEARRAY** ppsa = NULL;
399398
if(arg==NULL) {
400399
c_args[i].v_ptr = NULL;
401400
} else if(env->IsSameObject(env->GetObjectClass(arg),com4j_Holder)) {
@@ -406,12 +405,12 @@ jobject Environment::invoke( void* pComObject, ComMethod method, jobjectArray ar
406405
jobject o = jholder(arg)->get(env);
407406
unm = new SafeArrayUnmarshaller<safearray::SafeArrayXducer>(env, static_cast<jarray>(o));
408407
add( new OutParamHandler( jholder(arg), unm ) ); // after the method call unmarshal it back to SAFEARRAY
409-
ppsa = static_cast<SAFEARRAY**>(unm->addr());
408+
SAFEARRAY** ppsa = static_cast<SAFEARRAY**>(unm->addr());
409+
c_args[i].v_ptr = ppsa;
410410
} else {
411411
error(env,__FILE__,__LINE__,"unable to convert the given object to SAFEARRAY*");
412412
return NULL;
413413
}
414-
c_args[i].v_ptr = ppsa;
415414
ffi_types[i + 1] = &ffi_type_pointer;
416415
ffi_values[i + 1] = &c_args[i].v_ptr;
417416
break;

runtime/src/main/java/com4j/ComMethod.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com4j;
22

33
import java.lang.annotation.Annotation;
4+
import java.lang.reflect.GenericArrayType;
45
import java.lang.reflect.Method;
56
import java.lang.reflect.ParameterizedType;
67
import java.lang.reflect.Type;
@@ -241,6 +242,8 @@ static NativeType getDefaultConversion(Type t) {
241242
return NativeType.VariantBool_ByRef;
242243
if(Buffer.class.isAssignableFrom(c))
243244
return NativeType.PVOID_ByRef;
245+
if(c.isArray())
246+
return NativeType.SafeArray_ByRef;
244247
}
245248
if(v instanceof GenericArrayType){
246249
return NativeType.SafeArray_ByRef;

runtime/src/main/java/com4j/NativeType.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -583,13 +583,7 @@ Object toJava(Class<?> signature, Type genericSignature, Object param) {
583583
* </ul>
584584
*/
585585
SafeArray(500,24),
586-
587-
// TODO: Not supported yet: SafeArray_ByRef(500|BYREF, 4)
588-
589-
;
590-
591-
592-
586+
SafeArray_ByRef(500|BYREF,4);
593587

594588

595589
/**

0 commit comments

Comments
 (0)