aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@bug.st>2015-04-21 18:10:32 +0200
committerCristian Maglie <c.maglie@bug.st>2015-04-21 18:10:32 +0200
commitad7ede5647ec785a6e7fae215ebe8ce229cf8971 (patch)
tree21358dca47e1abc8bf257dd43152381f9a6f16f5 /cores/arduino
parent9e2fdcc8f46fed5f10b950111d466e20e6e89bc8 (diff)
Fixed indentation in Stream.cpp, no code change
Diffstat (limited to 'cores/arduino')
-rw-r--r--cores/arduino/Stream.cpp60
1 files changed, 32 insertions, 28 deletions
diff --git a/cores/arduino/Stream.cpp b/cores/arduino/Stream.cpp
index f007ce9..b31942f 100644
--- a/cores/arduino/Stream.cpp
+++ b/cores/arduino/Stream.cpp
@@ -254,11 +254,12 @@ String Stream::readStringUntil(char terminator)
int Stream::findMulti( struct Stream::MultiTarget *targets, int tCount) {
// any zero length target string automatically matches and would make
// a mess of the rest of the algorithm.
- for (struct MultiTarget *t = targets; t < targets+tCount; ++t)
+ for (struct MultiTarget *t = targets; t < targets+tCount; ++t) {
if (t->len <= 0)
return t - targets;
+ }
- while(1) {
+ while (1) {
int c = timedRead();
if (c < 0)
return -1;
@@ -277,37 +278,40 @@ int Stream::findMulti( struct Stream::MultiTarget *targets, int tCount) {
// but it will match the second position so we can't just reset the current
// index to 0 when we find a mismatch.
if (t->index == 0)
- continue;
+ continue;
int origIndex = t->index;
do {
- --t->index;
- // first check if current char works against the new current index
- if (c != t->str[t->index])
- continue;
-
- // if it's the only char then we're good, nothing more to check
- if (t->index == 0) {
- t->index++;
- break;
- }
-
- // otherwise we need to check the rest of the found string
- int diff = origIndex - t->index;
- size_t i;
- for (i = 0; i < t->index; ++i)
- if (t->str[i] != t->str[i + diff])
- break;
- // if we successfully got through the previous loop then our current
- // index is good.
- if (i == t->index) {
- t->index++;
- break;
- }
- // otherwise we just try the next index
+ --t->index;
+ // first check if current char works against the new current index
+ if (c != t->str[t->index])
+ continue;
+
+ // if it's the only char then we're good, nothing more to check
+ if (t->index == 0) {
+ t->index++;
+ break;
+ }
+
+ // otherwise we need to check the rest of the found string
+ int diff = origIndex - t->index;
+ size_t i;
+ for (i = 0; i < t->index; ++i) {
+ if (t->str[i] != t->str[i + diff])
+ break;
+ }
+
+ // if we successfully got through the previous loop then our current
+ // index is good.
+ if (i == t->index) {
+ t->index++;
+ break;
+ }
+
+ // otherwise we just try the next index
} while (t->index);
}
}
// unreachable
return -1;
-} \ No newline at end of file
+}