From 132978b53dbcbbd78010fa7a1ad9863b95001b26 Mon Sep 17 00:00:00 2001 From: Norman Princen <63923352+NPrincen@users.noreply.github.com> Date: Sat, 18 Apr 2020 22:19:53 -0700 Subject: [PATCH] Changed drefs to const char* to fix compiler warnings --- TestScripts/C Tests/CtrlTests.h | 38 ++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/TestScripts/C Tests/CtrlTests.h b/TestScripts/C Tests/CtrlTests.h index 83e7d36..f000f4e 100644 --- a/TestScripts/C Tests/CtrlTests.h +++ b/TestScripts/C Tests/CtrlTests.h @@ -6,7 +6,7 @@ #include "Test.h" #include "xplaneConnect.h" -int doCTRLTest(XPCSocket *sock, char* drefs[7], float values[], int size, int ac, float expected[7]) +int doCTRLTest(XPCSocket *sock, const char* drefs[7], float values[], int size, int ac, float expected[7]) { float* data[7]; int sizes[7]; @@ -18,7 +18,7 @@ int doCTRLTest(XPCSocket *sock, char* drefs[7], float values[], int size, int ac // Execute command int result = sendCTRL(*sock, values, size, ac); - int d = 0.0f; + int d = 0.0f; if (result >= 0) { result = getDREFs(*sock, drefs, data, 7, sizes); @@ -66,19 +66,19 @@ int doGETCTest(float values[7], int ac, float expected[7]) return 0; } -int basicCTRLTest(char** drefs, int ac) +int basicCTRLTest(const char** drefs, int ac) { // Set control surfaces to known state. float CTRL[6] = { 0.0F, 0.0F, 0.0F, 0.8F, 1.0F, 0.5F }; float expected[7] = { 0.0F, 0.0F, 0.0F, NAN, NAN, NAN, NAN }; - XPCSocket sock = openUDP(IP); - pauseSim(sock, 1); // Pause so the controls wont change between 2 and 3 + XPCSocket sock = openUDP(IP); + pauseSim(sock, 1); // Pause so the controls wont change between 2 and 3 int result = doCTRLTest(&sock, drefs, CTRL, 3, ac, expected); if (result < 0) { return -10000 + result; } - crossPlatformUSleep(SLEEP_AMOUNT); + crossPlatformUSleep(SLEEP_AMOUNT); // Test control surfaces and set other values to known state. expected[0] = CTRL[0] = 0.2F; @@ -92,19 +92,19 @@ int basicCTRLTest(char** drefs, int ac) { return -20000 + result; } - crossPlatformUSleep(SLEEP_AMOUNT); + crossPlatformUSleep(SLEEP_AMOUNT); // Test other values and verify control surfaces unchanged. expected[0] = CTRL[0] = 0.15F; expected[1] = CTRL[1] = 0.15F; expected[2] = CTRL[2] = 0.15F; expected[3] = CTRL[3] = 0.9F; - CTRL[4] = -998; + CTRL[4] = -998; CTRL[5] = -998; result = doCTRLTest(&sock, drefs, CTRL, 6, ac, expected); - pauseSim(sock, 0); - closeUDP(sock); + pauseSim(sock, 0); + closeUDP(sock); if (result < 0) { if (result == -1004) { @@ -112,12 +112,12 @@ int basicCTRLTest(char** drefs, int ac) } return -30000 + result; } - return 0; + return 0; } int testCTRL_Player() { - char* drefs[] = + const char* drefs[] = { "sim/cockpit2/controls/yoke_pitch_ratio", "sim/cockpit2/controls/yoke_roll_ratio", @@ -132,7 +132,7 @@ int testCTRL_Player() int testCTRL_NonPlayer() { - char* drefs[] = + const char* drefs[] = { "sim/multiplayer/position/plane1_yolk_pitch", "sim/multiplayer/position/plane1_yolk_roll", @@ -147,7 +147,7 @@ int testCTRL_NonPlayer() int testCTRL_Speedbrakes() { - char* drefs[] = + const char* drefs[] = { "sim/cockpit2/controls/yoke_pitch_ratio", "sim/cockpit2/controls/yoke_roll_ratio", @@ -161,8 +161,8 @@ int testCTRL_Speedbrakes() // Arm float CTRL[7] = { -998, -998, -998, -998, -998, -998, -0.5F }; float expected[7] = { NAN, NAN, NAN, NAN, NAN, NAN, -0.5F }; - XPCSocket sock = openUDP(IP); - pauseSim(sock, 1); // Pause so the controls wont change between 2 and 3 + XPCSocket sock = openUDP(IP); + pauseSim(sock, 1); // Pause so the controls wont change between 2 and 3 int result = doCTRLTest(&sock, drefs, CTRL, 7, 0, expected); if (result < 0) { @@ -180,13 +180,13 @@ int testCTRL_Speedbrakes() // Retract expected[6] = CTRL[6] = 0.0F; result = doCTRLTest(&sock, drefs, CTRL, 7, 0, expected); - pauseSim(sock, 0); - closeUDP(sock); + pauseSim(sock, 0); + closeUDP(sock); if (result < 0) { return -30000 + result; } - return 0; + return 0; } int testGETC()