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
ef7091c9
Commit
ef7091c9
authored
May 07, 2013
by
csharptest
Committed by
rogerk
May 07, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #54: should retire all bytes in buffer (bufferSize)
parent
30f73e2e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
1 deletion
+44
-1
.hgignore
.hgignore
+1
-0
unittest_extras_lite.proto
protos/extest/unittest_extras_lite.proto
+10
-0
CodedInputStream.cs
src/ProtocolBuffers/CodedInputStream.cs
+5
-1
AbstractBuilderLiteTest.cs
src/ProtocolBuffersLite.Test/AbstractBuilderLiteTest.cs
+28
-0
UnitTestExtrasLiteProtoFile.cs
...uffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs
+0
-0
No files found.
.hgignore
View file @
ef7091c9
...
...
@@ -10,6 +10,7 @@ _ReSharper.*
*.suo
*.bat
*.zip
*.DotSettings
build/*.log
BenchmarkResults.txt
...
...
protos/extest/unittest_extras_lite.proto
View file @
ef7091c9
...
...
@@ -106,3 +106,12 @@ enum UnpackedTypesForeignEnumLite {
FOREIGN_LITE_BAR
=
5
;
FOREIGN_LITE_BAZ
=
6
;
}
message
BucketOfBytes
{
optional
bytes
value
=
1
;
}
message
BucketOfBytesEx
{
optional
bytes
value
=
1
;
optional
bytes
value2
=
255
;
}
\ No newline at end of file
src/ProtocolBuffers/CodedInputStream.cs
View file @
ef7091c9
...
...
@@ -1780,7 +1780,11 @@ namespace Google.ProtocolBuffers
{
// Skipping more bytes than are in the buffer. First skip what we have.
int
pos
=
bufferSize
-
bufferPos
;
totalBytesRetired
+=
pos
;
// ROK 5/7/2013 Issue #54: should retire all bytes in buffer (bufferSize)
// totalBytesRetired += pos;
totalBytesRetired
+=
bufferSize
;
bufferPos
=
0
;
bufferSize
=
0
;
...
...
src/ProtocolBuffersLite.Test/AbstractBuilderLiteTest.cs
View file @
ef7091c9
...
...
@@ -305,5 +305,32 @@ namespace Google.ProtocolBuffers
copy
=
msg
.
DefaultInstanceForType
.
ToBuilder
().
MergeFrom
(
msg
).
Build
();
TestUtil
.
AssertBytesEqual
(
msg
.
ToByteArray
(),
copy
.
ToByteArray
());
}
// ROK 5/7/2013 Issue #54: should retire all bytes in buffer (bufferSize)
[
TestMethod
]
public
void
TestBufferRefillIssue
()
{
var
ms
=
new
MemoryStream
();
BucketOfBytes
.
CreateBuilder
()
.
SetValue
(
ByteString
.
CopyFrom
(
new
byte
[
3000
]))
.
Build
().
WriteDelimitedTo
(
ms
);
BucketOfBytesEx
.
CreateBuilder
()
.
SetValue
(
ByteString
.
CopyFrom
(
new
byte
[
1000
]))
.
SetValue2
(
ByteString
.
CopyFrom
(
new
byte
[
1100
]))
.
Build
().
WriteDelimitedTo
(
ms
);
BucketOfBytes
.
CreateBuilder
()
.
SetValue
(
ByteString
.
CopyFrom
(
new
byte
[
100
]))
.
Build
().
WriteDelimitedTo
(
ms
);
ms
.
Position
=
0
;
var
input
=
CodedInputStream
.
CreateInstance
(
ms
);
var
builder
=
BucketOfBytes
.
CreateBuilder
();
input
.
ReadMessage
(
builder
,
ExtensionRegistry
.
Empty
);
Assert
.
AreEqual
(
3000
,
builder
.
Value
.
Length
);
input
.
ReadMessage
(
builder
,
ExtensionRegistry
.
Empty
);
Assert
.
AreEqual
(
1000
,
builder
.
Value
.
Length
);
input
.
ReadMessage
(
builder
,
ExtensionRegistry
.
Empty
);
Assert
.
AreEqual
(
100
,
builder
.
Value
.
Length
);
}
}
}
\ No newline at end of file
src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs
View file @
ef7091c9
This diff is collapsed.
Click to expand it.
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