Stefan Schuermans

Stefan Schuermans commited on 2023-08-18 09:55:23
Showing 21 changed files, with 717 additions and 857 deletions.

... ...
@@ -18,8 +18,8 @@ int BlinkenColorizerStr2Mode(const char *str);
18 18
 const char *BlinkenColorizerMode2Str(int mode);
19 19
 
20 20
 // get color for colorizing
21
-unsigned char BlinkenColorizerGetColor(int channels, int mode, int step,
22
-                                       int y, int x, int c);
21
+unsigned char BlinkenColorizerGetColor(int channels, int mode, int step, int y,
22
+                                       int x, int c);
23 23
 
24 24
 #ifdef __cplusplus
25 25
 } // extern "C"
... ...
@@ -14,8 +14,8 @@ extern "C" {
14 14
 
15 15
 typedef struct sBlinkenFrame stBlinkenFrame;
16 16
 
17
-stBlinkenFrame *BlinkenFrameNew(int height, int width, int channels,
18
-                                int maxval, int duration);
17
+stBlinkenFrame *BlinkenFrameNew(int height, int width, int channels, int maxval,
18
+                                int duration);
19 19
 
20 20
 stBlinkenFrame *BlinkenFrameClone(stBlinkenFrame *pSrcFrame);
21 21
 
... ...
@@ -31,8 +31,7 @@ int BlinkenFrameGetMaxval(stBlinkenFrame *pFrame);
31 31
 int BlinkenFrameGetDuration(stBlinkenFrame *pFrame);
32 32
 void BlinkenFrameSetDuration(stBlinkenFrame *pFrame, int duration);
33 33
 
34
-unsigned char BlinkenFrameGetPixel(stBlinkenFrame *pFrame, int y, int x,
35
-                                   int c);
34
+unsigned char BlinkenFrameGetPixel(stBlinkenFrame *pFrame, int y, int x, int c);
36 35
 void BlinkenFrameSetPixel(stBlinkenFrame *pFrame, int y, int x, int c,
37 36
                           unsigned char val);
38 37
 
... ...
@@ -51,8 +50,8 @@ void BlinkenFrameSetColor(stBlinkenFrame *pFrame, int y, int x,
51 50
  * \param[in] dc number of channels in area
52 51
  * \param[in] pData pointer to buffer for pixel data, size must be dy * dx * dc
53 52
  */
54
-void BlinkenFrameGetPixelData(stBlinkenFrame const *pFrame,
55
-                              int y, int dy, int x, int dx, int c, int dc,
53
+void BlinkenFrameGetPixelData(stBlinkenFrame const *pFrame, int y, int dy,
54
+                              int x, int dx, int c, int dc,
56 55
                               unsigned char *pData);
57 56
 
58 57
 /**
... ...
@@ -66,8 +65,8 @@ void BlinkenFrameGetPixelData(stBlinkenFrame const *pFrame,
66 65
  * \param[in] dc number of channels in area
67 66
  * \param[in] pData pointer to new pixel data, size must be dy * dx * dc
68 67
  */
69
-void BlinkenFrameSetPixelData(stBlinkenFrame *pFrame,
70
-                              int y, int dy, int x, int dx, int c, int dc,
68
+void BlinkenFrameSetPixelData(stBlinkenFrame *pFrame, int y, int dy, int x,
69
+                              int dx, int c, int dc,
71 70
                               unsigned char const *pData);
72 71
 
73 72
 int BlinkenFrameIsEmpty(stBlinkenFrame *pFrame);
... ...
@@ -78,14 +77,14 @@ int BlinkenFrameCompare(stBlinkenFrame *pFrame1, stBlinkenFrame *pFrame2);
78 77
 
79 78
 void BlinkenFrameResize(stBlinkenFrame *pFrame, int height, int width,
80 79
                         int channels, int maxval);
81
-void BlinkenFrameCrop(stBlinkenFrame *pFrame, int top, int left,
82
-                      int height, int width);
80
+void BlinkenFrameCrop(stBlinkenFrame *pFrame, int top, int left, int height,
81
+                      int width);
83 82
 void BlinkenFrameScale(stBlinkenFrame *pFrame, int height, int width);
84 83
 void BlinkenFrameColorize(stBlinkenFrame *pFrame, int channels, int mode,
85 84
                           int step);
86 85
 void BlinkenFrameCopyRect(stBlinkenFrame *pDest, int destY, int destX,
87
-                          stBlinkenFrame *pSrc, int srcY, int srcX,
88
-                          int height, int width);
86
+                          stBlinkenFrame *pSrc, int srcY, int srcX, int height,
87
+                          int width);
89 88
 
90 89
 void BlinkenFrameRotateCw(stBlinkenFrame *pFrame);
91 90
 void BlinkenFrameRotateCcw(stBlinkenFrame *pFrame);
... ...
@@ -6,10 +6,10 @@
6 6
 #ifndef INC_BlinkenLib_BlinkenLib
7 7
 #define INC_BlinkenLib_BlinkenLib
8 8
 
9
-#include <BlinkenLib/config.h>
10 9
 #include <BlinkenLib/BlinkenColorizer.h>
11 10
 #include <BlinkenLib/BlinkenFrame.h>
12 11
 #include <BlinkenLib/BlinkenMovie.h>
13 12
 #include <BlinkenLib/BlinkenProto.h>
13
+#include <BlinkenLib/config.h>
14 14
 
15 15
 #endif // #ifndef INC_BlinkenLib_BlinkenLib
... ...
@@ -6,8 +6,8 @@
6 6
 #ifndef INC_BlinkenLib_BlinkenMovie
7 7
 #define INC_BlinkenLib_BlinkenMovie
8 8
 
9
-#include <BlinkenLib/config.h>
10 9
 #include <BlinkenLib/BlinkenFrame.h>
10
+#include <BlinkenLib/config.h>
11 11
 
12 12
 #ifdef WIN32
13 13
 #include <winsock2.h>
... ...
@@ -60,8 +60,8 @@ void BlinkenMovieDeleteFrames(stBlinkenMovie *pMovie);
60 60
 int BlinkenMovieConcat(stBlinkenMovie *pMovie,
61 61
                        stBlinkenMovie *pMovie2 /* appended and freed */);
62 62
 void BlinkenMovieReverse(stBlinkenMovie *pMovie);
63
-void BlinkenMovieCutTime(stBlinkenMovie *pMovie,
64
-                         int begin /* in ms */, int end /* in ms */);
63
+void BlinkenMovieCutTime(stBlinkenMovie *pMovie, int begin /* in ms */,
64
+                         int end /* in ms */);
65 65
 void BlinkenMovieAdaptDuration(stBlinkenMovie *pMovie,
66 66
                                int duration /* in ms */);
67 67
 void BlinkenMovieAdaptMaxFrameDuration(stBlinkenMovie *pMovie,
... ...
@@ -69,13 +69,13 @@ void BlinkenMovieAdaptMaxFrameDuration(stBlinkenMovie *pMovie,
69 69
 
70 70
 void BlinkenMovieResize(stBlinkenMovie *pMovie, int height, int width,
71 71
                         int channels, int maxval);
72
-void BlinkenMovieCrop(stBlinkenMovie *pMovie, int top, int left,
73
-                      int height, int width);
72
+void BlinkenMovieCrop(stBlinkenMovie *pMovie, int top, int left, int height,
73
+                      int width);
74 74
 void BlinkenMovieScale(stBlinkenMovie *pMovie, int height, int width);
75 75
 void BlinkenMovieColorize(stBlinkenMovie *pMovie, int channels, int mode);
76 76
 void BlinkenMovieCopyRect(stBlinkenMovie *pDest, int destY, int destX,
77
-                          stBlinkenMovie *pSrc, int srcY, int srcX,
78
-                          int height, int width);
77
+                          stBlinkenMovie *pSrc, int srcY, int srcX, int height,
78
+                          int width);
79 79
 
80 80
 void BlinkenMovieRotateCw(stBlinkenMovie *pMovie);
81 81
 void BlinkenMovieRotateCcw(stBlinkenMovie *pMovie);
... ...
@@ -10,12 +10,19 @@
10 10
 extern "C" {
11 11
 #endif
12 12
 
13
-typedef enum eBlinkenProto { BlinkenProtoNone, BlinkenProtoBlp,
14
-  BlinkenProtoEblp, BlinkenProtoMcuf
13
+typedef enum eBlinkenProto {
14
+  BlinkenProtoNone,
15
+  BlinkenProtoBlp,
16
+  BlinkenProtoEblp,
17
+  BlinkenProtoMcuf
15 18
 } etBlinkenProto;
16 19
 
17
-typedef enum eBlinkenPacket { BlinkenPacketNone, BlinkenPacketFrame,
18
-  BlinkenPacketRequest, BlinkenPacketEndRequest, BlinkenPacketStreamEnd
20
+typedef enum eBlinkenPacket {
21
+  BlinkenPacketNone,
22
+  BlinkenPacketFrame,
23
+  BlinkenPacketRequest,
24
+  BlinkenPacketEndRequest,
25
+  BlinkenPacketStreamEnd
19 26
 } etBlinkenPacket;
20 27
 
21 28
 int BlinkenProtoMakePacket(etBlinkenProto proto, etBlinkenPacket packet,
... ...
@@ -23,8 +30,7 @@ int BlinkenProtoMakePacket(etBlinkenProto proto, etBlinkenPacket packet,
23 30
 // returns length or -1 on error
24 31
 
25 32
 void BlinkenProtoDetectPacket(const char *pData, int length,
26
-                              etBlinkenProto * pProto,
27
-                              etBlinkenPacket * pPacket);
33
+                              etBlinkenProto *pProto, etBlinkenPacket *pPacket);
28 34
 // returns protocol in *pProto if pProto not NULL
29 35
 // returns packet type in *pPacket if pPacket not NULL
30 36
 
... ...
@@ -10,8 +10,7 @@
10 10
 #include "Tools.h"
11 11
 
12 12
 unsigned char BlinkenColorizerSolid(int step, int channels, int y, int x,
13
-                                    int c)
14
-{
13
+                                    int c) {
15 14
   int substep, updown, chan;
16 15
   step %= channels * 2 * 254;
17 16
   substep = step % 254;
... ...
@@ -37,8 +36,7 @@ unsigned char BlinkenColorizerSolid(int step, int channels, int y, int x,
37 36
 }
38 37
 
39 38
 unsigned char BlinkenColorizerRainbow(int step, int channels, int y, int x,
40
-                                      int c)
41
-{
39
+                                      int c) {
42 40
   return BlinkenColorizerSolid(step + ((x + y) * 64), channels, y, x, c);
43 41
 }
44 42
 
... ...
@@ -56,8 +54,7 @@ static const BlinkenColorizingModeDesc BlinkenColorizingModeDescs[] = {
56 54
 
57 55
 // convert string to colorizing mode
58 56
 // returns colorizing mode (>= 0) or -1 on error
59
-int BlinkenColorizerStr2Mode(const char *str)
60
-{
57
+int BlinkenColorizerStr2Mode(const char *str) {
61 58
   unsigned int i;
62 59
   for (i = 0; i < arr_cnt(BlinkenColorizingModeDescs); i++)
63 60
     if (strcmp(str, BlinkenColorizingModeDescs[i].name) == 0)
... ...
@@ -68,17 +65,15 @@ int BlinkenColorizerStr2Mode(const char *str)
68 65
 }
69 66
 
70 67
 // convert colorizing mode to string
71
-const char *BlinkenColorizerMode2Str(int mode)
72
-{
68
+const char *BlinkenColorizerMode2Str(int mode) {
73 69
   if (mode < 0 || mode >= (int)arr_cnt(BlinkenColorizingModeDescs))
74 70
     return "(unknown)";
75 71
   return BlinkenColorizingModeDescs[mode].name;
76 72
 }
77 73
 
78 74
 // get color for colorizing
79
-unsigned char BlinkenColorizerGetColor(int channels, int mode, int step,
80
-                                       int y, int x, int c)
81
-{
75
+unsigned char BlinkenColorizerGetColor(int channels, int mode, int step, int y,
76
+                                       int x, int c) {
82 77
   if (mode < 0 || mode >= (int)arr_cnt(BlinkenColorizingModeDescs))
83 78
     return 255;
84 79
   return BlinkenColorizingModeDescs[mode].func(step, channels, y, x, c);
... ...
@@ -7,13 +7,13 @@
7 7
 #include <stdlib.h>
8 8
 #include <string.h>
9 9
 #ifdef WIN32
10
-#include <winsock2.h>
11 10
 #include <windows.h>
11
+#include <winsock2.h>
12 12
 typedef WORD uint16_t;
13 13
 typedef DWORD uint32_t;
14 14
 #else
15
-#include <stdint.h>
16 15
 #include <netinet/in.h>
16
+#include <stdint.h>
17 17
 #endif
18 18
 
19 19
 #include <BlinkenLib/BlinkenColorizer.h>
... ...
@@ -32,9 +32,8 @@ struct sBlinkenFrame {
32 32
   unsigned char **ppData;
33 33
 };
34 34
 
35
-stBlinkenFrame *BlinkenFrameNew(int height, int width, int channels,
36
-                                int maxval, int duration)
37
-{
35
+stBlinkenFrame *BlinkenFrameNew(int height, int width, int channels, int maxval,
36
+                                int duration) {
38 37
   stBlinkenFrame *pFrame;
39 38
 
40 39
   if (height < BlinkenHeightMin)
... ...
@@ -68,8 +67,7 @@ stBlinkenFrame *BlinkenFrameNew(int height, int width, int channels,
68 67
   pFrame->maxval = maxval;
69 68
   pFrame->duration = duration;
70 69
 
71
-  pFrame->ppData =
72
-      (unsigned char **)BlinkenMalloc2D(height, width * channels,
70
+  pFrame->ppData = (unsigned char **)BlinkenMalloc2D(height, width * channels,
73 71
                                                      sizeof(unsigned char));
74 72
   if (pFrame->ppData == NULL) {
75 73
     free(pFrame);
... ...
@@ -79,17 +77,16 @@ stBlinkenFrame *BlinkenFrameNew(int height, int width, int channels,
79 77
   return pFrame;
80 78
 }
81 79
 
82
-stBlinkenFrame *BlinkenFrameClone(stBlinkenFrame *pSrcFrame)
83
-{
80
+stBlinkenFrame *BlinkenFrameClone(stBlinkenFrame *pSrcFrame) {
84 81
   int y, x, c, i;
85 82
   stBlinkenFrame *pFrame;
86 83
 
87 84
   if (pSrcFrame == NULL)
88 85
     return NULL;
89 86
 
90
-  pFrame = BlinkenFrameNew(pSrcFrame->height, pSrcFrame->width,
91
-                           pSrcFrame->channels, pSrcFrame->maxval,
92
-                           pSrcFrame->duration);
87
+  pFrame =
88
+      BlinkenFrameNew(pSrcFrame->height, pSrcFrame->width, pSrcFrame->channels,
89
+                      pSrcFrame->maxval, pSrcFrame->duration);
93 90
   if (pFrame == NULL)
94 91
     return NULL;
95 92
 
... ...
@@ -101,8 +98,7 @@ stBlinkenFrame *BlinkenFrameClone(stBlinkenFrame *pSrcFrame)
101 98
   return pFrame;
102 99
 }
103 100
 
104
-void BlinkenFrameFree(stBlinkenFrame *pFrame)
105
-{
101
+void BlinkenFrameFree(stBlinkenFrame *pFrame) {
106 102
   if (pFrame == NULL)
107 103
     return;
108 104
 
... ...
@@ -110,8 +106,7 @@ void BlinkenFrameFree(stBlinkenFrame *pFrame)
110 106
   free(pFrame);
111 107
 }
112 108
 
113
-void BlinkenFrameClear(stBlinkenFrame *pFrame)
114
-{
109
+void BlinkenFrameClear(stBlinkenFrame *pFrame) {
115 110
   int y, x, c, i;
116 111
 
117 112
   if (pFrame == NULL)
... ...
@@ -123,48 +118,42 @@ void BlinkenFrameClear(stBlinkenFrame *pFrame)
123 118
         pFrame->ppData[y][i] = 0;
124 119
 }
125 120
 
126
-int BlinkenFrameGetHeight(stBlinkenFrame *pFrame)
127
-{
121
+int BlinkenFrameGetHeight(stBlinkenFrame *pFrame) {
128 122
   if (pFrame == NULL)
129 123
     return 0;
130 124
 
131 125
   return pFrame->height;
132 126
 }
133 127
 
134
-int BlinkenFrameGetWidth(stBlinkenFrame *pFrame)
135
-{
128
+int BlinkenFrameGetWidth(stBlinkenFrame *pFrame) {
136 129
   if (pFrame == NULL)
137 130
     return 0;
138 131
 
139 132
   return pFrame->width;
140 133
 }
141 134
 
142
-int BlinkenFrameGetChannels(stBlinkenFrame *pFrame)
143
-{
135
+int BlinkenFrameGetChannels(stBlinkenFrame *pFrame) {
144 136
   if (pFrame == NULL)
145 137
     return 0;
146 138
 
147 139
   return pFrame->channels;
148 140
 }
149 141
 
150
-int BlinkenFrameGetMaxval(stBlinkenFrame *pFrame)
151
-{
142
+int BlinkenFrameGetMaxval(stBlinkenFrame *pFrame) {
152 143
   if (pFrame == NULL)
153 144
     return 0;
154 145
 
155 146
   return pFrame->maxval;
156 147
 }
157 148
 
158
-int BlinkenFrameGetDuration(stBlinkenFrame *pFrame)
159
-{
149
+int BlinkenFrameGetDuration(stBlinkenFrame *pFrame) {
160 150
   if (pFrame == NULL)
161 151
     return 0;
162 152
 
163 153
   return pFrame->duration;
164 154
 }
165 155
 
166
-void BlinkenFrameSetDuration(stBlinkenFrame *pFrame, int duration)
167
-{
156
+void BlinkenFrameSetDuration(stBlinkenFrame *pFrame, int duration) {
168 157
   if (pFrame == NULL)
169 158
     return;
170 159
 
... ...
@@ -177,22 +166,18 @@ void BlinkenFrameSetDuration(stBlinkenFrame *pFrame, int duration)
177 166
 }
178 167
 
179 168
 unsigned char BlinkenFrameGetPixel(stBlinkenFrame *pFrame, int y, int x,
180
-                                   int c)
181
-{
182
-  if (pFrame == NULL ||
183
-      y < 0 || y >= pFrame->height ||
184
-      x < 0 || x >= pFrame->width || c < 0 || c >= pFrame->channels)
169
+                                   int c) {
170
+  if (pFrame == NULL || y < 0 || y >= pFrame->height || x < 0 ||
171
+      x >= pFrame->width || c < 0 || c >= pFrame->channels)
185 172
     return 0;
186 173
 
187 174
   return pFrame->ppData[y][x * pFrame->channels + c];
188 175
 }
189 176
 
190 177
 void BlinkenFrameSetPixel(stBlinkenFrame *pFrame, int y, int x, int c,
191
-                          unsigned char val)
192
-{
193
-  if (pFrame == NULL ||
194
-      y < 0 || y >= pFrame->height ||
195
-      x < 0 || x >= pFrame->width || c < 0 || c >= pFrame->channels)
178
+                          unsigned char val) {
179
+  if (pFrame == NULL || y < 0 || y >= pFrame->height || x < 0 ||
180
+      x >= pFrame->width || c < 0 || c >= pFrame->channels)
196 181
     return;
197 182
 
198 183
   if (val > pFrame->maxval)
... ...
@@ -200,12 +185,11 @@ void BlinkenFrameSetPixel(stBlinkenFrame *pFrame, int y, int x, int c,
200 185
   pFrame->ppData[y][x * pFrame->channels + c] = val;
201 186
 }
202 187
 
203
-unsigned long BlinkenFrameGetColor(stBlinkenFrame *pFrame, int y, int x)
204
-{
188
+unsigned long BlinkenFrameGetColor(stBlinkenFrame *pFrame, int y, int x) {
205 189
   int i;
206 190
 
207
-  if (pFrame == NULL ||
208
-      y < 0 || y >= pFrame->height || x < 0 || x >= pFrame->width)
191
+  if (pFrame == NULL || y < 0 || y >= pFrame->height || x < 0 ||
192
+      x >= pFrame->width)
209 193
     return 0;
210 194
 
211 195
   i = x * pFrame->channels;
... ...
@@ -213,41 +197,40 @@ unsigned long BlinkenFrameGetColor(stBlinkenFrame *pFrame, int y, int x)
213 197
   if (pFrame->channels == 1)
214 198
     return (((unsigned long)pFrame->ppData[y][i + 0] * 255 +
215 199
              pFrame->maxval / 2) /
216
-            pFrame->
217
-            maxval) << 16 | (((unsigned long)pFrame->ppData[y][i + 0] * 255 +
200
+            pFrame->maxval)
201
+               << 16 |
202
+           (((unsigned long)pFrame->ppData[y][i + 0] * 255 +
218 203
              pFrame->maxval / 2) /
219
-                             pFrame->maxval) << 8 | (((unsigned long)
220
-                                                      pFrame->ppData[y][i +
221
-                                                                        0] *
222
-                                                      255 +
204
+            pFrame->maxval)
205
+               << 8 |
206
+           (((unsigned long)pFrame->ppData[y][i + 0] * 255 +
223 207
              pFrame->maxval / 2) /
224 208
             pFrame->maxval);
225 209
   if (pFrame->channels == 2)
226 210
     return (((unsigned long)pFrame->ppData[y][i + 0] * 255 +
227 211
              pFrame->maxval / 2) /
228
-            pFrame->
229
-            maxval) << 16 | (((unsigned long)pFrame->ppData[y][i + 1] * 255 +
230
-                              pFrame->maxval / 2) / pFrame->maxval) << 8;
231
-  return (((unsigned long)pFrame->ppData[y][i + 0] * 255 +
232
-           pFrame->maxval / 2) /
233
-          pFrame->maxval) << 16 | (((unsigned long)pFrame->ppData[y][i + 1] *
234
-                                    255 +
212
+            pFrame->maxval)
213
+               << 16 |
214
+           (((unsigned long)pFrame->ppData[y][i + 1] * 255 +
235 215
              pFrame->maxval / 2) /
236
-                                   pFrame->maxval) << 8 | (((unsigned long)
237
-                                                            pFrame->ppData[y]
238
-                                                            [i + 2] * 255 +
239
-                                                            pFrame->maxval /
240
-                                                            2) /
216
+            pFrame->maxval)
217
+               << 8;
218
+  return (((unsigned long)pFrame->ppData[y][i + 0] * 255 + pFrame->maxval / 2) /
219
+          pFrame->maxval)
220
+             << 16 |
221
+         (((unsigned long)pFrame->ppData[y][i + 1] * 255 + pFrame->maxval / 2) /
222
+          pFrame->maxval)
223
+             << 8 |
224
+         (((unsigned long)pFrame->ppData[y][i + 2] * 255 + pFrame->maxval / 2) /
241 225
           pFrame->maxval);
242 226
 }
243 227
 
244 228
 void BlinkenFrameSetColor(stBlinkenFrame *pFrame, int y, int x,
245
-                          unsigned long color)
246
-{
229
+                          unsigned long color) {
247 230
   int i, alpha, alpha_, c;
248 231
 
249
-  if (pFrame == NULL ||
250
-      y < 0 || y >= pFrame->height || x < 0 || x >= pFrame->width)
232
+  if (pFrame == NULL || y < 0 || y >= pFrame->height || x < 0 ||
233
+      x >= pFrame->width)
251 234
     return;
252 235
 
253 236
   i = x * pFrame->channels;
... ...
@@ -256,34 +239,33 @@ void BlinkenFrameSetColor(stBlinkenFrame *pFrame, int y, int x,
256 239
   alpha_ = 255 - alpha;
257 240
   if (pFrame->channels >= 1)
258 241
     pFrame->ppData[y][i + 0] =
259
-        (unsigned
260
-         char)((((((color >> 16) & 0xFF) * pFrame->maxval +
261
-                  127) / 255) * alpha + (unsigned long)pFrame->ppData[y][i +
262
-                                                                         0] *
263
-                alpha_) / 255);
242
+        (unsigned char)((((((color >> 16) & 0xFF) * pFrame->maxval + 127) /
243
+                          255) *
244
+                             alpha +
245
+                         (unsigned long)pFrame->ppData[y][i + 0] * alpha_) /
246
+                        255);
264 247
   if (pFrame->channels >= 2)
265 248
     pFrame->ppData[y][i + 1] =
266
-        (unsigned
267
-         char)((((((color >> 8) & 0xFF) * pFrame->maxval +
268
-                  127) / 255) * alpha + (unsigned long)pFrame->ppData[y][i +
269
-                                                                         1] *
270
-                alpha_) / 255);
249
+        (unsigned char)((((((color >> 8) & 0xFF) * pFrame->maxval + 127) /
250
+                          255) *
251
+                             alpha +
252
+                         (unsigned long)pFrame->ppData[y][i + 1] * alpha_) /
253
+                        255);
271 254
   if (pFrame->channels >= 3)
272 255
     pFrame->ppData[y][i + 2] =
273
-        (unsigned
274
-         char)(((((color & 0xFF) * pFrame->maxval + 127) / 255) * alpha +
275
-                (unsigned long)pFrame->ppData[y][i + 2] * alpha_) / 255);
256
+        (unsigned char)(((((color & 0xFF) * pFrame->maxval + 127) / 255) *
257
+                             alpha +
258
+                         (unsigned long)pFrame->ppData[y][i + 2] * alpha_) /
259
+                        255);
276 260
   for (c = 3; c < pFrame->channels; c++)
277
-    pFrame->ppData[y][i + c] = (unsigned char)((0 + (unsigned long)
278
-                                                pFrame->ppData[y][i +
279
-                                                                  c] *
280
-                                                alpha_) / 255);
261
+    pFrame->ppData[y][i + c] =
262
+        (unsigned char)((0 + (unsigned long)pFrame->ppData[y][i + c] * alpha_) /
263
+                        255);
281 264
 }
282 265
 
283
-void BlinkenFrameGetPixelData(stBlinkenFrame const *pFrame,
284
-                              int y, int dy, int x, int dx, int c, int dc,
285
-                              unsigned char *pData)
286
-{
266
+void BlinkenFrameGetPixelData(stBlinkenFrame const *pFrame, int y, int dy,
267
+                              int x, int dx, int c, int dc,
268
+                              unsigned char *pData) {
287 269
   int height, width, channels;
288 270
   unsigned char const **ppFrameData;
289 271
   int sy, ey, iy, sx, ex, ix, sc, ec, ic; // start/end/index x/y/channel
... ...
@@ -309,10 +291,10 @@ void BlinkenFrameGetPixelData(stBlinkenFrame const *pFrame,
309 291
   ec = c + dc > channels ? channels - c : dc;
310 292
 
311 293
   // get pixel data
312
-  for (iy = sy, fy = y, biy = (sy * dx + sx) * dc + sc;
313
-       iy < ey; ++iy, ++fy, biy += dx * dc) {
314
-    for (ix = sx, fix = x * channels + c, bix = biy;
315
-         ix < ex; ++ix, fix += channels, bix += dc) {
294
+  for (iy = sy, fy = y, biy = (sy * dx + sx) * dc + sc; iy < ey;
295
+       ++iy, ++fy, biy += dx * dc) {
296
+    for (ix = sx, fix = x * channels + c, bix = biy; ix < ex;
297
+         ++ix, fix += channels, bix += dc) {
316 298
       for (ic = sc, fic = fix, bic = bix; ic < ec; ++ic, ++fic, ++bic) {
317 299
         pData[bic] = ppFrameData[fy][fic];
318 300
       }
... ...
@@ -320,10 +302,9 @@ void BlinkenFrameGetPixelData(stBlinkenFrame const *pFrame,
320 302
   }
321 303
 }
322 304
 
323
-void BlinkenFrameSetPixelData(stBlinkenFrame *pFrame,
324
-                              int y, int dy, int x, int dx, int c, int dc,
325
-                              unsigned char const *pData)
326
-{
305
+void BlinkenFrameSetPixelData(stBlinkenFrame *pFrame, int y, int dy, int x,
306
+                              int dx, int c, int dc,
307
+                              unsigned char const *pData) {
327 308
   int height, width, channels;
328 309
   unsigned char maxval;
329 310
   unsigned char **ppFrameData;
... ...
@@ -352,10 +333,10 @@ void BlinkenFrameSetPixelData(stBlinkenFrame *pFrame,
352 333
   ec = c + dc > channels ? channels - c : dc;
353 334
 
354 335
   // set pixel data
355
-  for (iy = sy, fy = y, biy = (sy * dx + sx) * dc + sc;
356
-       iy < ey; ++iy, ++fy, biy += dx * dc) {
357
-    for (ix = sx, fix = x * channels + c, bix = biy;
358
-         ix < ex; ++ix, fix += channels, bix += dc) {
336
+  for (iy = sy, fy = y, biy = (sy * dx + sx) * dc + sc; iy < ey;
337
+       ++iy, ++fy, biy += dx * dc) {
338
+    for (ix = sx, fix = x * channels + c, bix = biy; ix < ex;
339
+         ++ix, fix += channels, bix += dc) {
359 340
       for (ic = sc, fic = fix, bic = bix; ic < ec; ++ic, ++fic, ++bic) {
360 341
         value = pData[bic];
361 342
         ppFrameData[fy][fic] = value > maxval ? maxval : value;
... ...
@@ -413,8 +394,7 @@ int BlinkenFrameCompare(stBlinkenFrame *pFrame1, stBlinkenFrame *pFrame2)
413 394
     return 1;
414 395
 
415 396
   for (y = 0; y < pFrame1->height; y++) {
416
-    cmp =
417
-        memcmp(pFrame1->ppData[y], pFrame2->ppData[y],
397
+    cmp = memcmp(pFrame1->ppData[y], pFrame2->ppData[y],
418 398
                  pFrame1->width * pFrame2->channels);
419 399
     if (cmp != 0)
420 400
       return cmp;
... ...
@@ -424,9 +404,8 @@ int BlinkenFrameCompare(stBlinkenFrame *pFrame1, stBlinkenFrame *pFrame2)
424 404
 }
425 405
 
426 406
 static void BlinkenFramePadCrop(stBlinkenFrame *pFrame, int height, int width,
427
-                                int channels, int maxval,
428
-                                int emptyY, int emptyX, int skipY, int skipX)
429
-{
407
+                                int channels, int maxval, int emptyY,
408
+                                int emptyX, int skipY, int skipX) {
430 409
   unsigned char **ppData;
431 410
   int y, x, c, i, j;
432 411
   int rangeY, rangeX;
... ...
@@ -453,8 +432,8 @@ static void BlinkenFramePadCrop(stBlinkenFrame *pFrame, int height, int width,
453 432
     maxval = BlinkenMaxvalMax;
454 433
 
455 434
   if (height == pFrame->height && width == pFrame->width &&
456
-      channels == pFrame->channels && maxval == pFrame->maxval &&
457
-      emptyX == 0 && emptyY == 0 && skipY == 0 && skipX == 0)
435
+      channels == pFrame->channels && maxval == pFrame->maxval && emptyX == 0 &&
436
+      emptyY == 0 && skipY == 0 && skipX == 0)
458 437
     return;
459 438
 
460 439
   // allocate new data array
... ...
@@ -497,9 +476,10 @@ static void BlinkenFramePadCrop(stBlinkenFrame *pFrame, int height, int width,
497 476
       {
498 477
         for (c = 0; c < pFrame->channels; c++, i++, j++)
499 478
           ppData[emptyY + y][j] =
500
-              (unsigned
501
-               char)(((unsigned long)pFrame->ppData[skipY + y][i] * maxval +
502
-                      pFrame->maxval / 2) / pFrame->maxval);
479
+              (unsigned char)(((unsigned long)pFrame->ppData[skipY + y][i] *
480
+                                   maxval +
481
+                               pFrame->maxval / 2) /
482
+                              pFrame->maxval);
503 483
         for (; c < channels; c++, j++)
504 484
           ppData[emptyY + y][j] = ppData[emptyY + y][j - 1];
505 485
       } else // remove channels: merge leftover channels with last kept
... ...
@@ -508,9 +488,10 @@ static void BlinkenFramePadCrop(stBlinkenFrame *pFrame, int height, int width,
508 488
         val = 0;
509 489
         for (c = 0; c < channels - 1; c++, i++, j++)
510 490
           ppData[emptyY + y][j] =
511
-              (unsigned
512
-               char)(((unsigned long)pFrame->ppData[skipY + y][i] * maxval +
513
-                      pFrame->maxval / 2) / pFrame->maxval);
491
+              (unsigned char)(((unsigned long)pFrame->ppData[skipY + y][i] *
492
+                                   maxval +
493
+                               pFrame->maxval / 2) /
494
+                              pFrame->maxval);
514 495
         for (c = channels - 1; c < pFrame->channels; c++, i++)
515 496
           val += (unsigned long)pFrame->ppData[skipY + y][i];
516 497
         div = pFrame->maxval * (pFrame->channels - channels + 1);
... ...
@@ -529,8 +510,7 @@ static void BlinkenFramePadCrop(stBlinkenFrame *pFrame, int height, int width,
529 510
 }
530 511
 
531 512
 void BlinkenFrameResize(stBlinkenFrame *pFrame, int height, int width,
532
-                        int channels, int maxval)
533
-{
513
+                        int channels, int maxval) {
534 514
   int emptyY, emptyX, skipY, skipX;
535 515
 
536 516
   if (pFrame == NULL)
... ...
@@ -574,13 +554,12 @@ void BlinkenFrameResize(stBlinkenFrame *pFrame, int height, int width,
574 554
   }
575 555
 
576 556
   // resize frame with help of calculated parameters
577
-  BlinkenFramePadCrop(pFrame, height, width, channels, maxval,
578
-                      emptyY, emptyX, skipY, skipX);
557
+  BlinkenFramePadCrop(pFrame, height, width, channels, maxval, emptyY, emptyX,
558
+                      skipY, skipX);
579 559
 }
580 560
 
581
-void BlinkenFrameCrop(stBlinkenFrame *pFrame, int top, int left,
582
-                      int height, int width)
583
-{
561
+void BlinkenFrameCrop(stBlinkenFrame *pFrame, int top, int left, int height,
562
+                      int width) {
584 563
   if (pFrame == NULL)
585 564
     return;
586 565
 
... ...
@@ -601,8 +580,8 @@ void BlinkenFrameCrop(stBlinkenFrame *pFrame, int top, int left,
601 580
   if (width > pFrame->width - left)
602 581
     width = pFrame->width - left;
603 582
 
604
-  if (top == 0 && left == 0 &&
605
-      height == pFrame->height && width == pFrame->width)
583
+  if (top == 0 && left == 0 && height == pFrame->height &&
584
+      width == pFrame->width)
606 585
     return;
607 586
 
608 587
   // crop frame with help of calculated parameters
... ...
@@ -610,8 +589,7 @@ void BlinkenFrameCrop(stBlinkenFrame *pFrame, int top, int left,
610 589
                       0, 0, top, left);
611 590
 }
612 591
 
613
-void BlinkenFrameScale(stBlinkenFrame *pFrame, int height, int width)
614
-{
592
+void BlinkenFrameScale(stBlinkenFrame *pFrame, int height, int width) {
615 593
   unsigned char **ppData;
616 594
   double scaleHor, scaleVer, ox, oy, ox1, oy1, val;
617 595
   int chans, c, nx, ny, x, y, oxi, oyi, ox1i, oy1i;
... ...
@@ -635,8 +613,7 @@ void BlinkenFrameScale(stBlinkenFrame *pFrame, int height, int width)
635 613
   scaleVer = (double)height / (double)pFrame->height;
636 614
 
637 615
   // allocate new data array
638
-  ppData =
639
-      (unsigned char **)BlinkenMalloc2D(height, width * pFrame->channels,
616
+  ppData = (unsigned char **)BlinkenMalloc2D(height, width * pFrame->channels,
640 617
                                              sizeof(unsigned char));
641 618
   if (ppData == NULL)
642 619
     return;
... ...
@@ -666,10 +643,9 @@ void BlinkenFrameScale(stBlinkenFrame *pFrame, int height, int width)
666 643
             } else // one line of source pixels
667 644
             {
668 645
               val =
669
-                  (double)pFrame->ppData[oyi][oxi * chans + c] * (1 - ox +
670
-                                                                  oxi)
671
-                  + (double)pFrame->ppData[oyi][ox1i * chans + c] * (ox1 -
672
-                                                                     ox1i);
646
+                  (double)pFrame->ppData[oyi][oxi * chans + c] *
647
+                      (1 - ox + oxi) +
648
+                  (double)pFrame->ppData[oyi][ox1i * chans + c] * (ox1 - ox1i);
673 649
               for (x = oxi + 1; x < ox1i; x++)
674 650
                 val += (double)pFrame->ppData[oyi][x * chans + c];
675 651
               val /= ox1 - ox;
... ...
@@ -678,42 +654,33 @@ void BlinkenFrameScale(stBlinkenFrame *pFrame, int height, int width)
678 654
           {
679 655
             if (oxi == ox1i) {
680 656
               val =
681
-                  (double)pFrame->ppData[oyi][oxi * chans + c] * (1 - oy +
682
-                                                                  oyi)
683
-                  + (double)pFrame->ppData[oy1i][oxi * chans + c] * (oy1 -
684
-                                                                     oy1i);
657
+                  (double)pFrame->ppData[oyi][oxi * chans + c] *
658
+                      (1 - oy + oyi) +
659
+                  (double)pFrame->ppData[oy1i][oxi * chans + c] * (oy1 - oy1i);
685 660
               for (y = oyi + 1; y < oy1i; y++)
686 661
                 val += (double)pFrame->ppData[y][oxi * chans + c];
687 662
               val /= oy1 - oy;
688 663
             } else // rectangle of source pixels
689 664
             {
690
-              val =
691
-                  (double)pFrame->ppData[oyi][oxi * chans + c] * (1 - oy +
692
-                                                                  oyi) * (1 -
693
-                                                                          ox +
694
-                                                                          oxi)
695
-                  + (double)pFrame->ppData[oyi][ox1i * chans + c] * (1 - oy +
696
-                                                                     oyi) *
697
-                  (ox1 - ox1i)
698
-                  + (double)pFrame->ppData[oy1i][oxi * chans + c] * (oy1 -
699
-                                                                     oy1i) *
700
-                  (1 - ox + oxi)
701
-                  + (double)pFrame->ppData[oy1i][ox1i * chans + c] * (oy1 -
702
-                                                                      oy1i) *
703
-                  (ox1 - ox1i);
665
+              val = (double)pFrame->ppData[oyi][oxi * chans + c] *
666
+                        (1 - oy + oyi) * (1 - ox + oxi) +
667
+                    (double)pFrame->ppData[oyi][ox1i * chans + c] *
668
+                        (1 - oy + oyi) * (ox1 - ox1i) +
669
+                    (double)pFrame->ppData[oy1i][oxi * chans + c] *
670
+                        (oy1 - oy1i) * (1 - ox + oxi) +
671
+                    (double)pFrame->ppData[oy1i][ox1i * chans + c] *
672
+                        (oy1 - oy1i) * (ox1 - ox1i);
704 673
               for (y = oyi + 1; y < oy1i; y++) {
705 674
                 val +=
706
-                    (double)pFrame->ppData[y][oxi * chans + c] * (1 - ox +
707
-                                                                  oxi)
708
-                    + (double)pFrame->ppData[y][ox1i * chans + c] * (ox1 -
709
-                                                                     ox1i);
675
+                    (double)pFrame->ppData[y][oxi * chans + c] *
676
+                        (1 - ox + oxi) +
677
+                    (double)pFrame->ppData[y][ox1i * chans + c] * (ox1 - ox1i);
710 678
               }
711 679
               for (x = oxi + 1; x < ox1i; x++) {
712 680
                 val +=
713
-                    (double)pFrame->ppData[oyi][x * chans + c] * (1 - oy +
714
-                                                                  oyi)
715
-                    + (double)pFrame->ppData[oy1i][x * chans + c] * (oy1 -
716
-                                                                     oy1i);
681
+                    (double)pFrame->ppData[oyi][x * chans + c] *
682
+                        (1 - oy + oyi) +
683
+                    (double)pFrame->ppData[oy1i][x * chans + c] * (oy1 - oy1i);
717 684
               }
718 685
               for (y = oyi + 1; y < oy1i; y++)
719 686
                 for (x = oxi + 1; x < ox1i; x++)
... ...
@@ -734,8 +701,7 @@ void BlinkenFrameScale(stBlinkenFrame *pFrame, int height, int width)
734 701
 }
735 702
 
736 703
 void BlinkenFrameColorize(stBlinkenFrame *pFrame, int channels, int mode,
737
-                          int step)
738
-{
704
+                          int step) {
739 705
   unsigned char **ppData;
740 706
   int y, x, c, i, j;
741 707
   unsigned int val;
... ...
@@ -749,10 +715,8 @@ void BlinkenFrameColorize(stBlinkenFrame *pFrame, int channels, int mode,
749 715
     channels = BlinkenMaxvalMax;
750 716
 
751 717
   // allocate new data array
752
-  ppData =
753
-      (unsigned char **)BlinkenMalloc2D(pFrame->height,
754
-                                        pFrame->width * channels,
755
-                                        sizeof(unsigned char));
718
+  ppData = (unsigned char **)BlinkenMalloc2D(
719
+      pFrame->height, pFrame->width * channels, sizeof(unsigned char));
756 720
   if (ppData == NULL)
757 721
     return;
758 722
   for (y = 0; y < pFrame->height; y++)
... ...
@@ -786,9 +750,8 @@ void BlinkenFrameColorize(stBlinkenFrame *pFrame, int channels, int mode,
786 750
 }
787 751
 
788 752
 void BlinkenFrameCopyRect(stBlinkenFrame *pDest, int destY, int destX,
789
-                          stBlinkenFrame *pSrc, int srcY, int srcX,
790
-                          int height, int width)
791
-{
753
+                          stBlinkenFrame *pSrc, int srcY, int srcX, int height,
754
+                          int width) {
792 755
   int bFreeSrc = 0;
793 756
   int destI, srcI, y, x, c, dy, sy, di, si;
794 757
 
... ...
@@ -800,8 +763,8 @@ void BlinkenFrameCopyRect(stBlinkenFrame *pDest, int destY, int destX,
800 763
     pSrc = BlinkenFrameClone(pSrc);
801 764
     if (pSrc == NULL)
802 765
       return;
803
-    BlinkenFrameResize(pSrc, pSrc->height, pSrc->width,
804
-                       pDest->channels, pDest->maxval);
766
+    BlinkenFrameResize(pSrc, pSrc->height, pSrc->width, pDest->channels,
767
+                       pDest->maxval);
805 768
     bFreeSrc = 1; // source is now a temporary copy that needs to be freed
806 769
   }
807 770
 
... ...
@@ -852,8 +815,7 @@ void BlinkenFrameCopyRect(stBlinkenFrame *pDest, int destY, int destX,
852 815
     BlinkenFrameFree(pSrc);
853 816
 }
854 817
 
855
-void BlinkenFrameRotateCw(stBlinkenFrame *pFrame)
856
-{
818
+void BlinkenFrameRotateCw(stBlinkenFrame *pFrame) {
857 819
   int height, width, channels, y, x, c, i, j;
858 820
   unsigned char **ppData;
859 821
 
... ...
@@ -864,8 +826,7 @@ void BlinkenFrameRotateCw(stBlinkenFrame *pFrame)
864 826
   height = pFrame->width;
865 827
   width = pFrame->height;
866 828
   channels = pFrame->channels;
867
-  ppData =
868
-      (unsigned char **)BlinkenMalloc2D(height, width * channels,
829
+  ppData = (unsigned char **)BlinkenMalloc2D(height, width * channels,
869 830
                                              sizeof(unsigned char));
870 831
   if (ppData == NULL)
871 832
     return;
... ...
@@ -886,8 +847,7 @@ void BlinkenFrameRotateCw(stBlinkenFrame *pFrame)
886 847
   pFrame->ppData = ppData;
887 848
 }
888 849
 
889
-void BlinkenFrameRotateCcw(stBlinkenFrame *pFrame)
890
-{
850
+void BlinkenFrameRotateCcw(stBlinkenFrame *pFrame) {
891 851
   int height, width, channels, y, x, c, i, j;
892 852
   unsigned char **ppData;
893 853
 
... ...
@@ -898,8 +858,7 @@ void BlinkenFrameRotateCcw(stBlinkenFrame *pFrame)
898 858
   height = pFrame->width;
899 859
   width = pFrame->height;
900 860
   channels = pFrame->channels;
901
-  ppData =
902
-      (unsigned char **)BlinkenMalloc2D(height, width * channels,
861
+  ppData = (unsigned char **)BlinkenMalloc2D(height, width * channels,
903 862
                                              sizeof(unsigned char));
904 863
   if (ppData == NULL)
905 864
     return;
... ...
@@ -920,16 +879,15 @@ void BlinkenFrameRotateCcw(stBlinkenFrame *pFrame)
920 879
   pFrame->ppData = ppData;
921 880
 }
922 881
 
923
-void BlinkenFrameRotateHalf(stBlinkenFrame *pFrame)
924
-{
882
+void BlinkenFrameRotateHalf(stBlinkenFrame *pFrame) {
925 883
   int y1, y2, x1, x2, c, i1, i2;
926 884
 
927 885
   if (pFrame == NULL)
928 886
     return;
929 887
 
930 888
   for (y1 = 0, y2 = pFrame->height - 1; y1 < pFrame->height; y1++, y2--) {
931
-    for (x1 = 0, x2 = pFrame->width - 1,
932
-         i1 = 0, i2 = (pFrame->width - 1) * pFrame->channels;
889
+    for (x1 = 0, x2 = pFrame->width - 1, i1 = 0,
890
+        i2 = (pFrame->width - 1) * pFrame->channels;
933 891
          x1 < pFrame->width / 2; x1++, x2--, i2 -= 2 * pFrame->channels) {
934 892
       for (c = 0; c < pFrame->channels; c++, i1++, i2++) {
935 893
         unsigned char tmp = pFrame->ppData[y1][i1];
... ...
@@ -940,16 +898,15 @@ void BlinkenFrameRotateHalf(stBlinkenFrame *pFrame)
940 898
   }
941 899
 }
942 900
 
943
-void BlinkenFrameMirrorHor(stBlinkenFrame *pFrame)
944
-{
901
+void BlinkenFrameMirrorHor(stBlinkenFrame *pFrame) {
945 902
   int y, x1, x2, c, i1, i2;
946 903
 
947 904
   if (pFrame == NULL)
948 905
     return;
949 906
 
950 907
   for (y = 0; y < pFrame->height; y++) {
951
-    for (x1 = 0, x2 = pFrame->width - 1,
952
-         i1 = 0, i2 = (pFrame->width - 1) * pFrame->channels;
908
+    for (x1 = 0, x2 = pFrame->width - 1, i1 = 0,
909
+        i2 = (pFrame->width - 1) * pFrame->channels;
953 910
          x1 < pFrame->width / 2; x1++, x2--, i2 -= 2 * pFrame->channels) {
954 911
       for (c = 0; c < pFrame->channels; c++, i1++, i2++) {
955 912
         unsigned char tmp = pFrame->ppData[y][i1];
... ...
@@ -960,8 +917,7 @@ void BlinkenFrameMirrorHor(stBlinkenFrame *pFrame)
960 917
   }
961 918
 }
962 919
 
963
-void BlinkenFrameMirrorVer(stBlinkenFrame *pFrame)
964
-{
920
+void BlinkenFrameMirrorVer(stBlinkenFrame *pFrame) {
965 921
   int y1, y2, x, c, i;
966 922
 
967 923
   if (pFrame == NULL)
... ...
@@ -978,8 +934,7 @@ void BlinkenFrameMirrorVer(stBlinkenFrame *pFrame)
978 934
   }
979 935
 }
980 936
 
981
-void BlinkenFrameMirrorDiag(stBlinkenFrame *pFrame)
982
-{
937
+void BlinkenFrameMirrorDiag(stBlinkenFrame *pFrame) {
983 938
   int height, width, channels, y, x, c, i, j;
984 939
   unsigned char **ppData;
985 940
 
... ...
@@ -990,8 +945,7 @@ void BlinkenFrameMirrorDiag(stBlinkenFrame *pFrame)
990 945
   height = pFrame->width;
991 946
   width = pFrame->height;
992 947
   channels = pFrame->channels;
993
-  ppData =
994
-      (unsigned char **)BlinkenMalloc2D(height, width * channels,
948
+  ppData = (unsigned char **)BlinkenMalloc2D(height, width * channels,
995 949
                                              sizeof(unsigned char));
996 950
   if (ppData == NULL)
997 951
     return;
... ...
@@ -1012,8 +966,7 @@ void BlinkenFrameMirrorDiag(stBlinkenFrame *pFrame)
1012 966
   pFrame->ppData = ppData;
1013 967
 }
1014 968
 
1015
-void BlinkenFrameMirrorDiag2(stBlinkenFrame *pFrame)
1016
-{
969
+void BlinkenFrameMirrorDiag2(stBlinkenFrame *pFrame) {
1017 970
   int height, width, channels, y, x, c, i, j;
1018 971
   unsigned char **ppData;
1019 972
 
... ...
@@ -1024,8 +977,7 @@ void BlinkenFrameMirrorDiag2(stBlinkenFrame *pFrame)
1024 977
   height = pFrame->width;
1025 978
   width = pFrame->height;
1026 979
   channels = pFrame->channels;
1027
-  ppData =
1028
-      (unsigned char **)BlinkenMalloc2D(height, width * channels,
980
+  ppData = (unsigned char **)BlinkenMalloc2D(height, width * channels,
1029 981
                                              sizeof(unsigned char));
1030 982
   if (ppData == NULL)
1031 983
     return;
... ...
@@ -1046,8 +998,7 @@ void BlinkenFrameMirrorDiag2(stBlinkenFrame *pFrame)
1046 998
   pFrame->ppData = ppData;
1047 999
 }
1048 1000
 
1049
-char *BlinkenFrameToString(stBlinkenFrame *pFrame)
1050
-{
1001
+char *BlinkenFrameToString(stBlinkenFrame *pFrame) {
1051 1002
   int size, y, x, c, i;
1052 1003
   char *str, *ptr;
1053 1004
   unsigned long val;
... ...
@@ -1097,14 +1048,14 @@ int BlinkenFrameToNetwork(stBlinkenFrame *pFrame, etBlinkenProto proto,
1097 1048
 
1098 1049
   case BlinkenProtoBlp:
1099 1050
     // buffer too short
1100
-    if (maxLength < (int)sizeof(stBlinkenProtoBlpHdr) + pFrame->height * pFrame->width)
1051
+    if (maxLength <
1052
+        (int)sizeof(stBlinkenProtoBlpHdr) + pFrame->height * pFrame->width)
1101 1053
       return -1;
1102 1054
     // build header
1103 1055
     ((stBlinkenProtoBlpHdr *)pData)->magic = htonl(BlinkenProtoBlpMagic);
1104 1056
     ((stBlinkenProtoBlpHdr *)pData)->frameNo = htonl(0);
1105 1057
     ((stBlinkenProtoBlpHdr *)pData)->width = htons((uint16_t)pFrame->width);
1106
-    ((stBlinkenProtoBlpHdr *) pData)->height =
1107
-        htons((uint16_t) pFrame->height);
1058
+    ((stBlinkenProtoBlpHdr *)pData)->height = htons((uint16_t)pFrame->height);
1108 1059
     i = sizeof(stBlinkenProtoBlpHdr); // put data into packet
1109 1060
     for (y = 0; y < pFrame->height; y++) {
1110 1061
       for (x = 0, j = 0; x < pFrame->width; x++, i++) {
... ...
@@ -1119,15 +1070,14 @@ int BlinkenFrameToNetwork(stBlinkenFrame *pFrame, etBlinkenProto proto,
1119 1070
 
1120 1071
   case BlinkenProtoEblp:
1121 1072
     // buffer too short
1122
-    if (maxLength < (int)sizeof(stBlinkenProtoEblpHdr) + pFrame->height * pFrame->width)
1073
+    if (maxLength <
1074
+        (int)sizeof(stBlinkenProtoEblpHdr) + pFrame->height * pFrame->width)
1123 1075
       return -1;
1124 1076
     // build header
1125 1077
     ((stBlinkenProtoEblpHdr *)pData)->magic = htonl(BlinkenProtoEblpMagic);
1126 1078
     ((stBlinkenProtoEblpHdr *)pData)->frameNo = htonl(0);
1127
-    ((stBlinkenProtoEblpHdr *) pData)->width =
1128
-        htons((uint16_t) pFrame->width);
1129
-    ((stBlinkenProtoEblpHdr *) pData)->height =
1130
-        htons((uint16_t) pFrame->height);
1079
+    ((stBlinkenProtoEblpHdr *)pData)->width = htons((uint16_t)pFrame->width);
1080
+    ((stBlinkenProtoEblpHdr *)pData)->height = htons((uint16_t)pFrame->height);
1131 1081
     i = sizeof(stBlinkenProtoEblpHdr); // put data into packet
1132 1082
     for (y = 0; y < pFrame->height; y++) {
1133 1083
       for (x = 0, j = 0; x < pFrame->width; x++, i++) {
... ...
@@ -1135,7 +1085,8 @@ int BlinkenFrameToNetwork(stBlinkenFrame *pFrame, etBlinkenProto proto,
1135 1085
         for (c = 0; c < pFrame->channels; c++, j++)
1136 1086
           val += pFrame->ppData[y][j];
1137 1087
         val /= pFrame->channels;
1138
-        pData[i] = (pFrame->maxval == 255 ? (unsigned char)val
1088
+        pData[i] = (pFrame->maxval == 255
1089
+                        ? (unsigned char)val
1139 1090
                         : (unsigned char)((val * 255 + pFrame->maxval / 2) /
1140 1091
                                           pFrame->maxval));
1141 1092
       }
... ...
@@ -1144,18 +1095,16 @@ int BlinkenFrameToNetwork(stBlinkenFrame *pFrame, etBlinkenProto proto,
1144 1095
 
1145 1096
   case BlinkenProtoMcuf:
1146 1097
     // buffer too short
1147
-    if (maxLength < (int)sizeof(stBlinkenProtoMcufHdr) + pFrame->height * pFrame->width * pFrame->channels)
1098
+    if (maxLength < (int)sizeof(stBlinkenProtoMcufHdr) +
1099
+                        pFrame->height * pFrame->width * pFrame->channels)
1148 1100
       return -1;
1149 1101
     // build header
1150 1102
     ((stBlinkenProtoMcufHdr *)pData)->magic = htonl(BlinkenProtoMcufMagic);
1151
-    ((stBlinkenProtoMcufHdr *) pData)->height =
1152
-        htons((uint16_t) pFrame->height);
1153
-    ((stBlinkenProtoMcufHdr *) pData)->width =
1154
-        htons((uint16_t) pFrame->width);
1103
+    ((stBlinkenProtoMcufHdr *)pData)->height = htons((uint16_t)pFrame->height);
1104
+    ((stBlinkenProtoMcufHdr *)pData)->width = htons((uint16_t)pFrame->width);
1155 1105
     ((stBlinkenProtoMcufHdr *)pData)->channels =
1156 1106
         htons((uint16_t)pFrame->channels);
1157
-    ((stBlinkenProtoMcufHdr *) pData)->maxval =
1158
-        htons((uint16_t) pFrame->maxval);
1107
+    ((stBlinkenProtoMcufHdr *)pData)->maxval = htons((uint16_t)pFrame->maxval);
1159 1108
     i = sizeof(stBlinkenProtoMcufHdr); // put data into packet
1160 1109
     for (y = 0; y < pFrame->height; y++)
1161 1110
       for (x = 0, j = 0; x < pFrame->width; x++)
... ...
@@ -1177,8 +1125,7 @@ stBlinkenFrame *BlinkenFrameFromNetwork(const char *pData, int length,
1177 1125
   int height, width, channels, maxval, y, x, c, i, j;
1178 1126
 
1179 1127
   if (length >= (int)sizeof(stBlinkenProtoBlpHdr) &&
1180
-      ((stBlinkenProtoBlpHdr *) pData)->magic == htonl(BlinkenProtoBlpMagic))
1181
-  {
1128
+      ((stBlinkenProtoBlpHdr *)pData)->magic == htonl(BlinkenProtoBlpMagic)) {
1182 1129
     if (pProto != NULL) // return protocol
1183 1130
       *pProto = BlinkenProtoBlp;
1184 1131
     // get header data
... ...
@@ -1204,8 +1151,7 @@ stBlinkenFrame *BlinkenFrameFromNetwork(const char *pData, int length,
1204 1151
   }
1205 1152
 
1206 1153
   if (length >= (int)sizeof(stBlinkenProtoEblpHdr) &&
1207
-      ((stBlinkenProtoEblpHdr *) pData)->magic ==
1208
-      htonl(BlinkenProtoEblpMagic)) {
1154
+      ((stBlinkenProtoEblpHdr *)pData)->magic == htonl(BlinkenProtoEblpMagic)) {
1209 1155
     if (pProto != NULL) // return protocol
1210 1156
       *pProto = BlinkenProtoEblp;
1211 1157
     // get header data
... ...
@@ -1231,8 +1177,7 @@ stBlinkenFrame *BlinkenFrameFromNetwork(const char *pData, int length,
1231 1177
   }
1232 1178
 
1233 1179
   if (length >= (int)sizeof(stBlinkenProtoMcufHdr) &&
1234
-      ((stBlinkenProtoMcufHdr *) pData)->magic ==
1235
-      htonl(BlinkenProtoMcufMagic)) {
1180
+      ((stBlinkenProtoMcufHdr *)pData)->magic == htonl(BlinkenProtoMcufMagic)) {
1236 1181
     if (pProto != NULL) // return protocol
1237 1182
       *pProto = BlinkenProtoMcuf;
1238 1183
     // get header data
... ...
@@ -6,9 +6,9 @@
6 6
 #include <gif_lib.h>
7 7
 #include <stdlib.h>
8 8
 
9
-#include <BlinkenLib/config.h>
10 9
 #include <BlinkenLib/BlinkenFrame.h>
11 10
 #include <BlinkenLib/BlinkenMovie.h>
11
+#include <BlinkenLib/config.h>
12 12
 
13 13
 #include "BlinkenConstants.h"
14 14
 #include "BlinkenGif.h"
... ...
@@ -22,8 +22,7 @@
22 22
 // get color from GIF color map
23 23
 static void BlinkenGifGetColor(ColorMapObject *pMap, int idx, int transparent,
24 24
                                unsigned char *r, unsigned char *g,
25
-                               unsigned char *b, unsigned char *t)
26
-{
25
+                               unsigned char *b, unsigned char *t) {
27 26
   if (transparent >= 0 && idx == transparent) {
28 27
     *t = 1;
29 28
   } else {
... ...
@@ -50,8 +49,7 @@ static void BlinkenGifGetColor(ColorMapObject *pMap, int idx, int transparent,
50 49
 
51 50
 // set pixel to GIF color
52 51
 static void BlinkenGifSetPixel(ColorMapObject *pMap, int idx, int transparent,
53
-                               stBlinkenFrame *pFrame, int y, int x)
54
-{
52
+                               stBlinkenFrame *pFrame, int y, int x) {
55 53
   unsigned char r, g, b, t;
56 54
 
57 55
   if (pFrame != NULL) {
... ...
@@ -65,17 +63,17 @@ static void BlinkenGifSetPixel(ColorMapObject *pMap, int idx, int transparent,
65 63
 }
66 64
 
67 65
 // load a GIF file as BlinkenMovie
68
-stBlinkenMovie *BlinkenGifLoad(const char *pFilename)
69
-{
66
+stBlinkenMovie *BlinkenGifLoad(const char *pFilename) {
70 67
   GifFileType *gif;
71
-  struct sPass { int ofs, stride; };
68
+  struct sPass {
69
+    int ofs, stride;
70
+  };
72 71
   static struct sPass const passes_linear[] = {{0, 1}, {0, 0}};
73 72
   static struct sPass const passes_interlaced[] = {
74
-    { 0, 8 }, { 4, 8 }, { 2, 4 }, { 1, 2 }
75
-  };
73
+      {0, 8}, {4, 8}, {2, 4}, {1, 2}};
76 74
   struct sPass const *pass;
77
-  int height, width, frameCnt, frameIdx, i, y, x, y1, x1,
78
-      bg, disposal, delay, transp, idx;
75
+  int height, width, frameCnt, frameIdx, i, y, x, y1, x1, bg, disposal, delay,
76
+      transp, idx;
79 77
   ColorMapObject *pGlobalMap, *pMap;
80 78
   SavedImage *pImg;
81 79
   GifImageDesc *pDesc;
... ...
@@ -158,8 +156,8 @@ stBlinkenMovie *BlinkenGifLoad(const char *pFilename)
158 156
     }
159 157
     for (pass = pDesc->Interlace ? passes_interlaced : passes_linear;
160 158
          pass->stride > 0; ++pass) {
161
-      for (y = pass->ofs, y1 = pDesc->Top + pass->ofs, i = 0;
162
-           y < pDesc->Height; y += pass->stride, y1 += pass->stride) {
159
+      for (y = pass->ofs, y1 = pDesc->Top + pass->ofs, i = 0; y < pDesc->Height;
160
+           y += pass->stride, y1 += pass->stride) {
163 161
         for (x = 0, x1 = pDesc->Left; x < pDesc->Width; ++x, ++x1, ++i) {
164 162
           idx = pImg->RasterBits[i];
165 163
           switch (disposal) {
... ...
@@ -206,11 +204,10 @@ stBlinkenMovie *BlinkenGifLoad(const char *pFilename)
206 204
   return pMovie;
207 205
 }
208 206
 
209
-int BlinkenGifSave(stBlinkenMovie *pMovie, const char *pFilename)
210
-{
207
+int BlinkenGifSave(stBlinkenMovie *pMovie, const char *pFilename) {
211 208
   GifFileType *gif;
212
-  int frameCnt, height, width, channels, maxval, channels_new, maxval_new,
213
-      r, g, b, i, frame, y, x, c, y1, x1, y2, x2, v, ret;
209
+  int frameCnt, height, width, channels, maxval, channels_new, maxval_new, r, g,
210
+      b, i, frame, y, x, c, y1, x1, y2, x2, v, ret;
214 211
   unsigned int delay;
215 212
   stBlinkenMovie *pOutMovie;
216 213
   stBlinkenFrame *pFrame, *pLast;
... ...
@@ -236,10 +233,18 @@ int BlinkenGifSave(stBlinkenMovie *pMovie, const char *pFilename)
236 233
   else
237 234
     channels_new = channels;
238 235
   switch (channels) {
239
-    case 1:  maxval_new = 255; break;
240
-    case 2:  maxval_new = 15;  break;
241
-    case 3:  maxval_new = 5;   break;
242
-    default: maxval_new = 255; break;
236
+  case 1:
237
+    maxval_new = 255;
238
+    break;
239
+  case 2:
240
+    maxval_new = 15;
241
+    break;
242
+  case 3:
243
+    maxval_new = 5;
244
+    break;
245
+  default:
246
+    maxval_new = 255;
247
+    break;
243 248
   }
244 249
   pOutMovie = BlinkenMovieClone(pMovie);
245 250
   if (pOutMovie == NULL)
... ...
@@ -308,7 +313,8 @@ int BlinkenGifSave(stBlinkenMovie *pMovie, const char *pFilename)
308 313
       for (g = 0; g <= maxval; ++g) {
309 314
         for (r = 0; r <= maxval; ++r) {
310 315
           gif->SColorMap->Colors[i].Red = ((int)r * 255 + maxval / 2) / maxval;
311
-            gif->SColorMap->Colors[i].Green = ((int)g * 255 + maxval / 2) / maxval;
316
+          gif->SColorMap->Colors[i].Green =
317
+              ((int)g * 255 + maxval / 2) / maxval;
312 318
           gif->SColorMap->Colors[i].Blue = ((int)b * 255 + maxval / 2) / maxval;
313 319
           ++i;
314 320
         }
... ...
@@ -351,10 +357,14 @@ int BlinkenGifSave(stBlinkenMovie *pMovie, const char *pFilename)
351 357
               break;
352 358
           }
353 359
           if (c < channels) { // change detected at x,y
354
-            if (y < y1) y1 = y;
355
-            if (x < x1) x1 = x;
356
-            if (y > y2) y2 = y;
357
-            if (x > x2) x2 = x;
360
+            if (y < y1)
361
+              y1 = y;
362
+            if (x < x1)
363
+              x1 = x;
364
+            if (y > y2)
365
+              y2 = y;
366
+            if (x > x2)
367
+              x2 = x;
358 368
           }
359 369
         } // for x
360 370
       }   // for y
... ...
@@ -382,8 +392,8 @@ int BlinkenGifSave(stBlinkenMovie *pMovie, const char *pFilename)
382 392
     pDesc->ColorMap = NULL;
383 393
 
384 394
     // allocate pixel buffer
385
-    pImg->RasterBits = calloc(pDesc->Width * pDesc->Height,
386
-                              sizeof(unsigned char));
395
+    pImg->RasterBits =
396
+        calloc(pDesc->Width * pDesc->Height, sizeof(unsigned char));
387 397
     if (pImg->RasterBits == NULL) {
388 398
       EGifCloseFile(gif GIF5_err);
389 399
       BlinkenMovieFree(pOutMovie);
... ...
@@ -6,9 +6,9 @@
6 6
 #ifndef INC_BlinkenLib_BlinkenGif
7 7
 #define INC_BlinkenLib_BlinkenGif
8 8
 
9
-#include <BlinkenLib/config.h>
10 9
 #include <BlinkenLib/BlinkenFrame.h>
11 10
 #include <BlinkenLib/BlinkenMovie.h>
11
+#include <BlinkenLib/config.h>
12 12
 
13 13
 #ifndef BLINKENLIB_CFG_GIF
14 14
 #error This file is to be used for GIF support only.
... ...
@@ -16,9 +16,9 @@
16 16
 #define MNG_SUPPORT_WRITE
17 17
 #include <libmng.h>
18 18
 
19
-#include <BlinkenLib/config.h>
20 19
 #include <BlinkenLib/BlinkenFrame.h>
21 20
 #include <BlinkenLib/BlinkenMovie.h>
21
+#include <BlinkenLib/config.h>
22 22
 
23 23
 #include "BlinkenConstants.h"
24 24
 #include "BlinkenMng.h"
... ...
@@ -36,33 +36,28 @@ typedef struct _BlMng_userdata {
36 36
   stBlinkenMovie *movie; // movie being created
37 37
 } BlMng_userdata;
38 38
 
39
-mng_ptr BlMng_alloc(mng_size_t iSize)
40
-{
39
+mng_ptr BlMng_alloc(mng_size_t iSize) {
41 40
   void *ptr = malloc(iSize);
42 41
   if (ptr != NULL)
43 42
     memset(ptr, 0, iSize);
44 43
   return (mng_ptr)ptr;
45 44
 }
46 45
 
47
-void BlMng_free(mng_ptr pPtr, mng_size_t __attribute__ ((unused)) iSize)
48
-{
46
+void BlMng_free(mng_ptr pPtr, mng_size_t __attribute__((unused)) iSize) {
49 47
   free(pPtr);
50 48
 }
51 49
 
52
-mng_bool BlMng_openstream(mng_handle __attribute__ ((unused)) hMNG)
53
-{
50
+mng_bool BlMng_openstream(mng_handle __attribute__((unused)) hMNG) {
54 51
   return MNG_TRUE;
55 52
 }
56 53
 
57
-mng_bool BlMng_closestream(mng_handle __attribute__ ((unused)) hMNG)
58
-{
54
+mng_bool BlMng_closestream(mng_handle __attribute__((unused)) hMNG) {
59 55
   return MNG_TRUE;
60 56
 }
61 57
 
62 58
 // read data from the open file
63 59
 mng_bool BlMng_readdata(mng_handle hMNG, mng_ptr pBuf, mng_uint32 iSize,
64
-                        mng_uint32 * iRead)
65
-{
60
+                        mng_uint32 *iRead) {
66 61
   BlMng_userdata *data = (BlMng_userdata *)mng_get_userdata(hMNG);
67 62
   *iRead = fread(pBuf, 1, iSize, data->hFile);
68 63
   return MNG_TRUE;
... ...
@@ -70,8 +65,7 @@ mng_bool BlMng_readdata(mng_handle hMNG, mng_ptr pBuf, mng_uint32 iSize,
70 65
 
71 66
 // write data to the open file
72 67
 mng_bool BlMng_writedata(mng_handle hMNG, mng_ptr pBuf, mng_uint32 iSize,
73
-                         mng_uint32 * iWritten)
74
-{
68
+                         mng_uint32 *iWritten) {
75 69
   BlMng_userdata *data = (BlMng_userdata *)mng_get_userdata(hMNG);
76 70
   *iWritten = fwrite(pBuf, 1, iSize, data->hFile);
77 71
   return MNG_TRUE;
... ...
@@ -79,8 +73,7 @@ mng_bool BlMng_writedata(mng_handle hMNG, mng_ptr pBuf, mng_uint32 iSize,
79 73
 
80 74
 // MNG library has processed the header information
81 75
 mng_bool BlMng_processheader(mng_handle hMNG, mng_uint32 iWidth,
82
-                             mng_uint32 iHeight)
83
-{
76
+                             mng_uint32 iHeight) {
84 77
   BlMng_userdata *data = (BlMng_userdata *)mng_get_userdata(hMNG);
85 78
 
86 79
   // free old canvas (in case there is already one)
... ...
@@ -113,8 +106,7 @@ mng_bool BlMng_processheader(mng_handle hMNG, mng_uint32 iWidth,
113 106
 }
114 107
 
115 108
 // get access to a line of the canvas
116
-mng_ptr BlMng_getcanvasline(mng_handle hMNG, mng_uint32 iLinenr)
117
-{
109
+mng_ptr BlMng_getcanvasline(mng_handle hMNG, mng_uint32 iLinenr) {
118 110
   BlMng_userdata *data = (BlMng_userdata *)mng_get_userdata(hMNG);
119 111
 
120 112
   // return pointer to line
... ...
@@ -125,20 +117,18 @@ mng_ptr BlMng_getcanvasline(mng_handle hMNG, mng_uint32 iLinenr)
125 117
 }
126 118
 
127 119
 // the MNG library thinks that (a part of) the canvas should be shown
128
-mng_bool BlMng_refresh(mng_handle __attribute__ ((unused)) hMNG, mng_uint32
129
-                       __attribute__ ((unused)) iX, mng_uint32
130
-                       __attribute__ ((unused)) iY, mng_uint32
131
-                       __attribute__ ((unused)) iWidth, mng_uint32
132
-                       __attribute__ ((unused)) iHeight)
133
-{
120
+mng_bool BlMng_refresh(mng_handle __attribute__((unused)) hMNG,
121
+                       mng_uint32 __attribute__((unused)) iX,
122
+                       mng_uint32 __attribute__((unused)) iY,
123
+                       mng_uint32 __attribute__((unused)) iWidth,
124
+                       mng_uint32 __attribute__((unused)) iHeight) {
134 125
   // nothing to do here for BlinkenLib as we are only converting and not
135 126
   // displaying
136 127
   return MNG_TRUE;
137 128
 }
138 129
 
139 130
 // the MNG library want to know how many milliseconds have passed
140
-mng_uint32 BlMng_gettickcount(mng_handle hMNG)
141
-{
131
+mng_uint32 BlMng_gettickcount(mng_handle hMNG) {
142 132
   BlMng_userdata *data = (BlMng_userdata *)mng_get_userdata(hMNG);
143 133
 
144 134
   // just return the current number of milliseconds (only converting, do not
... ...
@@ -147,8 +137,7 @@ mng_uint32 BlMng_gettickcount(mng_handle hMNG)
147 137
 }
148 138
 
149 139
 // the MNG library wants to be be called again after some milliseconds
150
-mng_bool BlMng_settimer(mng_handle hMNG, mng_uint32 iMsecs)
151
-{
140
+mng_bool BlMng_settimer(mng_handle hMNG, mng_uint32 iMsecs) {
152 141
   BlMng_userdata *data = (BlMng_userdata *)mng_get_userdata(hMNG);
153 142
 
154 143
   // just remember the number of milliseconds
... ...
@@ -160,8 +149,7 @@ mng_bool BlMng_settimer(mng_handle hMNG, mng_uint32 iMsecs)
160 149
 // save as new frame to current movie
161 150
 void BlMng_save_frame(stBlinkenMovie *movie, unsigned int msec,
162 151
                       unsigned int width, unsigned int height,
163
-                      unsigned char *data)
164
-{
152
+                      unsigned char *data) {
165 153
   stBlinkenFrame *frame;
166 154
   unsigned int c, x, y;
167 155
 
... ...
@@ -191,8 +179,7 @@ void BlMng_save_frame(stBlinkenMovie *movie, unsigned int msec,
191 179
 
192 180
 // compress pixel data in a frame
193 181
 void BlMng_compress_frame(stBlinkenFrame *frame, unsigned char **p_out_ptr,
194
-                          unsigned int *p_out_len)
195
-{
182
+                          unsigned int *p_out_len) {
196 183
   unsigned int width = BlinkenFrameGetWidth(frame);
197 184
   unsigned int height = BlinkenFrameGetHeight(frame);
198 185
   // channels is always 3, maxval is always 255 - this function is only
... ...
@@ -233,8 +220,7 @@ void BlMng_compress_frame(stBlinkenFrame *frame, unsigned char **p_out_ptr,
233 220
 }
234 221
 
235 222
 // load a MNG file as BlinkenMovie
236
-stBlinkenMovie *BlinkenMngLoad(const char *pFilename)
237
-{
223
+stBlinkenMovie *BlinkenMngLoad(const char *pFilename) {
238 224
   BlMng_userdata *data;
239 225
   mng_handle hMNG;
240 226
   stBlinkenMovie *movie = NULL;
... ...
@@ -256,8 +242,7 @@ stBlinkenMovie *BlinkenMngLoad(const char *pFilename)
256 242
     if (data->hFile != NULL) {
257 243
 
258 244
       // initialize MNG library
259
-      hMNG =
260
-          mng_initialize((mng_ptr) data, BlMng_alloc, BlMng_free, MNG_NULL);
245
+      hMNG = mng_initialize((mng_ptr)data, BlMng_alloc, BlMng_free, MNG_NULL);
261 246
       if (hMNG) {
262 247
 
263 248
         // set MNG callbacks
... ...
@@ -369,8 +354,7 @@ stBlinkenMovie *BlinkenMngLoad(const char *pFilename)
369 354
   return movie;
370 355
 }
371 356
 
372
-int BlinkenMngSave(stBlinkenMovie *pMovie, const char *pFilename)
373
-{
357
+int BlinkenMngSave(stBlinkenMovie *pMovie, const char *pFilename) {
374 358
   BlMng_userdata *data;
375 359
   mng_handle hMNG;
376 360
   int b_success = 0;
... ...
@@ -397,8 +381,7 @@ int BlinkenMngSave(stBlinkenMovie *pMovie, const char *pFilename)
397 381
       if (data->hFile != NULL) {
398 382
 
399 383
         // initialize MNG library
400
-        hMNG =
401
-            mng_initialize((mng_ptr) data, BlMng_alloc, BlMng_free, MNG_NULL);
384
+        hMNG = mng_initialize((mng_ptr)data, BlMng_alloc, BlMng_free, MNG_NULL);
402 385
         if (hMNG) {
403 386
 
404 387
           // set MNG callbacks
... ...
@@ -417,7 +400,8 @@ int BlinkenMngSave(stBlinkenMovie *pMovie, const char *pFilename)
417 400
                 unsigned int frame_no;
418 401
 
419 402
                 // write MG header chunks
420
-                if (mng_putchunk_mhdr(hMNG, data->width, data->height,  // dimensions
403
+                if (mng_putchunk_mhdr(
404
+                        hMNG, data->width, data->height,    // dimensions
421 405
                         1000, 0, frame_cnt, total_duration, // ticks
422 406
                                                             //
423 407
                         //
... ...
@@ -430,7 +414,8 @@ int BlinkenMngSave(stBlinkenMovie *pMovie, const char *pFilename)
430 414
                         // frame
431 415
                         // count,
432 416
                         // duration
433
-                                      MNG_SIMPLICITY_VALID | MNG_SIMPLICITY_SIMPLEFEATURES | MNG_SIMPLICITY_COMPLEXFEATURES     // simplicity
417
+                        MNG_SIMPLICITY_VALID | MNG_SIMPLICITY_SIMPLEFEATURES |
418
+                            MNG_SIMPLICITY_COMPLEXFEATURES // simplicity
434 419
                         ) != 0)
435 420
                   break;
436 421
 
... ...
@@ -443,7 +428,8 @@ int BlinkenMngSave(stBlinkenMovie *pMovie, const char *pFilename)
443 428
                 // - this is needed to preserve duration of last frame
444 429
                 // - this results in a black frame with 1ms duration at the
445 430
                 // end of the MNG as side effect
446
-                if (mng_putchunk_term(hMNG, MNG_TERMACTION_CLEAR, MNG_ITERACTION_CLEAR, // show 
431
+                if (mng_putchunk_term(hMNG, MNG_TERMACTION_CLEAR,
432
+                                      MNG_ITERACTION_CLEAR, // show
447 433
                                                             //
448 434
                                       //
449 435
                                       //
... ...
@@ -467,15 +453,17 @@ int BlinkenMngSave(stBlinkenMovie *pMovie, const char *pFilename)
467 453
                   // get current frame
468 454
                   stBlinkenFrame *frame =
469 455
                       BlinkenMovieGetFrame(data->movie, frame_no);
470
-                  unsigned int frame_duration =
471
-                      BlinkenFrameGetDuration(frame);
456
+                  unsigned int frame_duration = BlinkenFrameGetDuration(frame);
472 457
 
473 458
                   // write MNG frame header chunks
474 459
                   if (mng_putchunk_seek(hMNG, 0, MNG_NULL // no name
475 460
                                         ) != 0)
476 461
                     break;
477 462
 
478
-                  if (mng_putchunk_fram(hMNG, MNG_FALSE, frame_no == 0 ? MNG_FRAMINGMODE_1 : MNG_FRAMINGMODE_NOCHANGE,  // empty, 
463
+                  if (mng_putchunk_fram(
464
+                          hMNG, MNG_FALSE,
465
+                          frame_no == 0 ? MNG_FRAMINGMODE_1
466
+                                        : MNG_FRAMINGMODE_NOCHANGE, // empty,
479 467
                                                                     //
480 468
                           //
481 469
                           //
... ...
@@ -483,7 +471,9 @@ int BlinkenMngSave(stBlinkenMovie *pMovie, const char *pFilename)
483 471
                           //
484 472
                           // mode
485 473
                           0, MNG_NULL, // frame name
486
-                                        MNG_CHANGEDELAY_DEFAULT, MNG_CHANGETIMOUT_NO, MNG_CHANGECLIPPING_NO, MNG_CHANGESYNCID_NO,       // changing 
474
+                          MNG_CHANGEDELAY_DEFAULT, MNG_CHANGETIMOUT_NO,
475
+                          MNG_CHANGECLIPPING_NO,
476
+                          MNG_CHANGESYNCID_NO, // changing
487 477
                                                //
488 478
                           //
489 479
                           //
... ...
@@ -504,7 +494,8 @@ int BlinkenMngSave(stBlinkenMovie *pMovie, const char *pFilename)
504 494
                           ) != 0)
505 495
                     break;
506 496
 
507
-                  if (mng_putchunk_defi(hMNG, 0, MNG_DONOTSHOW_VISIBLE, MNG_ABSTRACT,   // no 
497
+                  if (mng_putchunk_defi(hMNG, 0, MNG_DONOTSHOW_VISIBLE,
498
+                                        MNG_ABSTRACT, // no
508 499
                                                       //
509 500
                                         //
510 501
                                         //
... ...
@@ -519,7 +510,8 @@ int BlinkenMngSave(stBlinkenMovie *pMovie, const char *pFilename)
519 510
                                         ) != 0)
520 511
                     break;
521 512
 
522
-                  if (mng_putchunk_ihdr(hMNG, data->width, data->height, 8, MNG_COLORTYPE_RGB,  // dimensions 
513
+                  if (mng_putchunk_ihdr(hMNG, data->width, data->height, 8,
514
+                                        MNG_COLORTYPE_RGB, // dimensions
523 515
                                                            //
524 516
                                         //
525 517
                                         //
... ...
@@ -529,7 +521,9 @@ int BlinkenMngSave(stBlinkenMovie *pMovie, const char *pFilename)
529 521
                                         // 8
530 522
                                         // bit
531 523
                                         // RGB
532
-                                        MNG_COMPRESSION_DEFLATE, MNG_FILTER_ADAPTIVE, MNG_INTERLACE_NONE        // deflate 
524
+                                        MNG_COMPRESSION_DEFLATE,
525
+                                        MNG_FILTER_ADAPTIVE,
526
+                                        MNG_INTERLACE_NONE // deflate
533 527
                                                            //
534 528
                                                            //
535 529
                                                            //
... ...
@@ -552,8 +546,7 @@ int BlinkenMngSave(stBlinkenMovie *pMovie, const char *pFilename)
552 546
                     BlMng_compress_frame(frame, &ptr, &len);
553 547
 
554 548
                     iRC =
555
-                        mng_putchunk_idat(hMNG, (mng_uint32) len,
556
-                                          (mng_ptr) ptr);
549
+                        mng_putchunk_idat(hMNG, (mng_uint32)len, (mng_ptr)ptr);
557 550
                     free(ptr);
558 551
                     if (iRC != 0)
559 552
                       break;
... ...
@@ -6,9 +6,9 @@
6 6
 #ifndef INC_BlinkenLib_BlinkenMng
7 7
 #define INC_BlinkenLib_BlinkenMng
8 8
 
9
-#include <BlinkenLib/config.h>
10 9
 #include <BlinkenLib/BlinkenFrame.h>
11 10
 #include <BlinkenLib/BlinkenMovie.h>
11
+#include <BlinkenLib/config.h>
12 12
 
13 13
 #ifndef BLINKENLIB_CFG_MNG
14 14
 #error This file is to be used for MNG support only.
... ...
@@ -7,21 +7,21 @@
7 7
 #include <stdlib.h>
8 8
 #include <string.h>
9 9
 #ifdef WIN32
10
-#include <winsock2.h>
11 10
 #include <windows.h>
11
+#include <winsock2.h>
12 12
 #else
13
-#include <unistd.h>
13
+#include <sys/select.h>
14
+#include <sys/socket.h>
14 15
 #include <sys/time.h>
15 16
 #include <sys/types.h>
16
-#include <sys/socket.h>
17
-#include <sys/select.h>
17
+#include <unistd.h>
18 18
 #endif
19 19
 
20 20
 #include <BlinkenLib/BlinkenFrame.h>
21 21
 #include <BlinkenLib/BlinkenMovie.h>
22 22
 
23
-#include "Tools.h"
24 23
 #include "BlinkenConstants.h"
24
+#include "Tools.h"
25 25
 #ifdef BLINKENLIB_CFG_MNG
26 26
 #include "BlinkenMng.h"
27 27
 #endif // #ifdef BLINKENLIB_CFG_MNG
... ...
@@ -42,25 +42,15 @@ struct sBlinkenMovie {
42 42
 
43 43
 #ifdef WIN32
44 44
 
45
-static void msleep(unsigned int ms)
46
-{
47
-  Sleep(ms);
48
-}
45
+static void msleep(unsigned int ms) { Sleep(ms); }
49 46
 
50
-static unsigned int get_ms()
51
-{
52
-  return GetTickCount();
53
-}
47
+static unsigned int get_ms() { return GetTickCount(); }
54 48
 
55 49
 #else
56 50
 
57
-static void msleep(unsigned int ms)
58
-{
59
-  usleep(ms * 1000);
60
-}
51
+static void msleep(unsigned int ms) { usleep(ms * 1000); }
61 52
 
62
-static unsigned int get_ms()
63
-{
53
+static unsigned int get_ms() {
64 54
   struct timeval tv;
65 55
   gettimeofday(&tv, NULL);
66 56
   return (unsigned int)(tv.tv_usec / 1000 + tv.tv_sec * 1000);
... ...
@@ -69,8 +59,7 @@ static unsigned int get_ms()
69 59
 #endif
70 60
 
71 61
 stBlinkenMovie *BlinkenMovieNew(int height, int width, int channels,
72
-                                int maxval)
73
-{
62
+                                int maxval) {
74 63
   stBlinkenMovie *pMovie;
75 64
 
76 65
   if (height < BlinkenHeightMin)
... ...
@@ -116,14 +105,12 @@ stBlinkenMovie *BlinkenMovieNew(int height, int width, int channels,
116 105
   return pMovie;
117 106
 }
118 107
 
119
-stBlinkenMovie *BlinkenMovieClone(stBlinkenMovie *pSrcMovie)
120
-{
108
+stBlinkenMovie *BlinkenMovieClone(stBlinkenMovie *pSrcMovie) {
121 109
   stBlinkenMovie *pMovie;
122 110
   stBlinkenFrame *pFrame;
123 111
   int i;
124 112
 
125
-  pMovie =
126
-      BlinkenMovieNew(pSrcMovie->height, pSrcMovie->width,
113
+  pMovie = BlinkenMovieNew(pSrcMovie->height, pSrcMovie->width,
127 114
                            pSrcMovie->channels, pSrcMovie->maxval);
128 115
   if (pMovie == NULL)
129 116
     return NULL;
... ...
@@ -141,8 +128,7 @@ stBlinkenMovie *BlinkenMovieClone(stBlinkenMovie *pSrcMovie)
141 128
   return pMovie;
142 129
 }
143 130
 
144
-void BlinkenMovieFree(stBlinkenMovie *pMovie)
145
-{
131
+void BlinkenMovieFree(stBlinkenMovie *pMovie) {
146 132
   int i;
147 133
 
148 134
   if (pMovie == NULL)
... ...
@@ -161,40 +147,35 @@ void BlinkenMovieFree(stBlinkenMovie *pMovie)
161 147
   free(pMovie);
162 148
 }
163 149
 
164
-int BlinkenMovieGetHeight(stBlinkenMovie *pMovie)
165
-{
150
+int BlinkenMovieGetHeight(stBlinkenMovie *pMovie) {
166 151
   if (pMovie == NULL)
167 152
     return 0;
168 153
 
169 154
   return pMovie->height;
170 155
 }
171 156
 
172
-int BlinkenMovieGetWidth(stBlinkenMovie *pMovie)
173
-{
157
+int BlinkenMovieGetWidth(stBlinkenMovie *pMovie) {
174 158
   if (pMovie == NULL)
175 159
     return 0;
176 160
 
177 161
   return pMovie->width;
178 162
 }
179 163
 
180
-int BlinkenMovieGetChannels(stBlinkenMovie *pMovie)
181
-{
164
+int BlinkenMovieGetChannels(stBlinkenMovie *pMovie) {
182 165
   if (pMovie == NULL)
183 166
     return 0;
184 167
 
185 168
   return pMovie->channels;
186 169
 }
187 170
 
188
-int BlinkenMovieGetMaxval(stBlinkenMovie *pMovie)
189
-{
171
+int BlinkenMovieGetMaxval(stBlinkenMovie *pMovie) {
190 172
   if (pMovie == NULL)
191 173
     return 0;
192 174
 
193 175
   return pMovie->maxval;
194 176
 }
195 177
 
196
-int BlinkenMovieGetDuration(stBlinkenMovie *pMovie)
197
-{
178
+int BlinkenMovieGetDuration(stBlinkenMovie *pMovie) {
198 179
   int i, duration;
199 180
 
200 181
   if (pMovie == NULL)
... ...
@@ -206,16 +187,14 @@ int BlinkenMovieGetDuration(stBlinkenMovie *pMovie)
206 187
   return duration;
207 188
 }
208 189
 
209
-int BlinkenMovieGetInfoCnt(stBlinkenMovie *pMovie)
210
-{
190
+int BlinkenMovieGetInfoCnt(stBlinkenMovie *pMovie) {
211 191
   if (pMovie == NULL)
212 192
     return 0;
213 193
 
214 194
   return pMovie->infoCnt;
215 195
 }
216 196
 
217
-char *BlinkenMovieGetInfoType(stBlinkenMovie *pMovie, int infoNo)
218
-{
197
+char *BlinkenMovieGetInfoType(stBlinkenMovie *pMovie, int infoNo) {
219 198
   if (pMovie == NULL || pMovie->infoCnt < 1)
220 199
     return "";
221 200
 
... ...
@@ -226,8 +205,7 @@ char *BlinkenMovieGetInfoType(stBlinkenMovie *pMovie, int infoNo)
226 205
   return pMovie->pppInfos[infoNo][0];
227 206
 }
228 207
 
229
-char *BlinkenMovieGetInfoData(stBlinkenMovie *pMovie, int infoNo)
230
-{
208
+char *BlinkenMovieGetInfoData(stBlinkenMovie *pMovie, int infoNo) {
231 209
   if (pMovie == NULL || pMovie->infoCnt < 1)
232 210
     return "";
233 211
 
... ...
@@ -239,8 +217,7 @@ char *BlinkenMovieGetInfoData(stBlinkenMovie *pMovie, int infoNo)
239 217
 }
240 218
 
241 219
 void BlinkenMovieSetInfo(stBlinkenMovie *pMovie, int infoNo,
242
-                         const char *pInfoType, const char *pInfoData)
243
-{
220
+                         const char *pInfoType, const char *pInfoData) {
244 221
   char *pType, *pData;
245 222
 
246 223
   if (pMovie == NULL || infoNo < 0 || infoNo >= pMovie->infoCnt)
... ...
@@ -262,16 +239,15 @@ void BlinkenMovieSetInfo(stBlinkenMovie *pMovie, int infoNo,
262 239
 }
263 240
 
264 241
 void BlinkenMovieInsertInfo(stBlinkenMovie *pMovie, int infoNo,
265
-                            const char *pInfoType, const char *pInfoData)
266
-{
242
+                            const char *pInfoType, const char *pInfoData) {
267 243
   char ***pppNewInfos, *pType, *pData;
268 244
   int i;
269 245
 
270 246
   if (pMovie == NULL || infoNo < 0 || infoNo > pMovie->infoCnt)
271 247
     return;
272 248
 
273
-  pppNewInfos = (char ***)BlinkenMalloc2D(pMovie->infoCnt + 1, 2,
274
-                                          sizeof(char *));
249
+  pppNewInfos =
250
+      (char ***)BlinkenMalloc2D(pMovie->infoCnt + 1, 2, sizeof(char *));
275 251
   if (pppNewInfos == NULL)
276 252
     return;
277 253
 
... ...
@@ -306,24 +282,22 @@ void BlinkenMovieInsertInfo(stBlinkenMovie *pMovie, int infoNo,
306 282
 }
307 283
 
308 284
 void BlinkenMovieAppendInfo(stBlinkenMovie *pMovie, const char *pInfoType,
309
-                            const char *pInfoData)
310
-{
285
+                            const char *pInfoData) {
311 286
   if (pMovie == NULL)
312 287
     return;
313 288
 
314 289
   BlinkenMovieInsertInfo(pMovie, pMovie->infoCnt, pInfoType, pInfoData);
315 290
 }
316 291
 
317
-void BlinkenMovieDeleteInfo(stBlinkenMovie *pMovie, int infoNo)
318
-{
292
+void BlinkenMovieDeleteInfo(stBlinkenMovie *pMovie, int infoNo) {
319 293
   char ***pppNewInfos;
320 294
   int i;
321 295
 
322 296
   if (pMovie == NULL || infoNo < 0 || infoNo >= pMovie->infoCnt)
323 297
     return;
324 298
 
325
-  pppNewInfos = (char ***)BlinkenMalloc2D(pMovie->infoCnt - 1, 2,
326
-                                          sizeof(char *));
299
+  pppNewInfos =
300
+      (char ***)BlinkenMalloc2D(pMovie->infoCnt - 1, 2, sizeof(char *));
327 301
   if (pppNewInfos == NULL)
328 302
     return;
329 303
 
... ...
@@ -345,8 +319,7 @@ void BlinkenMovieDeleteInfo(stBlinkenMovie *pMovie, int infoNo)
345 319
   pMovie->infoCnt--;
346 320
 }
347 321
 
348
-void BlinkenMovieDeleteInfos(stBlinkenMovie *pMovie)
349
-{
322
+void BlinkenMovieDeleteInfos(stBlinkenMovie *pMovie) {
350 323
   char ***pppNewInfos;
351 324
   int i;
352 325
 
... ...
@@ -367,16 +340,14 @@ void BlinkenMovieDeleteInfos(stBlinkenMovie *pMovie)
367 340
   pMovie->infoCnt = 0;
368 341
 }
369 342
 
370
-int BlinkenMovieGetFrameCnt(stBlinkenMovie *pMovie)
371
-{
343
+int BlinkenMovieGetFrameCnt(stBlinkenMovie *pMovie) {
372 344
   if (pMovie == NULL)
373 345
     return 0;
374 346
 
375 347
   return pMovie->frameCnt;
376 348
 }
377 349
 
378
-stBlinkenFrame *BlinkenMovieGetFrame(stBlinkenMovie *pMovie, int frameNo)
379
-{
350
+stBlinkenFrame *BlinkenMovieGetFrame(stBlinkenMovie *pMovie, int frameNo) {
380 351
   if (pMovie == NULL || pMovie->frameCnt < 1)
381 352
     return NULL;
382 353
 
... ...
@@ -388,8 +359,7 @@ stBlinkenFrame *BlinkenMovieGetFrame(stBlinkenMovie *pMovie, int frameNo)
388 359
 }
389 360
 
390 361
 void BlinkenMovieSetFrame(stBlinkenMovie *pMovie, int frameNo,
391
-                          stBlinkenFrame *pFrame)
392
-{
362
+                          stBlinkenFrame *pFrame) {
393 363
   if (pMovie == NULL || frameNo < 0 || frameNo >= pMovie->frameCnt)
394 364
     return;
395 365
 
... ...
@@ -399,16 +369,14 @@ void BlinkenMovieSetFrame(stBlinkenMovie *pMovie, int frameNo,
399 369
 }
400 370
 
401 371
 int BlinkenMovieInsertFrame(stBlinkenMovie *pMovie, int frameNo,
402
-                            stBlinkenFrame *pFrame)
403
-{
372
+                            stBlinkenFrame *pFrame) {
404 373
   stBlinkenFrame **ppNewFrames;
405 374
   int i;
406 375
 
407 376
   if (pMovie == NULL || frameNo < 0 || frameNo > pMovie->frameCnt)
408 377
     return -1;
409 378
 
410
-  ppNewFrames =
411
-      (stBlinkenFrame **) BlinkenMalloc1D(pMovie->frameCnt + 1,
379
+  ppNewFrames = (stBlinkenFrame **)BlinkenMalloc1D(pMovie->frameCnt + 1,
412 380
                                                    sizeof(stBlinkenFrame *));
413 381
   if (ppNewFrames == NULL)
414 382
     return -1;
... ...
@@ -429,16 +397,14 @@ int BlinkenMovieInsertFrame(stBlinkenMovie *pMovie, int frameNo,
429 397
   return 0;
430 398
 }
431 399
 
432
-int BlinkenMovieAppendFrame(stBlinkenMovie *pMovie, stBlinkenFrame *pFrame)
433
-{
400
+int BlinkenMovieAppendFrame(stBlinkenMovie *pMovie, stBlinkenFrame *pFrame) {
434 401
   if (pMovie == NULL)
435 402
     return -1;
436 403
 
437 404
   return BlinkenMovieInsertFrame(pMovie, pMovie->frameCnt, pFrame);
438 405
 }
439 406
 
440
-void BlinkenMovieDeleteFrame(stBlinkenMovie *pMovie, int frameNo)
441
-{
407
+void BlinkenMovieDeleteFrame(stBlinkenMovie *pMovie, int frameNo) {
442 408
   stBlinkenFrame **ppNewFrames;
443 409
   int i;
444 410
 
... ...
@@ -463,16 +429,14 @@ void BlinkenMovieDeleteFrame(stBlinkenMovie *pMovie, int frameNo)
463 429
   pMovie->frameCnt--;
464 430
 }
465 431
 
466
-void BlinkenMovieDeleteFrames(stBlinkenMovie *pMovie)
467
-{
432
+void BlinkenMovieDeleteFrames(stBlinkenMovie *pMovie) {
468 433
   stBlinkenFrame **ppNewFrames;
469 434
   int i;
470 435
 
471 436
   if (pMovie == NULL)
472 437
     return;
473 438
 
474
-  ppNewFrames =
475
-      (stBlinkenFrame **)BlinkenMalloc1D(0, sizeof(stBlinkenFrame *));
439
+  ppNewFrames = (stBlinkenFrame **)BlinkenMalloc1D(0, sizeof(stBlinkenFrame *));
476 440
   if (ppNewFrames == NULL)
477 441
     return;
478 442
 
... ...
@@ -485,8 +449,7 @@ void BlinkenMovieDeleteFrames(stBlinkenMovie *pMovie)
485 449
 }
486 450
 
487 451
 int BlinkenMovieConcat(stBlinkenMovie *pMovie,
488
-                       stBlinkenMovie *pMovie2 /* appended and freed */)
489
-{
452
+                       stBlinkenMovie *pMovie2 /* appended and freed */) {
490 453
   stBlinkenFrame **ppNewFrames, **ppNewFrames2;
491 454
   int i;
492 455
 
... ...
@@ -496,12 +459,12 @@ int BlinkenMovieConcat(stBlinkenMovie *pMovie,
496 459
   BlinkenMovieResize(pMovie2, pMovie->height, pMovie->width, pMovie->channels,
497 460
                      pMovie->maxval);
498 461
 
499
-  ppNewFrames =
500
-      (stBlinkenFrame **)BlinkenMalloc1D(pMovie->frameCnt + pMovie2->frameCnt,
501
-                                         sizeof(stBlinkenFrame *));
462
+  ppNewFrames = (stBlinkenFrame **)BlinkenMalloc1D(
463
+      pMovie->frameCnt + pMovie2->frameCnt, sizeof(stBlinkenFrame *));
502 464
   if (ppNewFrames == NULL)
503 465
     return -1;
504
-  ppNewFrames2 = (stBlinkenFrame **)BlinkenMalloc1D(0, sizeof(stBlinkenFrame *));
466
+  ppNewFrames2 =
467
+      (stBlinkenFrame **)BlinkenMalloc1D(0, sizeof(stBlinkenFrame *));
505 468
   if (ppNewFrames2 == NULL) {
506 469
     free(ppNewFrames);
507 470
     return -1;
... ...
@@ -525,8 +488,7 @@ int BlinkenMovieConcat(stBlinkenMovie *pMovie,
525 488
   return 0;
526 489
 }
527 490
 
528
-void BlinkenMovieReverse(stBlinkenMovie *pMovie)
529
-{
491
+void BlinkenMovieReverse(stBlinkenMovie *pMovie) {
530 492
   int i, j;
531 493
   stBlinkenFrame *pFrame;
532 494
 
... ...
@@ -537,9 +499,8 @@ void BlinkenMovieReverse(stBlinkenMovie *pMovie)
537 499
   }
538 500
 }
539 501
 
540
-void BlinkenMovieCutTime(stBlinkenMovie *pMovie,
541
-                         int begin /* in ms */, int end /* in ms */)
542
-{
502
+void BlinkenMovieCutTime(stBlinkenMovie *pMovie, int begin /* in ms */,
503
+                         int end /* in ms */) {
543 504
   int i, duration, curtime, idx_begin, idx_end, duration_begin, duration_end;
544 505
   int frameCnt;
545 506
   stBlinkenFrame **ppNewFrames;
... ...
@@ -605,8 +566,8 @@ void BlinkenMovieCutTime(stBlinkenMovie *pMovie,
605 566
   // remove/free unneeded frames
606 567
 
607 568
   frameCnt = idx_end - idx_begin + 1;
608
-  ppNewFrames = (stBlinkenFrame **)BlinkenMalloc1D(frameCnt,
609
-                                                   sizeof(stBlinkenFrame *));
569
+  ppNewFrames =
570
+      (stBlinkenFrame **)BlinkenMalloc1D(frameCnt, sizeof(stBlinkenFrame *));
610 571
   if (ppNewFrames == NULL)
611 572
     return;
612 573
 
... ...
@@ -629,8 +590,7 @@ void BlinkenMovieCutTime(stBlinkenMovie *pMovie,
629 590
 }
630 591
 
631 592
 void BlinkenMovieAdaptDuration(stBlinkenMovie *pMovie,
632
-                               int duration /* in ms */)
633
-{
593
+                               int duration /* in ms */) {
634 594
   int old_duration, old_curtime, curtime;
635 595
   int i, old_dur, dur, old_end, end;
636 596
 
... ...
@@ -651,8 +611,8 @@ void BlinkenMovieAdaptDuration(stBlinkenMovie *pMovie,
651 611
     old_dur = BlinkenFrameGetDuration(pMovie->ppFrames[i]);
652 612
     old_end = old_curtime + old_dur;
653 613
     // compute new end time and new duration
654
-    end = (int)((double)old_end / (double)old_duration * (double)duration
655
-                + 0.5);
614
+    end =
615
+        (int)((double)old_end / (double)old_duration * (double)duration + 0.5);
656 616
     dur = end - curtime;
657 617
     if (dur < BlinkenDurationMin)
658 618
       dur = BlinkenDurationMin;
... ...
@@ -667,8 +627,7 @@ void BlinkenMovieAdaptDuration(stBlinkenMovie *pMovie,
667 627
 }
668 628
 
669 629
 void BlinkenMovieAdaptMaxFrameDuration(stBlinkenMovie *pMovie,
670
-                                       int maxDuration /* in ms */)
671
-{
630
+                                       int maxDuration /* in ms */) {
672 631
   int i, j, cmp, dur, lastdur;
673 632
   unsigned int extraFrames;
674 633
   stBlinkenFrame **ppNewFrames;
... ...
@@ -691,9 +650,8 @@ void BlinkenMovieAdaptMaxFrameDuration(stBlinkenMovie *pMovie,
691 650
   }
692 651
 
693 652
   // allocate new frame array
694
-  ppNewFrames = (stBlinkenFrame **)BlinkenMalloc1D(pMovie->frameCnt
695
-                                                   + extraFrames,
696
-                                                   sizeof(stBlinkenFrame *));
653
+  ppNewFrames = (stBlinkenFrame **)BlinkenMalloc1D(
654
+      pMovie->frameCnt + extraFrames, sizeof(stBlinkenFrame *));
697 655
   if (!ppNewFrames) {
698 656
     return;
699 657
   }
... ...
@@ -750,8 +708,7 @@ void BlinkenMovieAdaptMaxFrameDuration(stBlinkenMovie *pMovie,
750 708
 }
751 709
 
752 710
 void BlinkenMovieResize(stBlinkenMovie *pMovie, int height, int width,
753
-                        int channels, int maxval)
754
-{
711
+                        int channels, int maxval) {
755 712
   int i;
756 713
 
757 714
   if (pMovie == NULL)
... ...
@@ -783,9 +740,8 @@ void BlinkenMovieResize(stBlinkenMovie *pMovie, int height, int width,
783 740
     BlinkenFrameResize(pMovie->ppFrames[i], height, width, channels, maxval);
784 741
 }
785 742
 
786
-void BlinkenMovieCrop(stBlinkenMovie *pMovie, int top, int left,
787
-                      int height, int width)
788
-{
743
+void BlinkenMovieCrop(stBlinkenMovie *pMovie, int top, int left, int height,
744
+                      int width) {
789 745
   int i;
790 746
 
791 747
   if (pMovie == NULL)
... ...
@@ -808,8 +764,8 @@ void BlinkenMovieCrop(stBlinkenMovie *pMovie, int top, int left,
808 764
   if (width > pMovie->width - left)
809 765
     width = pMovie->width - left;
810 766
 
811
-  if (top == 0 && left == 0 &&
812
-      height == pMovie->height && width == pMovie->width)
767
+  if (top == 0 && left == 0 && height == pMovie->height &&
768
+      width == pMovie->width)
813 769
     return;
814 770
 
815 771
   pMovie->height = height;
... ...
@@ -819,8 +775,7 @@ void BlinkenMovieCrop(stBlinkenMovie *pMovie, int top, int left,
819 775
     BlinkenFrameCrop(pMovie->ppFrames[i], top, left, height, width);
820 776
 }
821 777
 
822
-void BlinkenMovieScale(stBlinkenMovie *pMovie, int height, int width)
823
-{
778
+void BlinkenMovieScale(stBlinkenMovie *pMovie, int height, int width) {
824 779
   int i;
825 780
 
826 781
   if (pMovie == NULL)
... ...
@@ -842,8 +797,7 @@ void BlinkenMovieScale(stBlinkenMovie *pMovie, int height, int width)
842 797
     BlinkenFrameScale(pMovie->ppFrames[i], height, width);
843 798
 }
844 799
 
845
-void BlinkenMovieColorize(stBlinkenMovie *pMovie, int channels, int mode)
846
-{
800
+void BlinkenMovieColorize(stBlinkenMovie *pMovie, int channels, int mode) {
847 801
   int i, step;
848 802
 
849 803
   if (pMovie == NULL)
... ...
@@ -865,9 +819,8 @@ void BlinkenMovieColorize(stBlinkenMovie *pMovie, int channels, int mode)
865 819
 }
866 820
 
867 821
 void BlinkenMovieCopyRect(stBlinkenMovie *pDest, int destY, int destX,
868
-                          stBlinkenMovie *pSrc, int srcY, int srcX,
869
-                          int height, int width)
870
-{
822
+                          stBlinkenMovie *pSrc, int srcY, int srcX, int height,
823
+                          int width) {
871 824
   int dcnt, scnt, di, si, dest_dur, src_dur, src_time_ofs;
872 825
   stBlinkenFrame *pFrame;
873 826
 
... ...
@@ -891,9 +844,8 @@ void BlinkenMovieCopyRect(stBlinkenMovie *pDest, int destY, int destX,
891 844
     // make sure there is a frame in destination movie
892 845
     if (di >= dcnt) {
893 846
       // append new empty frame that last until end of source frame
894
-      pFrame = BlinkenFrameNew(pDest->height, pDest->width,
895
-                               pDest->channels, pDest->maxval,
896
-                               src_dur - src_time_ofs);
847
+      pFrame = BlinkenFrameNew(pDest->height, pDest->width, pDest->channels,
848
+                               pDest->maxval, src_dur - src_time_ofs);
897 849
       if (pFrame == NULL)
898 850
         return;
899 851
       BlinkenFrameClear(pFrame);
... ...
@@ -912,16 +864,15 @@ void BlinkenMovieCopyRect(stBlinkenMovie *pDest, int destY, int destX,
912 864
       if (BlinkenMovieInsertFrame(pDest, di + 1, pFrame) != 0)
913 865
         return;
914 866
       dcnt++;
915
-      BlinkenFrameSetDuration(pDest->ppFrames[di],
916
-                              src_dur - src_time_ofs);
867
+      BlinkenFrameSetDuration(pDest->ppFrames[di], src_dur - src_time_ofs);
917 868
       BlinkenFrameSetDuration(pDest->ppFrames[di + 1],
918 869
                               dest_dur - (src_dur - src_time_ofs));
919 870
       dest_dur = src_dur - src_time_ofs;
920 871
     }
921 872
 
922 873
     // copy from source frame to destination frame
923
-    BlinkenFrameCopyRect(pDest->ppFrames[di], destY, destX,
924
-                         pSrc->ppFrames[si], srcY, srcX, height, width);
874
+    BlinkenFrameCopyRect(pDest->ppFrames[di], destY, destX, pSrc->ppFrames[si],
875
+                         srcY, srcX, height, width);
925 876
     src_time_ofs += dest_dur;
926 877
     di++;
927 878
     dest_dur = di < dcnt ? BlinkenFrameGetDuration(pDest->ppFrames[di]) : 0;
... ...
@@ -936,8 +887,7 @@ void BlinkenMovieCopyRect(stBlinkenMovie *pDest, int destY, int destX,
936 887
   } // while (si < scnt)
937 888
 }
938 889
 
939
-void BlinkenMovieRotateCw(stBlinkenMovie *pMovie)
940
-{
890
+void BlinkenMovieRotateCw(stBlinkenMovie *pMovie) {
941 891
   int tmp, i;
942 892
 
943 893
   if (pMovie == NULL)
... ...
@@ -951,8 +901,7 @@ void BlinkenMovieRotateCw(stBlinkenMovie *pMovie)
951 901
     BlinkenFrameRotateCw(pMovie->ppFrames[i]);
952 902
 }
953 903
 
954
-void BlinkenMovieRotateCcw(stBlinkenMovie *pMovie)
955
-{
904
+void BlinkenMovieRotateCcw(stBlinkenMovie *pMovie) {
956 905
   int tmp, i;
957 906
 
958 907
   if (pMovie == NULL)
... ...
@@ -966,8 +915,7 @@ void BlinkenMovieRotateCcw(stBlinkenMovie *pMovie)
966 915
     BlinkenFrameRotateCcw(pMovie->ppFrames[i]);
967 916
 }
968 917
 
969
-void BlinkenMovieRotateHalf(stBlinkenMovie *pMovie)
970
-{
918
+void BlinkenMovieRotateHalf(stBlinkenMovie *pMovie) {
971 919
   int i;
972 920
 
973 921
   if (pMovie == NULL)
... ...
@@ -977,8 +925,7 @@ void BlinkenMovieRotateHalf(stBlinkenMovie *pMovie)
977 925
     BlinkenFrameRotateHalf(pMovie->ppFrames[i]);
978 926
 }
979 927
 
980
-void BlinkenMovieMirrorHor(stBlinkenMovie *pMovie)
981
-{
928
+void BlinkenMovieMirrorHor(stBlinkenMovie *pMovie) {
982 929
   int i;
983 930
 
984 931
   if (pMovie == NULL)
... ...
@@ -988,8 +935,7 @@ void BlinkenMovieMirrorHor(stBlinkenMovie *pMovie)
988 935
     BlinkenFrameMirrorHor(pMovie->ppFrames[i]);
989 936
 }
990 937
 
991
-void BlinkenMovieMirrorVer(stBlinkenMovie *pMovie)
992
-{
938
+void BlinkenMovieMirrorVer(stBlinkenMovie *pMovie) {
993 939
   int i;
994 940
 
995 941
   if (pMovie == NULL)
... ...
@@ -999,8 +945,7 @@ void BlinkenMovieMirrorVer(stBlinkenMovie *pMovie)
999 945
     BlinkenFrameMirrorVer(pMovie->ppFrames[i]);
1000 946
 }
1001 947
 
1002
-void BlinkenMovieMirrorDiag(stBlinkenMovie *pMovie)
1003
-{
948
+void BlinkenMovieMirrorDiag(stBlinkenMovie *pMovie) {
1004 949
   int tmp, i;
1005 950
 
1006 951
   if (pMovie == NULL)
... ...
@@ -1014,8 +959,7 @@ void BlinkenMovieMirrorDiag(stBlinkenMovie *pMovie)
1014 959
     BlinkenFrameMirrorDiag(pMovie->ppFrames[i]);
1015 960
 }
1016 961
 
1017
-void BlinkenMovieMirrorDiag2(stBlinkenMovie *pMovie)
1018
-{
962
+void BlinkenMovieMirrorDiag2(stBlinkenMovie *pMovie) {
1019 963
   int tmp, i;
1020 964
 
1021 965
   if (pMovie == NULL)
... ...
@@ -1029,8 +973,7 @@ void BlinkenMovieMirrorDiag2(stBlinkenMovie *pMovie)
1029 973
     BlinkenFrameMirrorDiag2(pMovie->ppFrames[i]);
1030 974
 }
1031 975
 
1032
-char *BlinkenMovieToString(stBlinkenMovie *pMovie)
1033
-{
976
+char *BlinkenMovieToString(stBlinkenMovie *pMovie) {
1034 977
   char **strs, *str, *ptr;
1035 978
   int i, size;
1036 979
 
... ...
@@ -1053,8 +996,7 @@ char *BlinkenMovieToString(stBlinkenMovie *pMovie)
1053 996
 
1054 997
   size = 128;
1055 998
   for (i = 0; i < pMovie->infoCnt; i++)
1056
-    size +=
1057
-        strlen(pMovie->pppInfos[i][0]) + strlen(pMovie->pppInfos[i][1]) + 8;
999
+    size += strlen(pMovie->pppInfos[i][0]) + strlen(pMovie->pppInfos[i][1]) + 8;
1058 1000
   for (i = 0; i < pMovie->frameCnt; i++)
1059 1001
     size += strlen(strs[i]) + 32;
1060 1002
 
... ...
@@ -1087,8 +1029,7 @@ char *BlinkenMovieToString(stBlinkenMovie *pMovie)
1087 1029
   return str;
1088 1030
 }
1089 1031
 
1090
-stBlinkenMovie *BlinkenMovieLoadBlm(const char *pFilename)
1091
-{
1032
+stBlinkenMovie *BlinkenMovieLoadBlm(const char *pFilename) {
1092 1033
   FILE *pFile;
1093 1034
   stBlinkenMovie *pMovie;
1094 1035
   stBlinkenFrame *pFrame;
... ...
@@ -1121,11 +1062,11 @@ stBlinkenMovie *BlinkenMovieLoadBlm(const char *pFilename)
1121 1062
   // read frames
1122 1063
   while (!feof(pFile)) {
1123 1064
     // skip rest of previous line (including newline)
1124
-    while ((chr = fgetc(pFile)) != '\n' && chr != EOF) ;
1065
+    while ((chr = fgetc(pFile)) != '\n' && chr != EOF)
1066
+      ;
1125 1067
 
1126 1068
     // info line
1127
-    if (fscanf
1128
-        (pFile, " # %255[A-Za-z0-9] %*[=:] %1023[^\n]", infoType,
1069
+    if (fscanf(pFile, " # %255[A-Za-z0-9] %*[=:] %1023[^\n]", infoType,
1129 1070
                infoData) == 2) {
1130 1071
       BlinkenMovieAppendInfo(pMovie, infoType, infoData);
1131 1072
     }
... ...
@@ -1163,8 +1104,7 @@ stBlinkenMovie *BlinkenMovieLoadBlm(const char *pFilename)
1163 1104
   return pMovie;
1164 1105
 }
1165 1106
 
1166
-stBlinkenMovie *BlinkenMovieLoadBmm(const char *pFilename)
1167
-{
1107
+stBlinkenMovie *BlinkenMovieLoadBmm(const char *pFilename) {
1168 1108
   FILE *pFile;
1169 1109
   stBlinkenMovie *pMovie;
1170 1110
   stBlinkenFrame *pFrame;
... ...
@@ -1197,11 +1137,11 @@ stBlinkenMovie *BlinkenMovieLoadBmm(const char *pFilename)
1197 1137
   // read frames
1198 1138
   while (!feof(pFile)) {
1199 1139
     // skip rest of previous line (including newline)
1200
-    while ((chr = fgetc(pFile)) != '\n' && chr != EOF) ;
1140
+    while ((chr = fgetc(pFile)) != '\n' && chr != EOF)
1141
+      ;
1201 1142
 
1202 1143
     // info line
1203
-    if (fscanf
1204
-        (pFile, " # %255[A-Za-z0-9] %*[=:] %1023[^\n]", infoType,
1144
+    if (fscanf(pFile, " # %255[A-Za-z0-9] %*[=:] %1023[^\n]", infoType,
1205 1145
                infoData) == 2) {
1206 1146
       BlinkenMovieAppendInfo(pMovie, infoType, infoData);
1207 1147
     }
... ...
@@ -1243,8 +1183,7 @@ stBlinkenMovie *BlinkenMovieLoadBmm(const char *pFilename)
1243 1183
   return pMovie;
1244 1184
 }
1245 1185
 
1246
-stBlinkenMovie *BlinkenMovieLoadBml(const char *pFilename)
1247
-{
1186
+stBlinkenMovie *BlinkenMovieLoadBml(const char *pFilename) {
1248 1187
   FILE *pFile;
1249 1188
   stBlinkenMovie *pMovie;
1250 1189
   stBlinkenFrame *pFrame;
... ...
@@ -1330,8 +1269,7 @@ stBlinkenMovie *BlinkenMovieLoadBml(const char *pFilename)
1330 1269
       // description tag
1331 1270
       else if (fscanf(pFile, "description>%2047[^<]", buffer) == 1) {
1332 1271
         // check if generic info
1333
-        if (sscanf
1334
-            (buffer, "%255[A-Za-z0-9] %*[=:] %1023[^\n]", infoType,
1272
+        if (sscanf(buffer, "%255[A-Za-z0-9] %*[=:] %1023[^\n]", infoType,
1335 1273
                    infoData) == 2)
1336 1274
           // add info to movie
1337 1275
           BlinkenMovieAppendInfo(pMovie, infoType, infoData);
... ...
@@ -1410,8 +1348,7 @@ stBlinkenMovie *BlinkenMovieLoadBml(const char *pFilename)
1410 1348
   return pMovie;
1411 1349
 }
1412 1350
 
1413
-stBlinkenMovie *BlinkenMovieLoadBbm(const char *pFilename)
1414
-{
1351
+stBlinkenMovie *BlinkenMovieLoadBbm(const char *pFilename) {
1415 1352
   FILE *pFile;
1416 1353
   stBlinkenMovie *pMovie;
1417 1354
   stBlinkenFrame *pFrame;
... ...
@@ -1437,15 +1374,15 @@ stBlinkenMovie *BlinkenMovieLoadBbm(const char *pFilename)
1437 1374
     fclose(pFile);
1438 1375
     return NULL;
1439 1376
   }
1440
-  headerMagic =
1441
-      (unsigned long)header[0] << 24 | (unsigned long)header[1] << 16 |
1442
-      (unsigned long)header[2] << 8 | (unsigned long)header[3];
1377
+  headerMagic = (unsigned long)header[0] << 24 |
1378
+                (unsigned long)header[1] << 16 | (unsigned long)header[2] << 8 |
1379
+                (unsigned long)header[3];
1443 1380
   headerHeight = (unsigned short)header[4] << 8 | (unsigned short)header[5];
1444 1381
   headerWidth = (unsigned short)header[6] << 8 | (unsigned short)header[7];
1445 1382
   headerChannels = (unsigned short)header[8] << 8 | (unsigned short)header[9];
1446 1383
   headerMaxval = (unsigned short)header[10] << 8 | (unsigned short)header[11];
1447
-  headerFramePtr =
1448
-      (unsigned long)header[20] << 24 | (unsigned long)header[21] << 16 |
1384
+  headerFramePtr = (unsigned long)header[20] << 24 |
1385
+                   (unsigned long)header[21] << 16 |
1449 1386
                    (unsigned long)header[22] << 8 | (unsigned long)header[23];
1450 1387
   // check magic
1451 1388
   if (headerMagic != 0x23542666) {
... ...
@@ -1454,8 +1391,7 @@ stBlinkenMovie *BlinkenMovieLoadBbm(const char *pFilename)
1454 1391
   }
1455 1392
   // allocate a new movie
1456 1393
   pMovie =
1457
-      BlinkenMovieNew(headerHeight, headerWidth, headerChannels,
1458
-                      headerMaxval);
1394
+      BlinkenMovieNew(headerHeight, headerWidth, headerChannels, headerMaxval);
1459 1395
   if (pMovie == NULL) {
1460 1396
     fclose(pFile);
1461 1397
     return NULL;
... ...
@@ -1468,14 +1404,14 @@ stBlinkenMovie *BlinkenMovieLoadBbm(const char *pFilename)
1468 1404
       return NULL;
1469 1405
     }
1470 1406
     subHeaderMagic =
1471
-        (unsigned long)subHeader[0] << 24 | (unsigned long)subHeader[1] << 16
1472
-        | (unsigned long)subHeader[2] << 8 | (unsigned long)subHeader[3];
1407
+        (unsigned long)subHeader[0] << 24 | (unsigned long)subHeader[1] << 16 |
1408
+        (unsigned long)subHeader[2] << 8 | (unsigned long)subHeader[3];
1473 1409
     subHeaderSize =
1474 1410
         (unsigned short)subHeader[4] << 8 | (unsigned short)subHeader[5];
1475 1411
 
1476 1412
     // header fits into gap to frame start
1477
-    if (subHeaderSize >= 6
1478
-        && ftell(pFile) + subHeaderSize - 6 <= (long)headerFramePtr) {
1413
+    if (subHeaderSize >= 6 &&
1414
+        ftell(pFile) + subHeaderSize - 6 <= (long)headerFramePtr) {
1479 1415
       // info header
1480 1416
       if (subHeaderMagic == 0x696E666F) // 'i' 'n' 'f' 'o'
1481 1417
       {
... ...
@@ -1494,8 +1430,8 @@ stBlinkenMovie *BlinkenMovieLoadBbm(const char *pFilename)
1494 1430
           return NULL;
1495 1431
         }
1496 1432
         // parse information
1497
-        if ((pInfoHeaderX =
1498
-             memchr(pInfoHeader, 0, subHeaderSize - 6)) != NULL) {
1433
+        if ((pInfoHeaderX = memchr(pInfoHeader, 0, subHeaderSize - 6)) !=
1434
+            NULL) {
1499 1435
           pInfoHeaderX++;
1500 1436
           len = pInfoHeaderX - pInfoHeader;
1501 1437
           if (memchr(pInfoHeaderX, 0, subHeaderSize - 6 - len) != NULL)
... ...
@@ -1520,9 +1456,9 @@ stBlinkenMovie *BlinkenMovieLoadBbm(const char *pFilename)
1520 1456
     fclose(pFile);
1521 1457
     return NULL;
1522 1458
   }
1523
-  frameStartMarkerMagic =
1524
-      (unsigned long)frameStartMarker[0] << 24 | (unsigned long)
1525
-      frameStartMarker[1] << 16 | (unsigned long)frameStartMarker[2] << 8 |
1459
+  frameStartMarkerMagic = (unsigned long)frameStartMarker[0] << 24 |
1460
+                          (unsigned long)frameStartMarker[1] << 16 |
1461
+                          (unsigned long)frameStartMarker[2] << 8 |
1526 1462
                           (unsigned long)frameStartMarker[3];
1527 1463
   if (frameStartMarkerMagic != 0x66726D73) // 'f' 'r' 'm' 's'
1528 1464
   {
... ...
@@ -1546,8 +1482,7 @@ stBlinkenMovie *BlinkenMovieLoadBbm(const char *pFilename)
1546 1482
     duration =
1547 1483
         (unsigned short)pFrameData[0] << 8 | (unsigned short)pFrameData[1];
1548 1484
     // build frame and append it to movie
1549
-    pFrame =
1550
-        BlinkenFrameNew(headerHeight, headerWidth, headerChannels,
1485
+    pFrame = BlinkenFrameNew(headerHeight, headerWidth, headerChannels,
1551 1486
                              headerMaxval, duration);
1552 1487
     if (pFrame == NULL)
1553 1488
       break;
... ...
@@ -1574,8 +1509,7 @@ stBlinkenMovie *BlinkenMovieLoadBbm(const char *pFilename)
1574 1509
 
1575 1510
 #ifdef BLINKENLIB_CFG_MNG
1576 1511
 
1577
-stBlinkenMovie *BlinkenMovieLoadMng(const char *pFilename)
1578
-{
1512
+stBlinkenMovie *BlinkenMovieLoadMng(const char *pFilename) {
1579 1513
   return BlinkenMngLoad(pFilename);
1580 1514
 }
1581 1515
 
... ...
@@ -1583,15 +1517,13 @@ stBlinkenMovie *BlinkenMovieLoadMng(const char *pFilename)
1583 1517
 
1584 1518
 #ifdef BLINKENLIB_CFG_GIF
1585 1519
 
1586
-stBlinkenMovie *BlinkenMovieLoadGif(const char *pFilename)
1587
-{
1520
+stBlinkenMovie *BlinkenMovieLoadGif(const char *pFilename) {
1588 1521
   return BlinkenGifLoad(pFilename);
1589 1522
 }
1590 1523
 
1591 1524
 #endif // #ifdef BLINKENLIB_CFG_GIF
1592 1525
 
1593
-stBlinkenMovie *BlinkenMovieLoad(const char *pFilename)
1594
-{
1526
+stBlinkenMovie *BlinkenMovieLoad(const char *pFilename) {
1595 1527
   int len;
1596 1528
 
1597 1529
   if (pFilename == NULL)
... ...
@@ -1617,8 +1549,7 @@ stBlinkenMovie *BlinkenMovieLoad(const char *pFilename)
1617 1549
   return NULL;
1618 1550
 }
1619 1551
 
1620
-int BlinkenMovieSaveBlm(stBlinkenMovie *pMovie, const char *pFilename)
1621
-{
1552
+int BlinkenMovieSaveBlm(stBlinkenMovie *pMovie, const char *pFilename) {
1622 1553
   stBlinkenMovie *pOutMovie;
1623 1554
   FILE *pFile;
1624 1555
   int i, y, x;
... ...
@@ -1649,8 +1580,7 @@ int BlinkenMovieSaveBlm(stBlinkenMovie *pMovie, const char *pFilename)
1649 1580
 
1650 1581
   // write frames
1651 1582
   for (i = 0; i < pOutMovie->frameCnt; i++) {
1652
-    fprintf(pFile, "\n@%u\n",
1653
-            BlinkenFrameGetDuration(pOutMovie->ppFrames[i]));
1583
+    fprintf(pFile, "\n@%u\n", BlinkenFrameGetDuration(pOutMovie->ppFrames[i]));
1654 1584
     for (y = 0; y < pOutMovie->height; y++) {
1655 1585
       for (x = 0; x < pOutMovie->width; x++) {
1656 1586
         if (BlinkenFrameGetPixel(pOutMovie->ppFrames[i], y, x, 0) != 0)
... ...
@@ -1672,8 +1602,7 @@ int BlinkenMovieSaveBlm(stBlinkenMovie *pMovie, const char *pFilename)
1672 1602
   return 0;
1673 1603
 }
1674 1604
 
1675
-int BlinkenMovieSaveBmm(stBlinkenMovie *pMovie, const char *pFilename)
1676
-{
1605
+int BlinkenMovieSaveBmm(stBlinkenMovie *pMovie, const char *pFilename) {
1677 1606
   stBlinkenMovie *pOutMovie;
1678 1607
   FILE *pFile;
1679 1608
   int i, y, x;
... ...
@@ -1704,8 +1633,7 @@ int BlinkenMovieSaveBmm(stBlinkenMovie *pMovie, const char *pFilename)
1704 1633
 
1705 1634
   // write frames
1706 1635
   for (i = 0; i < pOutMovie->frameCnt; i++) {
1707
-    fprintf(pFile, "\n@%u\n",
1708
-            BlinkenFrameGetDuration(pOutMovie->ppFrames[i]));
1636
+    fprintf(pFile, "\n@%u\n", BlinkenFrameGetDuration(pOutMovie->ppFrames[i]));
1709 1637
     for (y = 0; y < pOutMovie->height; y++) {
1710 1638
       fprintf(pFile, "0x%02X",
1711 1639
               BlinkenFrameGetPixel(pOutMovie->ppFrames[i], y, 0, 0));
... ...
@@ -1726,8 +1654,7 @@ int BlinkenMovieSaveBmm(stBlinkenMovie *pMovie, const char *pFilename)
1726 1654
   return 0;
1727 1655
 }
1728 1656
 
1729
-int BlinkenMovieSaveBml(stBlinkenMovie *pMovie, const char *pFilename)
1730
-{
1657
+int BlinkenMovieSaveBml(stBlinkenMovie *pMovie, const char *pFilename) {
1731 1658
   stBlinkenMovie *pOutMovie;
1732 1659
   FILE *pFile;
1733 1660
   int bits, val, i, y, x, c;
... ...
@@ -1740,7 +1667,8 @@ int BlinkenMovieSaveBml(stBlinkenMovie *pMovie, const char *pFilename)
1740 1667
   if (pOutMovie == NULL)
1741 1668
     return -1;
1742 1669
   val = pOutMovie->maxval; // get number of bits
1743
-  for (bits = 0; val != 0; val >>= 1, bits++) ;
1670
+  for (bits = 0; val != 0; val >>= 1, bits++)
1671
+    ;
1744 1672
   BlinkenMovieResize(pOutMovie, pOutMovie->height, pOutMovie->width,
1745 1673
                      pOutMovie->channels, (1 << bits) - 1);
1746 1674
 
... ...
@@ -1767,8 +1695,7 @@ int BlinkenMovieSaveBml(stBlinkenMovie *pMovie, const char *pFilename)
1767 1695
       fprintf(pFile, "\t\t<description>%s</description>\n",
1768 1696
               pOutMovie->pppInfos[i][1]);
1769 1697
     else if (strcmp(pOutMovie->pppInfos[i][0], "creator") == 0)
1770
-      fprintf(pFile, "\t\t<creator>%s</creator>\n",
1771
-              pOutMovie->pppInfos[i][1]);
1698
+      fprintf(pFile, "\t\t<creator>%s</creator>\n", pOutMovie->pppInfos[i][1]);
1772 1699
     else if (strcmp(pOutMovie->pppInfos[i][0], "author") == 0)
1773 1700
       fprintf(pFile, "\t\t<author>%s</author>\n", pOutMovie->pppInfos[i][1]);
1774 1701
     else if (strcmp(pOutMovie->pppInfos[i][0], "email") == 0)
... ...
@@ -1809,12 +1736,10 @@ int BlinkenMovieSaveBml(stBlinkenMovie *pMovie, const char *pFilename)
1809 1736
   return 0;
1810 1737
 }
1811 1738
 
1812
-int BlinkenMovieSaveBbm(stBlinkenMovie *pMovie, const char *pFilename)
1813
-{
1739
+int BlinkenMovieSaveBbm(stBlinkenMovie *pMovie, const char *pFilename) {
1814 1740
   unsigned char *pFrameData;
1815 1741
   FILE *pFile;
1816
-  unsigned char header[24], infoHeader[6], framePointer[4],
1817
-      frameStartMarker[4];
1742
+  unsigned char header[24], infoHeader[6], framePointer[4], frameStartMarker[4];
1818 1743
   int duration, len, len0, len1, i, j, y, x, c, val;
1819 1744
   long pos;
1820 1745
 
... ...
@@ -1822,9 +1747,7 @@ int BlinkenMovieSaveBbm(stBlinkenMovie *pMovie, const char *pFilename)
1822 1747
     return -1;
1823 1748
 
1824 1749
   // allocate frame data buffer
1825
-  pFrameData =
1826
-      (unsigned char *)malloc(2 +
1827
-                              pMovie->height * pMovie->width *
1750
+  pFrameData = (unsigned char *)malloc(2 + pMovie->height * pMovie->width *
1828 1751
                                                pMovie->channels);
1829 1752
   if (pFrameData == NULL)
1830 1753
     return -1;
... ...
@@ -1928,8 +1851,7 @@ int BlinkenMovieSaveBbm(stBlinkenMovie *pMovie, const char *pFilename)
1928 1851
 
1929 1852
 #ifdef BLINKENLIB_CFG_MNG
1930 1853
 
1931
-int BlinkenMovieSaveMng(stBlinkenMovie *pMovie, const char *pFilename)
1932
-{
1854
+int BlinkenMovieSaveMng(stBlinkenMovie *pMovie, const char *pFilename) {
1933 1855
   return BlinkenMngSave(pMovie, pFilename);
1934 1856
 }
1935 1857
 
... ...
@@ -1937,15 +1859,13 @@ int BlinkenMovieSaveMng(stBlinkenMovie *pMovie, const char *pFilename)
1937 1859
 
1938 1860
 #ifdef BLINKENLIB_CFG_GIF
1939 1861
 
1940
-int BlinkenMovieSaveGif(stBlinkenMovie *pMovie, const char *pFilename)
1941
-{
1862
+int BlinkenMovieSaveGif(stBlinkenMovie *pMovie, const char *pFilename) {
1942 1863
   return BlinkenGifSave(pMovie, pFilename);
1943 1864
 }
1944 1865
 
1945 1866
 #endif // #ifdef BLINKENLIB_CFG_GIF
1946 1867
 
1947
-int BlinkenMovieSave(stBlinkenMovie *pMovie, const char *pFilename)
1948
-{
1868
+int BlinkenMovieSave(stBlinkenMovie *pMovie, const char *pFilename) {
1949 1869
   int len;
1950 1870
 
1951 1871
   if (pMovie == NULL || pFilename == NULL)
... ...
@@ -1981,8 +1901,7 @@ void BlinkenMovieSend(stBlinkenMovie *pMovie, SOCKET udpSocket,
1981 1901
   char buffer[65536]; // 64kB is more than maximum UDP size
1982 1902
 
1983 1903
   for (i = 0; i < pMovie->frameCnt; i++) {
1984
-    len =
1985
-        BlinkenFrameToNetwork(pMovie->ppFrames[i], proto, buffer,
1904
+    len = BlinkenFrameToNetwork(pMovie->ppFrames[i], proto, buffer,
1986 1905
                                 sizeof(buffer));
1987 1906
     duration = BlinkenFrameGetDuration(pMovie->ppFrames[i]);
1988 1907
     if (len > 0) {
... ...
@@ -2048,10 +1967,9 @@ stBlinkenMovie *BlinkenMovieReceive(SOCKET udpSocket, int timeout,
2048 1967
           // no movie yet
2049 1968
           if (pMovie == NULL) {
2050 1969
             // allocate a new movie
2051
-            pMovie = BlinkenMovieNew(BlinkenFrameGetHeight(pFrame),
2052
-                                     BlinkenFrameGetWidth(pFrame),
2053
-                                     BlinkenFrameGetChannels(pFrame),
2054
-                                     BlinkenFrameGetMaxval(pFrame));
1970
+            pMovie = BlinkenMovieNew(
1971
+                BlinkenFrameGetHeight(pFrame), BlinkenFrameGetWidth(pFrame),
1972
+                BlinkenFrameGetChannels(pFrame), BlinkenFrameGetMaxval(pFrame));
2055 1973
             if (pMovie == NULL) {
2056 1974
               BlinkenFrameFree(pFrame);
2057 1975
               break;
... ...
@@ -2059,8 +1977,8 @@ stBlinkenMovie *BlinkenMovieReceive(SOCKET udpSocket, int timeout,
2059 1977
           }
2060 1978
           // ignore frame if it is equal to last one
2061 1979
           if (pMovie->frameCnt > 0) {
2062
-            if (BlinkenFrameCompare
2063
-                (pFrame, pMovie->ppFrames[pMovie->frameCnt - 1]) == 0) {
1980
+            if (BlinkenFrameCompare(
1981
+                    pFrame, pMovie->ppFrames[pMovie->frameCnt - 1]) == 0) {
2064 1982
               BlinkenFrameFree(pFrame);
2065 1983
               continue;
2066 1984
             }
... ...
@@ -5,13 +5,13 @@
5 5
 
6 6
 #include <string.h>
7 7
 #ifdef WIN32
8
-#include <winsock2.h>
9 8
 #include <windows.h>
9
+#include <winsock2.h>
10 10
 typedef WORD uint16_t;
11 11
 typedef DWORD uint32_t;
12 12
 #else
13
-#include <stdint.h>
14 13
 #include <netinet/in.h>
14
+#include <stdint.h>
15 15
 #endif
16 16
 
17 17
 #include <BlinkenLib/BlinkenProto.h>
... ...
@@ -131,8 +131,7 @@ int BlinkenProtoMakePacket(etBlinkenProto proto, etBlinkenPacket packet,
131 131
 }
132 132
 
133 133
 void BlinkenProtoDetectPacket(const char *pData, int length,
134
-                              etBlinkenProto * pProto,
135
-                              etBlinkenPacket * pPacket)
134
+                              etBlinkenProto *pProto, etBlinkenPacket *pPacket)
136 135
 // returns protocol in *pProto if pProto not NULL
137 136
 // returns packet type in *pPacket if pPacket not NULL
138 137
 {
... ...
@@ -161,28 +160,32 @@ void BlinkenProtoDetectPacket(const char *pData, int length,
161 160
     }
162 161
     break;
163 162
   case BlinkenProtoBlpReqMagic:
164
-    if (length >= (int)sizeof(magic) + 10 && !memcmp(pData + sizeof(magic), "REFRESH256", 10)) {
163
+    if (length >= (int)sizeof(magic) + 10 &&
164
+        !memcmp(pData + sizeof(magic), "REFRESH256", 10)) {
165 165
       if (pProto)
166 166
         *pProto = BlinkenProtoEblp;
167 167
       if (pPacket)
168 168
         *pPacket = BlinkenPacketRequest;
169 169
       return;
170 170
     }
171
-    if (length >= (int)sizeof(magic) + 8 && !memcmp(pData + sizeof(magic), "CLOSE256", 8)) {
171
+    if (length >= (int)sizeof(magic) + 8 &&
172
+        !memcmp(pData + sizeof(magic), "CLOSE256", 8)) {
172 173
       if (pProto)
173 174
         *pProto = BlinkenProtoEblp;
174 175
       if (pPacket)
175 176
         *pPacket = BlinkenPacketEndRequest;
176 177
       return;
177 178
     }
178
-    if (length >= (int)sizeof(magic) + 7 && !memcmp(pData + sizeof(magic), "REFRESH", 7)) {
179
+    if (length >= (int)sizeof(magic) + 7 &&
180
+        !memcmp(pData + sizeof(magic), "REFRESH", 7)) {
179 181
       if (pProto)
180 182
         *pProto = BlinkenProtoBlp;
181 183
       if (pPacket)
182 184
         *pPacket = BlinkenPacketRequest;
183 185
       return;
184 186
     }
185
-    if (length >= (int)sizeof(magic) + 5 && !memcmp(pData + sizeof(magic), "CLOSE", 5)) {
187
+    if (length >= (int)sizeof(magic) + 5 &&
188
+        !memcmp(pData + sizeof(magic), "CLOSE", 5)) {
186 189
       if (pProto)
187 190
         *pProto = BlinkenProtoBlp;
188 191
       if (pPacket)
... ...
@@ -7,8 +7,7 @@
7 7
 
8 8
 #include "Tools.h"
9 9
 
10
-void *BlinkenMalloc1D(int count1, int size)
11
-{
10
+void *BlinkenMalloc1D(int count1, int size) {
12 11
   if (count1 < 1)
13 12
     count1 = 1;
14 13
   if (size < 1)
... ...
@@ -17,8 +16,7 @@ void *BlinkenMalloc1D(int count1, int size)
17 16
   return malloc(count1 * size);
18 17
 }
19 18
 
20
-void **BlinkenMalloc2D(int count1, int count2, int size)
21
-{
19
+void **BlinkenMalloc2D(int count1, int count2, int size) {
22 20
   int sz, i;
23 21
   char *p;
24 22
   void **ptr;
... ...
@@ -19,12 +19,17 @@
19 19
  * @param[in] str_duration duration of each frame in ms (as string)
20 20
  */
21 21
 static void gen_test_movie(stBlinkenMovie **ppMovie, const char *str_format,
22
-                           const char *str_mode, const char *str_duration)
23
-{
22
+                           const char *str_mode, const char *str_duration) {
24 23
   unsigned int height, width, channels, colors;
25 24
   enum {
26
-    ModeNone, ModeBlack, ModeWhite, ModeGradient,
27
-    ModeDots, ModeLines, ModeTrans, ModeRainbow,
25
+    ModeNone,
26
+    ModeBlack,
27
+    ModeWhite,
28
+    ModeGradient,
29
+    ModeDots,
30
+    ModeLines,
31
+    ModeTrans,
32
+    ModeRainbow,
28 33
   } mode = ModeNone;
29 34
   int fmt_ok, append, duration;
30 35
 
... ...
@@ -43,8 +48,8 @@ static void gen_test_movie(stBlinkenMovie **ppMovie, const char *str_format,
43 48
       append = 1;
44 49
     }
45 50
   } else {
46
-    fmt_ok = sscanf(str_format, "%ux%u-%u/%u",
47
-                    &width, &height, &channels, &colors) == 4;
51
+    fmt_ok = sscanf(str_format, "%ux%u-%u/%u", &width, &height, &channels,
52
+                    &colors) == 4;
48 53
     append = 0;
49 54
   }
50 55
   // mode
... ...
@@ -96,9 +101,7 @@ static void gen_test_movie(stBlinkenMovie **ppMovie, const char *str_format,
96 101
         break;
97 102
 
98 103
       case ModeBlack:
99
-        pFrame =
100
-            BlinkenFrameNew(height, width, channels, colors - 1,
101
-                            duration);
104
+        pFrame = BlinkenFrameNew(height, width, channels, colors - 1, duration);
102 105
         for (yy = 0; yy < height; yy++)
103 106
           for (xx = 0; xx < width; xx++)
104 107
             for (cc = 0; cc < channels; cc++)
... ...
@@ -107,9 +110,7 @@ static void gen_test_movie(stBlinkenMovie **ppMovie, const char *str_format,
107 110
         break;
108 111
 
109 112
       case ModeWhite:
110
-        pFrame =
111
-            BlinkenFrameNew(height, width, channels, colors - 1,
112
-                            duration);
113
+        pFrame = BlinkenFrameNew(height, width, channels, colors - 1, duration);
113 114
         for (yy = 0; yy < height; yy++)
114 115
           for (xx = 0; xx < width; xx++)
115 116
             for (cc = 0; cc < channels; cc++)
... ...
@@ -118,19 +119,29 @@ static void gen_test_movie(stBlinkenMovie **ppMovie, const char *str_format,
118 119
         break;
119 120
 
120 121
       case ModeGradient:
121
-        pFrame =
122
-            BlinkenFrameNew(height, width, channels, colors - 1,
123
-                            duration);
122
+        pFrame = BlinkenFrameNew(height, width, channels, colors - 1, duration);
124 123
         for (yy = 0; yy < height; yy++) {
125 124
           fy = (float)yy / (float)(height - 1);
126 125
           for (xx = 0; xx < width; xx++) {
127 126
             fx = (float)xx / (float)(width - 1);
128 127
             for (cc = 0, ccc = 0; cc < channels; cc++) {
129 128
               switch (ccc) {
130
-                case 0:  fc = fx;                      ccc = 1; break;
131
-                case 1:  fc = fy;                      ccc = 2; break;
132
-                case 2:  fc = 1.0f - 0.5f * (fx + fy); ccc = 0; break;
133
-                default: fc = 0.0f;                    ccc = 0; break;
129
+              case 0:
130
+                fc = fx;
131
+                ccc = 1;
132
+                break;
133
+              case 1:
134
+                fc = fy;
135
+                ccc = 2;
136
+                break;
137
+              case 2:
138
+                fc = 1.0f - 0.5f * (fx + fy);
139
+                ccc = 0;
140
+                break;
141
+              default:
142
+                fc = 0.0f;
143
+                ccc = 0;
144
+                break;
134 145
               }
135 146
               BlinkenFrameSetPixel(pFrame, yy, xx, cc,
136 147
                                    (int)(fc * (float)(colors - 1) + .5f));
... ...
@@ -144,15 +155,14 @@ static void gen_test_movie(stBlinkenMovie **ppMovie, const char *str_format,
144 155
         for (c = 0; c < channels; c++)
145 156
           for (y = 0; y < height; y++)
146 157
             for (x = 0; x < width; x++) {
147
-              pFrame =
148
-                  BlinkenFrameNew(height, width, channels, colors - 1,
158
+              pFrame = BlinkenFrameNew(height, width, channels, colors - 1,
149 159
                                        duration);
150 160
               for (yy = 0; yy < height; yy++)
151 161
                 for (xx = 0; xx < width; xx++)
152 162
                   for (cc = 0; cc < channels; cc++)
153
-                    BlinkenFrameSetPixel(pFrame, yy, xx, cc,
154
-                                         yy == y && xx == x
155
-                                         && cc == c ? colors - 1 : 0);
163
+                    BlinkenFrameSetPixel(
164
+                        pFrame, yy, xx, cc,
165
+                        yy == y && xx == x && cc == c ? colors - 1 : 0);
156 166
               BlinkenMovieAppendFrame(*ppMovie, pFrame);
157 167
             }
158 168
         break;
... ...
@@ -161,8 +171,7 @@ static void gen_test_movie(stBlinkenMovie **ppMovie, const char *str_format,
161 171
         for (c = 0; c < channels; c++) {
162 172
           for (x = 0; x < width; x++) {
163 173
             pFrame =
164
-                BlinkenFrameNew(height, width, channels, colors - 1,
165
-                                duration);
174
+                BlinkenFrameNew(height, width, channels, colors - 1, duration);
166 175
             for (yy = 0; yy < height; yy++)
167 176
               for (xx = 0; xx < width; xx++)
168 177
                 for (cc = 0; cc < channels; cc++)
... ...
@@ -172,8 +181,7 @@ static void gen_test_movie(stBlinkenMovie **ppMovie, const char *str_format,
172 181
           }
173 182
           for (y = 0; y < height; y++) {
174 183
             pFrame =
175
-                BlinkenFrameNew(height, width, channels, colors - 1,
176
-                                duration);
184
+                BlinkenFrameNew(height, width, channels, colors - 1, duration);
177 185
             for (yy = 0; yy < height; yy++)
178 186
               for (xx = 0; xx < width; xx++)
179 187
                 for (cc = 0; cc < channels; cc++)
... ...
@@ -189,14 +197,16 @@ static void gen_test_movie(stBlinkenMovie **ppMovie, const char *str_format,
189 197
           for (b = 0; b < 2; b++)
190 198
             for (c2 = 0; c2 < channels; c2++)
191 199
               for (o = 0; o < colors - 1; o++) {
192
-                pFrame =
193
-                    BlinkenFrameNew(height, width, channels, colors - 1,
200
+                pFrame = BlinkenFrameNew(height, width, channels, colors - 1,
194 201
                                          duration);
195 202
                 for (cc = 0; cc < channels; cc++) {
196 203
                   c3 = (cc + channels - c) % channels;
197
-                  oo = b ? (c3 < c2 ? 0 : c3 >
198
-                            c2 ? colors - 1 : colors - 1 - o)
199
-                      : (c3 < c2 ? colors - 1 : c3 > c2 ? 0 : o);
204
+                  oo = b ? (c3 < c2   ? 0
205
+                            : c3 > c2 ? colors - 1
206
+                                      : colors - 1 - o)
207
+                         : (c3 < c2   ? colors - 1
208
+                            : c3 > c2 ? 0
209
+                                      : o);
200 210
                   for (yy = 0; yy < height; yy++)
201 211
                     for (xx = 0; xx < width; xx++)
202 212
                       BlinkenFrameSetPixel(pFrame, yy, xx, cc, oo);
... ...
@@ -207,30 +217,64 @@ static void gen_test_movie(stBlinkenMovie **ppMovie, const char *str_format,
207 217
 
208 218
       case ModeRainbow:
209 219
         for (b = 0; b < width * height; b++) {
210
-          pFrame = BlinkenFrameNew(height, width, channels,
211
-                                   colors - 1, duration);
220
+          pFrame =
221
+              BlinkenFrameNew(height, width, channels, colors - 1, duration);
212 222
           for (yy = 0; yy < height; yy++) {
213 223
             for (xx = 0; xx < width; xx++) {
214 224
               for (cc = 0; cc < channels; cc++) {
215 225
                 y = b + yy + xx + cc * 8;
216 226
                 switch (y % 24) {
217
-                  case  0: oo = 0; break;
218
-                  case  1: oo = 1; break;
219
-                  case  2: oo = 2; break;
220
-                  case  3: oo = 3; break;
221
-                  case  4: oo = 4; break;
222
-                  case  5: oo = 4; break;
223
-                  case  6: oo = 4; break;
224
-                  case  7: oo = 4; break;
225
-                  case  8: oo = 4; break;
226
-                  case  9: oo = 4; break;
227
-                  case 10: oo = 4; break;
228
-                  case 11: oo = 4; break;
229
-                  case 12: oo = 4; break;
230
-                  case 13: oo = 3; break;
231
-                  case 14: oo = 2; break;
232
-                  case 15: oo = 1; break;
233
-                  default: oo = 0; break;
227
+                case 0:
228
+                  oo = 0;
229
+                  break;
230
+                case 1:
231
+                  oo = 1;
232
+                  break;
233
+                case 2:
234
+                  oo = 2;
235
+                  break;
236
+                case 3:
237
+                  oo = 3;
238
+                  break;
239
+                case 4:
240
+                  oo = 4;
241
+                  break;
242
+                case 5:
243
+                  oo = 4;
244
+                  break;
245
+                case 6:
246
+                  oo = 4;
247
+                  break;
248
+                case 7:
249
+                  oo = 4;
250
+                  break;
251
+                case 8:
252
+                  oo = 4;
253
+                  break;
254
+                case 9:
255
+                  oo = 4;
256
+                  break;
257
+                case 10:
258
+                  oo = 4;
259
+                  break;
260
+                case 11:
261
+                  oo = 4;
262
+                  break;
263
+                case 12:
264
+                  oo = 4;
265
+                  break;
266
+                case 13:
267
+                  oo = 3;
268
+                  break;
269
+                case 14:
270
+                  oo = 2;
271
+                  break;
272
+                case 15:
273
+                  oo = 1;
274
+                  break;
275
+                default:
276
+                  oo = 0;
277
+                  break;
234 278
                 }
235 279
                 oo = oo * colors / 4;
236 280
                 if (oo > colors - 1)
... ...
@@ -255,8 +299,7 @@ static void gen_test_movie(stBlinkenMovie **ppMovie, const char *str_format,
255 299
 
256 300
 static void copy_rect(stBlinkenMovie *pMovie, char *str_file,
257 301
                       const char *str_src_pos, const char *str_dim,
258
-                      const char *str_dest_pos)
259
-{
302
+                      const char *str_dest_pos) {
260 303
   unsigned int sy, sx, h, w, dy, dx;
261 304
   stBlinkenMovie *pSrcMovie;
262 305
 
... ...
@@ -275,23 +318,24 @@ static void copy_rect(stBlinkenMovie *pMovie, char *str_file,
275 318
 
276 319
       BlinkenMovieCopyRect(pMovie, dy, dx, pSrcMovie, sy, sx, h, w);
277 320
       BlinkenMovieFree(pSrcMovie);
278
-      printf("copied %ux%u pixels from movie \"%s\" %u,%u to %u,%u\n",
279
-             w, h, str_file, sx, sy, dx, dy );
280
-
321
+      printf("copied %ux%u pixels from movie \"%s\" %u,%u to %u,%u\n", w, h,
322
+             str_file, sx, sy, dx, dy);
281 323
     }
282 324
   }
283 325
 }
284 326
 
285
-static stBlinkenMovie * scroll(stBlinkenMovie *pMovie,
286
-                               const char * str_direction,
327
+static stBlinkenMovie *scroll(stBlinkenMovie *pMovie, const char *str_direction,
287 328
                               const char *str_width_height,
288
-                               const char * str_duration)
289
-{
329
+                              const char *str_duration) {
290 330
   enum {
291
-    DirNone, DirLeft, DirRight, DirUp, DirDown,
331
+    DirNone,
332
+    DirLeft,
333
+    DirRight,
334
+    DirUp,
335
+    DirDown,
292 336
   } dir = DirNone;
293
-  int width_height, duration, height, width, channels, maxval,
294
-      new_height, new_width, sy, sx, dy, dx, steps, step;
337
+  int width_height, duration, height, width, channels, maxval, new_height,
338
+      new_width, sy, sx, dy, dx, steps, step;
295 339
   stBlinkenFrame *pScroll, *pFrame;
296 340
 
297 341
   // direction
... ...
@@ -388,14 +432,13 @@ static stBlinkenMovie * scroll(stBlinkenMovie *pMovie,
388 432
   BlinkenFrameFree(pScroll);
389 433
 
390 434
   printf("scrolled %ux%u-%u/%u frame to %ux%u-%u/%u movie (direction %s)\n",
391
-         width, height, channels, maxval + 1,
392
-         new_width, new_height, channels, maxval + 1, str_direction);
435
+         width, height, channels, maxval + 1, new_width, new_height, channels,
436
+         maxval + 1, str_direction);
393 437
 
394 438
   return pMovie;
395 439
 }
396 440
 
397
-int main(int argCnt, char **args)
398
-{
441
+int main(int argCnt, char **args) {
399 442
   stBlinkenMovie *pMovie;
400 443
   int i;
401 444
   char *str;
... ...
@@ -424,12 +467,15 @@ int main(int argCnt, char **args)
424 467
 #else
425 468
 #define GIFEXT
426 469
 #endif
427
-    printf("syntax: %s <parameter> [...]\n\n"
470
+    printf(
471
+        "syntax: %s <parameter> [...]\n\n"
428 472
         "parameters:\n"
429 473
         "  -i <file>\n"
430
-           "     read movie from file (*.blm, *.bmm, *.bml, *.bbm" MNGEXT GIFEXT ")\n"
474
+        "     read movie from file (*.blm, *.bmm, *.bml, *.bbm" MNGEXT GIFEXT
475
+        ")\n"
431 476
         "  -a <file>\n"
432
-           "     append movie from file (*.blm, *.bmm, *.bml, *.bbm" MNGEXT GIFEXT ")\n"
477
+        "     append movie from file (*.blm, *.bmm, *.bml, *.bbm" MNGEXT GIFEXT
478
+        ")\n"
433 479
         "  -l <number>\n"
434 480
         "     loop video a number of times\n"
435 481
         "  -f\n"
... ...
@@ -477,7 +523,8 @@ int main(int argCnt, char **args)
477 523
         "  -Md2\n"
478 524
         "     mirror movie diagonally (/)\n"
479 525
         "  -o <file>\n"
480
-           "     write movie to file (*.blm, *.bmm, *.bml, *.bbm" MNGEXT GIFEXT ")\n\n"
526
+        "     write movie to file (*.blm, *.bmm, *.bml, *.bbm" MNGEXT GIFEXT
527
+        ")\n\n"
481 528
         "test_modes: black, white, gradient, dots, lines, trans, rainbow\n\n"
482 529
         "old syntax: %s <input-file> [<output-file>]\n\n",
483 530
         args[0], args[0]);
... ...
@@ -517,8 +564,7 @@ int main(int argCnt, char **args)
517 564
           else {
518 565
             if (BlinkenMovieConcat(pMovie, pMovie2) < 0) {
519 566
               BlinkenMovieFree(pMovie2);
520
-              printf("movie read from \"%s\" could not be appended\n",
521
-                     args[i]);
567
+              printf("movie read from \"%s\" could not be appended\n", args[i]);
522 568
             } else
523 569
               printf("movie \"%s\" read and appended\n", args[i]);
524 570
           }
... ...
@@ -567,16 +613,14 @@ int main(int argCnt, char **args)
567 613
     // output format, frame count and duration of movie
568 614
     else if (strcmp(args[i], "-f") == 0) {
569 615
       if (pMovie == NULL)
570
-        printf
571
-            ("no movie loaded to output format, frame count and duration of\n");
616
+        printf(
617
+            "no movie loaded to output format, frame count and duration of\n");
572 618
       else
573
-        printf
574
-            ("format:      %ux%u-%u/%u\nframe count: %u\nduration:    %u ms\n",
619
+        printf(
620
+            "format:      %ux%u-%u/%u\nframe count: %u\nduration:    %u ms\n",
575 621
             BlinkenMovieGetWidth(pMovie), BlinkenMovieGetHeight(pMovie),
576
-             BlinkenMovieGetChannels(pMovie),
577
-             BlinkenMovieGetMaxval(pMovie) + 1,
578
-             BlinkenMovieGetFrameCnt(pMovie),
579
-             BlinkenMovieGetDuration(pMovie));
622
+            BlinkenMovieGetChannels(pMovie), BlinkenMovieGetMaxval(pMovie) + 1,
623
+            BlinkenMovieGetFrameCnt(pMovie), BlinkenMovieGetDuration(pMovie));
580 624
     }
581 625
     // print movie
582 626
     else if (strcmp(args[i], "-p") == 0) {
... ...
@@ -596,8 +640,7 @@ int main(int argCnt, char **args)
596 640
     else if (strcmp(args[i], "-r") == 0) {
597 641
       if (i + 1 < argCnt) {
598 642
         i++;
599
-        if (sscanf
600
-            (args[i], "%ux%u-%u/%u", &width, &height, &channels,
643
+        if (sscanf(args[i], "%ux%u-%u/%u", &width, &height, &channels,
601 644
                    &colors) != 4)
602 645
           printf("invalid movie format \"%s\"\n", args[i]);
603 646
         else if (pMovie == NULL)
... ...
@@ -618,11 +661,9 @@ int main(int argCnt, char **args)
618 661
         topleft = args[i];
619 662
         i++;
620 663
         dimensions = args[i];
621
-        if (sscanf
622
-            (topleft, "%u,%u", &left, &top) != 2)
664
+        if (sscanf(topleft, "%u,%u", &left, &top) != 2)
623 665
           printf("invalid top-left position \"%s\"\n", topleft);
624
-        else if (sscanf
625
-            (dimensions, "%ux%u", &width, &height) != 2)
666
+        else if (sscanf(dimensions, "%ux%u", &width, &height) != 2)
626 667
           printf("invalid movie dimensions \"%s\"\n", dimensions);
627 668
         else if (pMovie == NULL)
628 669
           printf("no movie loaded to crop\n");
... ...
@@ -707,8 +748,7 @@ int main(int argCnt, char **args)
707 748
           BlinkenMovieCutTime(pMovie, begin, end);
708 749
           printf("movie cut to time %u-%u\n", begin, end);
709 750
         }
710
-      }
711
-      else if (i + 1 < argCnt) {
751
+      } else if (i + 1 < argCnt) {
712 752
         printf("missing end time for \"-ct\"\n");
713 753
         i++;
714 754
       } else
... ...
@@ -764,8 +804,7 @@ int main(int argCnt, char **args)
764 804
             printf("no movie loaded to delete frames from\n");
765 805
           else if (first + count >
766 806
                    (unsigned int)BlinkenMovieGetFrameCnt(pMovie))
767
-            printf
768
-                ("invalid frame range (%u-%u) for deletion from %u frames\n",
807
+            printf("invalid frame range (%u-%u) for deletion from %u frames\n",
769 808
                    first, first + count,
770 809
                    (unsigned int)BlinkenMovieGetFrameCnt(pMovie));
771 810
           else {
... ...
@@ -942,8 +981,8 @@ int main(int argCnt, char **args)
942 981
     }
943 982
     // old style input filename
944 983
     else if (i == 1 && args[i][0] != '-') {
945
-      printf("old style input filename \"%s\", better use \"-i %s\"\n",
946
-             args[i], args[i]);
984
+      printf("old style input filename \"%s\", better use \"-i %s\"\n", args[i],
985
+             args[i]);
947 986
       if (pMovie != NULL)
948 987
         BlinkenMovieFree(pMovie);
949 988
       pMovie = BlinkenMovieLoad(args[i]);
... ...
@@ -965,8 +1004,7 @@ int main(int argCnt, char **args)
965 1004
     }
966 1005
     // unknown parameter
967 1006
     else
968
-      printf
969
-          ("unknown parameter \"%s\", call without parameters to get help\n",
1007
+      printf("unknown parameter \"%s\", call without parameters to get help\n",
970 1008
              args[i]);
971 1009
 
972 1010
   } // for( i ...
... ...
@@ -7,21 +7,19 @@
7 7
 
8 8
 #include <errno.h>
9 9
 #include <fcntl.h>
10
-#include <stdlib.h>
11 10
 #include <stdio.h>
12 11
 #include <stdlib.h>
13 12
 #include <string.h>
13
+#include <sys/time.h>
14
+#include <sys/types.h>
14 15
 #include <termios.h>
15 16
 #include <time.h>
16 17
 #include <unistd.h>
17
-#include <sys/time.h>
18
-#include <sys/types.h>
19 18
 
20 19
 #include <BlinkenLib/BlinkenLib.h>
21 20
 
22 21
 // get serial settings from text
23
-static int serial_settings_parse(char *str, int *settings, int *speed)
24
-{
22
+static int serial_settings_parse(char *str, int *settings, int *speed) {
25 23
   int baud, data, stop;
26 24
   char parity;
27 25
   int set = 0, sp = 0;
... ...
@@ -32,7 +30,8 @@ static int serial_settings_parse(char *str, int *settings, int *speed)
32 30
 
33 31
     // baud rate
34 32
 #define BAUD(rate) else if (baud == rate) sp = B##rate;
35
-  if (0) {}
33
+  if (0) {
34
+  }
36 35
   BAUD(300)
37 36
   BAUD(600)
38 37
   BAUD(1200)
... ...
@@ -128,8 +127,7 @@ static int serial_settings_parse(char *str, int *settings, int *speed)
128 127
 
129 128
 // convert serial settings to text
130 129
 static void serial_settings_to_str(int settings, char *buf,
131
-                                   unsigned int maxlen)
132
-{
130
+                                   unsigned int maxlen) {
133 131
   int baud, data, stop;
134 132
   char parity;
135 133
 
... ...
@@ -188,8 +186,7 @@ static void serial_settings_to_str(int settings, char *buf,
188 186
 }
189 187
 
190 188
 // set serial settings for fd
191
-static int serial_settings_set(int fd, int settings, int speed)
192
-{
189
+static int serial_settings_set(int fd, int settings, int speed) {
193 190
   struct termios tio;
194 191
 
195 192
   // set port settings
... ...
@@ -222,11 +219,9 @@ static int serial_settings_set(int fd, int settings, int speed)
222 219
 // dev_fd may be -1 for not doing anything with device
223 220
 // returns error code (not for device-errors, 0 for success)
224 221
 static int out_movie(stBlinkenMovie *pMovie, int dev_fd,
225
-                     unsigned int format_change,
226
-                     unsigned int format_height, unsigned int format_width,
227
-                     unsigned int format_channels,
228
-                     unsigned int format_colors, etBlinkenProto proto)
229
-{
222
+                     unsigned int format_change, unsigned int format_height,
223
+                     unsigned int format_width, unsigned int format_channels,
224
+                     unsigned int format_colors, etBlinkenProto proto) {
230 225
   int frame_cnt, frame;
231 226
   stBlinkenFrame *pFrame;
232 227
   fd_set readFds, errFds;
... ...
@@ -255,8 +250,8 @@ static int out_movie(stBlinkenMovie *pMovie, int dev_fd,
255 250
 
256 251
     // change format
257 252
     if (format_change)
258
-      BlinkenFrameResize(pFrame, format_height, format_width,
259
-                         format_channels, format_colors - 1);
253
+      BlinkenFrameResize(pFrame, format_height, format_width, format_channels,
254
+                         format_colors - 1);
260 255
 
261 256
     // create output data from frame
262 257
     len = BlinkenFrameToNetwork(pFrame, proto, buffer, sizeof(buffer));
... ...
@@ -333,14 +328,12 @@ static int out_movie(stBlinkenMovie *pMovie, int dev_fd,
333 328
 // open device and output movie
334 329
 // returns error code (not for device-errors, 0 for success)
335 330
 static int open_and_output(stBlinkenMovie *pMovie, char *device,
336
-                           int serial_settings_change,
337
-                           int serial_settings, int serial_speed,
338
-                           unsigned int format_change,
331
+                           int serial_settings_change, int serial_settings,
332
+                           int serial_speed, unsigned int format_change,
339 333
                            unsigned int format_height,
340 334
                            unsigned int format_width,
341 335
                            unsigned int format_channels,
342
-                           unsigned int format_colors, etBlinkenProto proto)
343
-{
336
+                           unsigned int format_colors, etBlinkenProto proto) {
344 337
   int dev_fd, err;
345 338
   char txt[64];
346 339
 
... ...
@@ -362,8 +355,7 @@ static int open_and_output(stBlinkenMovie *pMovie, char *device,
362 355
     }
363 356
   }
364 357
   // output movie to device
365
-  err = out_movie(pMovie, dev_fd,
366
-                  format_change, format_height, format_width,
358
+  err = out_movie(pMovie, dev_fd, format_change, format_height, format_width,
367 359
                   format_channels, format_colors, proto);
368 360
 
369 361
   // close device
... ...
@@ -374,8 +366,7 @@ static int open_and_output(stBlinkenMovie *pMovie, char *device,
374 366
   return err;
375 367
 }
376 368
 
377
-int main(int argCnt, char **args)
378
-{
369
+int main(int argCnt, char **args) {
379 370
   int i, serial_settings, serial_speed;
380 371
   char *device;
381 372
   etBlinkenProto proto;
... ...
@@ -421,7 +412,8 @@ int main(int argCnt, char **args)
421 412
            "  -n <number>\n"
422 413
            "     set number of times to send movies (defaults to 1)\n"
423 414
            "  -i <file>\n"
424
-           "     read movie from file (*.blm, *.bmm, *.bml, *.bbm" MNGEXT GIFEXT ") and send it\n"
415
+           "     read movie from file (*.blm, *.bmm, *.bml, *.bbm" MNGEXT GIFEXT
416
+           ") and send it\n"
425 417
            "  -l <number>\n"
426 418
            "     loop number of times (defaults to 1, use 0 for forever)\n\n",
427 419
            args[0]);
... ...
@@ -471,10 +463,10 @@ int main(int argCnt, char **args)
471 463
       else if (strcmp(args[i], "-f") == 0) {
472 464
         if (i + 1 < argCnt) {
473 465
           i++;
474
-          if (sscanf
475
-              (args[i], "%ux%u-%u/%u", &width, &height, &channels, &colors) == 4
476
-              && width > 0 && width < 1000 && height > 0 && height < 1000
477
-              && channels > 0 && channels < 20 && colors > 1 && colors <= 256) {
466
+          if (sscanf(args[i], "%ux%u-%u/%u", &width, &height, &channels,
467
+                     &colors) == 4 &&
468
+              width > 0 && width < 1000 && height > 0 && height < 1000 &&
469
+              channels > 0 && channels < 20 && colors > 1 && colors <= 256) {
478 470
             format_change = 1;
479 471
             format_height = height;
480 472
             format_width = width;
... ...
@@ -528,9 +520,9 @@ int main(int argCnt, char **args)
528 520
               printf("outputting movie \"%s\" (%u/%u)...\n", args[i], ui + 1,
529 521
                      send_cnt);
530 522
               if (open_and_output(pMovie, device, serial_settings_change,
531
-                                  serial_settings, serial_speed,
532
-                                  format_change, format_height, format_width,
533
-                                  format_channels, format_colors, proto) == 0) {
523
+                                  serial_settings, serial_speed, format_change,
524
+                                  format_height, format_width, format_channels,
525
+                                  format_colors, proto) == 0) {
534 526
                 printf("movie \"%s\" output successful\n", args[i]);
535 527
               } else {
536 528
                 printf("movie \"%s\" output failed\n", args[i]);
... ...
@@ -555,8 +547,8 @@ int main(int argCnt, char **args)
555 547
       }
556 548
       // unknown parameter
557 549
       else
558
-        printf
559
-            ("unknown parameter \"%s\", call without parameters to get help\n",
550
+        printf(
551
+            "unknown parameter \"%s\", call without parameters to get help\n",
560 552
             args[i]);
561 553
 
562 554
     } // for( i ...
... ...
@@ -5,25 +5,24 @@
5 5
 /* OS X support by Manfred Wuits
6 6
    <manfred@werkzeugH.at> */
7 7
 
8
+#include <arpa/inet.h>
8 9
 #include <errno.h>
9 10
 #include <fcntl.h>
10
-#include <stdlib.h>
11
+#include <netinet/in.h>
11 12
 #include <stdio.h>
13
+#include <stdlib.h>
12 14
 #include <string.h>
15
+#include <sys/socket.h>
16
+#include <sys/time.h>
17
+#include <sys/types.h>
13 18
 #include <termios.h>
14 19
 #include <time.h>
15 20
 #include <unistd.h>
16
-#include <arpa/inet.h>
17
-#include <netinet/in.h>
18
-#include <sys/types.h>
19
-#include <sys/time.h>
20
-#include <sys/socket.h>
21 21
 
22 22
 #include <BlinkenLib/BlinkenLib.h>
23 23
 
24 24
 // get serial settings from text
25
-static int serial_settings_parse(char *str, int *settings, int *speed)
26
-{
25
+static int serial_settings_parse(char *str, int *settings, int *speed) {
27 26
   int baud, data, stop;
28 27
   char parity;
29 28
   int set = 0, sp = 0;
... ...
@@ -34,7 +33,8 @@ static int serial_settings_parse(char *str, int *settings, int *speed)
34 33
 
35 34
     // baud rate
36 35
 #define BAUD(rate) else if (baud == rate) sp = B##rate;
37
-  if (0) {}
36
+  if (0) {
37
+  }
38 38
   BAUD(300)
39 39
   BAUD(600)
40 40
   BAUD(1200)
... ...
@@ -130,8 +130,7 @@ static int serial_settings_parse(char *str, int *settings, int *speed)
130 130
 
131 131
 // convert serial settings to text
132 132
 static void serial_settings_to_str(int settings, char *buf,
133
-                                   unsigned int maxlen)
134
-{
133
+                                   unsigned int maxlen) {
135 134
   int baud, data, stop;
136 135
   char parity;
137 136
 
... ...
@@ -190,8 +189,7 @@ static void serial_settings_to_str(int settings, char *buf,
190 189
 }
191 190
 
192 191
 // set serial settings for fd
193
-static int serial_settings_set(int fd, int settings, int speed)
194
-{
192
+static int serial_settings_set(int fd, int settings, int speed) {
195 193
   struct termios tio;
196 194
 
197 195
   // set port settings
... ...
@@ -226,12 +224,10 @@ static int serial_settings_set(int fd, int settings, int speed)
226 224
 static int recv_and_out(SOCKET udpSocket, int dev_fd,
227 225
                         int *p_device_output_active,
228 226
                         unsigned int min_interval_ms,
229
-                        unsigned int format_change,
230
-                        unsigned int format_height, unsigned int format_width,
231
-                        unsigned int format_channels,
227
+                        unsigned int format_change, unsigned int format_height,
228
+                        unsigned int format_width, unsigned int format_channels,
232 229
                         unsigned int format_colors, etBlinkenProto proto,
233
-                        int use_msecs, unsigned int msecs)
234
-{
230
+                        int use_msecs, unsigned int msecs) {
235 231
   fd_set readFds, errFds;
236 232
   stBlinkenFrame *pFrame;
237 233
   char buffer[65536]; // 64kB is more than maximum UDP size
... ...
@@ -373,17 +369,13 @@ static int recv_and_out(SOCKET udpSocket, int dev_fd,
373 369
 
374 370
 // open device and output frames
375 371
 // returns error code (not for device-errors, 0 for success)
376
-static int open_and_output(SOCKET udpSocket, char *device,
377
-                           int *p_device_output_active,
372
+static int
373
+open_and_output(SOCKET udpSocket, char *device, int *p_device_output_active,
378 374
                 int serial_settings_change, int serial_settings,
379
-                           int serial_speed,
380
-                           unsigned int min_interval_ms,
381
-                           unsigned int format_change,
382
-                           unsigned int format_height,
383
-                           unsigned int format_width,
384
-                           unsigned int format_channels,
385
-                           unsigned int format_colors, etBlinkenProto proto)
386
-{
375
+                int serial_speed, unsigned int min_interval_ms,
376
+                unsigned int format_change, unsigned int format_height,
377
+                unsigned int format_width, unsigned int format_channels,
378
+                unsigned int format_colors, etBlinkenProto proto) {
387 379
   int dev_fd, err;
388 380
   char txt[64];
389 381
 
... ...
@@ -406,8 +398,7 @@ static int open_and_output(SOCKET udpSocket, char *device,
406 398
     }
407 399
   }
408 400
   // receive frames and output to device
409
-  err = recv_and_out(udpSocket, dev_fd, p_device_output_active,
410
-                     min_interval_ms,
401
+  err = recv_and_out(udpSocket, dev_fd, p_device_output_active, min_interval_ms,
411 402
                      format_change, format_height, format_width,
412 403
                      format_channels, format_colors, proto, 0, 0);
413 404
 
... ...
@@ -419,19 +410,14 @@ static int open_and_output(SOCKET udpSocket, char *device,
419 410
 
420 411
 // open device and output frames in a loop
421 412
 // returns error code (not for device-errors, 0 for success)
422
-static int open_and_output_loop(SOCKET udpSocket, char *device,
423
-                                int serial_settings_change,
424
-                                int serial_settings, int serial_speed,
425
-                                int reopen_device,
413
+static int
414
+open_and_output_loop(SOCKET udpSocket, char *device, int serial_settings_change,
415
+                     int serial_settings, int serial_speed, int reopen_device,
426 416
                      unsigned int reopen_device_ms,
427
-                                unsigned int min_interval_ms,
428
-                                unsigned int format_change,
429
-                                unsigned int format_height,
430
-                                unsigned int format_width,
431
-                                unsigned int format_channels,
432
-                                unsigned int format_colors,
433
-                                etBlinkenProto proto)
434
-{
417
+                     unsigned int min_interval_ms, unsigned int format_change,
418
+                     unsigned int format_height, unsigned int format_width,
419
+                     unsigned int format_channels, unsigned int format_colors,
420
+                     etBlinkenProto proto) {
435 421
   int device_output_active, err;
436 422
 
437 423
   printf("receiving frames and outputting them to \"%s\"...\n", device);
... ...
@@ -440,13 +426,10 @@ static int open_and_output_loop(SOCKET udpSocket, char *device,
440 426
   for (;;) {
441 427
 
442 428
     // try to open device and output frames
443
-    err = open_and_output(udpSocket, device,
444
-                          &device_output_active,
445
-                          serial_settings_change, serial_settings,
446
-                          serial_speed, min_interval_ms,
447
-                          format_change, format_height,
448
-                          format_width, format_channels, format_colors,
449
-                          proto);
429
+    err = open_and_output(udpSocket, device, &device_output_active,
430
+                          serial_settings_change, serial_settings, serial_speed,
431
+                          min_interval_ms, format_change, format_height,
432
+                          format_width, format_channels, format_colors, proto);
450 433
     if (err != 0 || !reopen_device)
451 434
       break;
452 435
 
... ...
@@ -456,8 +439,7 @@ static int open_and_output_loop(SOCKET udpSocket, char *device,
456 439
     device_output_active = 0;
457 440
 
458 441
     // only fetch data from socket for a short time
459
-    err = recv_and_out(udpSocket, -1, &device_output_active,
460
-                       min_interval_ms,
442
+    err = recv_and_out(udpSocket, -1, &device_output_active, min_interval_ms,
461 443
                        format_change, format_height, format_width,
462 444
                        format_channels, format_colors, proto, 1,
463 445
                        reopen_device_ms);
... ...
@@ -474,8 +455,7 @@ static int open_and_output_loop(SOCKET udpSocket, char *device,
474 455
   return err;
475 456
 }
476 457
 
477
-int main(int argCnt, char **args)
478
-{
458
+int main(int argCnt, char **args) {
479 459
   int i, bound, serial_settings, serial_speed;
480 460
   SOCKET udpSocket;
481 461
   etBlinkenProto proto;
... ...
@@ -501,7 +481,8 @@ int main(int argCnt, char **args)
501 481
 
502 482
   // print syntax
503 483
   if (argCnt <= 1) {
504
-    printf("syntax: %s <parameter> [...]\n\n"
484
+    printf(
485
+        "syntax: %s <parameter> [...]\n\n"
505 486
         "parameters:\n"
506 487
         "  -l [<ip>:]<port>\n"
507 488
         "     local address (defaults to 0.0.0.0:2323)\n"
... ...
@@ -517,10 +498,12 @@ int main(int argCnt, char **args)
517 498
         "  -s <baud-rate>,<parity>,<data-bits>,<stop-bits>\n"
518 499
         "     settings to use for serial devices (defaults to no change)\n"
519 500
         "  -o <milliseconds>\n"
520
-           "     reopen device after short time on error (defaults to not reopen)\n"
501
+        "     reopen device after short time on error (defaults to not "
502
+        "reopen)\n"
521 503
         "  -i <milliseconds>\n"
522 504
         "     minimum interval between two frames on output (defaults to 0)\n"
523
-           "\n", args[0]);
505
+        "\n",
506
+        args[0]);
524 507
     return 0;
525 508
   }
526 509
   // create udp socket
... ...
@@ -611,10 +594,10 @@ int main(int argCnt, char **args)
611 594
     else if (strcmp(args[i], "-f") == 0) {
612 595
       if (i + 1 < argCnt) {
613 596
         i++;
614
-        if (sscanf
615
-            (args[i], "%ux%u-%u/%u", &width, &height, &channels, &colors) == 4
616
-            && width > 0 && width < 1000 && height > 0 && height < 1000
617
-            && channels > 0 && channels < 20 && colors > 1 && colors <= 256) {
597
+        if (sscanf(args[i], "%ux%u-%u/%u", &width, &height, &channels,
598
+                   &colors) == 4 &&
599
+            width > 0 && width < 1000 && height > 0 && height < 1000 &&
600
+            channels > 0 && channels < 20 && colors > 1 && colors <= 256) {
618 601
           format_change = 1;
619 602
           format_height = height;
620 603
           format_width = width;
... ...
@@ -648,8 +631,8 @@ int main(int argCnt, char **args)
648 631
     else if (strcmp(args[i], "-o") == 0) {
649 632
       if (i + 1 < argCnt) {
650 633
         i++;
651
-        if (sscanf(args[i], "%u", &reopen_device_ms) == 1
652
-            && reopen_device_ms >= 1)
634
+        if (sscanf(args[i], "%u", &reopen_device_ms) == 1 &&
635
+            reopen_device_ms >= 1)
653 636
           reopen_device = 1;
654 637
         else
655 638
           printf("invalid number of milliseconds \"%s\"\n", args[i]);
... ...
@@ -669,8 +652,7 @@ int main(int argCnt, char **args)
669 652
     }
670 653
     // unknown parameter
671 654
     else
672
-      printf
673
-          ("unknown parameter \"%s\", call without parameters to get help\n",
655
+      printf("unknown parameter \"%s\", call without parameters to get help\n",
674 656
              args[i]);
675 657
 
676 658
   } // for( i ...
... ...
@@ -691,11 +673,10 @@ int main(int argCnt, char **args)
691 673
     }
692 674
   }
693 675
   // open device and output frames in a loop
694
-  open_and_output_loop(udpSocket, device,
695
-                       serial_settings_change, serial_settings, serial_speed,
696
-                       reopen_device, reopen_device_ms, min_interval_ms,
697
-                       format_change, format_height, format_width,
698
-                       format_channels, format_colors, proto);
676
+  open_and_output_loop(
677
+      udpSocket, device, serial_settings_change, serial_settings, serial_speed,
678
+      reopen_device, reopen_device_ms, min_interval_ms, format_change,
679
+      format_height, format_width, format_channels, format_colors, proto);
699 680
 
700 681
   // close socket
701 682
   close(udpSocket);
... ...
@@ -4,11 +4,11 @@
4 4
    a blinkenarea.org project */
5 5
 
6 6
 #include <fcntl.h>
7
-#include <stdlib.h>
8 7
 #include <stdio.h>
8
+#include <stdlib.h>
9 9
 #include <string.h>
10
-#include <winsock2.h>
11 10
 #include <windows.h>
11
+#include <winsock2.h>
12 12
 
13 13
 #include <BlinkenLib/BlinkenLib.h>
14 14
 
... ...
@@ -23,8 +23,7 @@ struct s_serial_settings {
23 23
 
24 24
 // get serial settings from text
25 25
 static int serial_settings_parse(char *str,
26
-                                 struct s_serial_settings *serial_settings)
27
-{
26
+                                 struct s_serial_settings *serial_settings) {
28 27
   int baud, data, stop;
29 28
   char parity;
30 29
 
... ...
@@ -117,8 +116,8 @@ static int serial_settings_parse(char *str,
117 116
 }
118 117
 
119 118
 // set serial settings for fd
120
-static int serial_settings_set(HANDLE hDev, struct s_serial_settings *settings)
121
-{
119
+static int serial_settings_set(HANDLE hDev,
120
+                               struct s_serial_settings *settings) {
122 121
   DCB PortDcb;
123 122
   COMMTIMEOUTS CommTimeouts;
124 123
 
... ...
@@ -164,14 +163,12 @@ static int serial_settings_set(HANDLE hDev, struct s_serial_settings *settings)
164 163
 // hDev may be INVALID_HANDLE_VALUE for not doing anything with device
165 164
 // returns error code (not for device-errors, 0 for success)
166 165
 static int recv_and_out(SOCKET udpSocket, HANDLE hDev,
167
-                        int *p_device_output_active,
168
-                        unsigned int format_change,
166
+                        int *p_device_output_active, unsigned int format_change,
169 167
                         unsigned int format_height, unsigned int format_width,
170 168
                         unsigned int format_channels,
171 169
                         unsigned int format_colors, etBlinkenProto proto,
172 170
                         int use_msecs, unsigned int msecs,
173
-                        int is_serial_device)
174
-{
171
+                        int is_serial_device) {
175 172
   fd_set readFds, errFds;
176 173
   stBlinkenFrame *pFrame;
177 174
   char buffer[65536]; // 64kB is more than maximum UDP size
... ...
@@ -231,8 +228,8 @@ static int recv_and_out(SOCKET udpSocket, HANDLE hDev,
231 228
 
232 229
         // output data to device
233 230
         if (hDev != INVALID_HANDLE_VALUE && len > 0) {
234
-          if (!WriteFile(hDev, buffer, len, &DevWrLen, NULL)
235
-              || (int)DevWrLen != len) {
231
+          if (!WriteFile(hDev, buffer, len, &DevWrLen, NULL) ||
232
+              (int)DevWrLen != len) {
236 233
             if (*p_device_output_active)
237 234
               printf("error writing to device: error %lu\n", GetLastError());
238 235
             break;
... ...
@@ -273,23 +270,19 @@ static int recv_and_out(SOCKET udpSocket, HANDLE hDev,
273 270
 
274 271
 // open device and output frames
275 272
 // returns error code (not for device-errors, 0 for success)
276
-static int open_and_output(SOCKET udpSocket, char *device,
277
-                           int *p_device_output_active,
273
+static int
274
+open_and_output(SOCKET udpSocket, char *device, int *p_device_output_active,
278 275
                 int serial_settings_change,
279 276
                 struct s_serial_settings *serial_settings,
280
-                           unsigned int format_change,
281
-                           unsigned int format_height,
282
-                           unsigned int format_width,
283
-                           unsigned int format_channels,
284
-                           unsigned int format_colors, etBlinkenProto proto)
285
-{
277
+                unsigned int format_change, unsigned int format_height,
278
+                unsigned int format_width, unsigned int format_channels,
279
+                unsigned int format_colors, etBlinkenProto proto) {
286 280
   HANDLE hDev;
287 281
   int err;
288 282
 
289 283
   // open device
290
-  hDev =
291
-      CreateFile(device, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
292
-                 0, NULL);
284
+  hDev = CreateFile(device, GENERIC_READ | GENERIC_WRITE, 0, NULL,
285
+                    OPEN_EXISTING, 0, NULL);
293 286
   if (hDev == INVALID_HANDLE_VALUE) {
294 287
     if (*p_device_output_active)
295 288
       printf("could not open \"%s\": error %lu\n", device, GetLastError());
... ...
@@ -305,10 +298,9 @@ static int open_and_output(SOCKET udpSocket, char *device,
305 298
     }
306 299
   }
307 300
   // receive frames and output to device
308
-  err = recv_and_out(udpSocket, hDev, p_device_output_active,
309
-                     format_change, format_height, format_width,
310
-                     format_channels, format_colors, proto, 0, 0,
311
-                     serial_settings_change);
301
+  err = recv_and_out(udpSocket, hDev, p_device_output_active, format_change,
302
+                     format_height, format_width, format_channels,
303
+                     format_colors, proto, 0, 0, serial_settings_change);
312 304
 
313 305
   // close device
314 306
   CloseHandle(hDev);
... ...
@@ -318,18 +310,13 @@ static int open_and_output(SOCKET udpSocket, char *device,
318 310
 
319 311
 // open device and output frames in a loop
320 312
 // returns error code (not for device-errors, 0 for success)
321
-static int open_and_output_loop(SOCKET udpSocket, char *device,
322
-                                int serial_settings_change,
313
+static int
314
+open_and_output_loop(SOCKET udpSocket, char *device, int serial_settings_change,
323 315
                      struct s_serial_settings *serial_settings,
324
-                                int reopen_device,
325
-                                unsigned int reopen_device_ms,
326
-                                unsigned int format_change,
327
-                                unsigned int format_height,
328
-                                unsigned int format_width,
329
-                                unsigned int format_channels,
330
-                                unsigned int format_colors,
331
-                                etBlinkenProto proto)
332
-{
316
+                     int reopen_device, unsigned int reopen_device_ms,
317
+                     unsigned int format_change, unsigned int format_height,
318
+                     unsigned int format_width, unsigned int format_channels,
319
+                     unsigned int format_colors, etBlinkenProto proto) {
333 320
   int device_output_active, err;
334 321
 
335 322
   printf("receiving frames and outputting them to \"%s\"...\n", device);
... ...
@@ -338,8 +325,7 @@ static int open_and_output_loop(SOCKET udpSocket, char *device,
338 325
   for (;;) {
339 326
 
340 327
     // try to open device and output frames
341
-    err = open_and_output(udpSocket, device,
342
-                          &device_output_active,
328
+    err = open_and_output(udpSocket, device, &device_output_active,
343 329
                           serial_settings_change, serial_settings,
344 330
                           format_change, format_height, format_width,
345 331
                           format_channels, format_colors, proto);
... ...
@@ -369,8 +354,7 @@ static int open_and_output_loop(SOCKET udpSocket, char *device,
369 354
   return err;
370 355
 }
371 356
 
372
-int main(int argCnt, char **args)
373
-{
357
+int main(int argCnt, char **args) {
374 358
   WSADATA WsaData;
375 359
   int i, bound;
376 360
   SOCKET udpSocket;
... ...
@@ -410,8 +394,10 @@ int main(int argCnt, char **args)
410 394
            "  -s <baud-rate>,<parity>,<data-bits>,<stop-bits>\n"
411 395
            "     settings to use for serial devices (defaults to no change)\n"
412 396
            "  -o <milliseconds>\n"
413
-           "     reopen device after short time on error (defaults to not reopen)\n"
414
-           "\n", args[0]);
397
+           "     reopen device after short time on error (defaults to not "
398
+           "reopen)\n"
399
+           "\n",
400
+           args[0]);
415 401
     return 0;
416 402
   }
417 403
 
... ...
@@ -511,10 +497,10 @@ int main(int argCnt, char **args)
511 497
     else if (strcmp(args[i], "-f") == 0) {
512 498
       if (i + 1 < argCnt) {
513 499
         i++;
514
-        if (sscanf
515
-            (args[i], "%ux%u-%u/%u", &width, &height, &channels, &colors) == 4
516
-            && width > 0 && width < 1000 && height > 0 && height < 1000
517
-            && channels > 0 && channels < 20 && colors > 1 && colors <= 256) {
500
+        if (sscanf(args[i], "%ux%u-%u/%u", &width, &height, &channels,
501
+                   &colors) == 4 &&
502
+            width > 0 && width < 1000 && height > 0 && height < 1000 &&
503
+            channels > 0 && channels < 20 && colors > 1 && colors <= 256) {
518 504
           format_change = 1;
519 505
           format_height = height;
520 506
           format_width = width;
... ...
@@ -548,8 +534,8 @@ int main(int argCnt, char **args)
548 534
     else if (strcmp(args[i], "-o") == 0) {
549 535
       if (i + 1 < argCnt) {
550 536
         i++;
551
-        if (sscanf(args[i], "%u", &reopen_device_ms) == 1
552
-            && reopen_device_ms >= 1)
537
+        if (sscanf(args[i], "%u", &reopen_device_ms) == 1 &&
538
+            reopen_device_ms >= 1)
553 539
           reopen_device = 1;
554 540
         else
555 541
           printf("invalid number of milliseconds \"%s\"\n", args[i]);
... ...
@@ -558,8 +544,7 @@ int main(int argCnt, char **args)
558 544
     }
559 545
     // unknown parameter
560 546
     else
561
-      printf
562
-          ("unknown parameter \"%s\", call without parameters to get help\n",
547
+      printf("unknown parameter \"%s\", call without parameters to get help\n",
563 548
              args[i]);
564 549
 
565 550
   } // for( i ...
... ...
@@ -580,9 +565,8 @@ int main(int argCnt, char **args)
580 565
     }
581 566
   }
582 567
   // open device and output frames in a loop
583
-  open_and_output_loop(udpSocket, device,
584
-                       serial_settings_change, &serial_settings,
585
-                       reopen_device, reopen_device_ms,
568
+  open_and_output_loop(udpSocket, device, serial_settings_change,
569
+                       &serial_settings, reopen_device, reopen_device_ms,
586 570
                        format_change, format_height, format_width,
587 571
                        format_channels, format_colors, proto);
588 572
 
... ...
@@ -11,18 +11,17 @@
11 11
 #include <ws2tcpip.h>
12 12
 #define close closesocket
13 13
 #else
14
-#include <unistd.h>
15
-#include <sys/types.h>
16
-#include <sys/socket.h>
17
-#include <netinet/in.h>
18 14
 #include <arpa/inet.h>
15
+#include <netinet/in.h>
16
+#include <sys/socket.h>
17
+#include <sys/types.h>
18
+#include <unistd.h>
19 19
 #endif
20 20
 
21
-#include <BlinkenLib/BlinkenLib.h>
22 21
 #include "Tools2.h"
22
+#include <BlinkenLib/BlinkenLib.h>
23 23
 
24
-int main(int argCnt, char **args)
25
-{
24
+int main(int argCnt, char **args) {
26 25
   int i, bound, val, timeout, ipv6;
27 26
   SOCKET udpSocket, tmpSock;
28 27
   struct sockaddr_in addr;
... ...
@@ -65,7 +64,8 @@ int main(int argCnt, char **args)
65 64
            "  -t <milliseconds>\n"
66 65
            "     set timeout (to detect movie end, defaults to 5000)\n"
67 66
            "  -o <file>\n"
68
-           "     receive movie and write it to file (*.blm, *.bmm, *.bml, *.bbm" MNGEXT GIFEXT ")\n\n",
67
+           "     receive movie and write it to file (*.blm, *.bmm, *.bml, "
68
+           "*.bbm" MNGEXT GIFEXT ")\n\n",
69 69
            args[0]);
70 70
     return 0;
71 71
   }
... ...
@@ -213,8 +213,7 @@ int main(int argCnt, char **args)
213 213
     }
214 214
     // unknown parameter
215 215
     else
216
-      printf
217
-          ("unknown parameter \"%s\", call without parameters to get help\n",
216
+      printf("unknown parameter \"%s\", call without parameters to get help\n",
218 217
              args[i]);
219 218
 
220 219
   } // for( i ...
... ...
@@ -12,18 +12,17 @@
12 12
 #define close closesocket
13 13
 #define strcasecmp stricmp
14 14
 #else
15
-#include <unistd.h>
16
-#include <sys/types.h>
17
-#include <sys/socket.h>
18
-#include <netinet/in.h>
19 15
 #include <arpa/inet.h>
16
+#include <netinet/in.h>
17
+#include <sys/socket.h>
18
+#include <sys/types.h>
19
+#include <unistd.h>
20 20
 #endif
21 21
 
22
-#include <BlinkenLib/BlinkenLib.h>
23 22
 #include "Tools2.h"
23
+#include <BlinkenLib/BlinkenLib.h>
24 24
 
25
-int main(int argCnt, char **args)
26
-{
25
+int main(int argCnt, char **args) {
27 26
   int i, connected, ipv6;
28 27
   SOCKET udpSocket, tmpSock;
29 28
   etBlinkenProto proto;
... ...
@@ -68,11 +67,13 @@ int main(int argCnt, char **args)
68 67
            "  -p [BLP|EBLP|MCUF]\n"
69 68
            "     protocol to use (defaults to MCUF)\n"
70 69
            "  -t <milliseconds>\n"
71
-           "     set maximum idle time between frames (defaults to 3000, use 0 for infinite)\n"
70
+           "     set maximum idle time between frames (defaults to 3000, use 0 "
71
+           "for infinite)\n"
72 72
            "  -n <number>\n"
73 73
            "     set number of times to send movies (defaults to 1)\n"
74 74
            "  -i <file>\n"
75
-           "     read movie from file (*.blm, *.bmm, *.bml, *.bbm" MNGEXT GIFEXT ") and send it\n"
75
+           "     read movie from file (*.blm, *.bmm, *.bml, *.bbm" MNGEXT GIFEXT
76
+           ") and send it\n"
76 77
            "  -l <number>\n"
77 78
            "     loop number of times (defaults to 1, use 0 for forever)\n\n",
78 79
            args[0]);
... ...
@@ -162,18 +163,15 @@ int main(int argCnt, char **args)
162 163
           i++;
163 164
           if (!ipv6) {
164 165
             if (!txt2addr(args[i], &addr) ||
165
-                connect(udpSocket, (struct sockaddr *)&addr,
166
-                        sizeof(addr)) != 0)
167
-                printf("could not set destination address to \"%s\"\n",
168
-                       args[i]);
166
+                connect(udpSocket, (struct sockaddr *)&addr, sizeof(addr)) != 0)
167
+              printf("could not set destination address to \"%s\"\n", args[i]);
169 168
             else
170 169
               connected = 1;
171 170
           } else {
172 171
             if (!txt2addr6(args[i], &addr6) ||
173
-                connect(udpSocket, (struct sockaddr *)&addr6,
174
-                        sizeof(addr6)) != 0)
175
-                printf("could not set destination address to \"%s\"\n",
176
-                       args[i]);
172
+                connect(udpSocket, (struct sockaddr *)&addr6, sizeof(addr6)) !=
173
+                    0)
174
+              printf("could not set destination address to \"%s\"\n", args[i]);
177 175
             else
178 176
               connected = 1;
179 177
           }
... ...
@@ -228,9 +226,10 @@ int main(int argCnt, char **args)
228 226
                      "  using default destination address \"127.0.0.1:2323\"\n",
229 227
                      args[i]);
230 228
               if (!txt2addr("127.0.0.1:2323", &addr) ||
231
-                  connect(udpSocket, (struct sockaddr *)&addr,
232
-                          sizeof(addr)) != 0)
233
-                printf("could not set destination address to \"127.0.0.1:2323\"\n");
229
+                  connect(udpSocket, (struct sockaddr *)&addr, sizeof(addr)) !=
230
+                      0)
231
+                printf("could not set destination address to "
232
+                       "\"127.0.0.1:2323\"\n");
234 233
               else
235 234
                 connected = 1;
236 235
             } else {
... ...
@@ -260,8 +259,7 @@ int main(int argCnt, char **args)
260 259
               BlinkenMovieFree(pMovie);
261 260
             }
262 261
           } else
263
-            printf("no destination address to sent movie \"%s\" to\n",
264
-                   args[i]);
262
+            printf("no destination address to sent movie \"%s\" to\n", args[i]);
265 263
         } else
266 264
           printf("missing input filename for \"-i\"\n");
267 265
       }
... ...
@@ -278,8 +276,8 @@ int main(int argCnt, char **args)
278 276
       }
279 277
       // unknown parameter
280 278
       else
281
-        printf
282
-            ("unknown parameter \"%s\", call without parameters to get help\n",
279
+        printf(
280
+            "unknown parameter \"%s\", call without parameters to get help\n",
283 281
             args[i]);
284 282
 
285 283
     } // for( i ...
... ...
@@ -10,17 +10,16 @@
10 10
 #include <winsock2.h>
11 11
 #include <ws2tcpip.h>
12 12
 #else
13
-#include <sys/types.h>
14
-#include <sys/socket.h>
15
-#include <netinet/in.h>
16 13
 #include <arpa/inet.h>
14
+#include <netinet/in.h>
15
+#include <sys/socket.h>
16
+#include <sys/types.h>
17 17
 #endif
18 18
 
19 19
 #include "Tools2.h"
20 20
 
21 21
 #ifdef WIN32
22
-static int inet_pton(int af, const char *src, void *dst)
23
-{
22
+static int inet_pton(int af, const char *src, void *dst) {
24 23
   struct sockaddr_storage ss;
25 24
   int size = sizeof(ss);
26 25
   char src_copy[INET6_ADDRSTRLEN + 1];
... ...
@@ -29,7 +28,8 @@ static int inet_pton(int af, const char *src, void *dst)
29 28
   strncpy(src_copy, src, sizeof(src_copy));
30 29
   src_copy[sizeof(src_copy) - 1] = 0;
31 30
 
32
-  if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0) {
31
+  if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) ==
32
+      0) {
33 33
     switch (af) {
34 34
     case AF_INET:
35 35
       *(struct in_addr *)dst = ((struct sockaddr_in *)&ss)->sin_addr;
... ...
@@ -44,8 +44,7 @@ static int inet_pton(int af, const char *src, void *dst)
44 44
 #endif
45 45
 
46 46
 // convert text to IPv4 address
47
-int txt2addr(char *text, struct sockaddr_in *addr)
48
-{
47
+int txt2addr(char *text, struct sockaddr_in *addr) {
49 48
   char txt[48];
50 49
   unsigned short port;
51 50
 
... ...
@@ -70,8 +69,7 @@ int txt2addr(char *text, struct sockaddr_in *addr)
70 69
 }
71 70
 
72 71
 // convert text to IPv6 address
73
-int txt2addr6(char *text, struct sockaddr_in6 *addr6)
74
-{
72
+int txt2addr6(char *text, struct sockaddr_in6 *addr6) {
75 73
   char txt[128];
76 74
   unsigned short port;
77 75
 
78 76