/* Seeks a certain offset in the file entry data * Returns a Python object holding the offset if successful or NULL on error */ PyObject *pyewf_file_entry_seek_offset( pyewf_file_entry_t *pyewf_file_entry, PyObject *arguments, PyObject *keywords ) { libcerror_error_t *error = NULL; static char *function = "pyewf_file_entry_seek_offset"; static char *keyword_list[] = { "offset", "whence", NULL }; off64_t offset = 0; int whence = 0; if( pyewf_file_entry == NULL ) { PyErr_Format( PyExc_TypeError, "%s: invalid pyewf file_entry.", function ); return( NULL ); } if( pyewf_file_entry->file_entry == NULL ) { PyErr_Format( PyExc_TypeError, "%s: invalid pyewf file_entry - missing libewf file_entry.", function ); return( NULL ); } if( PyArg_ParseTupleAndKeywords( arguments, keywords, "L|i", keyword_list, &offset, &whence ) == 0 ) { return( NULL ); } Py_BEGIN_ALLOW_THREADS offset = libewf_file_entry_seek_offset( pyewf_file_entry->file_entry, offset, whence, &error ); Py_END_ALLOW_THREADS if( offset == -1 ) { pyewf_error_raise( error, PyExc_IOError, "%s: unable to seek offset.", function ); libcerror_error_free( &error ); return( NULL ); } Py_IncRef( Py_None ); return( Py_None ); }
/* Seeks a certain offset in the file entry data * Returns a Python object holding the offset if successful or NULL on error */ PyObject *pyewf_file_entry_seek_offset( pyewf_file_entry_t *pyewf_file_entry, PyObject *arguments, PyObject *keywords ) { char error_string[ PYEWF_ERROR_STRING_SIZE ]; libcerror_error_t *error = NULL; static char *function = "pyewf_file_entry_seek_offset"; static char *keyword_list[] = { "offset", "whence", NULL }; off64_t offset = 0; int whence = 0; if( pyewf_file_entry == NULL ) { PyErr_Format( PyExc_TypeError, "%s: invalid pyewf file_entry.", function ); return( NULL ); } if( pyewf_file_entry->file_entry == NULL ) { PyErr_Format( PyExc_TypeError, "%s: invalid pyewf file_entry - missing libewf file_entry.", function ); return( NULL ); } if( PyArg_ParseTupleAndKeywords( arguments, keywords, "L|i", keyword_list, &offset, &whence ) == 0 ) { return( NULL ); } Py_BEGIN_ALLOW_THREADS offset = libewf_file_entry_seek_offset( pyewf_file_entry->file_entry, offset, whence, &error ); Py_END_ALLOW_THREADS if( offset == -1 ) { if( libcerror_error_backtrace_sprint( error, error_string, PYEWF_ERROR_STRING_SIZE ) == -1 ) { PyErr_Format( PyExc_IOError, "%s: unable to seek offset.", function ); } else { PyErr_Format( PyExc_IOError, "%s: unable to seek offset.\n%s", function, error_string ); } libcerror_error_free( &error ); return( NULL ); } Py_IncRef( Py_None ); return( Py_None ); }