-
Notifications
You must be signed in to change notification settings - Fork 29
Allow to do serializing in machine-independent format #45
Conversation
starius
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General comments:
- Style: add braces around one line blocks, please.
- Why not protocol buffer?
|
|
||
| void Pack(yostream* s) | ||
| { | ||
| char buf[PACKED_HEADERS * 8 * 4]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the meaning of 4? Could you replace 8 and 4 with named constants, please?
| static void PackScanner(const Scanner<Relocation, Shortcutting>& scanner, yostream* s) | ||
| { | ||
| Pire::Header hdr(1, 0); | ||
| char buf[256]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the meaning of 256? Could you replace it with named constants, please?
| Pire::Header hdr(1, 0); | ||
| char buf[256]; | ||
| char *ptr; | ||
| size_t i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this declaration to the loop where it is used.
| { | ||
| Pire::Header hdr(1, 0); | ||
| char buf[256]; | ||
| char *ptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declare a variable at the same line with setting its initial value, please.
| typedef Scanner<Relocation, Shortcutting> ScannerType; | ||
| Pire::Header hdr(1, 0); | ||
| Scanner<Relocation, Shortcutting> sc; | ||
| size_t i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to the line where it is used first time.
|
|
||
| template <class Header> | ||
| static void SetMaskRaw(Header& header, size_t ind, size_t val) | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/return//
|
|
||
| template <class Header> | ||
| static void SetMask(Header& header, size_t ind, char c) | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use SetMaskRaw here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain what did you mean? What SetMaskRaw should I use here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SetMaskRaw<Header>(header, ind, FillSizeT(c));
| #endif | ||
| #if defined(__cplusplus) && !defined(__STDC_LIMIT_MACROS) | ||
| #define __STDC_LIMIT_MACROS 1 /* make С++ to be happy */ | ||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain this code more carefully, please.
|
21.09.2016 03:39, Boris Nagaev wrote:
I'll fix the problems you've pointed on and then I'll resend the patches. |
The patches introduce Pack()/Unpack() functions for Multi scanner to serialize/deserialize with msgpack.