ソースを参照

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年前
コミット
ae953b741e
8個のファイルの変更41行の追加35行の削除
  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 ファイルの表示

++Index; // past it and scan for our name. ++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 char x = Data.Data(Index + I); // get each corresponding Data byte
if(x != myName.at(I)) { // check it sudden death style. if(x != myName.at(I)) { // check it sudden death style.
return false; // No-Match means we are not it. return false; // No-Match means we are not it.
) { // Then it _should_ be our own. ) { // Then it _should_ be our own.
Stopdex = Index; // Capture this position for content. Stopdex = Index; // Capture this position for content.
Index += 2; // Move Index to where the name starts. 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. char x = Data.Data(Index + I); // check each corresponding Data byte.
if(x != myName.at(I)) { // If we fail to match at any point if(x != myName.at(I)) { // If we fail to match at any point
return false; // then things are very broken return false; // then things are very broken


// Find our name. // 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 char x = Data.Data(Index + I); // get each corresponding Data byte
if(x != myName.at(I)) { // check it sudden death style. if(x != myName.at(I)) { // check it sudden death style.
return false; // No-Match means we are not it. return false; // No-Match means we are not it.

+ 3
- 4
configuration.hpp ファイルの表示

// configuration.hpp // configuration.hpp
// //
// (C) 2006 - 2009 MicroNeil Research Corporation. // (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 // 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 // under the terms of the GNU General Public License as published by the
// collection of the basic translators used for built-in mapTo()s. // collection of the basic translators used for built-in mapTo()s.


class ConfigurationTranslator { // Translators exist 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 translate(const char* Value) = 0; // Pure virtual translator.
virtual void initialize() = 0; // Pure virtual initializer. virtual void initialize() = 0; // Pure virtual initializer.
}; };

+ 12
- 12
configuration.inline.hpp ファイルの表示

myLine(0), myLine(0),
myIndex(0), myIndex(0),
myLength(0), myLength(0),
myInitOnInterpretFlag(false),
myCleanFlag(true) {
myCleanFlag(true),
myInitOnInterpretFlag(false) {
} }


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


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


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


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


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


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

+ 1
- 1
networking.cpp ファイルの表示

if(NULL == str) { // If the caller did not provide a if(NULL == str) { // If the caller did not provide a
str = IPStringBuffer; // buffer to use then we will use ours. 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. 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. sprintf(str, "%d.%d.%d.%d", a0, a1, a2, a3); // Format as dotted decimal notation.
return str; // Return the output buffer. return str; // Return the output buffer.

+ 1
- 2
networking.hpp ファイルの表示



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


hSocket getHandle(); // Returns the current SocketId. hSocket getHandle(); // Returns the current SocketId.
bool isNonBlocking(); // Returns true if socket is NonBlocking bool isNonBlocking(); // Returns true if socket is NonBlocking
TCPListener& MyListener; TCPListener& MyListener;


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



+ 9
- 4
networking.inline.hpp ファイルの表示

inline IP4Address::IP4Address(const string& newIP) { (*this) = newIP; } // Constructing with a cppstring. inline IP4Address::IP4Address(const string& newIP) { (*this) = newIP; } // Constructing with a cppstring.


inline IP4Address& 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. 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. 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. inline bool IP4Address::operator<(const IP4Address Right) const { // < Comparison.
} }


inline Socket::~Socket() { // When shutting down, be sure 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, inline void Socket::close() { // When we close,

+ 7
- 5
threading.cpp ファイルの表示

Thread::Thread() : // When constructing a WIN32 thread Thread::Thread() : // When constructing a WIN32 thread
MyThreadType(Thread::Type), // Use generic Thread Type. MyThreadType(Thread::Type), // Use generic Thread Type.
MyThreadName("UnNamed Thread"), // Use a generic Thread Name. MyThreadName("UnNamed Thread"), // Use a generic Thread Name.
MyThread(NULL), // Null the thread handle.
RunningFlag(false), // Couldn't be running yet. 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. Threads.rememberThread(this); // Remember this thread.
CurrentThreadState(ThreadInitialized); // Set our initialized state. CurrentThreadState(ThreadInitialized); // Set our initialized state.
} }
Thread::Thread(const ThreadType& T, const string N) : // Construct with specific Type/Name Thread::Thread(const ThreadType& T, const string N) : // Construct with specific Type/Name
MyThreadType(T), // Use generic Thread Type. MyThreadType(T), // Use generic Thread Type.
MyThreadName(N), // Use a generic Thread Name. MyThreadName(N), // Use a generic Thread Name.
MyThread(NULL), // Null the thread handle.
RunningFlag(false), // Couldn't be running yet. 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. Threads.rememberThread(this); // Remember this thread.
CurrentThreadState(ThreadInitialized); // Set our initialized state. CurrentThreadState(ThreadInitialized); // Set our initialized state.
} }
} }


unsigned __stdcall runThreadTask(void* thread_object) { // The WIN32 version has this form. 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... void Thread::run() { // Run a WIN32 thread...

+ 5
- 4
threading.hpp ファイルの表示

Pointer(P), Pointer(P),
Type(&T), Type(&T),
State(&S), State(&S),
Name(N),
isRunning(R), isRunning(R),
isBad(B), isBad(B),
Fault(F),
Name(N)
Fault(F)
{} {}


ThreadStatusRecord& operator=(const ThreadStatusRecord& Right) { // Minimal Assignment Operator ThreadStatusRecord& operator=(const ThreadStatusRecord& Right) { // Minimal Assignment Operator
isRunning = Right.isRunning; isRunning = Right.isRunning;
isBad = Right.isBad; isBad = Right.isBad;
Fault = Right.Fault; Fault = Right.Fault;
Name = Right.Name;
Name = Right.Name;
return *this;
} }


bool operator<(const ThreadStatusRecord& Right) { // Minimal Comparison Operator. bool operator<(const ThreadStatusRecord& Right) { // Minimal Comparison Operator.


Thread(); // Constructor (just in case) Thread(); // Constructor (just in case)
Thread(const ThreadType& T, string N); // Construct with specific Type/Name 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 run(); // Method to launch this thread.
void join(); // Method to Join this thread. void join(); // Method to Join this thread.

読み込み中…
キャンセル
保存