mirror of
https://github.com/depp/syncfiles.git
synced 2024-06-06 21:29:32 +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;
|
int lineno = 1, colno = 0;
|
||||||
for (ptr = start; ptr != end; ptr++) {
|
for (ptr = start; ptr != end; ptr++) {
|
||||||
colno++;
|
colno++;
|
||||||
if (*ptr == '\r') {
|
// Note: \r != 0x0d, \n != 0x0a on old Mac compilers.
|
||||||
|
if (*ptr == 0x0a || *ptr == 0x0d) {
|
||||||
lineno++;
|
lineno++;
|
||||||
colno = 0;
|
colno = 0;
|
||||||
}
|
}
|
||||||
|
@ -37,8 +38,9 @@ int mac_from_unix(unsigned char **outptr, unsigned char *outend,
|
||||||
while (ip < inend && op < outend) {
|
while (ip < inend && op < outend) {
|
||||||
c = *ip;
|
c = *ip;
|
||||||
if (c < 128) {
|
if (c < 128) {
|
||||||
if (c == '\n') {
|
// Note: \r != 0x0d, \n != 0x0a on old Mac compilers.
|
||||||
c = '\r';
|
if (c == 0x0a) {
|
||||||
|
c = 0x0d;
|
||||||
}
|
}
|
||||||
if (op == outend) {
|
if (op == outend) {
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user