subversion-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Kueng <tortoise...@gmail.com>
Subject extending the blame callback
Date Sat, 05 Jan 2019 15:58:00 GMT
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

]]]

Mime
View raw message