| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -599,21 +599,10 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo | |||
| 599 | 599 | { | |
| 600 | 600 | if (Runtime.PyUnicode_GetSize(value) == 1) | |
| 601 | 601 | { | |
| 602 | - op = Runtime.PyUnicode_AS_UNICODE(value); | ||
| 603 | - if (Runtime.UCS == 2) // Don't trust linter, statement not always true. | ||
| 604 | - { | ||
| 605 | - // 2011-01-02: Marshal as character array because the cast | ||
| 606 | - // result = (char)Marshal.ReadInt16(op); throws an OverflowException | ||
| 607 | - // on negative numbers with Check Overflow option set on the project | ||
| 608 | - Char[] buff = new Char[1]; | ||
| 609 | - Marshal.Copy(op, buff, 0, 1); | ||
| 610 | - result = buff[0]; | ||
| 611 | - } | ||
| 612 | - else // UCS4 | ||
| 613 | - { | ||
| 614 | - // XXX this is probably NOT correct? | ||
| 615 | - result = (char)Marshal.ReadInt32(op); | ||
| 616 | - } | ||
| 602 | + op = Runtime.PyUnicode_AsUnicode(value); | ||
| 603 | + Char[] buff = new Char[1]; | ||
| 604 | + Marshal.Copy(op, buff, 0, 1); | ||
| 605 | + result = buff[0]; | ||
| 617 | 606 | return true; | |
| 618 | 607 | } | |
| 619 | 608 | goto type_error; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1575,12 +1575,6 @@ internal unsafe static extern int | |||
| 1575 | 1575 | internal unsafe static extern IntPtr | |
| 1576 | 1576 | PyUnicode_AsUnicode(IntPtr ob); | |
| 1577 | 1577 | ||
| 1578 | - [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl, | ||
| 1579 | - EntryPoint = "PyUnicode_AsUnicode", | ||
| 1580 | - ExactSpelling = true, CharSet = CharSet.Unicode)] | ||
| 1581 | - internal unsafe static extern IntPtr | ||
| 1582 | - PyUnicode_AS_UNICODE(IntPtr op); | ||
| 1583 | - | ||
| 1584 | 1578 | [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl, | |
| 1585 | 1579 | ExactSpelling = true, CharSet = CharSet.Unicode)] | |
| 1586 | 1580 | internal unsafe static extern IntPtr | |
@@ -1616,12 +1610,6 @@ internal unsafe static extern int | |||
| 1616 | 1610 | internal unsafe static extern IntPtr | |
| 1617 | 1611 | PyUnicode_AsUnicode(IntPtr ob); | |
| 1618 | 1612 | ||
| 1619 | - [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl, | ||
| 1620 | - EntryPoint = "PyUnicodeUCS2_AsUnicode", | ||
| 1621 | - ExactSpelling = true, CharSet = CharSet.Unicode)] | ||
| 1622 | - internal unsafe static extern IntPtr | ||
| 1623 | - PyUnicode_AS_UNICODE(IntPtr op); | ||
| 1624 | - | ||
| 1625 | 1613 | [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl, | |
| 1626 | 1614 | EntryPoint = "PyUnicodeUCS2_FromOrdinal", | |
| 1627 | 1615 | ExactSpelling = true, CharSet = CharSet.Unicode)] | |
@@ -1663,12 +1651,6 @@ internal unsafe static extern int | |||
| 1663 | 1651 | internal unsafe static extern IntPtr | |
| 1664 | 1652 | PyUnicode_AsUnicode(IntPtr ob); | |
| 1665 | 1653 | ||
| 1666 | - [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl, | ||
| 1667 | - EntryPoint = "PyUnicode_AsUnicode", | ||
| 1668 | - ExactSpelling = true, CharSet = CharSet.Unicode)] | ||
| 1669 | - internal unsafe static extern IntPtr | ||
| 1670 | - PyUnicode_AS_UNICODE(IntPtr op); | ||
| 1671 | - | ||
| 1672 | 1654 | [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl, | |
| 1673 | 1655 | ExactSpelling = true, CharSet = CharSet.Unicode)] | |
| 1674 | 1656 | internal unsafe static extern IntPtr | |
@@ -1707,12 +1689,6 @@ internal unsafe static extern int | |||
| 1707 | 1689 | internal unsafe static extern IntPtr | |
| 1708 | 1690 | PyUnicode_AsUnicode(IntPtr ob); | |
| 1709 | 1691 | ||
| 1710 | - [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl, | ||
| 1711 | - EntryPoint = "PyUnicodeUCS4_AsUnicode", | ||
| 1712 | - ExactSpelling = true, CharSet = CharSet.Unicode)] | ||
| 1713 | - internal unsafe static extern IntPtr | ||
| 1714 | - PyUnicode_AS_UNICODE(IntPtr op); | ||
| 1715 | - | ||
| 1716 | 1692 | [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl, | |
| 1717 | 1693 | EntryPoint = "PyUnicodeUCS4_FromOrdinal", | |
| 1718 | 1694 | ExactSpelling = true, CharSet = CharSet.Unicode)] | |
| Back | FazBrowse Home | New Git URL |
0 commit comments