SF 1538011 -- document the fact that toString() convertes the underlying data type to a String type

This commit is contained in:
clay_shooter
2006-09-23 17:30:30 +00:00
parent 8e6be7ec6c
commit 3bd2d84f07
2 changed files with 17 additions and 2 deletions

View File

@@ -520,10 +520,12 @@ JNIEXPORT jstring JNICALL Java_com_jacob_com_Variant_toString
return env->NewStringUTF("null");
}
HRESULT hr;
// this actually changes the type of the variant to a String!
if (FAILED(hr = VariantChangeType(v, v, 0, VT_BSTR))) {
// cannot change type to a string
return env->NewStringUTF("???");
}
// create a returnable string from the converted variant
BSTR bs = V_BSTR(v);
jstring js = env->NewString(bs, SysStringLen(bs));
return js;
@@ -1114,6 +1116,9 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putFloat
}
}
/**
* changes the type of the underlying variant data
* */
JNIEXPORT void JNICALL Java_com_jacob_com_Variant_changeType
(JNIEnv *env, jobject _this, jshort t)
{