Browse Source

Minor tweaks to resolve compiler warnings.

git-svn-id: https://svn.microneil.com/svn/CodeDweller/trunk@3 d34b734f-a00e-4b39-a726-e4eeb87269ab
wx
madscientist 15 years ago
parent
commit
ae953b741e
8 changed files with 41 additions and 35 deletions
  1. 3
    3
      configuration.cpp
  2. 3
    4
      configuration.hpp
  3. 12
    12
      configuration.inline.hpp
  4. 1
    1
      networking.cpp
  5. 1
    2
      networking.hpp
  6. 9
    4
      networking.inline.hpp
  7. 7
    5
      threading.cpp
  8. 5
    4
      threading.hpp

+ 3
- 3
configuration.cpp View File

@@ -700,7 +700,7 @@ bool ConfigurationElement::interpret(ConfigurationData& Data) {
++Index; // past it and scan for our name.
}

for(int I = 0; I < myName.length(); I++) { // For the length of our name,
for(unsigned int I = 0; I < myName.length(); I++) { // For the length of our name,
char x = Data.Data(Index + I); // get each corresponding Data byte
if(x != myName.at(I)) { // check it sudden death style.
return false; // No-Match means we are not it.
@@ -821,7 +821,7 @@ bool ConfigurationElement::interpret(ConfigurationData& Data) {
) { // Then it _should_ be our own.
Stopdex = Index; // Capture this position for content.
Index += 2; // Move Index to where the name starts.
for(int I = 0; I < myName.length(); I++) { // For the length of the name,
for(unsigned int I = 0; I < myName.length(); I++) { // For the length of the name,
char x = Data.Data(Index + I); // check each corresponding Data byte.
if(x != myName.at(I)) { // If we fail to match at any point
return false; // then things are very broken
@@ -1051,7 +1051,7 @@ bool ConfigurationAttribute::interpret(ConfigurationData& Data) {

// Find our name.

for(int I = 0; I < myName.length(); I++) { // For the length of the name,
for(unsigned int I = 0; I < myName.length(); I++) { // For the length of the name,
char x = Data.Data(Index + I); // get each corresponding Data byte
if(x != myName.at(I)) { // check it sudden death style.
return false; // No-Match means we are not it.

+ 3
- 4
configuration.hpp View File

@@ -1,9 +1,7 @@
// configuration.hpp
//
// (C) 2006 - 2009 MicroNeil Research Corporation.
//
// This program is part of the MicroNeil Research Open Library Project. For
// more information go to http://www.microneil.com/OpenLibrary/index.html
// See http://www.codedweller.com for details.
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
@@ -611,7 +609,8 @@ class ConfigurationData {
// collection of the basic translators used for built-in mapTo()s.

class ConfigurationTranslator { // Translators exist
public:
public:
virtual ~ConfigurationTranslator(){}; // Stop No Virt Dtor warnings.
virtual void translate(const char* Value) = 0; // Pure virtual translator.
virtual void initialize() = 0; // Pure virtual initializer.
};

+ 12
- 12
configuration.inline.hpp View File

@@ -29,8 +29,8 @@ inline ConfigurationElement::ConfigurationElement(const char* Name) :
myLine(0),
myIndex(0),
myLength(0),
myInitOnInterpretFlag(false),
myCleanFlag(true) {
myCleanFlag(true),
myInitOnInterpretFlag(false) {
}

inline ConfigurationElement::ConfigurationElement(const string Name) : // Construct with a c++ string.
@@ -39,8 +39,8 @@ inline ConfigurationElement::ConfigurationElement(const string Name) :
myLine(0),
myIndex(0),
myLength(0),
myInitOnInterpretFlag(false),
myCleanFlag(true) {
myCleanFlag(true),
myInitOnInterpretFlag(false) {
}

inline ConfigurationElement::ConfigurationElement( // Construct sub element w/ cstring.
@@ -52,8 +52,8 @@ inline ConfigurationElement::ConfigurationElement(
myLine(0),
myIndex(0),
myLength(0),
myInitOnInterpretFlag(false),
myCleanFlag(true) {
myCleanFlag(true),
myInitOnInterpretFlag(false) {
}

inline ConfigurationElement::ConfigurationElement( // Construct sub element w/ string.
@@ -65,8 +65,8 @@ inline ConfigurationElement::ConfigurationElement(
myLine(0),
myIndex(0),
myLength(0),
myInitOnInterpretFlag(false),
myCleanFlag(true) {
myCleanFlag(true),
myInitOnInterpretFlag(false) {
}

inline string ConfigurationElement::Name() { return myName; } // Get the name of this element.
@@ -232,8 +232,8 @@ inline ConfigurationAttribute::ConfigurationAttribute(
myName(string(Name)), // We convert the name to a string.
myParent(Parent), // We just grab the parent.
myLine(0), // Everything else gets zeroed.
myLength(0),
myIndex(0) {
myIndex(0),
myLength(0) {
}

inline ConfigurationAttribute::ConfigurationAttribute( // Attributes are constrictued with a
@@ -241,8 +241,8 @@ inline ConfigurationAttribute::ConfigurationAttribute(
myName(Name), // We grab them and zero the rest.
myParent(Parent),
myLine(0),
myLength(0),
myIndex(0) {
myIndex(0),
myLength(0) {
}

inline string ConfigurationAttribute::Name() { // Get the name of this attribute.

+ 1
- 1
networking.cpp View File

@@ -249,7 +249,7 @@ const char* SocketAddress::getAddress(char* str) {
if(NULL == str) { // If the caller did not provide a
str = IPStringBuffer; // buffer to use then we will use ours.
}
int a0, a1, a2, a3, i=0; // Grab a bunch of handy integers.
int a0, a1, a2, a3; // Grab a bunch of handy integers.
getAddress(a0, a1, a2, a3); // Get the address as octets.
sprintf(str, "%d.%d.%d.%d", a0, a1, a2, a3); // Format as dotted decimal notation.
return str; // Return the output buffer.

+ 1
- 2
networking.hpp View File

@@ -259,7 +259,7 @@ class Socket {

public:
Socket(); // Constructor sets initial state.
~Socket(); // Destructor closes Socket if open.
virtual ~Socket(); // Destructor closes Socket if open.

hSocket getHandle(); // Returns the current SocketId.
bool isNonBlocking(); // Returns true if socket is NonBlocking
@@ -388,7 +388,6 @@ class TCPClient : public Socket, public MessagePort {
TCPListener& MyListener;

char ReadBuffer[TCPClientBufferSize]; // Buffer for delimited reading.
//int ReadBufferSize; // Size of buffer.
char* ReadPointer; // Read position.
int DataLength; // Length of data in buffer.


+ 9
- 4
networking.inline.hpp View File

@@ -112,14 +112,19 @@ inline IP4Address::IP4Address(const char* newIP) { (*this) = newIP; }
inline IP4Address::IP4Address(const string& newIP) { (*this) = newIP; } // Constructing with a cppstring.

inline IP4Address&
IP4Address::operator=(const unsigned long int Right) { IP = Right; } // Convert from unsigned long int.
IP4Address::operator=(const unsigned long int Right) { // Convert from unsigned long int.
IP = Right;
return *this;
}

inline IP4Address& IP4Address::operator=(const char* Right) { // Convert from c string.
IP = ntohl(inet_addr(Right));
IP = ntohl(inet_addr(Right));
return *this;
}

inline IP4Address& IP4Address::operator=(const string& Right) { // Convert from cpp string.
IP = ntohl(inet_addr(Right.c_str()));
IP = ntohl(inet_addr(Right.c_str()));
return *this;
}

inline bool IP4Address::operator<(const IP4Address Right) const { // < Comparison.
@@ -211,7 +216,7 @@ inline Socket::Socket() :
}

inline Socket::~Socket() { // When shutting down, be sure
close(); // any open socket is closed.
if(isOpen()) close(); // any open socket is closed.
}

inline void Socket::close() { // When we close,

+ 7
- 5
threading.cpp View File

@@ -175,9 +175,9 @@ thread_primative Thread::getMyThread() { return MyThread; }
Thread::Thread() : // When constructing a WIN32 thread
MyThreadType(Thread::Type), // Use generic Thread Type.
MyThreadName("UnNamed Thread"), // Use a generic Thread Name.
MyThread(NULL), // Null the thread handle.
RunningFlag(false), // Couldn't be running yet.
BadFlag(false), // Couldn't be bad yet.
MyThread(NULL) { // Null the thread handle.
BadFlag(false) { // Couldn't be bad yet.
Threads.rememberThread(this); // Remember this thread.
CurrentThreadState(ThreadInitialized); // Set our initialized state.
}
@@ -185,9 +185,9 @@ Thread::Thread() :
Thread::Thread(const ThreadType& T, const string N) : // Construct with specific Type/Name
MyThreadType(T), // Use generic Thread Type.
MyThreadName(N), // Use a generic Thread Name.
MyThread(NULL), // Null the thread handle.
RunningFlag(false), // Couldn't be running yet.
BadFlag(false), // Couldn't be bad yet.
MyThread(NULL) { // Null the thread handle.
BadFlag(false) { // Couldn't be bad yet.
Threads.rememberThread(this); // Remember this thread.
CurrentThreadState(ThreadInitialized); // Set our initialized state.
}
@@ -202,7 +202,9 @@ Thread::~Thread() {
}

unsigned __stdcall runThreadTask(void* thread_object) { // The WIN32 version has this form.
((Thread*)thread_object)->launchTask();
((Thread*)thread_object)->launchTask(); // Run the task.
_endthreadex(0); // Signal the thread is finished.
return 0; // Satisfy the unsigned return.
}

void Thread::run() { // Run a WIN32 thread...

+ 5
- 4
threading.hpp View File

@@ -119,10 +119,10 @@ class ThreadStatusRecord {
Pointer(P),
Type(&T),
State(&S),
Name(N),
isRunning(R),
isBad(B),
Fault(F),
Name(N)
Fault(F)
{}

ThreadStatusRecord& operator=(const ThreadStatusRecord& Right) { // Minimal Assignment Operator
@@ -132,7 +132,8 @@ class ThreadStatusRecord {
isRunning = Right.isRunning;
isBad = Right.isBad;
Fault = Right.Fault;
Name = Right.Name;
Name = Right.Name;
return *this;
}

bool operator<(const ThreadStatusRecord& Right) { // Minimal Comparison Operator.
@@ -228,7 +229,7 @@ class Thread {

Thread(); // Constructor (just in case)
Thread(const ThreadType& T, string N); // Construct with specific Type/Name
~Thread(); // Destructor (just in case)
virtual ~Thread(); // Destructor (just in case)

void run(); // Method to launch this thread.
void join(); // Method to Join this thread.

Loading…
Cancel
Save