diff file-data-provider.c @ 239:ec81395bf08d

Solve name collisions and other problems caused by including Windows headers
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Thu, 12 Feb 2015 19:13:55 +0100
parents 4102fe614df2
children
line wrap: on
line diff
--- a/file-data-provider.c	Thu Jan 29 18:40:07 2015 +0100
+++ b/file-data-provider.c	Thu Feb 12 19:13:55 2015 +0100
@@ -13,8 +13,8 @@
 
 int CVICALLBACK FileDataProvider (void *functionData)
 {
-	int mainThreadId;
-	char dataFileName[MAX_PATHNAME_LEN];
+	int main_thread_id;
+	char datafile[MAX_PATHNAME_LEN];
 	int fd;
 	int read;
 	int year, month, day, hour, min, sec, msec;
@@ -24,19 +24,19 @@
 	double now;
 	
 	/* get main thread id to post messages to it */
-	mainThreadId = CmtGetMainThreadID();
+	main_thread_id = CmtGetMainThreadID();
 	
 	/* guess current data log file name */
 	GetCurrentDateTime(&now);
 	GetDateTimeElements(now, NULL, NULL, NULL, &month, &day, &year);
-	snprintf(dataFileName, sizeof(dataFileName) - 1, 
+	snprintf(datafile, sizeof(datafile) - 1, 
 		"%s\\%02d%02d%02d_Frequ.txt", LOGFILEPATH, year % 100, month, day);
 	
 	/* open file */
-	fd = OpenFile(dataFileName, VAL_READ_ONLY, VAL_OPEN_AS_IS, VAL_ASCII);
+	fd = OpenFile(datafile, VAL_READ_ONLY, VAL_OPEN_AS_IS, VAL_ASCII);
 	if (fd < 0) {
 		/* notify error to the main thread */
-		SendMessage(mainThreadId, "error opening data file '%s'", dataFileName);
+		send_message(main_thread_id, "error opening data file '%s'", datafile);
 	}
 	
 	/* seek to file end */
@@ -57,7 +57,7 @@
 			&event.data[0], &event.data[1], &event.data[2], &event.data[3]);
 		if (read != 11) {
 			/* notify error to the main thread */
-			SendMessage(mainThreadId, "error parsing data log line");
+			send_message(main_thread_id, "error parsing data log line");
 			/* skip line */
 			continue;
 		}
@@ -90,7 +90,7 @@
 		if ((hour == 23) && (min == 59) && (sec == 59)) {
 				
 			/* next data file name */
-			snprintf(dataFileName, sizeof(dataFileName) - 1, 
+			snprintf(datafile, sizeof(datafile) - 1, 
 				"%s\\%02d%02d%02d_Frequ.txt", LOGFILEPATH, year, month, day + 1);
 				
 			/* close data file */
@@ -99,7 +99,7 @@
 			/* wait for new data file to appear */
 			int retry = 20;
 			while (retry--) {
-				fd = OpenFile(dataFileName, VAL_READ_ONLY, VAL_OPEN_AS_IS, VAL_ASCII);
+				fd = OpenFile(datafile, VAL_READ_ONLY, VAL_OPEN_AS_IS, VAL_ASCII);
 				if (fd != -1)
 					break;
 				Delay(0.01);