[haiku-commits] Re: haiku: hrev51162 - in src: tests/kits/shared kits/shared

  • From: Dario Casalinuovo <b.vitruvio@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 13 May 2017 14:08:39 +0200

Hi Andrew, cool work!

A few repeating style violations came up on my eyes :


+
+               // TODO; there is considerable opportunity for performance
improvements
+               // here by buffering the input and then feeding it into
the parse
+               // algorithm character by character.
+
+       status_t NextChar(char* buffer) {


Bracket should be on newline.


+

+/*! Note that this method will expect a UTF-8 encoded string. */
+
+status_t
+BJsonTextWriter::StreamStringEncoded(const char* string,
+       off_t offset, size_t length)
+{
+       status_t writeResult = B_OK;
+       uint8* string8bit = (uint8*)string;
+
+       while (writeResult == B_OK && 0 != length) {


The constant should be on the right.


+BJsonTextWriterArrayStackedEventListener::BJsonTextWriterArrayStackedEve
ntListener(
+       BJsonTextWriter* writer,
+       BJsonTextWriterStackedEventListener* parent)
+       : BJsonTextWriterStackedEventListener(writer, parent)
+{
+}


The ctor should be on the next line after ":"

+               switch (c) {
+                       case ']': // terminate the array
+                               if (!jsonParseContext.Listener()->Handle(
+                                       BJsonEvent(B_JSON_ARRAY_END))) {


I think you need an additional tab level as you open another parenthesis to
differentiate it.


+                                       return false;
+                               }
+                               return true;


Multi-line statements should always have brackets (even when the multi-line
is due to indentation) I see a lot of them.

+       if (!NextChar(jsonParseContext, &buffer[0])
+               || !NextChar(jsonParseContext, &buffer[1])
+               || !NextChar(jsonParseContext, &buffer[2])
+               || !NextChar(jsonParseContext, &buffer[3])) {
+               return false;
+       }


Alternate tab indentation level between logical operators.

Bye,
Dario

Other related posts: