openbsd-ports/audio/id3lib/patches/patch-src_io_helpers_cpp
bernd d901191f11 Fix a UTF-16 writing bug. Patch from the id3lib bug tracking system.
Submitted by Dennis Suhonin, thanks.

ok naddy@
2007-05-20 13:02:16 +00:00

20 lines
787 B
Plaintext

$OpenBSD: patch-src_io_helpers_cpp,v 1.1 2007/05/20 13:02:16 bernd Exp $
* Patch from Spoon to fix UTF-16 writing bug
http://sourceforge.net/tracker/index.php?func=detail&aid=1016290&group_id=979&atid=300979
--- src/io_helpers.cpp.orig Sun Mar 2 01:23:00 2003
+++ src/io_helpers.cpp Wed May 16 23:09:58 2007
@@ -363,9 +363,10 @@ size_t io::writeUnicodeText(ID3_Writer& writer, String
// Write the BOM: 0xFEFF
unicode_t BOM = 0xFEFF;
writer.writeChars((const unsigned char*) &BOM, 2);
+ unsigned char *pdata = (unsigned char *) data.c_str();
for (size_t i = 0; i < size; i += 2)
{
- unicode_t ch = (data[i] << 8) | data[i+1];
+ unicode_t ch = (pdata[i] << 8) | pdata[i+1];
writer.writeChars((const unsigned char*) &ch, 2);
}
}