code: drawterm

Download patch

ref: 602ec6770c59e95c66afca5d36c9c1ff2570c2b9
parent: a984a8b22b348aff075b246f3a9de5a590649ed6
author: Russ Cox <rsc@swtch.com>
date: Sun Jan 28 21:56:33 EST 2007

yet more length fiddling

--- a/gui-osx/screen.c
+++ b/gui-osx/screen.c
@@ -626,10 +626,10 @@
 					fprint(2, "apple pasteboard CopyItem failed - Error %d\n", err);
 					return 0;
 				}
-				CFIndex length = CFDataGetLength(cfdata)/sizeof(Rune);
+				CFIndex length = CFDataGetLength(cfdata);
 				if (length > sizeof rsnarf) length = sizeof rsnarf;
-				CFDataGetBytes(cfdata, CFRangeMake(0, length*sizeof(Rune)), (uint8_t *)rsnarf);
-				snprint(snarf, sizeof snarf, "%.*S", length, rsnarf);
+				CFDataGetBytes(cfdata, CFRangeMake(0, length), (uint8_t *)rsnarf);
+				snprint(snarf, sizeof snarf, "%.*S", length/sizeof(Rune), rsnarf);
 				char *s = snarf;
 				while (*s) {
 					if (*s == '\r') *s = '\n';