wok-next annotate id3lib/stuff/patches/30-fix-utf16.patch @ rev 21709
updated gsettings-desktop-schemas (3.28.1 -> 3.36.1)
author | Hans-G?nter Theisgen |
---|---|
date | Mon Jul 06 15:58:43 2020 +0100 (2020-07-06) |
parents | |
children |
rev | line source |
---|---|
al@20357 | 1 Patch from 'Spoon' to fix issues with writing certain unicode characters |
al@20357 | 2 --- a/ChangeLog |
al@20357 | 3 +++ b/ChangeLog |
al@20357 | 4 @@ -1,3 +1,8 @@ |
al@20357 | 5 +2006-02-17 Jerome Couderc |
al@20357 | 6 + |
al@20357 | 7 + * Patch from Spoon to fix UTF-16 writing bug |
al@20357 | 8 + http://sourceforge.net/tracker/index.php?func=detail&aid=1016290&group_id=979&atid=300979 |
al@20357 | 9 + |
al@20357 | 10 2003-03-02 Sunday 17:38 Thijmen Klok <thijmen@id3lib.org> |
al@20357 | 11 |
al@20357 | 12 * THANKS (1.20): added more people |
al@20357 | 13 --- a/src/io_helpers.cpp |
al@20357 | 14 +++ b/src/io_helpers.cpp |
al@20357 | 15 @@ -363,11 +363,22 @@ |
al@20357 | 16 // Write the BOM: 0xFEFF |
al@20357 | 17 unicode_t BOM = 0xFEFF; |
al@20357 | 18 writer.writeChars((const unsigned char*) &BOM, 2); |
al@20357 | 19 + // Patch from Spoon : 2004-08-25 14:17 |
al@20357 | 20 + // http://sourceforge.net/tracker/index.php?func=detail&aid=1016290&group_id=979&atid=300979 |
al@20357 | 21 + // Wrong code |
al@20357 | 22 + //for (size_t i = 0; i < size; i += 2) |
al@20357 | 23 + //{ |
al@20357 | 24 + // unicode_t ch = (data[i] << 8) | data[i+1]; |
al@20357 | 25 + // writer.writeChars((const unsigned char*) &ch, 2); |
al@20357 | 26 + //} |
al@20357 | 27 + // Right code |
al@20357 | 28 + unsigned char *pdata = (unsigned char *) data.c_str(); |
al@20357 | 29 for (size_t i = 0; i < size; i += 2) |
al@20357 | 30 { |
al@20357 | 31 - unicode_t ch = (data[i] << 8) | data[i+1]; |
al@20357 | 32 + unicode_t ch = (pdata[i] << 8) | pdata[i+1]; |
al@20357 | 33 writer.writeChars((const unsigned char*) &ch, 2); |
al@20357 | 34 } |
al@20357 | 35 + // End patch |
al@20357 | 36 } |
al@20357 | 37 return writer.getCur() - beg; |
al@20357 | 38 } |