672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
|
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
|
+
+
-
+
|
/*
* Write the file out, doing line translations on the way.
*/
if (contents != NULL) {
DWORD result, length;
const char *p;
int toCopy;
/*
* Convert the contents from UTF to native encoding
*/
native = Tcl_UtfToExternalDString(NULL, contents, -1, &dstring);
toCopy = Tcl_DStringLength(&dstring);
for (p = native; *p != '\0'; p++) {
for (p = native; toCopy > 0; p++, toCopy--) {
if (*p == '\n') {
length = p - native;
if (length > 0) {
if (!WriteFile(handle, native, length, &result, NULL)) {
goto error;
}
}
|