Skip to content

Commit 71c9199

Browse files
committed
Fix bugs for decoding void field.
1 parent dda2e9b commit 71c9199

File tree

119 files changed

+137
-156
lines changed

Some content is hidden

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

119 files changed

+137
-156
lines changed

Dropbox.Api/ApiException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ protected override void SetField(ApiException<TError> value, string fieldName, I
135135
value.ErrorMessage = StringDecoder.Instance.Decode(reader);
136136
break;
137137
default:
138-
SkipProperty(reader);
138+
reader.Skip();
139139
break;
140140
}
141141
}

Dropbox.Api/Async/LaunchResultBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ protected override void SetField(AsyncJobId value, string fieldName, enc.IJsonRe
211211
value.Value = enc.StringDecoder.Instance.Decode(reader);
212212
break;
213213
default:
214-
SkipProperty(reader);
214+
reader.Skip();
215215
break;
216216
}
217217
}

Dropbox.Api/Async/PollArg.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ protected override void SetField(PollArg value, string fieldName, enc.IJsonReade
112112
value.AsyncJobId = enc.StringDecoder.Instance.Decode(reader);
113113
break;
114114
default:
115-
SkipProperty(reader);
115+
reader.Skip();
116116
break;
117117
}
118118
}

Dropbox.Api/Babel/Decoder.cs

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -295,16 +295,6 @@ protected static bool TryReadPropertyName(IJsonReader reader, out string propert
295295
return false;
296296
}
297297

298-
/// <summary>
299-
/// Skip current property.
300-
/// </summary>
301-
/// <param name="reader">The json reader.</param>
302-
protected static void SkipProperty(IJsonReader reader)
303-
{
304-
reader.Skip();
305-
reader.Read();
306-
}
307-
308298
/// <summary>
309299
/// Read list of specific type.
310300
/// </summary>
@@ -407,32 +397,22 @@ public override T DecodeFields(IJsonReader reader)
407397
/// <summary>
408398
/// The decoder for Empty Type.
409399
/// </summary>
410-
internal sealed class EmptyDecoder : StructDecoder<Empty>
400+
internal sealed class EmptyDecoder : IDecoder<Empty>
411401
{
412402
/// <summary>
413403
/// The instance.
414404
/// </summary>
415405
public static readonly IDecoder<Empty> Instance = new EmptyDecoder();
416406

417407
/// <summary>
418-
/// Create a struct instance.
408+
/// Decoder for struct type.
419409
/// </summary>
420-
/// <returns>The struct instance.</returns>
421-
protected override Empty Create()
410+
/// <typeparam name="T">The struct type.</typeparam>
411+
public Empty Decode(IJsonReader reader)
422412
{
413+
reader.Skip();
423414
return Empty.Instance;
424415
}
425-
426-
/// <summary>
427-
/// Set given field.
428-
/// </summary>
429-
/// <param name="value">The field value.</param>
430-
/// <param name="fieldName">The field name.</param>
431-
/// <param name="reader">The json reader.</param>
432-
protected override void SetField(Empty value, string fieldName, IJsonReader reader)
433-
{
434-
SkipProperty(reader);
435-
}
436416
}
437417

438418
/// <summary>

Dropbox.Api/Babel/IJsonReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ internal interface IJsonReader
4545
bool Read();
4646

4747
/// <summary>
48-
/// Skip children of current token.
48+
/// Skip current token.
4949
/// </summary>
5050
void Skip();
5151

Dropbox.Api/Babel/JsonReader.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@ bool IJsonReader.Read()
9696
}
9797

9898
/// <summary>
99-
/// Skip children of current token.
99+
/// Skip current token.
100100
/// </summary>
101101
void IJsonReader.Skip()
102102
{
103103
this.reader.Skip();
104+
this.reader.Read();
104105
}
105106

106107
/// <summary>

Dropbox.Api/Dropbox.Api.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package >
33
<metadata>
44
<id>$id$</id>
5-
<version>2.0.1</version>
5+
<version>2.0.2</version>
66
<title>Dropbox v2 API Beta</title>
77
<authors>Dropbox Inc</authors>
88
<owners>Dropbox Inc</owners>

Dropbox.Api/Files/CommitInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ protected override void SetField(CommitInfo value, string fieldName, enc.IJsonRe
186186
value.Mute = enc.BooleanDecoder.Instance.Decode(reader);
187187
break;
188188
default:
189-
SkipProperty(reader);
189+
reader.Skip();
190190
break;
191191
}
192192
}

Dropbox.Api/Files/CreateFolderArg.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ protected override void SetField(CreateFolderArg value, string fieldName, enc.IJ
112112
value.Path = enc.StringDecoder.Instance.Decode(reader);
113113
break;
114114
default:
115-
SkipProperty(reader);
115+
reader.Skip();
116116
break;
117117
}
118118
}

Dropbox.Api/Files/CreateFolderError.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ protected override void SetField(Path value, string fieldName, enc.IJsonReader r
206206
value.Value = WriteError.Decoder.Decode(reader);
207207
break;
208208
default:
209-
SkipProperty(reader);
209+
reader.Skip();
210210
break;
211211
}
212212
}

0 commit comments

Comments
 (0)