mirror of
https://github.com/depp/syncfiles.git
synced 2025-02-16 17:30:25 +00:00
Fix Unix to Mac line ending conversion
GitOrigin-RevId: fac10ee30d9bcbb6f902c46509d64efb249b6cd4
This commit is contained in:
parent
f591e3ac64
commit
a85d31c36a
@ -12,7 +12,8 @@ static void print_uerr(const unsigned char *start, const unsigned char *end) {
|
||||
int lineno = 1, colno = 0;
|
||||
for (ptr = start; ptr != end; ptr++) {
|
||||
colno++;
|
||||
if (*ptr == '\r') {
|
||||
// Note: \r != 0x0d, \n != 0x0a on old Mac compilers.
|
||||
if (*ptr == 0x0a || *ptr == 0x0d) {
|
||||
lineno++;
|
||||
colno = 0;
|
||||
}
|
||||
@ -37,8 +38,9 @@ int mac_from_unix(unsigned char **outptr, unsigned char *outend,
|
||||
while (ip < inend && op < outend) {
|
||||
c = *ip;
|
||||
if (c < 128) {
|
||||
if (c == '\n') {
|
||||
c = '\r';
|
||||
// Note: \r != 0x0d, \n != 0x0a on old Mac compilers.
|
||||
if (c == 0x0a) {
|
||||
c = 0x0d;
|
||||
}
|
||||
if (op == outend) {
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user