Mercurial > hg > fxanalyse
comparison data-provider.h @ 101:8b90fbba59ef
Fix buffer size in SendMessage macro
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Mon, 08 Apr 2013 16:15:44 +0200 |
parents | 99cbe2b57530 |
children | be87c8e78266 |
comparison
equal
deleted
inserted
replaced
100:62b4f0b7a6e7 | 101:8b90fbba59ef |
---|---|
17 struct timeval time; | 17 struct timeval time; |
18 double data[4]; | 18 double data[4]; |
19 }; | 19 }; |
20 | 20 |
21 /* message buffer */ | 21 /* message buffer */ |
22 static char messages[256][16]; | 22 #define DATA_PROVIDER_MSGLEN 256 |
23 #define DATA_PROVIDER_MSGNUM 16 | |
24 static char messages[DATA_PROVIDER_MSGLEN][DATA_PROVIDER_MSGNUM]; | |
23 static unsigned int messageid = 0; | 25 static unsigned int messageid = 0; |
24 | 26 |
25 #define SendMessage(threadId, ...) \ | 27 #define SendMessage(threadId, ...) \ |
26 do { \ | 28 do { \ |
27 char *message = messages[messageid++ % 16]; \ | 29 char *message = messages[messageid++ % DATA_PROVIDER_MSGNUM]; \ |
28 snprintf(message, sizeof(message), ##__VA_ARGS__); \ | 30 snprintf(message, DATA_PROVIDER_MSGLEN - 1, ##__VA_ARGS__); \ |
29 PostDeferredCallToThread(MessageCB, message, threadId); \ | 31 PostDeferredCallToThread(MessageCB, message, threadId); \ |
30 } while (0) | 32 } while (0) |
31 | 33 |
32 #endif | 34 #endif |