示例#1
0
/* Tests retrieving the library version
 * Returns 1 if successful or 0 if not
 */
int msiecf_test_get_version(
     void )
{
	const char *version_string = NULL;
	int result                 = 0;

	version_string = libmsiecf_get_version();

	result = libcstring_narrow_string_compare(
	          version_string,
	          LIBMSIECF_VERSION_STRING,
	          9 );

	if( result != 0 )
	{
		return( 0 );
	}
	return( 1 );
}
示例#2
0
 * Returns a Python object if successful or NULL on error
 */
PyObject *pymsiecf_get_version(
           PyObject *self PYMSIECF_ATTRIBUTE_UNUSED,
           PyObject *arguments PYMSIECF_ATTRIBUTE_UNUSED )
{
	const char *errors           = NULL;
	const char *version_string   = NULL;
	size_t version_string_length = 0;

	PYMSIECF_UNREFERENCED_PARAMETER( self )
	PYMSIECF_UNREFERENCED_PARAMETER( arguments )

	Py_BEGIN_ALLOW_THREADS

	version_string = libmsiecf_get_version();

	Py_END_ALLOW_THREADS

	version_string_length = libcstring_narrow_string_length(
	                         version_string );

	/* Pass the string length to PyUnicode_DecodeUTF8
	 * otherwise it makes the end of string character is part
	 * of the string
	 */
	return( PyUnicode_DecodeUTF8(
	         version_string,
	         (Py_ssize_t) version_string_length,
	         errors ) );
}