using System;
using System.Collections;
using System.Text;
+using System.Collections.Generic;
#pragma warning disable 3021
namespace Mono {
#if MONO_DATACONVERTER_PUBLIC
- unsafe public abstract class DataConverter {
-#else
- unsafe internal abstract class DataConverter {
+ public
+#endif
+ unsafe abstract class DataConverter {
// Disables the warning: CLS compliance checking will not be performed on
// `XXXX' because it is not visible from outside this assembly
#pragma warning disable 3019
-#endif
- static DataConverter SwapConv = new SwapConverter ();
- static DataConverter CopyConv = new CopyConverter ();
+ static readonly DataConverter SwapConv = new SwapConverter ();
+ static readonly DataConverter CopyConv = new CopyConverter ();
public static readonly bool IsLittleEndian = BitConverter.IsLittleEndian;
n = 2;
break;
case '7':
+#if PCL
+ e = Encoding.GetEncoding ("utf-7");
+#else
e = Encoding.UTF7;
+#endif
n = 1;
break;
case 'b':
n = 2;
break;
case '3':
+#if PCL
+ e = Encoding.GetEncoding ("utf-32");
+#else
e = Encoding.GetEncoding (12000);
+#endif
n = 4;
break;
case '4':
+#if PCL
+ e = Encoding.GetEncoding ("utf-32BE");
+#else
e = Encoding.GetEncoding (12001);
+#endif
n = 4;
break;
static public IList Unpack (string description, byte [] buffer, int startIndex)
{
DataConverter conv = CopyConv;
- ArrayList result = new ArrayList ();
+ var result = new List<object> ();
int idx = startIndex;
bool align = false;
int repeat = 0, n;
case 'f':
if (Prepare (buffer, ref idx, 4, ref align)){
- result.Add (conv.GetDouble (buffer, idx));
+ result.Add (conv.GetFloat (buffer, idx));
idx += 4;
}
break;
if (count == -1)
throw new ArgumentException ("invalid size specification");
i = j;
+ save = i + 1;
repeat = count;
break;
fixed (byte *target = &dest [destIdx]){
byte *source = (byte *) &value;
- for (int i = 0; i < 4; i++)
+ for (int i = 0; i < 8; i++)
target [i] = source [7-i];
}
}