@@ -73,7 +73,7 @@ public override unsafe int GetByteCount(char[] chars, int index, int count)
73
73
Contract . EndContractBlock ( ) ;
74
74
75
75
// If no input, return 0, avoid fixed empty array problem
76
- if ( chars . Length == 0 )
76
+ if ( count == 0 )
77
77
return 0 ;
78
78
79
79
// Just call the pointer version
@@ -196,7 +196,7 @@ public override unsafe int GetBytes(char[] chars, int charIndex, int charCount,
196
196
Contract . EndContractBlock ( ) ;
197
197
198
198
// If nothing to encode return 0, avoid fixed problem
199
- if ( chars . Length == 0 )
199
+ if ( charCount == 0 )
200
200
return 0 ;
201
201
202
202
// Just call pointer version
@@ -261,7 +261,7 @@ public override unsafe int GetCharCount(byte[] bytes, int index, int count)
261
261
Contract . EndContractBlock ( ) ;
262
262
263
263
// If no input just return 0, fixed doesn't like 0 length arrays
264
- if ( bytes . Length == 0 )
264
+ if ( count == 0 )
265
265
return 0 ;
266
266
267
267
// Just call pointer version
@@ -319,7 +319,7 @@ public override unsafe int GetChars(byte[] bytes, int byteIndex, int byteCount,
319
319
Contract . EndContractBlock ( ) ;
320
320
321
321
// If no input, return 0 & avoid fixed problem
322
- if ( bytes . Length == 0 )
322
+ if ( byteCount == 0 )
323
323
return 0 ;
324
324
325
325
// Just call pointer version
@@ -385,7 +385,7 @@ public override unsafe String GetString(byte[] bytes, int byteIndex, int byteCou
385
385
Contract . EndContractBlock ( ) ;
386
386
387
387
// Avoid problems with empty input buffer
388
- if ( bytes . Length == 0 ) return String . Empty ;
388
+ if ( byteCount == 0 ) return String . Empty ;
389
389
390
390
fixed ( byte * pBytes = bytes )
391
391
return String . CreateStringFromEncoding (
0 commit comments