[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

extending the blame callback

From: Stefan Kueng <tortoisesvn_at_gmail.com>
Date: Sat, 5 Jan 2019 16:58:00 +0100

Hi,

When running blame on an utf16 text file, the lines can not be used
since the blame callback only passes a 'char *' parameter which means it
ends at the first zero char. But actually, svn knows if the line has
more content.
So I'd like to propose the following patch which extends the blame
callback with a 'bytelength' parameter indicating how many bytes the
line consists of. That way, clients can themselves determine whether to
show the full line (e.g. using hex display) or maybe try to convert the
line string from different encodings.
Without the length parameter, clients can not exceed beyond the first
null char to determine what the line really consists of without risking
an access violation.

I've already tested this with TSVN and now I can properly blame utf16
files. While it's not straight forward to figure out how to get the real
uft16 line, it's possible. One problem is that every line except the
first has a zero char at the beginning (the leftover zero char after the
detected LF from the previous line), but I can work around that.

So, with this patch I'm able to do a blame on utf16 files, so I'd like
to commit this if there are no objections.

[[[
Extend the blame callback with a string length parameter.

* subversion/incluce/svn_client.h
* subversion/libsvn_client/blame.c
   (svn_client_blame_receiver4_t): typedef for new callback
   (svn_client_blame6): new API using the svn_client_blame_receiver4_t
callback
* subversion/libsvn_client/deprecated.c
   (svn_client_blame5): moved API there, calling svn_client_blame6 using a
                        callback shim
   (blame_wrapper_receiver3): callback shim for svn_client_blame5

]]]

Received on 2019-01-05 17:04:16 CET

This is an archived mail posted to the Subversion Dev mailing list.