Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
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
capnproto
Commits
eeae230c
Commit
eeae230c
authored
May 23, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Review and classify TODOs.
parent
d7f3123c
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
36 additions
and
47 deletions
+36
-47
arena.c++
c++/src/capnproto/arena.c++
+11
-11
arena.h
c++/src/capnproto/arena.h
+4
-4
capnproto-carsales.c++
c++/src/capnproto/benchmark/capnproto-carsales.c++
+0
-1
capnproto-eval.c++
c++/src/capnproto/benchmark/capnproto-eval.c++
+0
-1
common.h
c++/src/capnproto/benchmark/common.h
+1
-1
capnpc-capnp.c++
c++/src/capnproto/compiler/capnpc-capnp.c++
+0
-1
io.c++
c++/src/capnproto/io.c++
+1
-1
io.h
c++/src/capnproto/io.h
+0
-4
layout-test.c++
c++/src/capnproto/layout-test.c++
+0
-1
layout.c++
c++/src/capnproto/layout.c++
+1
-1
layout.h
c++/src/capnproto/layout.h
+3
-3
logging.c++
c++/src/capnproto/logging.c++
+2
-2
message-test.c++
c++/src/capnproto/message-test.c++
+1
-1
schema.capnp
c++/src/capnproto/schema.capnp
+0
-4
serialize-packed-test.c++
c++/src/capnproto/serialize-packed-test.c++
+1
-1
serialize-packed.c++
c++/src/capnproto/serialize-packed.c++
+1
-1
serialize-snappy-test.c++
c++/src/capnproto/serialize-snappy-test.c++
+1
-1
serialize-snappy.c++
c++/src/capnproto/serialize-snappy.c++
+1
-1
serialize-test.c++
c++/src/capnproto/serialize-test.c++
+1
-1
serialize.c++
c++/src/capnproto/serialize.c++
+3
-2
type-safety.h
c++/src/capnproto/type-safety.h
+3
-3
util.h
c++/src/capnproto/util.h
+1
-1
No files found.
c++/src/capnproto/arena.c++
View file @
eeae230c
...
@@ -62,9 +62,9 @@ SegmentReader* ReaderArena::tryGetSegment(SegmentId id) {
...
@@ -62,9 +62,9 @@ SegmentReader* ReaderArena::tryGetSegment(SegmentId id) {
}
}
}
}
// TODO
: Lock a mutex so that reading is thread-safe. Take a reader lock during the first
// TODO
(someday): Lock a mutex so that reading is thread-safe. Take a reader lock during the
//
lookup, unlock it before calling getSegment(), then take a writer lock to update the map.
//
first lookup, unlock it before calling getSegment(), then take a writer lock to update the
// Bleh, lazy initialization is sad.
//
map.
Bleh, lazy initialization is sad.
if
(
moreSegments
!=
nullptr
)
{
if
(
moreSegments
!=
nullptr
)
{
auto
iter
=
moreSegments
->
find
(
id
.
value
);
auto
iter
=
moreSegments
->
find
(
id
.
value
);
...
@@ -108,8 +108,8 @@ SegmentBuilder* BuilderArena::getSegment(SegmentId id) {
...
@@ -108,8 +108,8 @@ SegmentBuilder* BuilderArena::getSegment(SegmentId id) {
}
}
SegmentBuilder
*
BuilderArena
::
getSegmentWithAvailable
(
WordCount
minimumAvailable
)
{
SegmentBuilder
*
BuilderArena
::
getSegmentWithAvailable
(
WordCount
minimumAvailable
)
{
// TODO
: Mutex-locking? Do we want to allow people to build different parts of the same messag
e
// TODO
(someday): Mutex-locking? Do we want to allow people to build different parts of th
e
// in different threads?
//
same message
in different threads?
if
(
segment0
.
getArena
()
==
nullptr
)
{
if
(
segment0
.
getArena
()
==
nullptr
)
{
// We're allocating the first segment.
// We're allocating the first segment.
...
@@ -127,12 +127,12 @@ SegmentBuilder* BuilderArena::getSegmentWithAvailable(WordCount minimumAvailable
...
@@ -127,12 +127,12 @@ SegmentBuilder* BuilderArena::getSegmentWithAvailable(WordCount minimumAvailable
if
(
moreSegments
==
nullptr
)
{
if
(
moreSegments
==
nullptr
)
{
moreSegments
=
std
::
unique_ptr
<
MultiSegmentState
>
(
new
MultiSegmentState
());
moreSegments
=
std
::
unique_ptr
<
MultiSegmentState
>
(
new
MultiSegmentState
());
}
else
{
}
else
{
// TODO
: Check for available space in more than just the last segment. We don't want this
// TODO
(perf): Check for available space in more than just the last segment. We don't
//
to be O(n), though, so we'll need to maintain some sort of table. Complicating matters,
//
want this to be O(n), though, so we'll need to maintain some sort of table. Complicating
//
we want SegmentBuilders::allocate() to be fast, so we can't update any such table when
//
matters, we want SegmentBuilders::allocate() to be fast, so we can't update any such
//
allocation actually happens. Instead, we could have a priority queue based on the
//
table when allocation actually happens. Instead, we could have a priority queue based
//
last-known available size, and then re-check the size when we pop segments off it and
//
on the last-known available size, and then re-check the size when we pop segments off it
// shove them to the back of the queue if they have become too small.
//
and
shove them to the back of the queue if they have become too small.
if
(
moreSegments
->
builders
.
back
()
->
available
()
>=
minimumAvailable
)
{
if
(
moreSegments
->
builders
.
back
()
->
available
()
>=
minimumAvailable
)
{
return
moreSegments
->
builders
.
back
().
get
();
return
moreSegments
->
builders
.
back
().
get
();
}
}
...
...
c++/src/capnproto/arena.h
View file @
eeae230c
...
@@ -145,7 +145,7 @@ public:
...
@@ -145,7 +145,7 @@ public:
// the VALIDATE_INPUT() macro which may throw an exception; if it return normally, the caller
// the VALIDATE_INPUT() macro which may throw an exception; if it return normally, the caller
// will need to continue with default values.
// will need to continue with default values.
// TODO: Methods to deal with bundled capabilities.
// TODO
(someday)
: Methods to deal with bundled capabilities.
};
};
class
ReaderArena
final
:
public
Arena
{
class
ReaderArena
final
:
public
Arena
{
...
@@ -187,7 +187,7 @@ public:
...
@@ -187,7 +187,7 @@ public:
// portion of each segment, whereas tryGetSegment() returns something that includes
// portion of each segment, whereas tryGetSegment() returns something that includes
// not-yet-allocated space.
// not-yet-allocated space.
// TODO: Methods to deal with bundled capabilities.
// TODO
(someday)
: Methods to deal with bundled capabilities.
// implements Arena ------------------------------------------------
// implements Arena ------------------------------------------------
SegmentReader
*
tryGetSegment
(
SegmentId
id
)
override
;
SegmentReader
*
tryGetSegment
(
SegmentId
id
)
override
;
...
@@ -262,8 +262,8 @@ inline word* SegmentBuilder::allocate(WordCount amount) {
...
@@ -262,8 +262,8 @@ inline word* SegmentBuilder::allocate(WordCount amount) {
if
(
amount
>
intervalLength
(
pos
,
ptr
.
end
()))
{
if
(
amount
>
intervalLength
(
pos
,
ptr
.
end
()))
{
return
nullptr
;
return
nullptr
;
}
else
{
}
else
{
// TODO
: Atomic increment, backtracking if we go over, would make this thread-safe. How much
// TODO
(someday): Atomic increment, backtracking if we go over, would make this thread-safe.
// would it cost in the single-threaded case? Is it free? Benchmark it.
//
How much
would it cost in the single-threaded case? Is it free? Benchmark it.
word
*
result
=
pos
;
word
*
result
=
pos
;
pos
+=
amount
;
pos
+=
amount
;
return
result
;
return
result
;
...
...
c++/src/capnproto/benchmark/capnproto-carsales.c++
View file @
eeae230c
...
@@ -73,7 +73,6 @@ void randomCar(Car::Builder car) {
...
@@ -73,7 +73,6 @@ void randomCar(Car::Builder car) {
car
.
setMake
(
MAKES
[
fastRand
(
sizeof
(
MAKES
)
/
sizeof
(
MAKES
[
0
]))]);
car
.
setMake
(
MAKES
[
fastRand
(
sizeof
(
MAKES
)
/
sizeof
(
MAKES
[
0
]))]);
car
.
setModel
(
MODELS
[
fastRand
(
sizeof
(
MODELS
)
/
sizeof
(
MODELS
[
0
]))]);
car
.
setModel
(
MODELS
[
fastRand
(
sizeof
(
MODELS
)
/
sizeof
(
MODELS
[
0
]))]);
// TODO: Color_RANGE or something.
car
.
setColor
((
Color
)
fastRand
((
uint
)
Color
::
SILVER
+
1
));
car
.
setColor
((
Color
)
fastRand
((
uint
)
Color
::
SILVER
+
1
));
car
.
setSeats
(
2
+
fastRand
(
6
));
car
.
setSeats
(
2
+
fastRand
(
6
));
car
.
setDoors
(
2
+
fastRand
(
3
));
car
.
setDoors
(
2
+
fastRand
(
3
));
...
...
c++/src/capnproto/benchmark/capnproto-eval.c++
View file @
eeae230c
...
@@ -29,7 +29,6 @@ namespace benchmark {
...
@@ -29,7 +29,6 @@ namespace benchmark {
namespace
capnp
{
namespace
capnp
{
int32_t
makeExpression
(
Expression
::
Builder
exp
,
uint
depth
)
{
int32_t
makeExpression
(
Expression
::
Builder
exp
,
uint
depth
)
{
// TODO: Operation_RANGE or something.
exp
.
setOp
((
Operation
)(
fastRand
((
int
)
Operation
::
MODULUS
+
1
)));
exp
.
setOp
((
Operation
)(
fastRand
((
int
)
Operation
::
MODULUS
+
1
)));
uint32_t
left
,
right
;
uint32_t
left
,
right
;
...
...
c++/src/capnproto/benchmark/common.h
View file @
eeae230c
...
@@ -127,13 +127,13 @@ private:
...
@@ -127,13 +127,13 @@ private:
sem_t
semaphore
;
sem_t
semaphore
;
};
};
// TODO(cleanup): Use SYSCALL(), get rid of this exception class.
class
OsException
:
public
std
::
exception
{
class
OsException
:
public
std
::
exception
{
public
:
public
:
OsException
(
int
error
)
:
error
(
error
)
{}
OsException
(
int
error
)
:
error
(
error
)
{}
~
OsException
()
noexcept
{}
~
OsException
()
noexcept
{}
const
char
*
what
()
const
noexcept
override
{
const
char
*
what
()
const
noexcept
override
{
// TODO: Use strerror_r or whatever for thread-safety. Ugh.
return
strerror
(
error
);
return
strerror
(
error
);
}
}
...
...
c++/src/capnproto/compiler/capnpc-capnp.c++
View file @
eeae230c
...
@@ -406,7 +406,6 @@ TextBlob genAnnotation(schema::Annotation::Reader annotation,
...
@@ -406,7 +406,6 @@ TextBlob genAnnotation(schema::Annotation::Reader annotation,
PRECOND
(
body
.
which
()
==
schema
::
Node
::
Body
::
ANNOTATION_NODE
);
PRECOND
(
body
.
which
()
==
schema
::
Node
::
Body
::
ANNOTATION_NODE
);
auto
annDecl
=
body
.
getAnnotationNode
();
auto
annDecl
=
body
.
getAnnotationNode
();
// TODO: Don't use displayName.
return
text
(
prefix
,
"$"
,
nodeName
(
decl
,
scope
),
"("
,
return
text
(
prefix
,
"$"
,
nodeName
(
decl
,
scope
),
"("
,
genValue
(
annDecl
.
getType
(),
annotation
.
getValue
(),
scope
),
")"
,
suffix
);
genValue
(
annDecl
.
getType
(),
annotation
.
getValue
(),
scope
),
")"
,
suffix
);
}
}
...
...
c++/src/capnproto/io.c++
View file @
eeae230c
...
@@ -129,7 +129,7 @@ BufferedOutputStreamWrapper::~BufferedOutputStreamWrapper() {
...
@@ -129,7 +129,7 @@ BufferedOutputStreamWrapper::~BufferedOutputStreamWrapper() {
try
{
try
{
inner
.
write
(
buffer
.
begin
(),
bufferPos
-
buffer
.
begin
());
inner
.
write
(
buffer
.
begin
(),
bufferPos
-
buffer
.
begin
());
}
catch
(...)
{
}
catch
(...)
{
// TODO: Report secondary faults.
// TODO
(someday)
: Report secondary faults.
}
}
}
else
{
}
else
{
flush
();
flush
();
...
...
c++/src/capnproto/io.h
View file @
eeae230c
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
#include <cstddef>
#include <cstddef>
#include "macros.h"
#include "macros.h"
#include "type-safety.h"
#include "type-safety.h"
#include <utility> // for std::forward; TODO: pulls in too much stuff just for std::forward.
namespace
capnproto
{
namespace
capnproto
{
...
@@ -220,9 +219,6 @@ class AutoCloseFd {
...
@@ -220,9 +219,6 @@ class AutoCloseFd {
//
//
// If your code is not exception-safe, you should not use AutoCloseFd. In this case you will
// If your code is not exception-safe, you should not use AutoCloseFd. In this case you will
// have to call close() yourself and handle errors appropriately.
// have to call close() yourself and handle errors appropriately.
//
// TODO: Create a general helper library for reporting/detecting secondary exceptions that
// occurred during unwind of some primary exception.
public
:
public
:
inline
AutoCloseFd
()
:
fd
(
-
1
)
{}
inline
AutoCloseFd
()
:
fd
(
-
1
)
{}
...
...
c++/src/capnproto/layout-test.c++
View file @
eeae230c
...
@@ -256,7 +256,6 @@ static void checkStruct(StructReader reader) {
...
@@ -256,7 +256,6 @@ static void checkStruct(StructReader reader) {
}
}
{
{
// TODO: Use valid default value.
ListReader
list
=
reader
.
getListField
(
3
*
POINTERS
,
FieldSize
::
POINTER
,
nullptr
);
ListReader
list
=
reader
.
getListField
(
3
*
POINTERS
,
FieldSize
::
POINTER
,
nullptr
);
ASSERT_EQ
(
5
*
ELEMENTS
,
list
.
size
());
ASSERT_EQ
(
5
*
ELEMENTS
,
list
.
size
());
for
(
uint
i
=
0
;
i
<
5
;
i
++
)
{
for
(
uint
i
=
0
;
i
<
5
;
i
++
)
{
...
...
c++/src/capnproto/layout.c++
View file @
eeae230c
...
@@ -178,7 +178,7 @@ struct WirePointer {
...
@@ -178,7 +178,7 @@ struct WirePointer {
CAPNPROTO_ALWAYS_INLINE
(
bool
isNull
()
const
)
{
CAPNPROTO_ALWAYS_INLINE
(
bool
isNull
()
const
)
{
// If the upper 32 bits are zero, this is a pointer to an empty struct. We consider that to be
// If the upper 32 bits are zero, this is a pointer to an empty struct. We consider that to be
// our "null" value.
// our "null" value.
// TODO: Maybe this would be faster, but violates aliasing rules; does it matter?:
// TODO
(perf)
: Maybe this would be faster, but violates aliasing rules; does it matter?:
// return *reinterpret_cast<const uint64_t*>(this) == 0;
// return *reinterpret_cast<const uint64_t*>(this) == 0;
return
(
offsetAndKind
.
get
()
==
0
)
&
(
upper32Bits
==
0
);
return
(
offsetAndKind
.
get
()
==
0
)
&
(
upper32Bits
==
0
);
}
}
...
...
c++/src/capnproto/layout.h
View file @
eeae230c
...
@@ -52,7 +52,7 @@ class SegmentBuilder;
...
@@ -52,7 +52,7 @@ class SegmentBuilder;
// =============================================================================
// =============================================================================
enum
class
FieldSize
:
uint8_t
{
enum
class
FieldSize
:
uint8_t
{
// TODO: Rename to FieldLayout or maybe ValueLayout.
// TODO
(cleanup)
: Rename to FieldLayout or maybe ValueLayout.
// Notice that each member of this enum, when representing a list element size, represents a
// Notice that each member of this enum, when representing a list element size, represents a
// size that is greater than or equal to the previous members, since INLINE_COMPOSITE is used
// size that is greater than or equal to the previous members, since INLINE_COMPOSITE is used
...
@@ -271,7 +271,7 @@ class WireValue {
...
@@ -271,7 +271,7 @@ class WireValue {
// Wraps a primitive value as it appears on the wire. Namely, values are little-endian on the
// Wraps a primitive value as it appears on the wire. Namely, values are little-endian on the
// wire, because little-endian is the most common endianness in modern CPUs.
// wire, because little-endian is the most common endianness in modern CPUs.
//
//
// TODO: On big-endian systems, inject byte-swapping here. Most big-endian CPUs implement
// TODO
(soon)
: On big-endian systems, inject byte-swapping here. Most big-endian CPUs implement
// dedicated instructions for this, so use those rather than writing a bunch of shifts and
// dedicated instructions for this, so use those rather than writing a bunch of shifts and
// masks. Note that GCC has e.g. __builtin__bswap32() for this.
// masks. Note that GCC has e.g. __builtin__bswap32() for this.
//
//
...
@@ -495,7 +495,7 @@ private:
...
@@ -495,7 +495,7 @@ private:
int
nestingLimit
;
int
nestingLimit
;
// Limits the depth of message structures to guard against stack-overflow-based DoS attacks.
// Limits the depth of message structures to guard against stack-overflow-based DoS attacks.
// Once this reaches zero, further pointers will be pruned.
// Once this reaches zero, further pointers will be pruned.
// TODO: Limit to 8 bits for better alignment?
// TODO
(perf)
: Limit to 8 bits for better alignment?
inline
StructReader
(
SegmentReader
*
segment
,
const
void
*
data
,
const
WirePointer
*
pointers
,
inline
StructReader
(
SegmentReader
*
segment
,
const
void
*
data
,
const
WirePointer
*
pointers
,
BitCount
dataSize
,
WirePointerCount
pointerCount
,
BitCount8
bit0Offset
,
BitCount
dataSize
,
WirePointerCount
pointerCount
,
BitCount8
bit0Offset
,
...
...
c++/src/capnproto/logging.c++
View file @
eeae230c
...
@@ -130,8 +130,8 @@ static Array<char> makeDescription(DescriptionStyle style, const char* code, int
...
@@ -130,8 +130,8 @@ static Array<char> makeDescription(DescriptionStyle style, const char* code, int
sysErrorArray
=
arrayPtr
(
strerror_r
(
errorNumber
,
buffer
,
sizeof
(
buffer
)));
sysErrorArray
=
arrayPtr
(
strerror_r
(
errorNumber
,
buffer
,
sizeof
(
buffer
)));
}
}
#else
#else
// TODO
: Other unixes should have strerror_r but it may have a different signature. Port for
// TODO
(port): Other unixes should have strerror_r but it may have a different signature.
// thread-safety.
//
Port for
thread-safety.
sysErrorArray
=
arrayPtr
(
strerror
(
errorNumber
));
sysErrorArray
=
arrayPtr
(
strerror
(
errorNumber
));
#endif
#endif
...
...
c++/src/capnproto/message-test.c++
View file @
eeae230c
...
@@ -46,7 +46,7 @@ TEST(Message, MallocBuilderWithFirstSegment) {
...
@@ -46,7 +46,7 @@ TEST(Message, MallocBuilderWithFirstSegment) {
EXPECT_EQ
(
16u
,
segment
.
size
());
EXPECT_EQ
(
16u
,
segment
.
size
());
}
}
// TODO: More tests.
// TODO
(test)
: More tests.
}
// namespace
}
// namespace
}
// namespace internal
}
// namespace internal
...
...
c++/src/capnproto/schema.capnp
View file @
eeae230c
...
@@ -235,10 +235,6 @@ struct StructNode {
...
@@ -235,10 +235,6 @@ struct StructNode {
# Fields of this union, ordered by ordinal. Currently all members are fields, but
# Fields of this union, ordered by ordinal. Currently all members are fields, but
# consumers should skip member types that they don't understand. The first member in this list
# consumers should skip member types that they don't understand. The first member in this list
# gets discriminant value zero, the next gets one, and so on.
# gets discriminant value zero, the next gets one, and so on.
#
# TODO(soon): Discriminant zero should be reserved to mean "unset", unless the first field in
# the union actually predates the union (it was retroactively unionized), in which case it
# gets discriminant zero.
}
}
}
}
...
...
c++/src/capnproto/serialize-packed-test.c++
View file @
eeae230c
...
@@ -543,7 +543,7 @@ TEST(Packed, RoundTripHugeStringEvenSegmentCountLazy) {
...
@@ -543,7 +543,7 @@ TEST(Packed, RoundTripHugeStringEvenSegmentCountLazy) {
EXPECT_TRUE
(
reader
.
getRoot
<
TestAllTypes
>
().
getTextField
()
==
std
::
string
(
5023
,
'x'
));
EXPECT_TRUE
(
reader
.
getRoot
<
TestAllTypes
>
().
getTextField
()
==
std
::
string
(
5023
,
'x'
));
}
}
// TODO: Test error cases.
// TODO
(test)
: Test error cases.
}
// namespace
}
// namespace
}
// namespace internal
}
// namespace internal
...
...
c++/src/capnproto/serialize-packed.c++
View file @
eeae230c
...
@@ -382,7 +382,7 @@ void PackedOutputStream::write(const void* src, size_t size) {
...
@@ -382,7 +382,7 @@ void PackedOutputStream::write(const void* src, size_t size) {
// Count the number of consecutive words in the input which have no more than a single
// Count the number of consecutive words in the input which have no more than a single
// zero-byte. We look for at least two zeros because that's the point where our compression
// zero-byte. We look for at least two zeros because that's the point where our compression
// scheme becomes a net win.
// scheme becomes a net win.
// TODO: Maybe look for three zeros? Compressing a two-zero word is a loss if the
// TODO
(perf)
: Maybe look for three zeros? Compressing a two-zero word is a loss if the
// following word has no zeros.
// following word has no zeros.
const
uint8_t
*
runStart
=
in
;
const
uint8_t
*
runStart
=
in
;
...
...
c++/src/capnproto/serialize-snappy-test.c++
View file @
eeae230c
...
@@ -253,7 +253,7 @@ TEST(Snappy, RoundTripTwoMessages) {
...
@@ -253,7 +253,7 @@ TEST(Snappy, RoundTripTwoMessages) {
EXPECT_TRUE
(
pipe
.
allRead
());
EXPECT_TRUE
(
pipe
.
allRead
());
}
}
// TODO: Test error cases.
// TODO
(test)
: Test error cases.
}
// namespace
}
// namespace
}
// namespace internal
}
// namespace internal
...
...
c++/src/capnproto/serialize-snappy.c++
View file @
eeae230c
...
@@ -144,7 +144,7 @@ SnappyOutputStream::~SnappyOutputStream() {
...
@@ -144,7 +144,7 @@ SnappyOutputStream::~SnappyOutputStream() {
try
{
try
{
flush
();
flush
();
}
catch
(...)
{
}
catch
(...)
{
// TODO: report secondary faults
// TODO
(someday)
: report secondary faults
}
}
}
else
{
}
else
{
flush
();
flush
();
...
...
c++/src/capnproto/serialize-test.c++
View file @
eeae230c
...
@@ -324,7 +324,7 @@ TEST(Serialize, RejectHugeMessage) {
...
@@ -324,7 +324,7 @@ TEST(Serialize, RejectHugeMessage) {
}
}
}
}
// TODO: Test error cases.
// TODO
(test)
: Test error cases.
}
// namespace
}
// namespace
}
// namespace internal
}
// namespace internal
...
...
c++/src/capnproto/serialize.c++
View file @
eeae230c
...
@@ -167,7 +167,8 @@ InputStreamMessageReader::InputStreamMessageReader(
...
@@ -167,7 +167,8 @@ InputStreamMessageReader::InputStreamMessageReader(
}
}
if
(
scratchSpace
.
size
()
<
totalWords
)
{
if
(
scratchSpace
.
size
()
<
totalWords
)
{
// TODO: Consider allocating each segment as a separate chunk to reduce memory fragmentation.
// TODO(perf): Consider allocating each segment as a separate chunk to reduce memory
// fragmentation.
ownedSpace
=
newArray
<
word
>
(
totalWords
);
ownedSpace
=
newArray
<
word
>
(
totalWords
);
scratchSpace
=
ownedSpace
;
scratchSpace
=
ownedSpace
;
}
}
...
@@ -203,7 +204,7 @@ InputStreamMessageReader::~InputStreamMessageReader() {
...
@@ -203,7 +204,7 @@ InputStreamMessageReader::~InputStreamMessageReader() {
try
{
try
{
inputStream
.
skip
(
allEnd
-
readPos
);
inputStream
.
skip
(
allEnd
-
readPos
);
}
catch
(...)
{
}
catch
(...)
{
// TODO: Devise some way to report secondary errors during unwind.
// TODO
(someday)
: Devise some way to report secondary errors during unwind.
}
}
}
else
{
}
else
{
inputStream
.
skip
(
allEnd
-
readPos
);
inputStream
.
skip
(
allEnd
-
readPos
);
...
...
c++/src/capnproto/type-safety.h
View file @
eeae230c
...
@@ -987,9 +987,9 @@ namespace internal { class BitLabel; class ElementLabel; class WirePointer; }
...
@@ -987,9 +987,9 @@ namespace internal { class BitLabel; class ElementLabel; class WirePointer; }
// also change symbol names, so it's important that the Cap'n proto library and any clients be
// also change symbol names, so it's important that the Cap'n proto library and any clients be
// compiled with the same setting here.
// compiled with the same setting here.
//
//
// TODO
: Decide policy on this. It may make sense to only use CAPNPROTO_DEBUG_TYPES when compiling
// TODO
(soon): Decide policy on this. It may make sense to only use CAPNPROTO_DEBUG_TYPES when
//
Cap'n Proto's own tests, but disable it for all real builds, as clients may find this safety
//
compiling Cap'n Proto's own tests, but disable it for all real builds, as clients may find
// t
iring
.
// t
his safety tiring. Also, need to benchmark to verify there really is no perf hit
.
#endif
#endif
...
...
c++/src/capnproto/util.h
View file @
eeae230c
...
@@ -40,7 +40,7 @@ namespace capnproto {
...
@@ -40,7 +40,7 @@ namespace capnproto {
// =======================================================================================
// =======================================================================================
// Arrays
// Arrays
// TODO
: Move Array here?
// TODO
(cleanup): Move these elsewhere, maybe an array.h.
template
<
typename
T
,
size_t
fixedSize
>
template
<
typename
T
,
size_t
fixedSize
>
class
FixedArray
{
class
FixedArray
{
...
...
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