76b76a6048
Instead of converting the patch bytes to strings apply the patch on byte level, like C git does. Converting the input lines and the hunk lines from bytes to strings and then applying the patch based on strings may give surprising results if a patch converts a text file from one encoding to another. Moreover, in the end we don't know which encoding to use to write the result. Previous code just wrote the result as UTF-8, which forcibly changed the encoding if the original input had some other encoding (even if the patch had the same non-UTF-8 encoding). It was also wrong if the input was UTF-8, and the patch should have changed the encoding to something else. So use ByteBuffers instead of Strings. This has the additional advantage that all these ByteBuffers can share the underlying byte arrays of the input and of the patch, so it also reduces memory consumption. Change-Id: I450975f2ba0e7d0bec8973e3113cc2e7aea187ee Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch> |
||
---|---|---|
.. | ||
edu.umd.cs.findbugs.core.prefs | ||
org.eclipse.core.resources.prefs | ||
org.eclipse.core.runtime.prefs | ||
org.eclipse.jdt.core.prefs | ||
org.eclipse.jdt.ui.prefs | ||
org.eclipse.mylyn.tasks.ui.prefs | ||
org.eclipse.mylyn.team.ui.prefs | ||
org.eclipse.pde.api.tools.prefs | ||
org.eclipse.pde.core.prefs | ||
org.eclipse.pde.prefs |