yet more length fiddling

This commit is contained in:
Russ Cox 2007-01-29 02:56:33 +00:00
parent a984a8b22b
commit 602ec6770c
1 changed files with 3 additions and 3 deletions

View File

@ -626,10 +626,10 @@ clipread(void)
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';