Skip to content

Commit dac84eb

Browse files
committed
Modify Unity compiler directives.
1 parent 20b6d71 commit dac84eb

80 files changed

Lines changed: 1440 additions & 1148 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/MsgPack/BigEndianBinary.cs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@
1818
//
1919
#endregion -- License Terms --
2020

21+
#if UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WII || UNITY_IPHONE || UNITY_ANDROID || UNITY_PS3 || UNITY_XBOX360 || UNITY_FLASH || UNITY_BKACKBERRY || UNITY_WINRT
22+
#define UNITY
23+
#endif
24+
2125
using System;
22-
#if !UNITY_ANDROID && !UNITY_IPHONE
26+
#if !UNITY
2327
using System.Diagnostics.Contracts;
24-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
28+
#endif // !UNITY
2529

2630
namespace MsgPack
2731
{
@@ -32,9 +36,9 @@ internal static class BigEndianBinary
3236
{
3337
public static sbyte ToSByte( byte[] buffer, int offset )
3438
{
35-
#if !UNITY_ANDROID && !UNITY_IPHONE
39+
#if !UNITY
3640
Contract.Assume( buffer.Length >= offset + sizeof( sbyte ) );
37-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
41+
#endif // !UNITY
3842

3943
unchecked
4044
{
@@ -44,9 +48,9 @@ public static sbyte ToSByte( byte[] buffer, int offset )
4448

4549
public static short ToInt16( byte[] buffer, int offset )
4650
{
47-
#if !UNITY_ANDROID && !UNITY_IPHONE
51+
#if !UNITY
4852
Contract.Assume( buffer.Length >= offset + sizeof( short ) );
49-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
53+
#endif // !UNITY
5054

5155
unchecked
5256
{
@@ -56,9 +60,9 @@ public static short ToInt16( byte[] buffer, int offset )
5660

5761
public static int ToInt32( byte[] buffer, int offset )
5862
{
59-
#if !UNITY_ANDROID && !UNITY_IPHONE
63+
#if !UNITY
6064
Contract.Assume( buffer.Length >= offset + sizeof( int ) );
61-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
65+
#endif // !UNITY
6266

6367
unchecked
6468
{
@@ -68,9 +72,9 @@ public static int ToInt32( byte[] buffer, int offset )
6872

6973
public static long ToInt64( byte[] buffer, int offset )
7074
{
71-
#if !UNITY_ANDROID && !UNITY_IPHONE
75+
#if !UNITY
7276
Contract.Assume( buffer.Length >= offset + sizeof( long ) );
73-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
77+
#endif // !UNITY
7478

7579
unchecked
7680
{
@@ -82,18 +86,18 @@ public static long ToInt64( byte[] buffer, int offset )
8286

8387
public static byte ToByte( byte[] buffer, int offset )
8488
{
85-
#if !UNITY_ANDROID && !UNITY_IPHONE
89+
#if !UNITY
8690
Contract.Assume( buffer.Length >= offset + sizeof( byte ) );
87-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
91+
#endif // !UNITY
8892

8993
return buffer[ offset ];
9094
}
9195

9296
public static ushort ToUInt16( byte[] buffer, int offset )
9397
{
94-
#if !UNITY_ANDROID && !UNITY_IPHONE
98+
#if !UNITY
9599
Contract.Assume( buffer.Length >= offset + sizeof( ushort ) );
96-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
100+
#endif // !UNITY
97101

98102
unchecked
99103
{
@@ -103,9 +107,9 @@ public static ushort ToUInt16( byte[] buffer, int offset )
103107

104108
public static uint ToUInt32( byte[] buffer, int offset )
105109
{
106-
#if !UNITY_ANDROID && !UNITY_IPHONE
110+
#if !UNITY
107111
Contract.Assume( buffer.Length >= offset + sizeof( uint ) );
108-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
112+
#endif // !UNITY
109113

110114
unchecked
111115
{
@@ -115,9 +119,9 @@ public static uint ToUInt32( byte[] buffer, int offset )
115119

116120
public static ulong ToUInt64( byte[] buffer, int offset )
117121
{
118-
#if !UNITY_ANDROID && !UNITY_IPHONE
122+
#if !UNITY
119123
Contract.Assume( buffer.Length >= offset + sizeof( ulong ) );
120-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
124+
#endif // !UNITY
121125

122126
unchecked
123127
{

src/MsgPack/CollectionOperation.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@
1818
//
1919
#endregion -- License Terms --
2020

21+
#if UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WII || UNITY_IPHONE || UNITY_ANDROID || UNITY_PS3 || UNITY_XBOX360 || UNITY_FLASH || UNITY_BKACKBERRY || UNITY_WINRT
22+
#define UNITY
23+
#endif
24+
2125
using System;
2226
using System.Collections.Generic;
23-
#if !UNITY_ANDROID && !UNITY_IPHONE
27+
#if !UNITY
2428
using System.Diagnostics.Contracts;
25-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
29+
#endif // !UNITY
2630
using System.Linq;
2731

2832
namespace MsgPack
@@ -44,9 +48,9 @@ public static void CopyTo<T>( IEnumerable<T> source, int sourceCount, int index,
4448
public static void CopyTo<TSource, TDestination>( IEnumerable<TSource> source, int sourceCount, int index, TDestination[] array, int arrayIndex, int count, Func<TSource, TDestination> converter )
4549
{
4650
ValidateCopyToArguments( sourceCount, index, array, arrayIndex, count );
47-
#if !UNITY_ANDROID && !UNITY_IPHONE
51+
#if !UNITY
4852
Contract.Assert( converter != null );
49-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
53+
#endif // !UNITY
5054

5155
int i = 0;
5256
foreach ( var item in source.Skip( index ).Take( count ) )

src/MsgPack/EnumerableStream.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@
1818
//
1919
#endregion -- License Terms --
2020

21+
#if UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WII || UNITY_IPHONE || UNITY_ANDROID || UNITY_PS3 || UNITY_XBOX360 || UNITY_FLASH || UNITY_BKACKBERRY || UNITY_WINRT
22+
#define UNITY
23+
#endif
24+
2125
using System;
2226
using System.Collections.Generic;
23-
#if !UNITY_ANDROID && !UNITY_IPHONE
27+
#if !UNITY
2428
using System.Diagnostics.Contracts;
25-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
29+
#endif // !UNITY
2630
using System.IO;
2731
using System.Linq;
2832

@@ -86,9 +90,9 @@ public override long Position
8690

8791
public EnumerableStream( IEnumerable<byte> source )
8892
{
89-
#if !UNITY_ANDROID && !UNITY_IPHONE
93+
#if !UNITY
9094
Contract.Assert( source != null );
91-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
95+
#endif // !UNITY
9296
this._underlyingList = source as IList<byte>;
9397
this._underlyingEnumerator = this._underlyingList == null ? source.GetEnumerator() : null;
9498
}

src/MsgPack/Float32Bits.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@
1818
//
1919
#endregion -- License Terms --
2020

21+
#if UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WII || UNITY_IPHONE || UNITY_ANDROID || UNITY_PS3 || UNITY_XBOX360 || UNITY_FLASH || UNITY_BKACKBERRY || UNITY_WINRT
22+
#define UNITY
23+
#endif
24+
2125
using System;
22-
#if !UNITY_ANDROID && !UNITY_IPHONE
26+
#if !UNITY
2327
using System.Diagnostics.Contracts;
24-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
28+
#endif // !UNITY
2529
using System.Runtime.InteropServices;
2630

2731
namespace MsgPack
@@ -81,10 +85,10 @@ public Float32Bits( float value )
8185
/// <param name="offset">Offset to read.</param>
8286
public Float32Bits( byte[] bigEndianBytes, int offset )
8387
{
84-
#if !UNITY_ANDROID && !UNITY_IPHONE
88+
#if !UNITY
8589
Contract.Assume( bigEndianBytes != null );
8690
Contract.Assume( bigEndianBytes.Length - offset >= 4, bigEndianBytes.Length + "-" + offset + ">= 4" );
87-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
91+
#endif // !UNITY
8892

8993
this = default( Float32Bits );
9094

src/MsgPack/Float64Bits.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@
1818
//
1919
#endregion -- License Terms --
2020

21+
#if UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WII || UNITY_IPHONE || UNITY_ANDROID || UNITY_PS3 || UNITY_XBOX360 || UNITY_FLASH || UNITY_BKACKBERRY || UNITY_WINRT
22+
#define UNITY
23+
#endif
24+
2125
using System;
22-
#if !UNITY_ANDROID && !UNITY_IPHONE
26+
#if !UNITY
2327
using System.Diagnostics.Contracts;
24-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
28+
#endif // !UNITY
2529
using System.Runtime.InteropServices;
2630

2731
namespace MsgPack
@@ -105,10 +109,10 @@ public Float64Bits( double value )
105109
/// <param name="offset">Offset to read.</param>
106110
public Float64Bits( byte[] bigEndianBytes, int offset )
107111
{
108-
#if !UNITY_ANDROID && !UNITY_IPHONE
112+
#if !UNITY
109113
Contract.Assume( bigEndianBytes != null );
110114
Contract.Assume( bigEndianBytes.Length - offset >= 8, bigEndianBytes.Length + "-" + offset + ">= 4" );
111-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
115+
#endif // !UNITY
112116

113117
this = default( Float64Bits );
114118

src/MsgPack/ItemsUnpacker.Skipping.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@
1919
//
2020
#endregion -- License Terms --
2121

22+
#if UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WII || UNITY_IPHONE || UNITY_ANDROID || UNITY_PS3 || UNITY_XBOX360 || UNITY_FLASH || UNITY_BKACKBERRY || UNITY_WINRT
23+
#define UNITY
24+
#endif
25+
2226
using System;
2327
using System.Collections.Generic;
24-
#if !UNITY_ANDROID && !UNITY_IPHONE
28+
#if !UNITY
2529
using System.Diagnostics.Contracts;
26-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
30+
#endif // !UNITY
2731
using System.Globalization;
2832

2933
namespace MsgPack
@@ -39,10 +43,10 @@ partial class ItemsUnpacker
3943
{
4044
var source = this._stream;
4145
var buffer = this._scalarBuffer;
42-
#if !UNITY_ANDROID && !UNITY_IPHONE
46+
#if !UNITY
4347
Contract.Assert( source != null );
4448
Contract.Assert( buffer != null );
45-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
49+
#endif // !UNITY
4650

4751
long remainingItems = -1;
4852
long skipped = 0;

src/MsgPack/ItemsUnpacker.Skipping.tt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@
2929
//
3030
#endregion -- License Terms --
3131

32+
#if UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WII || UNITY_IPHONE || UNITY_ANDROID || UNITY_PS3 || UNITY_XBOX360 || UNITY_FLASH || UNITY_BKACKBERRY || UNITY_WINRT
33+
#define UNITY
34+
#endif
35+
3236
using System;
3337
using System.Collections.Generic;
34-
#if !UNITY_ANDROID && !UNITY_IPHONE
38+
#if !UNITY
3539
using System.Diagnostics.Contracts;
36-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
40+
#endif // !UNITY
3741
using System.Globalization;
3842

3943
namespace MsgPack
@@ -49,10 +53,10 @@ namespace MsgPack
4953
{
5054
var source = this._stream;
5155
var buffer = this._scalarBuffer;
52-
#if !UNITY_ANDROID && !UNITY_IPHONE
56+
#if !UNITY
5357
Contract.Assert( source != null );
5458
Contract.Assert( buffer != null );
55-
#endif // !UNITY_ANDROID && !UNITY_IPHONE
59+
#endif // !UNITY
5660

5761
long remainingItems = -1;
5862
long skipped = 0;

0 commit comments

Comments
 (0)