Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
76a73945
Commit
76a73945
authored
Oct 01, 2011
by
csharptest
Committed by
rogerk
Oct 01, 2011
Browse files
Options
Browse Files
Download
Plain Diff
merged fix for SortedList
parents
7f7a7547
8601fc98
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
EnumLite.cs
src/ProtocolBuffers/EnumLite.cs
+2
-2
FieldSet.cs
src/ProtocolBuffers/FieldSet.cs
+18
-2
No files found.
src/ProtocolBuffers/EnumLite.cs
View file @
76a73945
...
@@ -93,11 +93,11 @@ namespace Google.ProtocolBuffers
...
@@ -93,11 +93,11 @@ namespace Google.ProtocolBuffers
}
}
}
}
private
readonly
SortedList
<
int
,
IEnumLite
>
items
;
private
readonly
Dictionary
<
int
,
IEnumLite
>
items
;
public
EnumLiteMap
()
public
EnumLiteMap
()
{
{
items
=
new
SortedList
<
int
,
IEnumLite
>();
items
=
new
Dictionary
<
int
,
IEnumLite
>();
#if SILVERLIGHT2
#if SILVERLIGHT2
// Silverlight doesn't support Enum.GetValues
// Silverlight doesn't support Enum.GetValues
// TODO(jonskeet): Validate that this reflection is permitted, e.g. in Windows Phone 7
// TODO(jonskeet): Validate that this reflection is permitted, e.g. in Windows Phone 7
...
...
src/ProtocolBuffers/FieldSet.cs
View file @
76a73945
...
@@ -87,8 +87,12 @@ namespace Google.ProtocolBuffers
...
@@ -87,8 +87,12 @@ namespace Google.ProtocolBuffers
public
static
FieldSet
CreateInstance
()
public
static
FieldSet
CreateInstance
()
{
{
#if SILVERLIGHT2
return
new
FieldSet
(
new
Dictionary
<
IFieldDescriptorLite
,
object
>());
#else
// Use SortedList to keep fields in the canonical order
// Use SortedList to keep fields in the canonical order
return
new
FieldSet
(
new
SortedList
<
IFieldDescriptorLite
,
object
>());
return
new
FieldSet
(
new
SortedList
<
IFieldDescriptorLite
,
object
>());
#endif
}
}
/// <summary>
/// <summary>
...
@@ -309,7 +313,16 @@ namespace Google.ProtocolBuffers
...
@@ -309,7 +313,16 @@ namespace Google.ProtocolBuffers
/// </summary>
/// </summary>
internal
IEnumerator
<
KeyValuePair
<
IFieldDescriptorLite
,
object
>>
GetEnumerator
()
internal
IEnumerator
<
KeyValuePair
<
IFieldDescriptorLite
,
object
>>
GetEnumerator
()
{
{
#if SILVERLIGHT2
List
<
KeyValuePair
<
IFieldDescriptorLite
,
object
>>
result
=
new
List
<
KeyValuePair
<
IFieldDescriptorLite
,
object
>>(
fields
);
result
.
Sort
(
delegate
(
KeyValuePair
<
IFieldDescriptorLite
,
object
>
a
,
KeyValuePair
<
IFieldDescriptorLite
,
object
>
b
)
{
return
a
.
Key
.
CompareTo
(
b
.
Key
);
}
);
return
result
.
GetEnumerator
();
#else
return
fields
.
GetEnumerator
();
return
fields
.
GetEnumerator
();
#endif
}
}
/// <summary>
/// <summary>
...
@@ -461,9 +474,12 @@ namespace Google.ProtocolBuffers
...
@@ -461,9 +474,12 @@ namespace Google.ProtocolBuffers
/// </summary>
/// </summary>
public
void
WriteTo
(
ICodedOutputStream
output
)
public
void
WriteTo
(
ICodedOutputStream
output
)
{
{
foreach
(
KeyValuePair
<
IFieldDescriptorLite
,
object
>
entry
in
fields
)
using
(
IEnumerator
<
KeyValuePair
<
IFieldDescriptorLite
,
object
>>
e
=
GetEnumerator
()
)
{
{
WriteField
(
entry
.
Key
,
entry
.
Value
,
output
);
while
(
e
.
MoveNext
())
{
WriteField
(
e
.
Current
.
Key
,
e
.
Current
.
Value
,
output
);
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment