Menu

#3 does not compile with gcc 4.3

open
nobody
None
5
2008-11-15
2008-11-15
Anonymous
No

Did not compile with gcc 4.3.2. Can be easily patched. Following is the patch :

diff -uNrB linc-daemon-1.2/Cfg.cpp linc-1.2-working-copy/Cfg.cpp
--- linc-daemon-1.2/Cfg.cpp 2003-04-05 10:42:36.000000000 +0530
+++ linc-1.2-working-copy/Cfg.cpp 2008-11-15 18:42:09.000000000 +0530
@@ -30,6 +30,8 @@
#include <Cfg.h>
#include <encrypt.h>
#include <iostream>
+#include <cstdlib>
+

using std::endl;

diff -uNrB linc-daemon-1.2/CliApp.cpp linc-1.2-working-copy/CliApp.cpp
--- linc-daemon-1.2/CliApp.cpp 2003-04-01 16:43:34.000000000 +0530
+++ linc-1.2-working-copy/CliApp.cpp 2008-11-15 18:44:09.000000000 +0530
@@ -50,6 +50,7 @@
#include <InactiveState.h>
#include <DiscState.h>
#include <DeInitState.h>
+#include <cstdlib>

//! the polling interval (i.e. interval for sending keepalive messages
#define POLLINTERVAL 120
diff -uNrB linc-daemon-1.2/encrypt.cpp linc-1.2-working-copy/encrypt.cpp
--- linc-daemon-1.2/encrypt.cpp 2003-04-05 10:42:37.000000000 +0530
+++ linc-1.2-working-copy/encrypt.cpp 2008-11-15 18:52:15.000000000 +0530
@@ -119,8 +119,8 @@
#define TS_STRLEN 10

//! scramble the timestamp
-u_int16_t ScrambleTimestamp(const string& oStrTimeStamp,
- u_int32_t& rui32Current, u_int32_t& rui32Previous);
+uint16_t ScrambleTimestamp(const string& oStrTimeStamp,
+ uint32_t& rui32Current, uint32_t& rui32Previous);

string Encrypt(const string& rkoStrPlaintext, time_t tTime)
{
@@ -133,14 +133,14 @@
oSrmCiphertext << oStrTimeStamp;

// Generate ciphertext
- u_int32_t ui32N1=0, ui32N2=0;
+ uint32_t ui32N1=0, ui32N2=0;
for (int i = 0; i < rkoStrPlaintext.size(); i++)
{
// the ith plaintext password character
char cCh = rkoStrPlaintext[i];

// call the scramble routine for the ith time
- u_int16_t ui16Scramble = ScrambleTimestamp(oStrTimeStamp, ui32N1, ui32N2);
+ uint16_t ui16Scramble = ScrambleTimestamp(oStrTimeStamp, ui32N1, ui32N2);

// XOR each timestamp character with the password character
for (int j = 0; j < TS_STRLEN; j++)
@@ -152,7 +152,7 @@
* the encrypted character is an XOR of the char, the high order
* scramble byte and the lower order scramble byte
*/
- u_int16_t ui16Enc = cCh ^ (ui16Scramble & 0xFF) ^ (ui16Scramble >> 8);
+ uint16_t ui16Enc = cCh ^ (ui16Scramble & 0xFF) ^ (ui16Scramble >> 8);

// write the encrypted character as its byte value
oSrmCiphertext << setw(3) << setfill('0') << ui16Enc;
@@ -161,18 +161,18 @@
return oSrmCiphertext.str();
}

-u_int16_t ScrambleTimestamp(const string& oStrTimeStamp,
- u_int32_t& rui32N1, u_int32_t& rui32N2)
+uint16_t ScrambleTimestamp(const string& oStrTimeStamp,
+ uint32_t& rui32N1, uint32_t& rui32N2)
{
- u_int32_t ui32N3 = 0;
- u_int32_t ui32Final = 0;
+ uint32_t ui32N3 = 0;
+ uint32_t ui32Final = 0;

- for(u_int32_t ui32Iter = 0; ui32Iter < TS_STRLEN/2; ui32Iter++)
+ for(uint32_t ui32Iter = 0; ui32Iter < TS_STRLEN/2; ui32Iter++)
{
/* the scrambled text is the XOR of ui32N3 and the ui32Iter'th
- * pair of bytes taken together as a u_int16_t value
+ * pair of bytes taken together as a uint16_t value
*/
- u_int32_t ui32Scramble = ui32N3 ^
+ uint32_t ui32Scramble = ui32N3 ^
((oStrTimeStamp[ui32Iter*2] << 8) | oStrTimeStamp[ui32Iter*2+1]);

/* I don't pretend to understand the remainder of this compound statement */
@@ -184,7 +184,7 @@
ui32Final ^= rui32N1 ^ ui32N3;
}

- return static_cast<u_int16_t> (ui32Final & 0xFFFF);
+ return static_cast<uint16_t> (ui32Final & 0xFFFF);
}
/*
* This source file is part of linc $Name: rel-1-2 $
diff -uNrB linc-daemon-1.2/main.cpp linc-1.2-working-copy/main.cpp
--- linc-daemon-1.2/main.cpp 2003-04-01 16:43:34.000000000 +0530
+++ linc-1.2-working-copy/main.cpp 2008-11-15 18:44:34.000000000 +0530
@@ -52,6 +52,7 @@
*
*/

+#include <cstdlib>
#include <CmdLine.h>
#include <CliApp.h>
extern "C" {

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.