/* Tests the libfsntfs_get_version function * Returns 1 if successful or 0 if not */ int fsntfs_test_get_version( void ) { const char *version_string = NULL; int result = 0; version_string = libfsntfs_get_version(); result = narrow_string_compare( version_string, LIBFSNTFS_VERSION_STRING, 9 ); FSNTFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); return( 1 ); on_error: return( 0 ); }
* Returns a Python object if successful or NULL on error */ PyObject *pyfsntfs_get_version( PyObject *self PYFSNTFS_ATTRIBUTE_UNUSED, PyObject *arguments PYFSNTFS_ATTRIBUTE_UNUSED ) { const char *errors = NULL; const char *version_string = NULL; size_t version_string_length = 0; PYFSNTFS_UNREFERENCED_PARAMETER( self ) PYFSNTFS_UNREFERENCED_PARAMETER( arguments ) Py_BEGIN_ALLOW_THREADS version_string = libfsntfs_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 ) ); }