You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(11) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
(36) |
Jun
(3) |
Jul
(39) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2004 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Update of /cvsroot/gnucula/Gnucula In directory sc8-pr-cvs1:/tmp/cvs-serv25504 Modified Files: Common.h Conversions.h FileLock.h GnuAltLoc.h GnuCache.h GnuCore.h GnuDownload.h GnuDownloadShell.h GnuFileHash.h GnuLocal.h GnuMeta.h GnuNode.h GnuPrefs.h GnuRouting.h GnuSchema.h GnuSearch.h GnuShare.h GnuSock.h GnuUpdate.h GnuUpdateSock.h GnuUpload.h GnuUploadQueue.h GnuUploadShell.h GnuWordHash.h Headers.h Packet.h Sha1.h md4.h stdafx.h Log Message: switched to platform/win/typdefs.h header Index: Common.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Common.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Common.h 20 Jan 2004 21:43:04 -0000 1.12 --- Common.h 22 Jan 2004 00:10:07 -0000 1.13 *************** *** 29,33 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 29,33 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: Conversions.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Conversions.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Conversions.h 20 Jan 2004 21:45:31 -0000 1.12 --- Conversions.h 22 Jan 2004 00:10:07 -0000 1.13 *************** *** 29,33 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #include "Packet.h" // IP enum... #else --- 29,33 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #include "Packet.h" // IP enum... #else Index: FileLock.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/FileLock.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FileLock.h 25 Nov 2002 09:10:38 -0000 1.4 --- FileLock.h 22 Jan 2004 00:10:07 -0000 1.5 *************** *** 7,17 **** */ #ifndef OPENGCC #pragma once #endif - #ifndef FILELOCK_H - #define FILELOCK_H - #ifndef OPENGCC #include <afxmt.h> --- 7,17 ---- */ + #ifndef FILELOCK_H + #define FILELOCK_H + #ifndef OPENGCC #pragma once #endif #ifndef OPENGCC #include <afxmt.h> Index: GnuAltLoc.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuAltLoc.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GnuAltLoc.h 20 Jan 2004 21:45:31 -0000 1.9 --- GnuAltLoc.h 22 Jan 2004 00:10:07 -0000 1.10 *************** *** 27,31 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 27,31 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: GnuCache.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuCache.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** GnuCache.h 20 Jan 2004 21:45:31 -0000 1.11 --- GnuCache.h 22 Jan 2004 00:10:07 -0000 1.12 *************** *** 30,34 **** #ifndef OPENGCC #pragma once ! typedef CString Charstring; #else #include "./platform/opengcc/typedefs.h" --- 30,34 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: GnuCore.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuCore.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GnuCore.h 8 Jul 2003 08:55:08 -0000 1.10 --- GnuCore.h 22 Jan 2004 00:10:07 -0000 1.11 *************** *** 28,32 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #endif --- 28,32 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #endif Index: GnuDownload.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuDownload.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GnuDownload.h 9 Jul 2003 05:50:08 -0000 1.10 --- GnuDownload.h 22 Jan 2004 00:10:07 -0000 1.11 *************** *** 29,33 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 29,33 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: GnuDownloadShell.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuDownloadShell.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** GnuDownloadShell.h 9 Jul 2003 05:50:08 -0000 1.11 --- GnuDownloadShell.h 22 Jan 2004 00:10:07 -0000 1.12 *************** *** 24,38 **** ********************************************************************************/ #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" #endif - #ifndef GNU_DOWNLOAD_SHELL_H - #define GNU_DOWNLOAD_SHELL_H - // #define DL_SECTION_SIZE (64 * 1024) // Download file in 64k pieces --- 24,38 ---- ********************************************************************************/ + #ifndef GNU_DOWNLOAD_SHELL_H + #define GNU_DOWNLOAD_SHELL_H + #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" #endif // #define DL_SECTION_SIZE (64 * 1024) // Download file in 64k pieces Index: GnuFileHash.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuFileHash.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GnuFileHash.h 9 Jul 2003 05:50:08 -0000 1.10 --- GnuFileHash.h 22 Jan 2004 00:10:07 -0000 1.11 *************** *** 29,33 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 29,33 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: GnuLocal.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuLocal.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GnuLocal.h 9 Jul 2003 05:50:08 -0000 1.7 --- GnuLocal.h 22 Jan 2004 00:10:07 -0000 1.8 *************** *** 29,33 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 29,33 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: GnuMeta.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuMeta.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GnuMeta.h 9 Jul 2003 05:50:08 -0000 1.6 --- GnuMeta.h 22 Jan 2004 00:10:07 -0000 1.7 *************** *** 30,34 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 30,34 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: GnuNode.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuNode.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** GnuNode.h 20 Jan 2004 21:43:04 -0000 1.19 --- GnuNode.h 22 Jan 2004 00:10:07 -0000 1.20 *************** *** 29,33 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 29,33 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: GnuPrefs.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuPrefs.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GnuPrefs.h 9 Jul 2003 05:50:08 -0000 1.7 --- GnuPrefs.h 22 Jan 2004 00:10:07 -0000 1.8 *************** *** 29,33 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 29,33 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: GnuRouting.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuRouting.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GnuRouting.h 9 Jul 2003 05:50:08 -0000 1.6 --- GnuRouting.h 22 Jan 2004 00:10:07 -0000 1.7 *************** *** 27,31 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 27,31 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: GnuSchema.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuSchema.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GnuSchema.h 9 Jul 2003 05:50:08 -0000 1.6 --- GnuSchema.h 22 Jan 2004 00:10:07 -0000 1.7 *************** *** 29,33 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 29,33 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: GnuSearch.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuSearch.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GnuSearch.h 9 Jul 2003 05:50:08 -0000 1.7 --- GnuSearch.h 22 Jan 2004 00:10:07 -0000 1.8 *************** *** 30,34 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 30,34 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: GnuShare.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuShare.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GnuShare.h 9 Jul 2003 06:37:44 -0000 1.10 --- GnuShare.h 22 Jan 2004 00:10:07 -0000 1.11 *************** *** 30,34 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 30,34 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: GnuSock.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuSock.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GnuSock.h 9 Jul 2003 06:37:44 -0000 1.8 --- GnuSock.h 22 Jan 2004 00:10:07 -0000 1.9 *************** *** 30,34 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 30,34 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: GnuUpdate.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuUpdate.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GnuUpdate.h 9 Jul 2003 06:37:44 -0000 1.7 --- GnuUpdate.h 22 Jan 2004 00:10:07 -0000 1.8 *************** *** 30,34 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 30,34 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: GnuUpdateSock.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuUpdateSock.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GnuUpdateSock.h 9 Jul 2003 07:34:05 -0000 1.7 --- GnuUpdateSock.h 22 Jan 2004 00:10:07 -0000 1.8 *************** *** 24,38 **** ********************************************************************************/ #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" #endif - #ifndef GNU_UPDATE_SOCK_H - #define GNU_UPDATE_SOCK_H - class CGnuUpdate; --- 24,38 ---- ********************************************************************************/ + #ifndef GNU_UPDATE_SOCK_H + #define GNU_UPDATE_SOCK_H + #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" #endif class CGnuUpdate; Index: GnuUpload.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuUpload.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GnuUpload.h 9 Jul 2003 07:34:05 -0000 1.10 --- GnuUpload.h 22 Jan 2004 00:10:07 -0000 1.11 *************** *** 29,33 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 29,33 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: GnuUploadQueue.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuUploadQueue.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GnuUploadQueue.h 10 Jul 2003 22:41:07 -0000 1.9 --- GnuUploadQueue.h 22 Jan 2004 00:10:07 -0000 1.10 *************** *** 30,34 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "platform/opengcc/typedefs.h" --- 30,34 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "platform/opengcc/typedefs.h" Index: GnuUploadShell.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuUploadShell.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** GnuUploadShell.h 10 Jul 2003 22:41:07 -0000 1.12 --- GnuUploadShell.h 22 Jan 2004 00:10:07 -0000 1.13 *************** *** 24,38 **** ********************************************************************************/ #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" #endif - #ifndef GNU_UPLOAD_SHELL_H - #define GNU_UPLOAD_SHELL_H - class CGnuTransfers; --- 24,38 ---- ********************************************************************************/ + #ifndef GNU_UPLOAD_SHELL_H + #define GNU_UPLOAD_SHELL_H + #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" #endif class CGnuTransfers; Index: GnuWordHash.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuWordHash.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GnuWordHash.h 10 Jul 2003 08:31:41 -0000 1.8 --- GnuWordHash.h 22 Jan 2004 00:10:07 -0000 1.9 *************** *** 30,34 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 30,34 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: Headers.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Headers.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Headers.h 10 Jul 2003 22:41:07 -0000 1.6 --- Headers.h 22 Jan 2004 00:10:07 -0000 1.7 *************** *** 29,33 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 29,33 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: Packet.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Packet.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Packet.h 11 Jul 2003 02:44:56 -0000 1.8 --- Packet.h 22 Jan 2004 00:10:07 -0000 1.9 *************** *** 29,33 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 29,33 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: Sha1.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Sha1.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Sha1.h 10 Jul 2003 08:31:41 -0000 1.9 --- Sha1.h 22 Jan 2004 00:10:07 -0000 1.10 *************** *** 5,9 **** #ifndef OPENGCC #pragma once ! typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" --- 5,9 ---- #ifndef OPENGCC #pragma once ! #include ".\platform\win\typedefs.h" #else #include "./platform/opengcc/typedefs.h" Index: md4.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/md4.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** md4.h 28 May 2003 05:18:09 -0000 1.3 --- md4.h 22 Jan 2004 00:10:07 -0000 1.4 *************** *** 1,9 **** - #ifndef OPENGCC - #pragma once - #endif #ifndef MD4_H #define MD4_H struct MD4Context { --- 1,10 ---- #ifndef MD4_H #define MD4_H + #ifndef OPENGCC + #pragma once + #endif + struct MD4Context { Index: stdafx.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/stdafx.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** stdafx.h 20 Jan 2004 21:43:04 -0000 1.17 --- stdafx.h 22 Jan 2004 00:10:07 -0000 1.18 *************** *** 116,122 **** // Master Version ! #define ACTUAL_GNUCULA_VERSION "0.1.0.8" ! #define GNUCDNA_VERSION "0.9.2.7" /* use the first for ultrapeer/leaf upgrading/downgrading, ! use the second for about screens and such. */ // Networking --- 116,122 ---- // Master Version ! #define ACTUAL_GNUCULA_VERSION "1.0.1.4" // Not really ! #define GNUCDNA_VERSION "0.9.2.8" /* use the first for ultrapeer/leaf upgrading/downgrading, ! use the second for about screens and such. */ // Networking *************** *** 132,181 **** // Prog defines ! #define MAX_TTL 7 ! #define CONNECT_TIMEOUT 15 ! #define TRANSFER_TIMEOUT 15 // Hardcoded Enums ! #define CLIENT_NORMAL 1 #define CLIENT_ULTRAPEER 2 ! #define CLIENT_LEAF 3 #define UPDATE_RELEASE 1 ! #define UPDATE_BETA 2 ! #define UPDATE_NONE 3 ! #define SOCK_UNKNOWN 0 ! #define SOCK_CONNECTING 1 ! #define SOCK_CONNECTED 2 ! #define SOCK_CLOSED 3 ! #define PACKET_PING 5 ! #define PACKET_PONG 4 ! #define PACKET_QUERY 3 ! #define PACKET_QUERYHIT 2 ! #define PACKET_PUSH 1 ! #define PACKET_BYE 1 ! #define ERROR_HOPS 1 ! #define ERROR_LOOPBACK 2 ! #define ERROR_TTL 3 ! #define ERROR_DUPLICATE 4 ! #define ERROR_ROUTING 5 ! #define TRANSFER_NOSOURCES 1 #define TRANSFER_PENDING 2 #define TRANSFER_CONNECTING 3 #define TRANSFER_CONNECTED 4 #define TRANSFER_SENDING 5 ! #define TRANSFER_RECEIVING 6 ! #define TRANSFER_PUSH 7 ! #define TRANSFER_CLOSED 8 #define TRANSFER_COMPLETED 9 ! #define TRANSFER_COOLDOWN 10 ! #define TRANSFER_QUEUED 11 #define RESULT_INACTIVE 1 ! #define RESULT_TRYING 2 #define RESULT_DOWNLOADING 3 #define RESULT_COMPLETED 4 --- 132,181 ---- // Prog defines ! #define MAX_TTL 7 ! #define CONNECT_TIMEOUT 15 ! #define TRANSFER_TIMEOUT 15 // Hardcoded Enums ! #define CLIENT_NORMAL 1 #define CLIENT_ULTRAPEER 2 ! #define CLIENT_LEAF 3 #define UPDATE_RELEASE 1 ! #define UPDATE_BETA 2 ! #define UPDATE_NONE 3 ! #define SOCK_UNKNOWN 0 ! #define SOCK_CONNECTING 1 ! #define SOCK_CONNECTED 2 ! #define SOCK_CLOSED 3 ! #define PACKET_PING 5 ! #define PACKET_PONG 4 ! #define PACKET_QUERY 3 ! #define PACKET_QUERYHIT 2 ! #define PACKET_PUSH 1 ! #define PACKET_BYE 1 ! #define ERROR_HOPS 1 ! #define ERROR_LOOPBACK 2 ! #define ERROR_TTL 3 ! #define ERROR_DUPLICATE 4 ! #define ERROR_ROUTING 5 ! #define TRANSFER_NOSOURCES 1 #define TRANSFER_PENDING 2 #define TRANSFER_CONNECTING 3 #define TRANSFER_CONNECTED 4 #define TRANSFER_SENDING 5 ! #define TRANSFER_RECEIVING 6 ! #define TRANSFER_PUSH 7 ! #define TRANSFER_CLOSED 8 #define TRANSFER_COMPLETED 9 ! #define TRANSFER_COOLDOWN 10 ! #define TRANSFER_QUEUED 11 #define RESULT_INACTIVE 1 ! #define RESULT_TRYING 2 #define RESULT_DOWNLOADING 3 #define RESULT_COMPLETED 4 *************** *** 183,190 **** #define HASH_TYPES 5 ! #define HASH_SHA1 0 ! #define HASH_MD5 1 #define HASH_MD4_ED2K 2 ! #define HASH_TIGERTREE 3 #define HASH_BITPRINT 4 #define HASH_UNKNOWN -1 --- 183,190 ---- #define HASH_TYPES 5 ! #define HASH_SHA1 0 ! #define HASH_MD5 1 #define HASH_MD4_ED2K 2 ! #define HASH_TIGERTREE 3 #define HASH_BITPRINT 4 #define HASH_UNKNOWN -1 *************** *** 202,206 **** typedef unsigned short word16; typedef unsigned int word32; ! #ifndef OPENGCC typedef unsigned __int64 word64; --- 202,206 ---- typedef unsigned short word16; typedef unsigned int word32; ! #ifndef OPENGCC // FIXME: get this all to work :) typedef unsigned __int64 word64; |
From: <ri...@us...> - 2004-01-21 23:52:27
|
Update of /cvsroot/gnucula/Gnucula/platform/win In directory sc8-pr-cvs1:/tmp/cvs-serv21564/platform/win Added Files: typedefs.h Log Message: initial import --- NEW FILE: typedefs.h --- #ifndef TYPEDEFS_H #define TYPEDEFS_H #pragma once typedef CString CharString; #endif // TYPEDEFS_H |
Update of /cvsroot/gnucula/Gnucula In directory sc8-pr-cvs1:/tmp/cvs-serv9738 Modified Files: Conversions.cpp Conversions.h FileLock.cpp GnuAltLoc.cpp GnuAltLoc.h GnuCache.cpp GnuCache.h Log Message: more changes to bring gnucula up to date with gnucdnaR2. Index: Conversions.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Conversions.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Conversions.cpp 11 Jul 2003 02:44:55 -0000 1.9 --- Conversions.cpp 20 Jan 2004 21:45:31 -0000 1.10 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2004 John Marshall This library is free software; you can redistribute it and/or *************** *** 54,58 **** { '8', 0x8 }, { '9', 0x9 }, ! { ':', 0x9 }, { ';', 0x9 }, { '<', 0x9 }, --- 54,58 ---- { '8', 0x8 }, { '9', 0x9 }, ! { ':', 0x9 }, { ';', 0x9 }, { '<', 0x9 }, *************** *** 118,132 **** ! /* Function: CharString DWrdtoStr(UINT in) * ! * Description: Uses sprintf() to format the unsigned integer, in, into the character array, buff. ! * (%u is format for unsigned int.) */ ! CharString DWrdtoStr(UINT in) { char buff[16]; ! ::sprintf(buff, "%u", in); return buff; --- 118,131 ---- ! /* Function: CharString NumtoStr(int in) * ! * Description: Uses sprintf() to format the integer, in, into the character array, buff. */ ! CharString NumtoStr(int in) { char buff[16]; ! ::sprintf(buff, "%d", in); return buff; *************** *** 151,154 **** --- 150,155 ---- } + // Eliminated in shift to G2 + #if 0 CharString ExIPtoStr(ExIP in) { *************** *** 179,183 **** ExIP out; out.a = a; out.b = b; out.c = c; out.d = d; ! CharString mode(rawMode); --- 180,184 ---- ExIP out; out.a = a; out.b = b; out.c = c; out.d = d; ! CharString mode(rawMode); *************** *** 191,194 **** --- 192,196 ---- } #endif + #endif CharString EncodeBase16(const unsigned char* buffer, unsigned int bufLen) *************** *** 246,262 **** } CharString EncodeBase32(const unsigned char* buffer, unsigned int bufLen) { ! CharString Base32Buff; ! unsigned int i, index; unsigned char word; - int pos = 0; ! for (i = 0, index = 0; i < bufLen; ) ! { ! // Is the current word going to span a byte boundary? ! if (index > 3) ! { word = (buffer[i] & (0xFF >> index)); index = (index + 5) % 8; --- 248,264 ---- } + // ?? does this fix issues with open string class ?? (no OES...) CharString EncodeBase32(const unsigned char* buffer, unsigned int bufLen) { ! int bufflen = EncodeLengthBase32(bufLen); ! char* encbuff = new char[bufflen]; ! int encsize = 0; ! // could be moved to local to the for {} unsigned char word; ! for (unsigned int i = 0, index = 0, buffpos = 0; i < bufLen; ) { ! /* Is the current word going to span a byte boundary? */ ! if (index > 3) { word = (buffer[i] & (0xFF >> index)); index = (index + 5) % 8; *************** *** 266,272 **** i++; ! } ! else ! { word = (buffer[i] >> (8 - (index + 5))) & 0x1F; index = (index + 5) % 8; --- 268,272 ---- i++; ! } else { word = (buffer[i] >> (8 - (index + 5))) & 0x1F; index = (index + 5) % 8; *************** *** 275,288 **** } ! // assert(word < 32); ! #ifdef OPENGCC // no EOS, += doesn't work; neither does this workaround... ! Base32Buff.AddString(base32Chars[word], 1); ! #else ! Base32Buff += base32Chars[word]; ! #endif //*(base32Buffer++) = (char) base32Chars[word]; ! } // end for ! return Base32Buff; } --- 275,296 ---- } ! // assert(word < 32); ! ! if (buffpos < bufflen) { ! encbuff[buffpos++] = (char) base32Chars[word]; ! encsize++; ! } ! else ! ASSERT(0); //*(base32Buffer++) = (char) base32Chars[word]; ! } ! ! // construct a new string from the buffer ! CharString encStr(encbuff, encsize); ! ! delete [] encbuff; ! ! return encStr; } *************** *** 298,302 **** lookup = toupper(base32Buffer[i]) - '0'; ! // Check to make sure that the given word falls inside a valid range if (lookup < 0 || lookup >= BASE32_LOOKUP_MAX) word = 0xFF; --- 306,310 ---- lookup = toupper(base32Buffer[i]) - '0'; ! // Check to make sure that the given word falls inside a valid range if (lookup < 0 || lookup >= BASE32_LOOKUP_MAX) word = 0xFF; *************** *** 377,381 **** temp = CTime(Year, Month, Day, Hour, Min, 0, 0); ! if (tolower(str[16]) == 'z') { return temp; --- 385,389 ---- temp = CTime(Year, Month, Day, Hour, Min, 0, 0); ! if (tolowerex(str[16]) == 'z') { return temp; *************** *** 403,406 **** --- 411,416 ---- } + // Eliminated in G2 change. + #if 0 BlockedHost StrtoBlocked(CharString strBlocked) { *************** *** 429,433 **** CharString strLine = strBlocked.Mid(BreakPos + 1); ! BreakPos = strLine.Find(':'); --- 439,443 ---- CharString strLine = strBlocked.Mid(BreakPos + 1); ! BreakPos = strLine.Find(':'); *************** *** 452,455 **** --- 462,466 ---- return strBlocked; } + #endif #endif // OPENGCC *************** *** 489,493 **** return HASH_MD4_ED2K; ! if (Tag.CompareNoCase("tree:tiger:") == 0) return HASH_TIGERTREE; --- 500,504 ---- return HASH_MD4_ED2K; ! if (Tag.CompareNoCase("tree:tiger/:") == 0 || Tag.CompareNoCase("tree:tiger:") == 0) return HASH_TIGERTREE; *************** *** 498,513 **** } ! CharString CommaIze(CharString in) { ! int Len = in.GetLength(); ! ! if (Len > 3) ! { ! CharString out; ! for (int pos = Len % 4; pos < Len; pos + 4, Len++) ! out.Insert(pos, ","); ! return out; ! } else return in; --- 509,518 ---- } ! // FIXME: These functions should be moved to the string class, ! // and a wrapper provided for CStrings. CharString CommaIze(CharString in) { ! if (in.GetLength() > 3) ! return CommaIze(in.Left(in.GetLength() - 3)) + "," + in.Right(3); else return in; *************** *** 524,537 **** CharString strNumber(FloatToString(dNumber)); ! //CharString strNumber(_fcvt(dNumber, 2, &decimal, &sign)); ! ! // if (decimal == 0) ! // strNumber.Insert(0, "0."); ! // else if (decimal == -1) ! // strNumber.Insert(0, "0.0"); ! // else if (decimal < -1) ! // return "0.00"; ! // else ! // strNumber.Insert(decimal, '.'); return strNumber; --- 529,540 ---- CharString strNumber(FloatToString(dNumber)); ! if (decimal == 0) ! strNumber.Insert(0, "0."); ! else if (decimal == -1) ! strNumber.Insert(0, "0.0"); ! else if (decimal < -1) ! return "0.00"; ! else ! strNumber.Insert(decimal, '.'); return strNumber; *************** *** 591,596 **** { copy++; ! Front = Front.Left(spacepos) + " "; ! Front += DWrdtoStr(copy); } } --- 594,598 ---- { copy++; ! Front = Front.Left(spacepos) + " " + NumtoStr(copy); } } *************** *** 667,708 **** VendorID.MakeUpper(); ! if (VendorID == "ARES") ! return "Ares"; ! if (VendorID == "BEAR") ! return "BearShare"; ! if (VendorID == "CULT") ! return "Cultiv8r"; ! if (VendorID == "GNOT") ! return "Gnotella"; ! if (VendorID == "GNUC") ! return "Gnucleus"; ! if (VendorID == "GNUT") ! return "Gnut"; ! if (VendorID == "GTKG") ! return "Gtk-Gnutella"; ! if (VendorID == "HSLG") ! return "Hagelslag"; ! if (VendorID == "LIME") ! return "LimeWire"; ! if (VendorID == "MACT") ! return "Mactella"; ! if (VendorID == "MNAP") ! return "MyNapster"; ! if (VendorID == "MRPH") ! return "Morpheus"; ! if (VendorID == "NAPS") ! return "NapShare"; ! if (VendorID == "OCFG") ! return "OCFolders"; ! if (VendorID == "QTEL") ! return "Qtella"; ! if (VendorID == "RAZA") ! return "Shareaza"; ! if (VendorID == "SNUT") ! return "SwapNut"; ! if (VendorID == "TOAD") ! return "ToadNode"; ! if (VendorID == "XOLO") ! return "Xolox"; return VendorID; --- 669,692 ---- VendorID.MakeUpper(); ! if(VendorID == "ARES") return "Ares"; ! if(VendorID == "BEAR") return "BearShare"; ! if(VendorID == "CULT") return "Cultiv8r"; ! if(VendorID == "GNOT") return "Gnotella"; ! if(VendorID == "GNUC") return "Gnucleus"; ! if(VendorID == "GNUT") return "Gnut"; ! if(VendorID == "GTKG") return "Gtk-Gnutella"; ! if(VendorID == "HSLG") return "Hagelslag"; ! if(VendorID == "LIME") return "LimeWire"; ! if(VendorID == "MACT") return "Mactella"; ! if(VendorID == "MNAP") return "MyNapster"; ! if(VendorID == "MMMM") return "Morpheus v2"; ! if(VendorID == "MRPH") return "Morpheus v3"; ! if(VendorID == "NAPS") return "NapShare"; ! if(VendorID == "OCFG") return "OCFolders"; ! if(VendorID == "QTEL") return "Qtella"; ! if(VendorID == "RAZA") return "Shareaza"; ! if(VendorID == "SNUT") return "SwapNut"; ! if(VendorID == "TOAD") return "ToadNode"; ! if(VendorID == "XOLO") return "Xolox"; return VendorID; *************** *** 730,787 **** char *FloatToString(double in) { // check that this works; untested ! int i; ! int temp_int = (int) in; ! char *part_one = IntToString(temp_int); ! in = (in - temp_int) * 100000; ! temp_int = (int) in; ! char *part_two = IntToString(temp_int); ! for (i = 0; *(part_one + i) != '\0'; i++) { ! ; } ! temp_int = i; ! for (i = 0; *(part_two + i) != '\0'; i++) { ! ; } ! temp_int += i + 1; // +1 for '.' ! char return_array[temp_int]; ! char *return_me = return_array; ! for (i = 0; *(part_one + i) != '\0'; i++) ! *(return_me + i) = *(part_one + i); ! temp_int = i + 1; ! *(return_me + temp_int) = '.'; ! for (i = 0; *(part_two + i) != '\0'; i++) ! *(return_me + i + temp_int) = *(part_one + i); ! *(return_me + i + temp_int) = '\0'; return return_me; } char *IntToString(int number) { // with significant thanks owed to other open implementations... ! static char buf[21]; ! char *p = buf + 20; ! if (number >= 0) ! { ! do ! { ! *--p = '0' + (number % 10); ! number /= 10; } while (number != 0); ! return p; ! } ! else /* number < 0 */ ! { ! do ! { ! *--p = '0' - (number % 10); ! number /= 10; } while (number != 0); ! *--p = '-'; } ! return p; } float StringToFloat(char *convert_me) --- 714,776 ---- char *FloatToString(double in) { // check that this works; untested ! int i; ! int temp_int = (int) in; ! char *part_one = IntToString(temp_int); ! in = (in - temp_int) * 100000; ! temp_int = (int) in; ! char *part_two = IntToString(temp_int); ! for (i = 0; *(part_one + i) != '\0'; i++) { ; } ! temp_int = i; ! for (i = 0; *(part_two + i) != '\0'; i++) { ; } ! ! temp_int += i + 1; // +1 for '.' ! ! char return_array[temp_int]; ! char *return_me = return_array; ! ! for (i = 0; *(part_one + i) != '\0'; i++) ! return_array[i] = *(part_one + i); ! ! temp_int = i + 1; ! *(return_me + temp_int) = '.'; ! ! for (i = 0; *(part_two + i) != '\0'; i++) ! return_array[i + temp_int] = *(part_two + i); ! ! *(return_me + i + temp_int) = '\0'; return return_me; } + // NumtoStr(int) negates need for this. + #if 0 char *IntToString(int number) { // with significant thanks owed to other open implementations... ! static char buf[21]; ! char *p = buf + 20; ! ! if (number >= 0) { ! do { ! *--p = '0' + (number % 10); ! number /= 10; } while (number != 0); ! return p; ! } else { ! /* number < 0 */ ! do { ! *--p = '0' - (number % 10); ! number /= 10; } while (number != 0); ! *--p = '-'; } ! ! return p; } + #endif float StringToFloat(char *convert_me) Index: Conversions.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Conversions.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Conversions.h 11 Jul 2003 02:44:55 -0000 1.11 --- Conversions.h 20 Jan 2004 21:45:31 -0000 1.12 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2004 John Marshall This library is free software; you can redistribute it and/or *************** *** 38,42 **** // Functions ! CharString DWrdtoStr(UINT); // Convert DWORD to a CharString #ifndef OPENGCC // need IP and CTime workarounds --- 38,42 ---- // Functions ! CharString NumtoStr(int); // Convert DWORD to a CharString #ifndef OPENGCC // need IP and CTime workarounds *************** *** 44,61 **** IP StrtoIP(CharString in); // Convert CharString to an IP - ExIP StrtoExIP(CharString in); // String to extended IP - CharString ExIPtoStr(ExIP in); // ExtendedIP to String - CTime StrToCTime(CharString& str); // Converts a string representation to a CTime CharString CTimeToStr(CTime& time); // reverse of above #endif ! CharString EncodeBase16(const byte* buffer, unsigned int bufLen); ! void DecodeBase16(const char *base16Buffer, unsigned int base16BufLen, byte *buffer); int EncodeLengthBase16(int rawLength); int DecodeLengthBase16(int base16Length); ! CharString EncodeBase32(const byte* buffer, unsigned int bufLen); ! void DecodeBase32(const char *base32Buffer, unsigned int base32BufLen, byte *buffer); int EncodeLengthBase32(int rawLength); int DecodeLengthBase32(int base32Length); --- 44,58 ---- IP StrtoIP(CharString in); // Convert CharString to an IP CTime StrToCTime(CharString& str); // Converts a string representation to a CTime CharString CTimeToStr(CTime& time); // reverse of above #endif ! CharString EncodeBase16(const byte* buffer, unsigned int bufLen); ! void DecodeBase16(const char *base16Buffer, unsigned int base16BufLen, byte *buffer); int EncodeLengthBase16(int rawLength); int DecodeLengthBase16(int base16Length); ! CharString EncodeBase32(const byte* buffer, unsigned int bufLen); ! void DecodeBase32(const char *base32Buffer, unsigned int base32BufLen, byte *buffer); int EncodeLengthBase32(int rawLength); int DecodeLengthBase32(int base32Length); *************** *** 64,72 **** CharString GetSpeedString(DWORD dwSpeed); - #ifndef OPENGCC - BlockedHost StrtoBlocked(CharString strBlocked); - CharString BlockedtoStr(BlockedHost badHost); - #endif - CharString HashIDtoTag(int HashID); int TagtoHashID(CharString Tag); --- 61,64 ---- Index: FileLock.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/FileLock.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FileLock.cpp 28 May 2003 05:18:09 -0000 1.4 --- FileLock.cpp 20 Jan 2004 21:45:31 -0000 1.5 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall, Filelock code - Makslane Araujo Rodrigues --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2004 John Marshall, Filelock code - Makslane Araujo Rodrigues Index: GnuAltLoc.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuAltLoc.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GnuAltLoc.cpp 8 Jul 2003 08:32:30 -0000 1.5 --- GnuAltLoc.cpp 20 Jan 2004 21:45:31 -0000 1.6 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2004 John Marshall This library is free software; you can redistribute it and/or Index: GnuAltLoc.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuAltLoc.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GnuAltLoc.h 9 Jul 2003 05:50:08 -0000 1.8 --- GnuAltLoc.h 20 Jan 2004 21:45:31 -0000 1.9 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2004 John Marshall This library is free software; you can redistribute it and/or Index: GnuCache.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuCache.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GnuCache.cpp 8 Jul 2003 08:32:30 -0000 1.9 --- GnuCache.cpp 20 Jan 2004 21:45:31 -0000 1.10 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2004 John Marshall [...1767 lines suppressed...] + } + else + { + if (!NotRecent(StrtoIP(ActiveNode.Host))) + return; + + if (itIP != m_AlreadyTried.end()) + if (m_RealNodes.size() > m_MaxCacheSize / 2) + return; + + while (m_RealNodes.size() > m_MaxCacheSize) + m_RealNodes.pop_back(); + + m_RealNodes.push_front(ActiveNode); + } + } + } + #endif + + Index: GnuCache.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuCache.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GnuCache.h 9 Jul 2003 05:50:08 -0000 1.10 --- GnuCache.h 20 Jan 2004 21:45:31 -0000 1.11 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2004 John Marshall This library is free software; you can redistribute it and/or *************** *** 24,27 **** --- 24,30 ---- ********************************************************************************/ + #ifndef GNU_CACHE_H + #define GNU_CACHE_H + #ifndef OPENGCC *************** *** 32,38 **** #endif - #ifndef GNU_CACHE_H - #define GNU_CACHE_H - class CGnuCore; --- 35,38 ---- *************** *** 43,46 **** --- 43,51 ---- #define DEAD 2 #define UNTESTED 3 + #define GWCERROR 4 + + #define GWC_VERSION1 1 + #define GWC_VERSION2 2 + struct AltWebCache *************** *** 48,56 **** CharString URL; int State; ! AltWebCache(CharString nURL = "", int nState = UNTESTED) ! { ! URL = nURL; State = nState; }; }; --- 53,71 ---- CharString URL; int State; + CTime LastRef; + int ErrCount; + int GWCVer; ! AltWebCache(CharString nURL = "", ! int nState = UNTESTED, ! CTime nLastRef = CTime::GetCurrentTime(), ! int nErrCount = 0, ! int nGWCVer = GWC_VERSION1) ! { ! URL = nURL; State = nState; + LastRef = nLastRef; + ErrCount = nErrCount; + GWCVer = nGWCVer; }; }; *************** *** 59,74 **** { public: ! CGnuCache(CGnuCore*); virtual ~CGnuCache(); void endThreads(); ! void LoadNodes(CharString); ! void LoadUltraNodes(CharString); ! void SaveNodes(CharString); ! void SaveUltraNodes(CharString); bool NotRecent(IP); - bool NotRecentSuperNodes(IP); - void UpdateCache(Node ActiveNode, bool Super=false); void RemoveIP(CharString); --- 74,89 ---- { public: ! CGnuCache(CGnuNetworks*); virtual ~CGnuCache(); void endThreads(); ! void LoadCache(CString); ! void SaveCache(CString); ! void WriteCache(CStdioFile&, std::list<Node>&); ! ! void AddKnown(Node ActiveNode); ! void AddWorking(Node WorkingNode); bool NotRecent(IP); void RemoveIP(CharString); *************** *** 76,85 **** void WriteLinkList(); - bool m_LinkListActivated; - int m_LinkListUpdateSec; - // Web Cache funtions ! void LoadWebCacheList(CharString); ! void SaveWebCacheList(CharString); void WebCacheRequest(bool HostFileOnly=false); --- 91,97 ---- void WriteLinkList(); // Web Cache funtions ! void LoadWebCaches(CharString); ! void SaveWebCaches(CharString); void WebCacheRequest(bool HostFileOnly=false); *************** *** 88,94 **** --- 100,112 ---- CharString WebCacheDoRequest(CharString); + void WebCacheGetRequest(CharString network = "gnutella"); void MarkWebCache(CharString, bool); void DebugDumpWebCaches(); + CString WebCacheDoRequest(CString); + bool WebCacheParseResponse(CString, CString); + void MarkWebCache(CString URL, bool isAlive, int GWCVer = GWC_VERSION1); + void DebugDumpWebCaches(); + bool ValidURL(CharString); CharString EscapeEncode(CharString &what); *************** *** 100,115 **** int m_MaxWebCacheSize; ! std::list<Node> m_PermNodes; // Nodes used for finding connections ! std::list<Node> m_RealNodes; // Most recent nodes on the network ! std::list<Node> m_UltraNodes; // Ultranodes! ! std::list<Node> m_LinkList; ! std::list<IP> m_RecentIPs; ! std::list<IP> m_RecentSuperIPs; ! std::map<UINT, bool> m_AlreadyTried; UINT m_WebMode; CharString m_WebCommand; CharString m_NewSite; --- 118,132 ---- int m_MaxWebCacheSize; ! std::list<Node> m_GnuPerm; ! std::list<Node> m_GnuReal; ! std::list<Node> m_G2Perm; ! std::list<Node> m_G2Real; ! std::list<IP> m_RecentIPs; UINT m_WebMode; CharString m_WebCommand; + CharString m_WebNetwork; CharString m_NewSite; *************** *** 128,138 **** std::vector<CharString> m_WebTransferList; ! CGnuCore* m_pCore; ! CGnuPrefs* m_pPrefs; private: - - - }; --- 145,153 ---- std::vector<CharString> m_WebTransferList; ! CGnuCore* m_pCore; ! CGnuNetworks* m_pNet; ! CGnuPrefs* m_pPrefs; private: }; |
From: <ri...@us...> - 2004-01-20 21:43:08
|
Update of /cvsroot/gnucula/Gnucula/platform/opengcc In directory sc8-pr-cvs1:/tmp/cvs-serv9205/platform/opengcc Modified Files: opentime.cpp opentime.h strings.cpp strings.h typedefs.h Log Message: initial changes to bring up to date with gnucdnaR2. Index: opentime.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/opentime.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** opentime.cpp 11 Jul 2003 18:52:49 -0000 1.2 --- opentime.cpp 20 Jan 2004 21:43:05 -0000 1.3 *************** *** 27,35 **** #ifdef LINUX #include <sys/time.h> ! // #include <isc/eventlib.h> ? #endif - - // #include <string> #include <errno.h> #include <signal.h> --- 27,33 ---- #ifdef LINUX #include <sys/time.h> ! // #include <isc/eventlib.h> // doc.s suggest... #endif #include <errno.h> #include <signal.h> *************** *** 43,52 **** #include "../../Conversions.h" ! #ifdef DEBUG // used for debugging. external to gnuc. #include "../../../console_interface/console_io.h" #endif /* ! * Function: current_time_string(char *) * * Description: Gets and returns the system time on a few systems. --- 41,50 ---- #include "../../Conversions.h" ! #ifdef CONSOLE_DEBUG // used for debugging. external to gnuc. #include "../../../console_interface/console_io.h" #endif /* ! * CHANGE ME! * * Description: Gets and returns the system time on a few systems. *************** *** 71,90 **** } ! Strings OpenTime::GetTZString(void) ! { ! OpenTime tempTime; ! tempTime.SetTime(GetTime()); ! ! Strings TZString = tempTime.Stringify("%Z"); ! return TZString; ! } ! timespec OpenTime::GetTime(void) { ! #ifdef DEBUG // used for debugging. external to gnuc. Console_Output debug_io; debug_io.kwik_out("In get"); #endif ! struct timespec CurrentEpochTime; ClockErrorCheck = clock_gettime(CLOCK_REALTIME, &CurrentEpochTime); // this uses errno, and may be unsafe with threading... --- 69,80 ---- } ! // semi-private functions timespec OpenTime::GetTime(void) { ! #ifdef CONSOLE_DEBUG // used for debugging. external to gnuc. Console_Output debug_io; debug_io.kwik_out("In get"); #endif ! struct ; ClockErrorCheck = clock_gettime(CLOCK_REALTIME, &CurrentEpochTime); // this uses errno, and may be unsafe with threading... *************** *** 95,104 **** void OpenTime::SetTime(timespec CurrentEpochTime) { ! #ifdef DEBUG // used for debugging. external to gnuc. Console_Output debug_io; debug_io.kwik_out("In set"); #endif FullTime = localtime(&(CurrentEpochTime.tv_sec)); ! return;// NewTime; } --- 85,96 ---- void OpenTime::SetTime(timespec CurrentEpochTime) { ! #ifdef CONSOLE_DEBUG // used for debugging. external to gnuc. Console_Output debug_io; debug_io.kwik_out("In set"); #endif FullTime = localtime(&(CurrentEpochTime.tv_sec)); ! TimeZone = Stringify("%Z"); ! TimeStamp = Stringify(); ! return; } *************** *** 107,111 **** // size_t string_length; Strings ReturnMe; ! if (ClockErrorCheck != 0) // something went wrong, return error { ReturnMe = "Clock Error: "; --- 99,103 ---- // size_t string_length; Strings ReturnMe; ! if (ClockErrorCheck != 0) // something is wrong, return error string instead { ReturnMe = "Clock Error: "; *************** *** 140,151 **** } // doesn't need to be internal... Strings OpenTime::CurrentTimeString(char *TimeStyle) { - OpenTime tempTime; Strings Current; - tempTime.SetTime(GetTime()); - if (ClockErrorCheck != 0) // something went wrong, return errno { --- 132,146 ---- } + Strings OpenTime::GetTZString(void) + { + Strings TZString = Stringify("%Z"); + return TZString; + } + // doesn't need to be internal... Strings OpenTime::CurrentTimeString(char *TimeStyle) { Strings Current; if (ClockErrorCheck != 0) // something went wrong, return errno { *************** *** 155,159 **** } ! Current = tempTime.Stringify(TimeStyle); return Current; --- 150,154 ---- } ! Current = Stringify(FullTime, TimeStyle); return Current; Index: opentime.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/opentime.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** opentime.h 11 Jul 2003 18:52:49 -0000 1.2 --- opentime.h 20 Jan 2004 21:43:05 -0000 1.3 *************** *** 33,36 **** --- 33,37 ---- class Strings; + struct tm; struct timespec; *************** *** 39,53 **** private: int ClockErrorCheck; ! struct tm *FullTime; public: OpenTime(void); // function prototypes Strings CurrentTimeString(char * = "%Y-%m-%dT%H:%MZ"); Strings GetTZString(void); - timespec GetTime(void); - void SetTime(timespec); Strings Stringify(char * = "%Y-%m-%dT%H:%MZ"); ! // void start_timers( timer_t *, timer_t *); --- 40,59 ---- private: int ClockErrorCheck; ! tm *FullTime; ! Strings TimeStamp; ! Strings TimeZone; public: OpenTime(void); + // semi-private functions + timespec GetTime(void); + void SetTime(timespec); // function prototypes Strings CurrentTimeString(char * = "%Y-%m-%dT%H:%MZ"); Strings GetTZString(void); Strings Stringify(char * = "%Y-%m-%dT%H:%MZ"); ! bool IsSet(void); ! Strings GetStamp(void); ! void UpdateStamp(void); // void start_timers( timer_t *, timer_t *); Index: strings.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/strings.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** strings.cpp 10 Jul 2003 22:41:07 -0000 1.7 --- strings.cpp 20 Jan 2004 21:43:05 -0000 1.8 *************** *** 3,7 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall GCC extended code - Clayton Rollins (also LGPL) --- 3,7 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2004 John Marshall GCC extended code - Clayton Rollins (also LGPL) Index: strings.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/strings.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** strings.h 10 Jul 2003 22:41:07 -0000 1.10 --- strings.h 20 Jan 2004 21:43:05 -0000 1.11 *************** *** 32,42 **** #define STRINGS_H - //#include <stddef.h> - //using namespace std; // was for NULL - class Strings { private: int StringLength; // position of last null public: // for testing, gives console easy access, but is unneeded internal to gnuc. --- 32,41 ---- #define STRINGS_H class Strings { private: int StringLength; // position of last null + // add bool HasNull; + // test lengths to avoid overflows (where possible) public: // for testing, gives console easy access, but is unneeded internal to gnuc. Index: typedefs.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/typedefs.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** typedefs.h 10 Jul 2003 08:31:41 -0000 1.6 --- typedefs.h 20 Jan 2004 21:43:05 -0000 1.7 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall GCC extended code - Clayton Rollins (also LGPL) --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2004 John Marshall GCC extended code - Clayton Rollins (also LGPL) *************** *** 27,37 **** #ifndef TYPEDEFS_H ! #define TYPEDEFS_H ! ! //#include <iostream> ! //#include <string> ! //#include <sstream> ! #include <stddef.h> ! using namespace std; class Strings; // forward declaration --- 27,31 ---- #ifndef TYPEDEFS_H ! #define TYPEDEFS_H class Strings; // forward declaration |
Update of /cvsroot/gnucula/Gnucula In directory sc8-pr-cvs1:/tmp/cvs-serv9205 Modified Files: Common.cpp Common.h GnuNode.cpp GnuNode.h GnuSearch.cpp stdafx.h Removed Files: TimeMod.cpp TimeMod.h Log Message: initial changes to bring up to date with gnucdnaR2. Index: Common.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Common.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Common.cpp 8 Jul 2003 07:43:49 -0000 1.9 --- Common.cpp 20 Jan 2004 21:43:04 -0000 1.10 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2004 John Marshall This library is free software; you can redistribute it and/or *************** *** 105,114 **** } ! CharString GetFileError(CFileException* error) { if(!error) return "File Error Unknown"; ! switch( error->m_cause ) { --- 105,114 ---- } ! CharString GetFileError(CFileException* error) { if(!error) return "File Error Unknown"; ! switch(error->m_cause) { *************** *** 163,167 **** } ! PriorityPacket::PriorityPacket(byte* packet, int length, int type, int hops) { --- 163,169 ---- } ! // FIXME: is priority packet not needed?? ! // remove if not. ! #if 0 PriorityPacket::PriorityPacket(byte* packet, int length, int type, int hops) { *************** *** 183,186 **** --- 185,189 ---- } } + #endif // Return the first string before the delim char *************** *** 337,338 **** --- 340,403 ---- return URL; } + + CharString GetTimeZoneStr() + { + CharString TZStr; + #ifndef OPENGCC + int TZHours = abs(_timezone) / (60 * 60); + int TZMins = ((abs(_timezone) / 60) - (TZHours * 60)); + + TZStr.Format("%c%2.2d:%2.2d", (_timezone < 0 ? '-' : '+'), TZHours, TZMins); + #else + OpenTime Temp; + TZStr = Temp.GetTZString(); + #endif + return TZStr; + } + + #ifdef OPENGCC // test functions here... + + #else// still in gnuc. code + CTimeSpan LocalTimeZone() + { + int TZHours = _timezone / (60 * 60); + int TZMins = ((abs(_timezone) / 60) - (abs(TZHours) * 60)); + + return CTimeSpan(0, TZHours, TZMins, 0); + } + #endif + + + // New functions, introduced with G2 + + char tolowerex(char letter) + { + if(65 <= letter && letter <= 90) + return letter + 32; + + return letter; + } + + int memfind(byte* mem, int length, byte value) + { + ASSERT(length); + + for(int i = 0; i < length; i++) + if( mem[i] == value) + return i; + + return -1; + } + + uint32 HashGuid(GUID &Guid) + { + byte* pGuidRaw = (byte*) &Guid; + + // XOR every 4 bytes together ... + uint32 hash = (pGuidRaw[0] ^ pGuidRaw[4] ^ pGuidRaw[8] ^ pGuidRaw[12]) + + 256 * (pGuidRaw[1] ^ pGuidRaw[5] ^ pGuidRaw[9] ^ pGuidRaw[13]) + + 256 * 256 * (pGuidRaw[2] ^ pGuidRaw[6] ^ pGuidRaw[10] ^ pGuidRaw[14]) + + 256 * 256 * 256 * (pGuidRaw[3] ^ pGuidRaw[7] ^ pGuidRaw[11] ^ pGuidRaw[15]); + + return hash; + } Index: Common.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Common.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Common.h 9 Jul 2003 05:50:08 -0000 1.11 --- Common.h 20 Jan 2004 21:43:04 -0000 1.12 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2004 John Marshall This library is free software; you can redistribute it and/or *************** *** 36,43 **** #include "stdafx.h" #include "FileLock.h" - #include "TimeMod.h" // Pre-definitions class CGnuNode; --- 36,47 ---- #include "stdafx.h" #include "FileLock.h" // Pre-definitions + struct Result; + struct ResultGroup; + + // eliminated in G2 + #if 0 class CGnuNode; *************** *** 56,62 **** struct QueryComp; struct RecentQuery; - struct Result; - struct ResultGroup; - struct UpdateFile; struct FileChunk; --- 60,63 ---- *************** *** 66,70 **** struct ErrorInfo; ! // Functions --- 67,71 ---- struct ErrorInfo; ! #endif // Functions *************** *** 78,81 **** --- 79,118 ---- void GnuCreateGuid(GUID *pGuid); + // Time Functions + CharString GetTimeZoneStr(); + CharString GetTimeString(char * = "%Y-%m-%dT%H:%MZ"); + + #ifdef OPENGCC + // put extensible time functions here, eliminate CTime types from main code + //void AdjustTime(&TimeObject); + //TimeObject CurrentTime(void); <- maybe unneeded + #else + CTimeSpan LocalTimeZone(); + #endif + + // introduced with G2 + char tolowerex(char letter); + int memfind(byte* mem, int length, byte value); + uint32 HashGuid(GUID &Guid); + + // introduced with G2... used in new gnushare and gnutransfers + // and most G2 files. + #ifndef OPENGCC + #pragma pack (push, 1) + #endif + struct IPv4 + { + IP Host; + UINT Port; + + IPv4() + { + Host.S_addr = 0; + Port = 0; + }; + }; + #ifndef OPENGCC + #pragma pack (pop) + #endif // Definitions *************** *** 135,139 **** --- 172,336 ---- }; + struct RangeType + { + DWORD StartByte; + DWORD EndByte; + }; + + struct FileSource + { + uint32 SourceID; + + // Node info + IPv4 Address; + int Network; + CString HostStr; + CString Path; + int Speed; + CString Vendor; + int Distance; + int GnuRouteID; + GUID PushID; + std::vector<IPv4> DirectHubs; + + bool Firewall; + bool OpenSlots; + bool Busy; + bool Stable; + bool ActualSpeed; + + int RealBytesPerSec; + + + // File info + CString Name; + CString NameLower; + + uint32 FileIndex; + uint64 Size; + + CString Sha1Hash; + CString TigerHash; + + int MetaID; + std::map<int, CString> AttributeMap; + + std::vector<CString> GnuExtraInfo; + + std::vector<RangeType> AvailableRanges; + + // Download info + CString Handshake; + CString Error; + int RetryWait; + int Tries; + bool TigerSupport; + bool PushSent; + + enum States + { + eUntested, + eTrying, + eAlive, + eCorrupt, + eFailed + } Status; + + + FileSource() + { + Init(); + }; + + FileSource(AltLocation& nAltLoc) + { + Init(); + + Network = NETWORK_GNUTELLA; // Replace with more specific + + Name = NameLower = nAltLoc.Name; + NameLower.MakeLower(); + + Sha1Hash = nAltLoc.Sha1Hash; + FileIndex = nAltLoc.Index; + + Address.Host = StrtoIP(nAltLoc.HostPort.Host); + Address.Port = nAltLoc.HostPort.Port; + }; + + void Init() + { + SourceID = 0; + + // Node + Network = 0; + Speed = 0; + Distance = 0; + GnuRouteID = 0; + memset(&PushID, 0, 16); + + Firewall = false; + OpenSlots = false; + Busy = false; + Stable = false; + ActualSpeed = false; + + RealBytesPerSec = 0; + + // File + FileIndex = 0; + Size = 0; + MetaID = 0; + + // Download + RetryWait = 0; + Tries = 0; + TigerSupport = false; + PushSent = false; + + Status = States::eUntested; + }; + }; + + + struct ResultGroup + { + uint32 ResultID; + + CharString Name; + CharString NameLower; + uint32 Size; + uint32 AvgSpeed; + + CharString Sha1Hash; + + std::map<UINT, UINT> HostMap; + std::vector<Result> ResultList; + + // Meta avg + int AvgMetaID; + std::map<int, CharString> AvgAttributeMap; + + int State; + + ResultGroup() + { + ResultID = 0; + NextHostID = 1; + + Size = 0; + AvgSpeed = 0; + + AvgMetaID = 0; + + State = 0; + }; + }; + + + // structures eliminated in G2 change + // FIXME: remove once compilation is verified. + #if 0 struct HashedFile { *************** *** 173,178 **** UINT Index; ! DWORD Size; ! DWORD Matches; DWORD Uploads; --- 370,375 ---- UINT Index; ! DWORD Size; ! DWORD Matches; DWORD Uploads; *************** *** 232,236 **** }; ! // struct WordData { --- 429,433 ---- }; ! // struct WordData { *************** *** 243,255 **** { std::vector<WordData>* LocalKey; // Locally indexed ! std::list<int>* RemoteKey; // Remotely indexed ! WordKey() { ! LocalKey = NULL; RemoteKey = NULL; }; ! ~WordKey() { if(LocalKey) --- 440,452 ---- { std::vector<WordData>* LocalKey; // Locally indexed ! std::list<int>* RemoteKey; // Remotely indexed ! WordKey() { ! LocalKey = NULL; RemoteKey = NULL; }; ! ~WordKey() { if(LocalKey) *************** *** 302,308 **** struct RecentQuery { ! GUID Guid; int SecsOld; ! RecentQuery(); --- 499,505 ---- struct RecentQuery { ! GUID Guid; int SecsOld; ! RecentQuery(); *************** *** 314,323 **** }; - struct RangeType - { - DWORD StartByte; - DWORD EndByte; - }; - struct Result { --- 511,514 ---- *************** *** 327,331 **** std::vector<CharString> Info; ! CharString Sha1Hash; --- 518,522 ---- std::vector<CharString> Info; ! CharString Sha1Hash; *************** *** 333,337 **** DWORD Size; ! // Node info UINT HostID; --- 524,528 ---- DWORD Size; ! // Node info UINT HostID; *************** *** 409,413 **** { Result(); ! Name = NameLower = nAltLoc.Name; NameLower.MakeLower(); --- 600,604 ---- { Result(); ! Name = NameLower = nAltLoc.Name; NameLower.MakeLower(); *************** *** 420,444 **** }; - struct ResultGroup - { - UINT ResultID; - - CharString Name; - CharString NameLower; - UINT Size; - UINT AvgSpeed; - - CharString Sha1Hash; - - std::map<UINT, UINT> HostMap; - std::vector<Result> ResultList; - - // Meta avg - int AvgMetaID; - std::map<int, CharString> AvgAttributeMap; - - int State; - }; - struct FilePart { --- 611,614 ---- *************** *** 461,465 **** CharString Sha1Hash; ! int StartPos; int ChunkLength; --- 631,635 ---- CharString Sha1Hash; ! int StartPos; int ChunkLength; *************** *** 493,497 **** PriorityPacket(byte*, int, int, int); ~PriorityPacket(); ! byte* m_Packet; int m_Length; --- 663,667 ---- PriorityPacket(byte*, int, int, int); ~PriorityPacket(); ! byte* m_Packet; int m_Length; *************** *** 508,511 **** --- 678,682 ---- ErrorInfo():Time(CTime::GetCurrentTime()) { } }; + #endif #endif // COMMON_H Index: GnuNode.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuNode.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** GnuNode.cpp 23 Aug 2003 21:30:00 -0000 1.20 --- GnuNode.cpp 20 Jan 2004 21:43:04 -0000 1.21 *************** *** 136,140 **** // Host Browsing m_BrowseID = 0; ! m_BrowseSize = 0; m_BrowseBuffer = NULL; m_BrowseBuffSize = 0; --- 136,140 ---- // Host Browsing m_BrowseID = 0; ! m_BrowseSize = 0; m_BrowseBuffer = NULL; m_BrowseBuffSize = 0; *************** *** 160,164 **** m_StatPackets[i][j] = 0; ! m_StatPos = 0; m_StatElements = 0; m_Efficiency = 0; --- 160,164 ---- m_StatPackets[i][j] = 0; ! m_StatPos = 0; m_StatElements = 0; m_Efficiency = 0; *************** *** 166,174 **** for (i = 0; i < 2; i++) { ! m_StatPings[i] = 0; ! m_StatPongs[i] = 0; ! m_StatQueries[i] = 0; m_StatQueryHits[i] = 0; ! m_StatPushes[i] = 0; } --- 166,174 ---- for (i = 0; i < 2; i++) { ! m_StatPings[i] = 0; ! m_StatPongs[i] = 0; ! m_StatQueries[i] = 0; m_StatQueryHits[i] = 0; ! m_StatPushes[i] = 0; } Index: GnuNode.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuNode.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** GnuNode.h 10 Jul 2003 22:41:07 -0000 1.18 --- GnuNode.h 20 Jan 2004 21:43:04 -0000 1.19 *************** *** 85,89 **** CharString FindHeader(CharString); ! void ParseTryHeader(CcharString, bool = false); // Sending packets --- 85,89 ---- CharString FindHeader(CharString); ! void ParseTryHeader(CharString, bool = false); // Sending packets *************** *** 104,111 **** // Socket vars int m_NodeID; ! int m_Status; ! int m_SecsTrying; int m_SecsAlive; ! int m_SecsDead; int m_IntervalPing; int m_NextReSearchWait; --- 104,111 ---- // Socket vars int m_NodeID; ! int m_Status; ! int m_SecsTrying; int m_SecsAlive; ! int m_SecsDead; int m_IntervalPing; int m_NextReSearchWait; Index: GnuSearch.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuSearch.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GnuSearch.cpp 9 Jul 2003 05:50:08 -0000 1.9 --- GnuSearch.cpp 20 Jan 2004 21:43:04 -0000 1.10 *************** *** 79,84 **** m_PacketLength = 0; - m_BrowseNode = NULL; - // Build list of hosts we've searched for (int i = 0; i < m_pComm->m_NodeList.size(); i++) --- 79,82 ---- Index: stdafx.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/stdafx.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** stdafx.h 11 Jul 2003 02:44:56 -0000 1.16 --- stdafx.h 20 Jan 2004 21:43:04 -0000 1.17 *************** *** 90,93 **** --- 90,99 ---- #else // OPENGCC start + // some standard lib.s + //#include <string> + //#include <sstream> + #include <stddef.h> // can disable?? + using namespace std; + #include "platform/opengcc/typedefs.h" // some type workarounds #include "platform/opengcc/strings.h" --- TimeMod.cpp DELETED --- --- TimeMod.h DELETED --- |
From: <ri...@us...> - 2003-08-23 21:30:04
|
Update of /cvsroot/gnucula/Gnucula In directory sc8-pr-cvs1:/tmp/cvs-serv22102 Modified Files: GnuControl.cpp GnuNode.cpp GnuShare.cpp Log Message: small changes... Index: GnuControl.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuControl.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** GnuControl.cpp 8 Jul 2003 08:55:08 -0000 1.13 --- GnuControl.cpp 23 Aug 2003 21:30:00 -0000 1.14 *************** *** 795,799 **** { ! for (int i = 0; i < 3; i++) { CGnuNode* DeadNode = NULL; --- 795,799 ---- { ! for (int mode = 0; mode < 3; mode++) { CGnuNode* DeadNode = NULL; *************** *** 802,817 **** // Drop Normal/Ultra nodes ! for (int j = 0; j < m_NodeList.size(); j++) if (SOCK_CONNECTED == m_NodeList[i]->m_Status) { ! if ((i == 0 && m_NodeList[j]->m_HostMode == CLIENT_NORMAL) || \ ! ((i == 1 && m_NodeList[j]->m_HostMode == CLIENT_ULTRAPEER && \ ! (m_NodeList[j]->m_RemoteAgent.Find("GnucDNA") == -1)) || \ ! (i == 2 && m_NodeList[j]->m_HostMode == CLIENT_ULTRAPEER)) ! if (LowestTime.GetTimeSpan() == 0 || CurrentTime - m_NodeList[j]->m_ConnectTime < LowestTime) { ! DeadNode = m_NodeList[j]; ! LowestTime = CurrentTime - m_NodeList[j]->m_ConnectTime; } } --- 802,818 ---- // Drop Normal/Ultra nodes ! for (int i = 0; i < m_NodeList.size(); i++) if (SOCK_CONNECTED == m_NodeList[i]->m_Status) { ! if ((mode == 0 && m_NodeList[i]->m_HostMode == CLIENT_NORMAL) || \ ! ((mode == 1 && m_NodeList[i]->m_HostMode == CLIENT_ULTRAPEER && \ ! (m_NodeList[i]->m_RemoteAgent.Find("GnucDNA") == -1)) || \ ! (mode == 2 && m_NodeList[i]->m_HostMode == CLIENT_ULTRAPEER)) ! if ((LowestTime.GetTimeSpan() == 0) || \ ! (CurrentTime - m_NodeList[i]->m_ConnectTime < LowestTime)) { ! DeadNode = m_NodeList[i]; ! LowestTime = CurrentTime - m_NodeList[i]->m_ConnectTime; } } Index: GnuNode.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuNode.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** GnuNode.cpp 10 Jul 2003 22:41:07 -0000 1.19 --- GnuNode.cpp 23 Aug 2003 21:30:00 -0000 1.20 *************** *** 81,96 **** m_SecsDead = 0; ! m_IntervalPing = 0; m_NextReSearchWait = 0; // Connection vars ! m_HostIP = Host; ! m_HostName = Host; ! m_NetworkName = m_pCore->NetworkName; m_HostMode = CLIENT_NORMAL; ! m_Port = Port; ! m_Inbound = false; m_ConnectTime = CTime::GetCurrentTime(); --- 81,96 ---- m_SecsDead = 0; ! m_IntervalPing = 0; m_NextReSearchWait = 0; // Connection vars ! m_HostIP = Host; ! m_HostName = Host; ! m_NetworkName = m_pCore->NetworkName; m_HostMode = CLIENT_NORMAL; ! m_Port = Port; ! m_Inbound = false; m_ConnectTime = CTime::GetCurrentTime(); *************** *** 100,117 **** m_DeflateSend = false; m_DeflateStreamSize = 0; ! m_ZipStat = 0; InflateStream.zalloc = Z_NULL; InflateStream.zfree = Z_NULL; InflateStream.opaque = Z_NULL; ! DeflateStream.zalloc = Z_NULL; ! DeflateStream.zfree = Z_NULL; ! DeflateStream.opaque = Z_NULL; // Ultrapeers ! m_HostUptime = CTimeSpan(0,0,0,0); m_NodeFileCount = 0; ! m_NodeLeafMax = 0; m_DowngradeRequest = false; --- 100,119 ---- m_DeflateSend = false; m_DeflateStreamSize = 0; ! m_ZipStat = 0; InflateStream.zalloc = Z_NULL; InflateStream.zfree = Z_NULL; InflateStream.opaque = Z_NULL; + InflateStream.state = Z_NULL; ! DeflateStream.zalloc = Z_NULL; ! DeflateStream.zfree = Z_NULL; ! DeflateStream.opaque = Z_NULL; ! DeflateStream.state = Z_NULL; // Ultrapeers ! m_HostUptime = CTimeSpan(0,0,0,0); m_NodeFileCount = 0; ! m_NodeLeafMax = 0; m_DowngradeRequest = false; *************** *** 121,138 **** // QRP ! m_TableInfinity = 0; ! m_TableLength = 0; ! m_PatchTable = NULL; ! m_TableNextPos = 0; m_CompressedTable = NULL; m_CompressedSize = 0; ! m_CurrentSeq = 1; // Host Browsing ! m_BrowseID = 0; ! m_BrowseSize = 0; m_BrowseBuffer = NULL; m_BrowseBuffSize = 0; --- 123,140 ---- // QRP ! m_TableInfinity = 0; ! m_TableLength = 0; ! m_PatchTable = NULL; ! m_TableNextPos = 0; m_CompressedTable = NULL; m_CompressedSize = 0; ! m_CurrentSeq = 1; // Host Browsing ! m_BrowseID = 0; ! m_BrowseSize = 0; m_BrowseBuffer = NULL; m_BrowseBuffSize = 0; Index: GnuShare.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuShare.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** GnuShare.cpp 9 Jul 2003 06:37:44 -0000 1.12 --- GnuShare.cpp 23 Aug 2003 21:30:00 -0000 1.13 *************** *** 514,522 **** { TRACE0("*** Search Thread Started\n"); ! srand((unsigned)time(NULL)); CGnuShare* pShare = (CGnuShare*) pVoidShare; CGnuCore* pCore = pShare->m_pCore; ! CGnuControl* pComm = pCore->m_pComm;; CGnuWordHash* pWordHash = pShare->m_pWordTable; --- 514,522 ---- { TRACE0("*** Search Thread Started\n"); ! srand((unsigned) time(NULL)); CGnuShare* pShare = (CGnuShare*) pVoidShare; CGnuCore* pCore = pShare->m_pCore; ! CGnuControl* pComm = pCore->m_pComm; CGnuWordHash* pWordHash = pShare->m_pWordTable; *************** *** 538,547 **** // Search vars QueryComp SearchQuery; ! byte* QueryReplyNext = NULL; ! DWORD QueryReplyLength = 0; ! UINT TotalReplyCount = 0; byte ReplyCount = 0; bool QueryMatch = false; ! int MaxReplies = 0; CharString MetaTail; --- 538,547 ---- // Search vars QueryComp SearchQuery; ! byte* QueryReplyNext = NULL; ! DWORD QueryReplyLength = 0; ! UINT TotalReplyCount = 0; byte ReplyCount = 0; bool QueryMatch = false; ! int MaxReplies = 0; CharString MetaTail; |
From: <ri...@us...> - 2003-07-11 18:52:52
|
Update of /cvsroot/gnucula/Gnucula/platform/opengcc In directory sc8-pr-cvs1:/tmp/cvs-serv1393/platform/opengcc Modified Files: opentime.cpp opentime.h Log Message: Time function set changed to new class. Index: opentime.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/opentime.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** opentime.cpp 11 Jul 2003 02:46:06 -0000 1.1 --- opentime.cpp 11 Jul 2003 18:52:49 -0000 1.2 *************** *** 43,46 **** --- 43,50 ---- #include "../../Conversions.h" + #ifdef DEBUG // used for debugging. external to gnuc. + #include "../../../console_interface/console_io.h" + #endif + /* * Function: current_time_string(char *) *************** *** 60,113 **** * supplied by errno. */ ! ! Strings CurrentTimeString(char *TimeFormat) { ! // size_t string_length; ! Strings Current; struct timespec CurrentEpochTime; ! struct tm *FullCurrentTime; // set time_format commonly used types ! char format_indicator = TimeFormat[0]; ! if (format_indicator == '%') { // literal format ; } ! else if (format_indicator == 'f' || format_indicator == 'F') { ! TimeFormat = "%r% %D% %Z"; } else // format not recognized, resetting default { ! TimeFormat = "%r% %D"; } - - int clock_error_check = clock_gettime(CLOCK_REALTIME, &CurrentEpochTime); - // this uses errno, and may be unsafe with threading... - // bsd docs suggest this doesn't need to be reentrant safe - if (clock_error_check!=0) // something went wrong, return errno - { - Current = GetErrno(errno); - return Current; - } - char TempTimeArray[24]; ! ! FullCurrentTime = localtime(&(CurrentEpochTime.tv_sec)); ! strftime(&TempTimeArray[0], 24, TimeFormat, FullCurrentTime); ! Current = TempTimeArray; ! return Current; } ! ! Strings GetTZString(void) { ! Strings TZString = CurrentTimeString("%Z"); ! return TZString; ! } /*void start_timers(timer_t *second_time, timer_t *minute_time) { --- 64,162 ---- * supplied by errno. */ ! ! OpenTime::OpenTime(void) { ! ClockErrorCheck = -1; ! SetTime(GetTime()); ! } ! ! Strings OpenTime::GetTZString(void) ! { ! OpenTime tempTime; ! tempTime.SetTime(GetTime()); ! ! Strings TZString = tempTime.Stringify("%Z"); ! return TZString; ! } ! ! timespec OpenTime::GetTime(void) ! { ! #ifdef DEBUG // used for debugging. external to gnuc. ! Console_Output debug_io; ! debug_io.kwik_out("In get"); ! #endif struct timespec CurrentEpochTime; ! ClockErrorCheck = clock_gettime(CLOCK_REALTIME, &CurrentEpochTime); ! // this uses errno, and may be unsafe with threading... ! // bsd docs suggest this doesn't need to be reentrant safe ! return CurrentEpochTime; ! } + void OpenTime::SetTime(timespec CurrentEpochTime) + { + #ifdef DEBUG // used for debugging. external to gnuc. + Console_Output debug_io; + debug_io.kwik_out("In set"); + #endif + FullTime = localtime(&(CurrentEpochTime.tv_sec)); + return;// NewTime; + } + + Strings OpenTime::Stringify(char *Style) + { + // size_t string_length; + Strings ReturnMe; + if (ClockErrorCheck != 0) // something went wrong, return error + { + ReturnMe = "Clock Error: "; + + if (ClockErrorCheck == -1) + ReturnMe += "Clock not initialized"; + else + ReturnMe += GetErrno(ClockErrorCheck); + + return ReturnMe; + } + // set time_format commonly used types ! char StyleIndicator = Style[0]; ! if (StyleIndicator == '%') { // literal format ; } ! else if (StyleIndicator == 'f' || StyleIndicator == 'F') { ! Style = "%r% %D% %Z"; } else // format not recognized, resetting default { ! Style = "%Y-%m-%dT%H:%MZ"; } char TempTimeArray[24]; ! strftime(&TempTimeArray[0], 24, Style, FullTime); ! ReturnMe = TempTimeArray; ! return ReturnMe; } ! // doesn't need to be internal... ! Strings OpenTime::CurrentTimeString(char *TimeStyle) { ! OpenTime tempTime; ! Strings Current; + tempTime.SetTime(GetTime()); + if (ClockErrorCheck != 0) // something went wrong, return errno + { + Current = "Clock Error: "; + Current += GetErrno(ClockErrorCheck); + return Current; + } + + Current = tempTime.Stringify(TimeStyle); + return Current; + } /*void start_timers(timer_t *second_time, timer_t *minute_time) { Index: opentime.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/opentime.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** opentime.h 11 Jul 2003 02:46:06 -0000 1.1 --- opentime.h 11 Jul 2003 18:52:49 -0000 1.2 *************** *** 28,42 **** #define OPEN_TIME_H class Strings; ! // function prototypes ! Strings CurrentTimeString(char * = "%r% %D"); ! Strings GetTZString(void); // void start_timers( timer_t *, timer_t *); ! #endif // OPEN_TIME_H --- 28,57 ---- #define OPEN_TIME_H + #include <sys/types.h> + using namespace std; class Strings; + struct timespec; ! class OpenTime ! { ! private: ! int ClockErrorCheck; ! struct tm *FullTime; ! ! public: ! OpenTime(void); ! // function prototypes ! Strings CurrentTimeString(char * = "%Y-%m-%dT%H:%MZ"); ! Strings GetTZString(void); ! timespec GetTime(void); ! void SetTime(timespec); ! Strings Stringify(char * = "%Y-%m-%dT%H:%MZ"); // void start_timers( timer_t *, timer_t *); ! }; ! #endif // OPEN_TIME_H |
From: <ri...@us...> - 2003-07-11 18:52:52
|
Update of /cvsroot/gnucula/Gnucula In directory sc8-pr-cvs1:/tmp/cvs-serv1393 Modified Files: TimeMod.cpp Log Message: Time function set changed to new class. Index: TimeMod.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/TimeMod.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TimeMod.cpp 11 Jul 2003 02:44:56 -0000 1.5 --- TimeMod.cpp 11 Jul 2003 18:52:49 -0000 1.6 *************** *** 41,45 **** TZStr.Format("%c%2.2d:%2.2d", (_timezone < 0 ? '-' : '+'), TZHours, TZMins); #else ! TZStr = GetTZString(); #endif return TZStr; --- 41,46 ---- TZStr.Format("%c%2.2d:%2.2d", (_timezone < 0 ? '-' : '+'), TZHours, TZMins); #else ! OpenTime Temp; ! TZStr = Temp.GetTZString(); #endif return TZStr; *************** *** 49,53 **** CharString GetTimeString(char *Format) { ! return CurrentTimeString(Format); } --- 50,55 ---- CharString GetTimeString(char *Format) { ! OpenTime Temp; ! return Temp.CurrentTimeString(Format); } |
Update of /cvsroot/gnucula/Gnucula In directory sc8-pr-cvs1:/tmp/cvs-serv32388 Modified Files: Conversions.cpp Conversions.h GnuSchemaImage.cpp Packet.cpp Packet.h TimeMod.cpp TimeMod.h stdafx.h Log Message: adding time methods. strings integrated. image schema fix. Index: Conversions.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Conversions.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Conversions.cpp 10 Jul 2003 08:31:41 -0000 1.8 --- Conversions.cpp 11 Jul 2003 02:44:55 -0000 1.9 *************** *** 830,832 **** --- 830,1135 ---- return atol(convert_me); } + + + char *GetErrno(int Number) + { + + switch (Number) + { + case 0: + return "Undefined Error"; // 0. Not used. + case 1: + return "EPERM"; // Operation not permitted. An attempt was made to perform an oper- + // ation limited to processes with appropriate privileges or to the + // owner of a file or other resources. + case 2: + return "ENOENT"; // No such file or directory. A component of a specified pathname + // did not exist, or the pathname was an empty string. + case 3: + return "ESRCH"; // No such process. No process could be found corresponding to that + // specified by the given process ID. + case 4: + return "EINTR"; // Interrupted system call. An asynchronous signal (such as SIGINT + // or SIGQUIT) was caught by the process during the execution of an + // interruptible function. If the signal handler performs a normal + // return, the interrupted function call will seem to have returned + // the error condition. + case 5: + return "EIO"; // Input/output error. Some physical input or output error occurred. + // This error will not be reported until a subsequent operation on + // the same file descriptor and may be lost (over written) by any + // subsequent errors. + case 6: + return "ENXIO"; // Device not configured. Input or output on a special file + // referred to a device that did not exist, or made a request beyond + // the limits of the device. This error may also occur when, for + // example, a tape drive is not online or no disk pack is loaded on + // a drive. + case 7: + return "E2BIG"; // Argument list too long. The number of bytes used for the argu- + // and environment list of the new process exceeded the current + // linit of 65536 bytes (NCARGS in <sys/param.h>). + case 8: + return "ENOEXEC"; // Exec format error. A request was made to execute a file that, + // although it has the appropriate permissions, was not in the for- + // mat required for an executable file. + case 9: + return "EBADF"; // Bad file descriptor. A file descriptor argument was out of + // range, referred to no open file, or a read (write) request was + // made to a file that was only open for writing (reading). + case 10: + return "ECHILD"; // No child processes. A wait(2) or waitpid(2) function was exe- + // cuted by a process that had no existing or unwaited-for child + // processes. + case 11: + return "EDEADLK"; // Resource deadlock avoided. An attempt was made to lock a sys- + // tem resource that would have resulted in a deadlock situation. + case 12: + return "ENOMEM"; // Cannot allocate memory. The new process image required more + // memory than was allowed by the hardware or by system-imposed mem- + // ory management constraints. A lack of swap space is normally + // temporary; however, a lack of core is not. Soft limits may be + // increased to their corresponding hard limits. + case 13: + return "EACCES"; // Permission denied. An attempt was made to access a file in a + // way forbidden by its file access permissions. + + case 14: + return "EFAULT"; // Bad address. The system detected an invalid address in + // attempting to use an argument of a call. + case 15: + return "ENOTBLK"; // Block device required. A block device operation was attempted + // on a non-block device or file. + case 16: + return "EBUSY"; // Device busy. An attempt to use a system resource which was in + // use at the time in a manner which would have conflicted with the request. + case 17: + return "EEXIST"; // File exists. An existing file was mentioned in an inappropri- + // ate context, for instance, as the new link name in a link(2) function. + case 18: + return "EXDEV"; // Cross-device link. A hard link to a file on another file system + // was attempted. + case 19: + return "ENODEV"; // Operation not supported by device. An attempt was made to + // apply an inappropriate function to a device, for example, trying + // to read a write-only device such as a printer. + case 20: + return "ENOTDIR"; // Not a directory. A component of the specified pathname + // existed, but it was not a directory, when a directory was expected. + case 21: + return "EISDIR"; // Is a directory. An attempt was made to open a directory with + // write mode specified. + case 22: + return "EINVAL"; // Invalid argument. Some invalid argument was supplied. (For example, + // specifying an undefined signal to a signal(3) or kill(2) function). + case 23: + return "ENFILE"; // Too many open files in system. Maximum number of file descrip- + // tors allowable on the system has been reached and a requests for + // an open cannot be satisfied until at least one has been closed. + case 24: + return "EMFILE"; // Too many open files. <As released, the limit on the number of + // open files per process is 64.> The getdtablesize(2) function will + // obtain the current limit. + case 25: + return "ENOTTY"; // Inappropriate ioctl for device. A control function (see + // ioctl(2)) was attempted for a file or special device for which + // the operation was inappropriate. + case 26: + return "ETXTBSY"; // Text file busy. The new process was a pure procedure (shared + // text) file which was open for writing by another process, or + // while the pure procedure file was being executed an open(2) call + // requested write access. + case 27: + return "EFBIG"; // File too large. The size of a file exceeded the maximum. + case 28: + return "ENOSPC"; // No space left on device. + case 29: + return "ESPIPE"; // Illegal seek. An lseek(2) function was issued on a socket, pipe or FIFO. + case 30: + return "EROFS"; // Read-only file system. An attempt was made to modify a file or + // directory on a file system that was read-only at the time. + case 31: + return "EMLINK"; // Too many links. Maximum allowable hard links to a single file + // has been exceeded (limit of 32767 hard links per file). + case 32: + return "EPIPE"; // Broken pipe. A write on a pipe, socket or FIFO for which there + // is no process to read the data. + case 33: + return "EDOM"; // Numerical argument out of domain. A numerical input argument was + // outside the defined domain of the mathematical function. + case 34: + return "ERANGE"; // Result too large. A numerical result of the function was too + // large to fit in the available space (perhaps exceeded precision). + case 35: + return "EAGAIN"; // Resource temporarily unavailable. This is a temporary condi- + // tion and later calls to the same routine may complete normally. + case 36: + return "EINPROGRESS"; // Operation now in progress. An operation that takes a long + // time to complete (such as a connect(2)) was attempted on a non- + // blocking object (see fcntl(2)). + case 37: + return "EALREADY"; // Operation already in progress. An operation was attempted on + // a non-blocking object that already had an operation in progress. + case 38: + return "ENOTSOCK"; // Socket operation on non-socket. Self-explanatory. + case 39: + return "EDESTADDRREQ"; // Destination address required. A required address was + // omitted from an operation on a socket. + case 40: + return "EMSGSIZE"; // Message too long. A message sent on a socket was larger than + // the internal message buffer or some other network limit. + case 41: + return "EPROTOTYPE"; // Protocol wrong type for socket. A protocol was specified that does + // not support the semantics of the socket type requested. For example, + // you cannot use the ARPA Internet UDP protocol with type SOCK_STREAM. + case 42: + return "ENOPROTOOPT"; // Protocol not available. A bad option or level was speci- + // fied in a getsockopt(2) or setsockopt(2) call. + case 43: + return "EPROTONOSUPPORT"; // Protocol not supported. The protocol has not been + // configured into the system or no implementation for it exists. + case 44: + return "ESOCKTNOSUPPORT"; // Socket type not supported. The support for the socket type has + // not been configured into the system or no implementation for it exists. + case 45: + return "EOPNOTSUPP"; // Operation not supported. The attempted operation is not supported + // for the type of object referenced. Usually this occurs when a file + // descriptor refers to a file or socket that cannot support this + // operation, for example, trying to accept a connection on a datagram socket. + case 46: + return "EPFNOSUPPORT"; // Protocol family not supported. The protocol family has not been + // configured into the system or no implementation for it exists. + case 47: + return "EAFNOSUPPORT"; // Address family not supported by protocol family. An + // address incompatible with the requested protocol was used. For + // example, you shouldn't necessarily expect to be able to use NS + // addresses with ARPA Internet protocols. + case 48: + return "EADDRINUSE"; // Address already in use. Only one usage of each address is + // normally permitted. + case 49: + return "EADDRNOTAVAIL"; // Cannot assign requested address. Normally results from an attempt + // to create a socket with an address not on this machine. + case 50: + return "ENETDOWN"; // Network is down. A socket operation encountered a dead network. + case 51: + return "ENETUNREACH"; // Network is unreachable. A socket operation was attempted + // to an unreachable network. + case 52: + return "ENETRESET"; // Network dropped connection on reset. The host you were con- + // nected to crashed and rebooted. + case 53: + return "ECONNABORTED"; // Software caused connection abort. A connection abort was + // caused internal to your host machine. + case 54: + return "ECONNRESET"; // Connection reset by peer. A connection was forcibly closed + // by a peer. This normally results from a loss of the connection + // on the remote socket due to a timeout or a reboot. + case 55: + return "ENOBUFS"; // No buffer space available. An operation on a socket or pipe + // was not performed because the system lacked sufficient buffer + // space or because a queue was full. + case 56: + return "EISCONN"; // Socket is already connected. A connect(2) request was made on + // an already connected socket; or, a sendto(2) or sendmsg(2) + // request on a connected socket specified a destination when + // already connected. + case 57: + return "ENOTCONN"; // Socket is not connected. An request to send or receive data + // was disallowed because the socket was not connected and (when + // sending on a datagram socket) no address was supplied. + case 58: + return "ESHUTDOWN"; // Cannot send after socket shutdown. A request to send data + // was disallowed because the socket had already been shut down with + // a previous shutdown(2) call. + case 60: + return "ETIMEDOUT"; // Operation timed out. A connect(2) or send(2) request failed + // because the connected party did not properly respond after a + // period of time. (The timeout period is dependent on the communi- + // cation protocol.) + case 61: + return "ECONNREFUSED"; // Connection refused. No connection could be made because the + // target machine actively refused it. This usually results from + // trying to connect to a service that is inactive on the foreign host. + case 62: + return "ELOOP"; // Too many levels of symbolic links. A path name lookup involved + // more than 32 (MAXSYMLINKS) symbolic links. + case 63: + return "ENAMETOOLONG"; // File name too long. A component of a path name exceeded + // 255 (MAXNAMELEN) characters, or an entire path name exceeded 1023 + // (MAXPATHLEN-1) characters. + case 64: + return "EHOSTDOWN"; // Host is down. A socket operation failed because the desti- + // nation host was down. + case 65: + return "EHOSTUNREACH"; // No route to host. A socket operation was attempted to an + // unreachable host. + case 66: + return "ENOTEMPTY"; // Directory not empty. A directory with entries other than + // `.' and `..' was supplied to a remove directory or rename call. + case 67: + return "EPROCLIM"; // Too many processes. + case 68: + return "EUSERS"; // Too many users. The quota system ran out of table entries. + case 69: + return "EDQUOT"; // Disc quota exceeded. A write(2) to an ordinary file, the creation of + // a directory or symbolic link, or the creation of a + // directory entry failed because the user's quota of disk blocks + // was exhausted, or the allocation of an inode for a newly created + // file failed because the user's quota of inodes was exhausted. + case 70: + return "ESTALE"; // Stale NFS file handle. An attempt was made to access an open file (on + // an NFS filesystem) which is now unavailable as referenced by the file + // descriptor. This may indicate the file was deleted on the NFS server + // or some other catastrophic event occurred. + case 72: + return "EBADRPC"; // RPC struct is bad. Exchange of RPC information was unsuccessful. + case 73: + return "ERPCMISMATCH"; // RPC version wrong. The version of RPC on the remote peer + // is not compatible with the local version. + case 74: + return "EPROGUNAVAIL"; // RPC prog. not avail. The requested program is not regis- + // tered on the remote host. + case 75: + return "EPROGMISMATCH"; // Program version wrong. The requested version of the + // program is not available on the remote host (RPC). + case 76: + return "EPROCUNAVAIL"; // Bad procedure for program. An RPC call was attempted for + // a procedure which doesn't exist in the remote program. + case 77: + return "ENOLCK"; // No locks available. A system-imposed limit on the number of + // simultaneous file locks was reached. + case 78: + return "ENOSYS"; // Function not implemented. Attempted a system call that is not + // available on this system. + case 79: + return "EFTYPE"; // Inappropriate file type or format. The file was the wrong type + // for the operation, or a data file had the wrong format. + case 80: + return "EAUTH"; // Authentication error. Attempted to use an invalid authentica- + // tion ticket to mount a NFS filesystem. + case 81: + return "ENEEDAUTH"; // Need authenticator. An authentication ticket must be + // obtained before the given NFS filesystem may be mounted. + case 82: + return "EIDRM"; // Identifier removed. An IPC identifier was removed while the + // current process was waiting on it. + case 83: + return "ENOMSG"; // No message of desired type. An IPC message queue does not contain a + // message of the desired type, or a message catalog does not contain the + // requested message. + case 84: + return "EOVERFLOW"; // Value too large to be stored in data type. A numerical + // result of the function was too large to be stored in the caller + // provided space. + case 85: + return "ECANCELED"; // Operation canceled. The scheduled operation was canceled. + case 86: + return "EILSEQ"; // Illegal byte sequence. While decoding a multibyte character + // the function came along an invalid or an incomplete sequence of + // bytes or the given wide character is invalid. + } + return "Unknown Errno Condition"; + } + #endif Index: Conversions.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Conversions.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Conversions.h 10 Jul 2003 08:31:41 -0000 1.10 --- Conversions.h 11 Jul 2003 02:44:55 -0000 1.11 *************** *** 90,93 **** --- 90,94 ---- int atoi(CharString); int atol(CharString); + char *GetErrno(int); #endif Index: GnuSchemaImage.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuSchemaImage.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GnuSchemaImage.cpp 6 Jul 2003 20:35:33 -0000 1.6 --- GnuSchemaImage.cpp 11 Jul 2003 02:44:55 -0000 1.7 *************** *** 47,53 **** Attribute* imgattr = image_file_analyze(File.Dir.c_str()); ! ! LoadFileAttribute(&File, "width", imgattr[0].value); ! LoadFileAttribute(&File, "height", imgattr[1].value); ! LoadFileAttribute(&File, "colors", imgattr[2].value); } --- 47,55 ---- Attribute* imgattr = image_file_analyze(File.Dir.c_str()); ! if (imgattr) ! { ! LoadFileAttribute(&File, "width", imgattr[0].value); ! LoadFileAttribute(&File, "height", imgattr[1].value); ! LoadFileAttribute(&File, "colors", imgattr[2].value); ! } } Index: Packet.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Packet.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Packet.cpp 28 May 2003 05:18:09 -0000 1.4 --- Packet.cpp 11 Jul 2003 02:44:56 -0000 1.5 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 28,42 **** #include "Packet.h" // Get rid of ugly warnings #pragma warning (disable : 4786) ! ! Node::Node(CString HostPort) { *this = HostPort; } ! Node::Node(CString nHost, UINT nPort) { Host = nHost; --- 28,43 ---- #include "Packet.h" + #ifndef OPENGCC // Get rid of ugly warnings #pragma warning (disable : 4786) + #endif ! Node::Node(CharString HostPort) { *this = HostPort; } ! Node::Node(CharString nHost, UINT nPort) { Host = nHost; *************** *** 46,50 **** // Allow Node = "host:port" assignment ! Node& Node::operator=(CString &rhs) { int pos = rhs.Find(":") + 1; --- 47,51 ---- // Allow Node = "host:port" assignment ! Node& Node::operator=(CharString &rhs) { int pos = rhs.Find(":") + 1; *************** *** 65,69 **** } ! CString Node::GetString() { return (Host + ":" + DWrdtoStr(Port)); --- 66,70 ---- } ! CharString Node::GetString() { return (Host + ":" + DWrdtoStr(Port)); Index: Packet.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Packet.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Packet.h 6 Jul 2003 20:35:33 -0000 1.7 --- Packet.h 11 Jul 2003 02:44:56 -0000 1.8 *************** *** 24,35 **** ********************************************************************************/ #ifndef OPENGCC #pragma once #endif - #ifndef PACKET_H - #define PACKET_H - #ifndef OPENGCC #pragma pack (push, 1) --- 24,37 ---- ********************************************************************************/ + #ifndef PACKET_H + #define PACKET_H #ifndef OPENGCC #pragma once + typedef CString CharString; + #else + #include "./platform/opengcc/typedefs.h" #endif #ifndef OPENGCC #pragma pack (push, 1) *************** *** 106,110 **** struct Node { ! CString Host; UINT Port; CTime Time; --- 108,112 ---- struct Node { ! CharString Host; UINT Port; CTime Time; *************** *** 114,125 **** // Create a node based on a standard "Host:port" string ! Node(CString HostPort); ! Node(CString nHost, UINT nPort); void Clear() { Host = ""; Port = 0; }; // Allow Node = "host:port" assignment ! Node& operator=(CString &rhs); ! CString GetString(); bool operator == (Node& first) { --- 116,127 ---- // Create a node based on a standard "Host:port" string ! Node(CharString HostPort); ! Node(CharString nHost, UINT nPort); void Clear() { Host = ""; Port = 0; }; // Allow Node = "host:port" assignment ! Node& operator=(CharString &rhs); ! CharString GetString(); bool operator == (Node& first) { *************** *** 132,143 **** struct LanNode /* : public Node */ { ! CString Host; UINT Port; UINT Leaves; ! CString Name; ! CString IRCserver; ! //CString UpdateServer; ! CString InfoPage; }; --- 134,145 ---- struct LanNode /* : public Node */ { ! CharString Host; UINT Port; UINT Leaves; ! CharString Name; ! CharString IRCserver; ! //CharString UpdateServer; ! CharString InfoPage; }; *************** *** 163,167 **** IP EndIP; ! CString Reason; }; --- 165,169 ---- IP EndIP; ! CharString Reason; }; Index: TimeMod.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/TimeMod.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TimeMod.cpp 28 May 2003 05:18:09 -0000 1.4 --- TimeMod.cpp 11 Jul 2003 02:44:56 -0000 1.5 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 28,43 **** #include "TimeMod.h" ! CString GetTimeZoneStr(void) ! { ! CString TZStr; int TZHours = abs(_timezone) / (60 * 60); int TZMins = ((abs(_timezone) / 60) - (TZHours * 60)); TZStr.Format("%c%2.2d:%2.2d", (_timezone < 0 ? '-' : '+'), TZHours, TZMins); ! return TZStr; } CTimeSpan LocalTimeZone() { --- 28,58 ---- #include "TimeMod.h" ! #ifdef OPENGCC ! #include "platform/opengcc/opentime.h" ! #endif + CharString GetTimeZoneStr() + { + CharString TZStr; + #ifndef OPENGCC int TZHours = abs(_timezone) / (60 * 60); int TZMins = ((abs(_timezone) / 60) - (TZHours * 60)); TZStr.Format("%c%2.2d:%2.2d", (_timezone < 0 ? '-' : '+'), TZHours, TZMins); ! #else ! TZStr = GetTZString(); ! #endif return TZStr; } + + CharString GetTimeString(char *Format) + { + return CurrentTimeString(Format); + } + + #ifdef OPENGCC // test functions here... + + #else// still in gnuc. code CTimeSpan LocalTimeZone() { *************** *** 46,48 **** return CTimeSpan(0, TZHours, TZMins, 0); ! } \ No newline at end of file --- 61,64 ---- return CTimeSpan(0, TZHours, TZMins, 0); ! } ! #endif Index: TimeMod.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/TimeMod.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TimeMod.h 28 May 2003 05:18:09 -0000 1.5 --- TimeMod.h 11 Jul 2003 02:44:56 -0000 1.6 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 24,41 **** ********************************************************************************/ #ifndef OPENGCC #pragma once #endif - #ifndef TIMEMOD_H - #define TIMEMOD_H // Functions ! CTimeSpan LocalTimeZone(); ! CString GetTimeZoneStr(); #endif // TIMEMOD_H --- 24,52 ---- ********************************************************************************/ + #ifndef TIMEMOD_H + #define TIMEMOD_H + #ifndef OPENGCC #pragma once + typedef CString CharString; + #else + #include "platform/opengcc/typedefs.h" #endif // Functions ! CharString GetTimeZoneStr(); ! CharString GetTimeString(char * = "%Y-%m-%dT%H:%MZ"); ! #ifdef OPENGCC ! // put extensible time functions here, eliminate CTime types from main code ! //void AdjustTime(&TimeObject); ! //TimeObject CurrentTime(void); <- maybe unneeded + #else + CTimeSpan LocalTimeZone(); + #endif #endif // TIMEMOD_H Index: stdafx.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/stdafx.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** stdafx.h 10 Jul 2003 08:31:41 -0000 1.15 --- stdafx.h 11 Jul 2003 02:44:56 -0000 1.16 *************** *** 93,98 **** #include "platform/opengcc/strings.h" #include "platform/opengcc/w_strings.h" #include "zlib/zlib.h" ! #endif // end OPENGCC #include <memory> --- 93,99 ---- #include "platform/opengcc/strings.h" #include "platform/opengcc/w_strings.h" + #include "platform/opengcc/opentime.h" #include "zlib/zlib.h" ! #endif // end OPENGCC specific #include <memory> *************** *** 105,113 **** ! // Debugging (screws up 'new' keyword; disabled.) // #define new DEBUG_NEW // Master Version ! #define ACTUAL_GNUCULA_VERSION "0.1.0.7" #define GNUCDNA_VERSION "0.9.2.7" /* use the first for ultrapeer/leaf upgrading/downgrading, use the second for about screens and such. */ --- 106,114 ---- ! // Debugging (screws up 'new' keyword in gcc; disabled.) // #define new DEBUG_NEW // Master Version ! #define ACTUAL_GNUCULA_VERSION "0.1.0.8" #define GNUCDNA_VERSION "0.9.2.7" /* use the first for ultrapeer/leaf upgrading/downgrading, use the second for about screens and such. */ |
From: <ri...@us...> - 2003-07-11 02:48:12
|
Update of /cvsroot/gnucula/Gnucula/platform/opengcc In directory sc8-pr-cvs1:/tmp/cvs-serv32636/platform/opengcc Added Files: opentime.cpp opentime.h Log Message: initial time files. --- NEW FILE: opentime.cpp --- /******************************************************************************** Gnucula - A Gnutella Library Based on GnucDNA Copyright (C) 2000-2003 John Marshall GCC extended code - Clayton Rollins (also LGPL) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For support, questions, comments, etc... Forum: http://gnucula.sourceforge.net/forum/index.php ********************************************************************************/ #ifdef LINUX #include <sys/time.h> // #include <isc/eventlib.h> ? #endif // #include <string> #include <errno.h> #include <signal.h> // #include <unistd.h> #include <sys/types.h> using namespace std; #include "opentime.h" #include "strings.h" #include "../../Conversions.h" /* * Function: current_time_string(char *) * * Description: Gets and returns the system time on a few systems. * * Arguments: * char *time_format = "%r% %D": a date format string of standard type, see * the strftime man page for an explanation of formatting options.a default * is set to "%r% %D". A few commonly used formats are handled internally; * they may be designated by a string such as "full," though only the first * character is used. * * Returns: a formatted string with the current date/time * * Default: returns current system time, or a string explaining the failure, as * supplied by errno. */ Strings CurrentTimeString(char *TimeFormat) { // size_t string_length; Strings Current; struct timespec CurrentEpochTime; struct tm *FullCurrentTime; // set time_format commonly used types char format_indicator = TimeFormat[0]; if (format_indicator == '%') { // literal format ; } else if (format_indicator == 'f' || format_indicator == 'F') { TimeFormat = "%r% %D% %Z"; } else // format not recognized, resetting default { TimeFormat = "%r% %D"; } int clock_error_check = clock_gettime(CLOCK_REALTIME, &CurrentEpochTime); // this uses errno, and may be unsafe with threading... // bsd docs suggest this doesn't need to be reentrant safe if (clock_error_check!=0) // something went wrong, return errno { Current = GetErrno(errno); return Current; } char TempTimeArray[24]; FullCurrentTime = localtime(&(CurrentEpochTime.tv_sec)); strftime(&TempTimeArray[0], 24, TimeFormat, FullCurrentTime); Current = TempTimeArray; return Current; } Strings GetTZString(void) { Strings TZString = CurrentTimeString("%Z"); return TZString; } /*void start_timers(timer_t *second_time, timer_t *minute_time) { // open implementation??? e.g. Linux, Solaris. doesn't work for BSD int timer_create_error = 0; struct sigevent blank; timer_create_error = timer_create( CLOCK_REALTIME, blank, second_time); if (timer_create_error != 0) {return;} timer_create_error = timer_create( CLOCK_REALTIME, &blank, minute_time); if (timer_create_error != 0) {return;} }*/ --- NEW FILE: opentime.h --- /******************************************************************************** Gnucula - A Gnutella Library Based on GnucDNA Copyright (C) 2000-2003 John Marshall GCC extended code - Clayton Rollins (also LGPL) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For support, questions, comments, etc... Forum: http://gnucula.sourceforge.net/forum/index.php ********************************************************************************/ #ifndef OPEN_TIME_H #define OPEN_TIME_H class Strings; // function prototypes Strings CurrentTimeString(char * = "%r% %D"); Strings GetTZString(void); // void start_timers( timer_t *, timer_t *); #endif // OPEN_TIME_H |
From: <ri...@us...> - 2003-07-10 22:41:11
|
Update of /cvsroot/gnucula/Gnucula/platform/opengcc In directory sc8-pr-cvs1:/tmp/cvs-serv320/platform/opengcc Modified Files: strings.cpp strings.h Log Message: Syntax fixes, string enhancements, DNA code reintegrated. Index: strings.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/strings.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** strings.cpp 10 Jul 2003 08:31:41 -0000 1.6 --- strings.cpp 10 Jul 2003 22:41:07 -0000 1.7 *************** *** 243,247 **** int Strings::ReverseFind(char FindMe) { - bool Mismatch = false; for (int i = StringLength - 1; *(TextPointer + i) != '\0'; i--) if (*(TextPointer + i) == FindMe) --- 243,246 ---- *************** *** 288,291 **** --- 287,291 ---- } ret = ReturnText; + ret.StringLength = i; return ret; } *************** *** 336,341 **** ! void Strings::Replace(char *ReplaceMe, char *NewText) { int ReplacePos = 0, NewTextLen = 0, OldTextLen = 0, Occurrences = 0, i; #ifdef DDEBUG --- 336,342 ---- ! void Strings::Replace(char *ReplaceMe, char *NewText, int pos) { + bool SingleDone = false, SingleReplace = false; int ReplacePos = 0, NewTextLen = 0, OldTextLen = 0, Occurrences = 0, i; #ifdef DDEBUG *************** *** 357,375 **** debug_io.kwik_out(OldTextLen); #endif ! // count occurrences ! i = 0; ! while (i >= 0) { ! Occurrences++; ! i = Find(ReplaceMe, i + 1); ! #ifdef DDEBUG ! debug_io.multiline_output("Occurrences:", " "); ! debug_io.kwik_out(Occurrences); ! debug_io.multiline_output("i:", " "); ! debug_io.kwik_out(i); ! #endif } - Occurrences--; #ifdef DDEBUG debug_io.multiline_output("Occurrences:", " "); --- 358,385 ---- debug_io.kwik_out(OldTextLen); #endif ! ! if (pos != 0) { ! SingleReplace = true; ! if (pos <= -1) ! pos = 0; ! if (Find(ReplaceMe, pos) >= pos) ! Occurrences = 1; ! } ! else ! { ! // count occurrences ! i = 0; ! while (i >= 0) ! { ! Occurrences++; ! i = Find(ReplaceMe, i + 1); ! } ! Occurrences--; } + if (Occurrences == 0) + return; + #ifdef DDEBUG debug_io.multiline_output("Occurrences:", " "); *************** *** 377,383 **** #endif - if (Occurrences == 0) - return; - int OrigLen = StringLength; StringLength = StringLength + ((NewTextLen - OldTextLen) * Occurrences) + 1; --- 387,390 ---- *************** *** 394,397 **** --- 401,415 ---- while (ReplacePos >= 0) { + if (SingleReplace) + { + if (!SingleDone) + { + ReplacePos = Find(ReplaceMe, pos); + SingleDone = true; + } + else + ReplacePos = -1; + } + ReplacePos = Find(ReplaceMe, lastread + 1); #ifdef DDEBUG *************** *** 429,435 **** ! void Strings::Remove(char *RemoveMe) { ! Replace(RemoveMe, ""); } --- 447,509 ---- ! void Strings::Remove(char *RemoveMe, int pos) { ! Replace(RemoveMe, "", pos); ! } ! ! ! void Strings::TrimLeft(char *TrimMe) ! { ! int i, Len; ! for (i = 0; *(TrimMe + i) != '\0'; i++) { ! ; } ! Len = i; ! ! for (i = 0; ; i = 0) ! if (*(TextPointer + i) == *TrimMe) ! { ! if (Len > 1) ! { ! for (int j = 0; *(TrimMe + j) != '\0'; j++) ! if (*(TextPointer + i + j) != *(TrimMe + j)) ! return; ! } ! ! char *NewText = new char[StringLength - Len]; ! for (i = 0; (Len + i) <= StringLength; i++) ! { ! *(NewText + i) = *(TextPointer + Len + i); ! if (*(TextPointer + Len + i) == '\0') ! break; ! } ! StringLength -= Len; ! } ! else ! return; ! } ! ! ! void Strings::TrimRight(char *TrimMe) ! { ! int i, Len; ! for (i = 0; *(TrimMe + i) != '\0'; i++) { ! ; } ! Len = i; ! ! for (i = StringLength - Len; ; i = StringLength - Len) ! if (*(TextPointer + i) == *TrimMe) ! { ! if (Len > 1) ! { ! for (int j = 0; *(TrimMe + j) != '\0'; j++) ! if (*(TextPointer + i + j) != *(TrimMe + j)) ! return; ! } ! ! *(TextPointer + i) = '\0'; ! StringLength -= Len; ! } ! else ! return; } Index: strings.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/strings.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** strings.h 10 Jul 2003 08:31:41 -0000 1.9 --- strings.h 10 Jul 2003 22:41:07 -0000 1.10 *************** *** 67,73 **** Strings Right(int); void Insert(int, char *); ! void Replace(char *, char *); ! void Remove(char *); // Strings Format(char *, int, int); // operator overloads --- 67,76 ---- Strings Right(int); void Insert(int, char *); ! void Replace(char *, char *, int = -1); // -, once near start. 0, all. +, once near int ! void Remove(char *, int = -1); // Strings Format(char *, int, int); + void TrimLeft(char * = "\n"); // proper default is?? + void TrimRight(char * = "\n"); + // operator overloads |
Update of /cvsroot/gnucula/Gnucula In directory sc8-pr-cvs1:/tmp/cvs-serv320 Modified Files: GnuNode.cpp GnuNode.h GnuSchemaVideo.cpp GnuUploadQueue.cpp GnuUploadQueue.h GnuUploadShell.h Headers.cpp Headers.h Log Message: Syntax fixes, string enhancements, DNA code reintegrated. Index: GnuNode.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuNode.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** GnuNode.cpp 8 Jul 2003 07:43:50 -0000 1.18 --- GnuNode.cpp 10 Jul 2003 22:41:07 -0000 1.19 *************** *** 106,125 **** InflateStream.opaque = Z_NULL; - if (inflateInit(&InflateStream) != Z_OK) - m_CompressionOn = false; - - InflateStream.avail_in = 0; - InflateStream.next_out = m_pBuff; - InflateStream.avail_out = PACKET_BUFF; - DeflateStream.zalloc = Z_NULL; DeflateStream.zfree = Z_NULL; DeflateStream.opaque = Z_NULL; - if (deflateInit(&DeflateStream, Z_DEFAULT_COMPRESSION) != Z_OK) - m_CompressionOn = false; - - DeflateStream.avail_in = 0; - DeflateStream.next_out = DeflateBuff; - DeflateStream.avail_out = ZSTREAM_BUFF; // Ultrapeers --- 106,112 ---- *************** *** 446,450 **** if (lastError != WSAEWOULDBLOCK) { ! CloseWithReason("Receive Error " + DWrdtoStr(nErrorCode)); return; } --- 433,437 ---- if (lastError != WSAEWOULDBLOCK) { ! CloseWithReason("Receive Error " + DWrdtoStr(lastError)); return; } *************** *** 1590,1593 **** --- 1577,1608 ---- m_StatusText = "Connected"; m_pComm->NodeUpdate(this); + + // Setup inflate if remote host supports it + if (m_InflateRecv) + { + if (inflateInit(&InflateStream) != Z_OK) + { + CloseWithReason("InflateInit Failed"); + return; + } + + InflateStream.avail_in = 0; + InflateStream.next_out = m_pBuff; + InflateStream.avail_out = PACKET_BUFF; + } + + //Setup deflate if remote host supports it + if (m_DeflateSend) + { + if (deflateInit(&DeflateStream, Z_DEFAULT_COMPRESSION) != Z_OK) + { + CloseWithReason("DeflateInit Failed"); + return; + } + + DeflateStream.avail_in = 0; + DeflateStream.next_out = DeflateBuff; + DeflateStream.avail_out = ZSTREAM_BUFF; + } // We are a leaf send index to supernode *************** *** 1634,1638 **** m_PacketList[distance].pop_back(); - ASSERT(m_PacketListLength[distance] >= 0); } --- 1649,1652 ---- *************** *** 1715,1719 **** if (lastError != WSAEWOULDBLOCK) { ! CloseWithReason("Back Buffer Error " + DWrdtoStr(lastError)); // needs http code?? return; } --- 1729,1733 ---- if (lastError != WSAEWOULDBLOCK) { ! CloseWithReason("Back Buffer Error " + DWrdtoStr(lastError), true); // needs http code?? return; } *************** *** 1797,1801 **** if (GetLastError() != WSAEWOULDBLOCK) { ! CloseWithReason("Send Error " + DWrdtoStr(lastError)); return; } --- 1811,1815 ---- if (GetLastError() != WSAEWOULDBLOCK) { ! CloseWithReason("Send Error " + DWrdtoStr(lastError), true); return; } *************** *** 1930,1934 **** void CGnuNode::CloseWithReason(CharString Reason, bool RemoteClosed) { ! if (m_Status == SOCK_CONNECTED) { Send_Bye(Reason); --- 1944,1948 ---- void CGnuNode::CloseWithReason(CharString Reason, bool RemoteClosed) { ! if (m_Status == SOCK_CONNECTED && !RemoteClosed) { Send_Bye(Reason); *************** *** 3012,3015 **** --- 3026,3033 ---- strcpy((char*) &PacketData[23], (LPCSTR) Reason); + + byte test[255]; + memcpy(test, PacketData, PacketSize); + PacketData[PacketSize - 1] = NULL; *************** *** 3328,3332 **** if (m_IntervalPing == 45) { ! AvoidTriangles(); Send_Ping(2); m_IntervalPing = 0; --- 3346,3350 ---- if (m_IntervalPing == 45) { ! AvoidTriangles(); // was turned off in DNA to reduce dropped connections Send_Ping(2); m_IntervalPing = 0; Index: GnuNode.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuNode.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** GnuNode.h 9 Jul 2003 05:50:08 -0000 1.17 --- GnuNode.h 10 Jul 2003 22:41:07 -0000 1.18 *************** *** 34,40 **** #endif - #define PACKET_BUFF 32768 ! #define ZSTREAM_BUFF 163384 #define PACKETCACHE_SIZE 1000 --- 34,39 ---- #endif #define PACKET_BUFF 32768 ! #define ZSTREAM_BUFF 16384 #define PACKETCACHE_SIZE 1000 *************** *** 43,46 **** --- 42,57 ---- #define NODE_MAX_LEAVES 1000 + + // Actual mem 720k + + //byte InflateBuff[ZSTREAM_BUFF]; // 16k + //byte DeflateBuff[ZSTREAM_BUFF]; // 16k + //byte m_pBuff[PACKET_BUFF]; // 32k + //byte m_BackBuff[PACKET_BUFF]; // 32k + // inflateInit // 56k + // deflateInit // 272k + + // Total 420k + enum status { status_DONE, \ Index: GnuSchemaVideo.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuSchemaVideo.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GnuSchemaVideo.cpp 6 Jul 2003 20:35:33 -0000 1.6 --- GnuSchemaVideo.cpp 10 Jul 2003 22:41:07 -0000 1.7 *************** *** 48,53 **** Attribute *videoatt = video_file_analyze(File.Dir.c_str()); ! LoadFileAttribute(&File, "width", videoatt[1].value); ! LoadFileAttribute(&File, "height", videoatt[2].value); ! LoadFileAttribute(&File, "minutes", videoatt[4].value); } --- 48,56 ---- Attribute *videoatt = video_file_analyze(File.Dir.c_str()); ! if (videoatt) ! { ! LoadFileAttribute(&File, "width", videoatt[1].value); ! LoadFileAttribute(&File, "height", videoatt[2].value); ! LoadFileAttribute(&File, "minutes", videoatt[4].value); ! } } Index: GnuUploadQueue.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuUploadQueue.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GnuUploadQueue.cpp 10 Jul 2003 08:31:41 -0000 1.8 --- GnuUploadQueue.cpp 10 Jul 2003 22:41:07 -0000 1.9 *************** *** 78,81 **** --- 78,82 ---- { std::list<UploadQueueItem>::iterator itItem; + CharString Traceline; // See if upload already in pass list *************** *** 90,95 **** if (m_PassList.size() < m_pPrefs->m_MaxUploads) { ! m_PassList.push_back( UploadQueueItem(p) ); ! TRACE0("Q> Pass Added: " + IPtoStr(p->m_Host) + p->m_RequestURI + "\n"); return true; } --- 91,98 ---- if (m_PassList.size() < m_pPrefs->m_MaxUploads) { ! m_PassList.push_back(UploadQueueItem(p)); ! Traceline = "Q> Pass Added: "; ! Traceline += IPtoStr(p->m_Host) + p->m_RequestURI + "\n"; ! TRACE0(Traceline); return true; } *************** *** 130,135 **** if (FilesQueued < m_SameHostLimit) { ! m_Queue.push_back( UploadQueueItem(p) ); ! TRACE0("Q> Queue Added: " + IPtoStr(p->m_Host) + p->m_RequestURI + "\n"); return true; } --- 133,140 ---- if (FilesQueued < m_SameHostLimit) { ! m_Queue.push_back(UploadQueueItem(p)); ! Traceline = "Q> Queue Added: "; ! Traceline += IPtoStr(p->m_Host) + p->m_RequestURI + "\n"; ! TRACE0(Traceline); return true; } *************** *** 140,143 **** --- 145,149 ---- { std::list<UploadQueueItem>::iterator itItem; + CharString Traceline; // Go through wait list *************** *** 146,150 **** if ((*itItem).SecsLeft == 0) { ! TRACE0("Q> Wait Removed: " + IPtoStr((*itItem).Host) + (*itItem).RequestURI + "\n"); itItem = m_WaitList.erase(itItem); --- 152,158 ---- if ((*itItem).SecsLeft == 0) { ! Traceline = "Q> Wait Removed: "; ! Traceline += IPtoStr((*itItem).Host) + (*itItem).RequestURI + "\n"; ! TRACE0(Traceline); itItem = m_WaitList.erase(itItem); *************** *** 161,165 **** if (!PollItem(*itItem)) { ! TRACE0("Q> Queue Removed: " + IPtoStr((*itItem).Host) + (*itItem).RequestURI + "\n"); itItem = m_Queue.erase(itItem); --- 169,175 ---- if (!PollItem(*itItem)) { ! Traceline = "Q> Queue Removed: "; ! Traceline += IPtoStr((*itItem).Host) + (*itItem).RequestURI + "\n"; ! TRACE0(Traceline); itItem = m_Queue.erase(itItem); *************** *** 176,182 **** (*itItem).SecsLeft = MAX_POLL * 5; m_WaitList.push_back(*itItem); ! ! TRACE0("Q> Pass Removed: " + IPtoStr((*itItem).Host) + (*itItem).RequestURI + "\n"); ! TRACE0("Q> Wait Added: " + IPtoStr((*itItem).Host) + (*itItem).RequestURI + "\n"); itItem = m_PassList.erase(itItem); --- 186,196 ---- (*itItem).SecsLeft = MAX_POLL * 5; m_WaitList.push_back(*itItem); ! ! Traceline = "Q> Pass Removed: "; ! Traceline += IPtoStr((*itItem).Host) + (*itItem).RequestURI + "\n"; ! TRACE0(Traceline); ! Traceline = "Q> Wait Added: "; ! Traceline += IPtoStr((*itItem).Host) + (*itItem).RequestURI + "\n"; ! TRACE0(Traceline); itItem = m_PassList.erase(itItem); *************** *** 215,218 **** --- 229,233 ---- std::list<UploadQueueItem>::iterator itQueueItem; std::list<UploadQueueItem>::iterator itPassItem; + CharString Traceline; while (m_PassList.size() < m_pPrefs->m_MaxUploads) *************** *** 234,238 **** m_PassList.push_back(*itQueueItem); ! TRACE0("Q> Pass Added from Queue: " + IPtoStr((*itQueueItem).Host) + (*itQueueItem).RequestU m_Queue.erase(itQueueItem); --- 249,255 ---- m_PassList.push_back(*itQueueItem); ! Traceline = "Q> Pass Added from Queue: "; ! Traceline += IPtoStr((*itQueueItem).Host) + (*itQueueItem).RequestURI + "\n"; ! TRACE0(Traceline); m_Queue.erase(itQueueItem); *************** *** 264,267 **** --- 281,285 ---- // enabled // return; + CharString Traceline; if (m_Minute < 60) *************** *** 278,290 **** int i = 0; for (itItem = m_WaitList.begin(); itItem != m_WaitList.end(); itItem++, i++) ! TRACE0("Q> Wait " + DWrdtoStr(i + 1) + ": " + IPtoStr((*itItem).Host) + (*itItem).RequestURI + " ttl=" + DWrdtoStr((*itItem).SecsLeft) + "\n"); ! i = 0; ! for (itItem = m_Queue.begin(); itItem != m_Queue.end(); itItem++, i++) ! TRACE0("Q> Queue " + DWrdtoStr(i + 1) + ": " + IPtoStr((*itItem).Host) + (*itItem).RequestURI + " ttl=" + DWrdtoStr((*itItem).SecsLeft) + "\n"); ! i = 0; ! for (itItem = m_PassList.begin(); itItem != m_PassList.end(); itItem++, i++) ! TRACE0("Q> Pass " + DWrdtoStr(i + 1) + ": " + IPtoStr((*itItem).Host) + (*itItem).RequestURI + " ttl=" + DWrdtoStr((*itItem).SecsLeft) + "\n"); TRACE0("\n"); --- 296,324 ---- int i = 0; for (itItem = m_WaitList.begin(); itItem != m_WaitList.end(); itItem++, i++) ! { ! Traceline = "Q> Wait "; ! Traceline += DWrdtoStr(i + 1) + ": "; ! Traceline += IPtoStr((*itItem).Host) + (*itItem).RequestURI + " ttl="; ! Traceline += DWrdtoStr((*itItem).SecsLeft) + "\n"; ! TRACE0(Traceline); ! } ! for (i = 0, itItem = m_Queue.begin(); itItem != m_Queue.end(); itItem++, i++) ! { ! Traceline = "Q> Queue "; ! Traceline += DWrdtoStr(i + 1) + ": "; ! Traceline += IPtoStr((*itItem).Host) + (*itItem).RequestURI + " ttl="; ! Traceline += DWrdtoStr((*itItem).SecsLeft) + "\n"; ! TRACE0(Traceline); ! } ! for (i = 0, itItem = m_PassList.begin(); itItem != m_PassList.end(); itItem++, i++) ! { ! Traceline = "Q> Pass "; ! Traceline += DWrdtoStr(i + 1) + ": "; ! Traceline += IPtoStr((*itItem).Host) + (*itItem).RequestURI + " ttl="; ! Traceline += DWrdtoStr((*itItem).SecsLeft) + "\n"; ! TRACE0(Traceline); ! } TRACE0("\n"); Index: GnuUploadQueue.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuUploadQueue.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GnuUploadQueue.h 10 Jul 2003 08:31:41 -0000 1.8 --- GnuUploadQueue.h 10 Jul 2003 22:41:07 -0000 1.9 *************** *** 31,34 **** --- 31,36 ---- #pragma once typedef CString CharString; + #else + #include "platform/opengcc/typedefs.h" #endif Index: GnuUploadShell.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuUploadShell.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** GnuUploadShell.h 10 Jul 2003 08:31:41 -0000 1.11 --- GnuUploadShell.h 10 Jul 2003 22:41:07 -0000 1.12 *************** *** 53,62 **** void PushFile(); ! void ParseRequest(CString); bool LoadTigerTree(); int GetStatus(); UINT GetFileLength(); ! bool ParseRangeHeader(CString); int GetBytesPerSec(); --- 53,62 ---- void PushFile(); ! void ParseRequest(CharString); bool LoadTigerTree(); int GetStatus(); UINT GetFileLength(); ! bool ParseRangeHeader(CharString); int GetBytesPerSec(); Index: Headers.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Headers.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Headers.cpp 28 May 2003 05:18:09 -0000 1.4 --- Headers.cpp 10 Jul 2003 22:41:07 -0000 1.5 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 29,52 **** ! CParsedHeaders::CParsedHeaders(CString RawHeaderBlock) { m_Warning = 0; - //Allow header continuations RawHeaderBlock.Replace("\r\n\t", " "); RawHeaderBlock.Replace("\r\n ", " "); - //Make sure RawHeaderBlock ends with ONE "\r\n" RawHeaderBlock.TrimRight("\r\n"); RawHeaderBlock += "\r\n"; - Header NewHeader; ! CString Line; ! CString Name; ! CString Value; int delimpos = 0; --- 29,49 ---- ! CParsedHeaders::CParsedHeaders(CharString RawHeaderBlock) { m_Warning = 0; //Allow header continuations RawHeaderBlock.Replace("\r\n\t", " "); RawHeaderBlock.Replace("\r\n ", " "); //Make sure RawHeaderBlock ends with ONE "\r\n" RawHeaderBlock.TrimRight("\r\n"); RawHeaderBlock += "\r\n"; Header NewHeader; ! CharString Line; ! CharString Name; ! CharString Value; int delimpos = 0; *************** *** 83,87 **** { //Trick to avoid splitting on timestamps like Thu, 27 Jun 2002 20:22:26 GMT work ! CString PossibleDay = Line.Mid(commapos - 4, 4); if (PossibleDay == " Sun" || PossibleDay == " Mon" || PossibleDay == " Tue" || PossibleDay == " Wed" || PossibleDay == " Thu" || PossibleDay == " Fri" || PossibleDay == " Sat") { --- 80,84 ---- { //Trick to avoid splitting on timestamps like Thu, 27 Jun 2002 20:22:26 GMT work ! CharString PossibleDay = Line.Mid(commapos - 4, 4); if (PossibleDay == " Sun" || PossibleDay == " Mon" || PossibleDay == " Tue" || PossibleDay == " Wed" || PossibleDay == " Thu" || PossibleDay == " Fri" || PossibleDay == " Sat") { *************** *** 139,150 **** //Continue with next line anyway } ! } }; ! CString CParsedHeaders::FindHeader (CString HeaderName) { HeaderName.MakeLower(); ! CString tmp; for (int i = 0; i < m_Headers.size(); i++) --- 136,147 ---- //Continue with next line anyway } ! } }; ! CharString CParsedHeaders::FindHeader (CharString HeaderName) { HeaderName.MakeLower(); ! CharString tmp; for (int i = 0; i < m_Headers.size(); i++) *************** *** 161,170 **** } ! bool ValidHttpHeader(CString Header, CString Version, int Code, CString Reason) { return false; } ! CString LimitHeadersLength( CString Headers ) { if (Headers.GetLength() > 4000) //4000 - \r\n and some margin --- 158,167 ---- } ! bool ValidHttpHeader(CharString Header, CharString Version, int Code, CharString Reason) { return false; } ! CharString LimitHeadersLength(CharString Headers) { if (Headers.GetLength() > 4000) //4000 - \r\n and some margin Index: Headers.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Headers.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Headers.h 28 May 2003 05:18:09 -0000 1.5 --- Headers.h 10 Jul 2003 22:41:07 -0000 1.6 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 24,40 **** ********************************************************************************/ #ifndef OPENGCC #pragma once #endif - #ifndef HEADERS_H - #define HEADERS_H - struct Header { ! CString Name; ! CString Value; }; --- 24,42 ---- ********************************************************************************/ + #ifndef HEADERS_H + #define HEADERS_H #ifndef OPENGCC #pragma once + typedef CString CharString; + #else + #include "./platform/opengcc/typedefs.h" #endif struct Header { ! CharString Name; ! CharString Value; }; *************** *** 44,49 **** public: ! CParsedHeaders (CString RawHeaderBlock); ! CString FindHeader (CString HeaderName); std::vector<Header> m_Headers; --- 46,51 ---- public: ! CParsedHeaders (CharString RawHeaderBlock); ! CharString FindHeader (CharString HeaderName); std::vector<Header> m_Headers; *************** *** 52,57 **** ! CString LimitHeadersLength(CString Headers); ! bool ValidHttpHeader(CString Header, CString Version, int Code, CString Reason); #endif // HEADERS_H --- 54,59 ---- ! CharString LimitHeadersLength(CharString Headers); ! bool ValidHttpHeader(CharString Header, CharString Version, int Code, CharString Reason); #endif // HEADERS_H |
From: <ri...@us...> - 2003-07-10 08:32:49
|
Update of /cvsroot/gnucula/Gnucula/platform/opengcc In directory sc8-pr-cvs1:/tmp/cvs-serv5355/platform/opengcc Added Files: w_strings.cpp w_strings.h Log Message: initial w_strings file. --- NEW FILE: w_strings.cpp --- /******************************************************************************** Gnucula - A Gnutella Library Based on GnucDNA Copyright (C) 2000-2003 John Marshall GCC extended code - Clayton Rollins (also LGPL) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For support, questions, comments, etc... Forum: http://gnucula.sourceforge.net/forum/index.php ********************************************************************************/ #include "w_strings.h" // #include "../../Conversions.h" #ifdef DEBUG // used for debugging. external to gnuc. #include "../../../console_interface/console_io.h" #endif // Need to add a few conversion functions W_Strings::W_Strings(void) { Flush(); } W_Strings::W_Strings(wchar_t *new_string, int Len) { Flush(); AddString(new_string, Len); } W_Strings::W_Strings(char *new_string, int Len) { Flush(); wchar_t *ConvertedString = ConvertAscii(new_string, Len); AddString(ConvertedString, Len); } void W_Strings::Flush(void) { TextPointer = new wchar_t[1]; *TextPointer = '\0'; StringLength = 0; } bool W_Strings::AddString(wchar_t *text_to_add, int Len) { int i; if (Len == -1) { // strings must be null terminated or have a valid Len /* todo - fix that */ for (i = 0; *(text_to_add + i) != '\0'; i++) { ; } Len = i; } if (*(TextPointer) != '\0') { while (*(TextPointer + StringLength) == '\0') StringLength--; // pop off any trailing nulls StringLength++; //focus on last null } #ifdef DDEBUG // this is console code for testing. (don't let it confuse you...) Console_Output debug_io; debug_io.multiline_output("Adding string: ", text_to_add, "\n"); debug_io.multiline_output("To the current string: ", TextPointer, "\nNew string's length: "); debug_io.kwik_out(Len); debug_io.multiline_output("Current string's length:", " "); debug_io.kwik_out(StringLength); //if (debug_io.kwik_lower_in("Continue? (y or n)") != 'y') // return false; #endif wchar_t *new_string = new wchar_t[StringLength + Len + 1]; for (i = 0; i < StringLength; i++) *(new_string + i) = *(TextPointer + i); for (i = 0; i <= Len; i++) *(new_string + StringLength + i) = *(text_to_add + i); StringLength += Len; if (*(new_string + StringLength) != '\0') { StringLength++; *(new_string + StringLength) = '\0'; } #ifdef DDEBUG debug_io.multiline_output("New String is: ", new_string, "\nTotal Length:"); debug_io.kwik_out(StringLength); debug_io.console_pause(); #endif TextPointer = new_string; return true; } int W_Strings::GetLength(void) { return StringLength; } void W_Strings::CopyText(wchar_t text_out[], int Len) { int i; if (Len <= 0) { for (i = 0; *(TextPointer + i) != '\0'; i++) text_out[i] = *(TextPointer + i); text_out[i] = '\0'; } else { // Todo - Test this condition further..., looks bad if (*(TextPointer + Len) != '\0') { Len++; text_out = new wchar_t[Len]; text_out[Len] = '\0'; } for (i = 0; i < Len; i++) text_out[i] = *(TextPointer + i); } #ifdef DDEBUG Console_Output debug_io; debug_io.multiline_output("In CopyText; text_out: ", text_out, "\n"); #endif } wchar_t *W_Strings::ConvertAscii(char *ConvertMe, int& Len) { int i = 0; if (Len <= 0) { // we need to get the proper Len for (i = 0; *(ConvertMe + i) != '\0'; i++) { ; } Len = i; } wchar_t *ConvertedString = new wchar_t[Len]; for (i = 0; i < Len; i++) *(ConvertedString + i) = (wchar_t) *(ConvertMe + i); return ConvertedString; } wchar_t *W_Strings::ConvertAscii(char *ConvertMe) { int i = 0, Len = 0; if (Len <= 0) { // we need to get the proper Len for (i = 0; *(ConvertMe + i) != '\0'; i++) { ; } Len = i; } wchar_t *ConvertedString = new wchar_t[Len]; for (i = 0; i < Len; i++) *(ConvertedString + i) = (wchar_t) *(ConvertMe + i); return ConvertedString; } bool W_Strings::IsEmpty(void) { if (*(TextPointer) == '\0' || StringLength == 0) return true; return false; } void W_Strings::MakeLower(void) { for (int i = 0; *(TextPointer + i); i++) if (*(TextPointer + i) >= 'A' && *(TextPointer + i) <= 'Z') *(TextPointer + i) = *(TextPointer + i) + 32; } void W_Strings::MakeUpper(void) { for (int i = 0; *(TextPointer + i); i++) if (*(TextPointer + i) >= 'a' && *(TextPointer + i) <= 'z') *(TextPointer + i) = *(TextPointer + i) - 32; } int W_Strings::Find(wchar_t *FindMe, int startpos) { bool Mismatch = false; for (int i = startpos; *(TextPointer + i) != '\0'; i++) if (*(TextPointer + i) == *FindMe) { Mismatch = false; for (int j = 0; *(FindMe + j) != '\0'; j++) if (*(TextPointer + i + j) != *(FindMe + j)) { Mismatch = true; break; } if (!Mismatch) return i; // startpos of 'found' wchar_ts } return -1; } int W_Strings::Find(char *FindMe, int startpos) { wchar_t *w_FindMe = ConvertAscii(FindMe); return Find(w_FindMe, startpos); } int W_Strings::ReverseFind(wchar_t *FindMe) { bool Mismatch = false; for (int i = StringLength - 1; *(TextPointer + i) != '\0'; i--) if (*(TextPointer + i) == *FindMe) { for (int j = 0; *(FindMe + j) != '\0'; j++) if (*(TextPointer + i + j) != *(FindMe + j)) { Mismatch = true; break; } else Mismatch = false; if (!Mismatch) return i; // startpos of 'found' wchar_ts } return -1; } int W_Strings::ReverseFind(char *FindMe) { wchar_t *w_FindMe = ConvertAscii(FindMe); return ReverseFind(w_FindMe); } int W_Strings::CompareNoCase(wchar_t *CompareMe) { // exit conditions?? why int?? int i; for (i = 0; *(TextPointer + i) != '\0'; i++) if (*(TextPointer + i) != *(CompareMe + i)) if (*(TextPointer + i) + 32 != *(CompareMe + i)) if (*(TextPointer + i) != *(CompareMe + i) + 32) return -1; if (*(CompareMe + i) != '\0') return -1; return 0; } int W_Strings::CompareNoCase(char *CompareMe) { // exit conditions?? why int?? wchar_t *w_CompareMe = ConvertAscii(CompareMe); return CompareNoCase(w_CompareMe); } W_Strings W_Strings::Mid(int startpos, int endpos) { if (endpos == 0) // unbounded request >= 512K endpos = 524288; int i; W_Strings ret; if (endpos < startpos) { ret = "Invalid range requested in Mid()"; return ret; } wchar_t *ReturnText = new wchar_t[endpos - startpos + 1]; for (i = 0; (startpos + i) <= endpos; i++) { *(ReturnText + i) = *(TextPointer + startpos + i); if (*(TextPointer + startpos + i) == '\0') break; } ret = ReturnText; return ret; } W_Strings W_Strings::Left(int endpos) { W_Strings ret = Mid(0, endpos); return ret; } W_Strings W_Strings::Right(int startpos) { W_Strings ret = Mid(startpos); return ret; } void W_Strings::Insert(int pos, wchar_t *InsertMe) { int i, j; // count strings length for (i = 0; *(InsertMe + i) != '\0'; i++) { ; } if (i == 0) return; StringLength += i; wchar_t *NewString = new wchar_t[StringLength]; for (i = 0; i < pos; i++) *(NewString + i) = *(TextPointer + i); for (j = 0; *(InsertMe + j) != '\0'; j++) { *(NewString + i + j) = *(InsertMe + j); } // copy the rest and cap the string for ( ; *(TextPointer + i) != '\0'; i++) *(NewString + i + j) = *(TextPointer + i); *(NewString + i + j) = '\0'; TextPointer = NewString; } void W_Strings::Insert(int pos, char *InsertMe) { wchar_t *w_InsertMe = ConvertAscii(InsertMe); Insert(pos, w_InsertMe); } void W_Strings::Replace(wchar_t *ReplaceMe, wchar_t *NewText) { int ReplacePos = 0, NewTextLen = 0, OldTextLen = 0, Occurrences = 0, i; #ifdef DDEBUG Console_Output debug_io; // debug_io.kwik_out("in replace"); #endif // count strings length for (i = 0; *(NewText + i) != '\0'; i++) { ; } NewTextLen = i; for (i = 0; *(ReplaceMe + i) != '\0'; i++) { ; } OldTextLen = i; #ifdef DDEBUG debug_io.multiline_output("NewTextLen:", " "); debug_io.kwik_out(NewTextLen); debug_io.multiline_output("OldTextLen:", " "); debug_io.kwik_out(OldTextLen); #endif // count occurrences i = 0; while (i >= 0) { Occurrences++; i = Find(ReplaceMe, i + 1); #ifdef DDEBUG debug_io.multiline_output("Occurrences:", " "); debug_io.kwik_out(Occurrences); debug_io.multiline_output("i:", " "); debug_io.kwik_out(i); #endif } Occurrences--; #ifdef DDEBUG debug_io.multiline_output("Occurrences:", " "); debug_io.kwik_out(Occurrences); #endif if (Occurrences == 0) return; int OrigLen = StringLength; StringLength = StringLength + ((NewTextLen - OldTextLen) * Occurrences) + 1; wchar_t *NewString = new wchar_t[StringLength]; int lastread = 0, lastwrite = 0; #ifdef DDEBUG debug_io.multiline_output("New length:", " "); debug_io.kwik_out(StringLength); debug_io.multiline_output("Old length:", " "); debug_io.kwik_out(OrigLen); #endif while (ReplacePos >= 0) { ReplacePos = Find(ReplaceMe, lastread + 1); #ifdef DDEBUG debug_io.multiline_output("Replacing at:", " "); debug_io.kwik_out(ReplacePos); #endif if (ReplacePos >= 0) { for (i = lastread; i < ReplacePos; i++) { *(NewString + lastwrite) = *(TextPointer + i); lastwrite++; lastread++; } for (int j = 0; j <= NewTextLen; j++) *(NewString + lastwrite + j) = *(NewText + j); lastwrite += NewTextLen; } else { // copy the rest and cap the string for (i = lastread; i < OrigLen; i++, lastwrite++) *(NewString + lastwrite) = *(TextPointer + i); *(NewString + StringLength) = '\0'; } lastread += OldTextLen; #ifdef DDEBUG debug_io.multiline_output("lastread is:", " "); debug_io.kwik_out(lastread); debug_io.multiline_output("lastwrite is:", " "); debug_io.kwik_out(lastwrite); #endif } TextPointer = NewString; } void W_Strings::Replace(wchar_t *ReplaceMe, char *NewText) { wchar_t *w_NewText = ConvertAscii(NewText); Replace(ReplaceMe, w_NewText); } void W_Strings::Replace(char *ReplaceMe, wchar_t *NewText) { wchar_t *w_ReplaceMe = ConvertAscii(ReplaceMe); Replace(w_ReplaceMe, NewText); } void W_Strings::Replace(char *ReplaceMe, char *NewText) { wchar_t *w_NewText = ConvertAscii(NewText); wchar_t *w_ReplaceMe = ConvertAscii(ReplaceMe); Replace(w_ReplaceMe, w_NewText); } void W_Strings::Remove(char *RemoveMe) { wchar_t *w_RemoveMe = ConvertAscii(RemoveMe); Replace(w_RemoveMe, (wchar_t *) ""); } void W_Strings::Remove(wchar_t *RemoveMe) { Replace(RemoveMe, (wchar_t *) ""); } // operators wchar_t *W_Strings::operator+(char *add_me) { int i = 0; //W_Strings Ret; while (*(add_me + i) != '\0') i++; wchar_t *text_out = new wchar_t[StringLength + i + 1]; CopyText(text_out); for (int k = 0; k <= i; k++) *(text_out + StringLength + k) = (wchar_t) *(add_me + k); *(text_out + StringLength + i + 1) = '\0'; return text_out; //return Ret; } wchar_t *W_Strings::operator+(wchar_t *add_me) { int i = 0; //W_Strings Ret; while (*(add_me + i) != '\0') i++; wchar_t *text_out = new wchar_t[StringLength + i + 1]; CopyText(text_out); for (int k = 0; k <= i; k++) *(text_out + StringLength + k) = *(add_me + k); *(text_out + StringLength + i + 1) = '\0'; return text_out; //return Ret; } wchar_t *W_Strings::operator+(W_Strings &CopyFrom) { //W_Strings Ret; int length = CopyFrom.GetLength(); wchar_t *new_text = new wchar_t[length]; CopyFrom.CopyText(new_text); //Ret = new_text; return new_text; } void W_Strings::operator+=(char *add_me) { int Len = 0; wchar_t *w_add_me = ConvertAscii(add_me, Len); AddString(w_add_me, Len); } void W_Strings::operator+=(wchar_t *add_me) { AddString(add_me); } void W_Strings::operator+=(W_Strings &CopyFrom) { int i; int length = CopyFrom.GetLength(); //if (length <= 0) // return; wchar_t *new_text = new wchar_t[length + 1]; CopyFrom.CopyText(new_text); AddString(new_text); } void W_Strings::operator=(char *add_me) { Flush(); int Len = 0; wchar_t *Converted = ConvertAscii(add_me, Len); AddString(Converted, Len); } void W_Strings::operator=(wchar_t *add_me) { Flush(); AddString(add_me); } // case sensitive... bool W_Strings::operator==(W_Strings &CompareMe) { int length = CompareMe.GetLength(); if (length != StringLength) return false; // length mismatch wchar_t *temp = new wchar_t[length]; CompareMe.CopyText(temp); for (int i = 0; i <= length; i++) if (*(TextPointer + i) != *(temp + i)) return false; return true; } bool W_Strings::operator==(wchar_t *CompareMe) { int i; for (i = 0; *(TextPointer + i) != '\0'; i++) if (*(TextPointer + i) != *(CompareMe + i)) return false; if (*(CompareMe + i) != '\0') return false; return true; } bool W_Strings::operator==(char *CompareMe) { int i; for (i = 0; *(TextPointer + i) != '\0'; i++) if (*(TextPointer + i) != (wchar_t) *(CompareMe + i)) return false; if (*(CompareMe + i) != '\0') return false; return true; } bool W_Strings::operator!=(W_Strings &CompareMe) { int length = CompareMe.GetLength(); if (length != StringLength) return true; // length mismatch wchar_t *temp = new wchar_t[length]; CompareMe.CopyText(temp); for (int i = 0; i <= length; i++) if (*(TextPointer + i) != *(temp + i)) return true; return false; } bool W_Strings::operator!=(wchar_t *CompareMe) { int i; for (i = 0; *(TextPointer + i) != '\0'; i++) if (*(TextPointer + i) != *(CompareMe + i)) return true; if (*(CompareMe + i) != '\0') return true; return false; } bool W_Strings::operator!=(char *CompareMe) { int i; for (i = 0; *(TextPointer + i) != '\0'; i++) if (*(TextPointer + i) != (wchar_t) *(CompareMe + i)) return true; if (*(CompareMe + i) != '\0') return true; return false; } --- NEW FILE: w_strings.h --- /******************************************************************************** Gnucula - A Gnutella Library Based on GnucDNA Copyright (C) 2000-2003 John Marshall GCC extended code - Clayton Rollins (also LGPL) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For support, questions, comments, etc... Forum: http://gnucula.sourceforge.net/forum/index.php ********************************************************************************/ /* Note that the code here, though similar to base classes in some compilers and libraries, it is solely intended as a workaround to maintain semantics of existing code, not to replace those libraries. It will not be developed beyond what is needed by existing code. */ #ifndef W_STRINGS_H #define W_STRINGS_H //#include <stddef.h> //using namespace std; // was for NULL class W_Strings { private: int StringLength; // position of last null public: // for testing, gives console easy access, but is unneeded internal to gnuc. wchar_t *TextPointer; public: W_Strings(void); W_Strings(wchar_t *, int = -1); W_Strings(char *, int = -1); // local sort of stuff void Flush(void); bool AddString(wchar_t *, int = -1); int GetLength(void); void CopyText(wchar_t *, int = -1); wchar_t *ConvertAscii(char *, int&); wchar_t *ConvertAscii(char *); // useful functions (ie. semantically similar to existing code) bool IsEmpty(void); void MakeLower(void); void MakeUpper(void); int Find(wchar_t *, int = 0); int Find(char *, int = 0); int ReverseFind(wchar_t *); int ReverseFind(char *); int CompareNoCase(wchar_t *); int CompareNoCase(char *); W_Strings Mid(int = 0, int = 0); W_Strings Left(int); // start 'til int W_Strings Right(int); void Insert(int, wchar_t *); void Insert(int, char *); void Replace(wchar_t *, wchar_t *); void Replace(wchar_t *, char *); void Replace(char *, wchar_t *); void Replace(char *, char *); void Remove(wchar_t *); void Remove(char *); // W_Strings Format(wchar_t *, int, int); // operator overloads wchar_t *operator+(char *); wchar_t *operator+(wchar_t *); wchar_t *operator+(W_Strings &); void operator+=(char *); void operator+=(wchar_t *); void operator+=(W_Strings &); void operator=(char *); void operator=(wchar_t *); bool operator==(W_Strings &); bool operator==(wchar_t *); bool operator==(char *); bool operator!=(W_Strings &); bool operator!=(wchar_t *); bool operator!=(char *); }; #endif // W_STRINGS_H |
From: <ri...@us...> - 2003-07-10 08:31:44
|
Update of /cvsroot/gnucula/Gnucula In directory sc8-pr-cvs1:/tmp/cvs-serv5110 Modified Files: Conversions.cpp Conversions.h GnuUploadQueue.cpp GnuUploadQueue.h GnuUploadShell.cpp GnuUploadShell.h GnuWordHash.cpp GnuWordHash.h Sha1.cpp Sha1.h stdafx.h tiger.cpp tiger.h tigertree2.cpp tigertree2.h Log Message: Mostly just syntax fixes. Unicode strings added. Index: Conversions.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Conversions.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Conversions.cpp 8 Jul 2003 08:11:03 -0000 1.7 --- Conversions.cpp 10 Jul 2003 08:31:41 -0000 1.8 *************** *** 28,31 **** --- 28,37 ---- #include "Conversions.h" + #ifdef OPENGCC + #include <stdlib.h> + #include <stdio.h> + using namespace std; + #endif + // Get rid of ugly warnings #pragma warning (disable : 4786) *************** *** 122,130 **** char buff[16]; ! ::sprintf (buff, "%u", in); return buff; } CharString IPtoStr(IP in) { --- 128,137 ---- char buff[16]; ! ::sprintf(buff, "%u", in); return buff; } + #ifndef OPENGCC CharString IPtoStr(IP in) { *************** *** 183,186 **** --- 190,194 ---- return out; } + #endif CharString EncodeBase16(const unsigned char* buffer, unsigned int bufLen) *************** *** 190,195 **** --- 198,208 ---- for (int i = 0; i < bufLen; i++) { + #ifndef OPENGCC // no EOS, += doesn't work; neither does this workaround... Base16Buff += base16Chars[buffer[i] >> 4]; Base16Buff += base16Chars[buffer[i] & 0xf]; + #else + Base16Buff.AddString(base16Chars[buffer[i] >> 4], 1); + Base16Buff.AddString(base16Chars[buffer[i] & 0xf], 1); + #endif } return Base16Buff; *************** *** 199,203 **** { memset(buffer, 0, DecodeLengthBase16(base16BufLen)); ! for (int i = 0; i < base16BufLen; i++) { --- 212,216 ---- { memset(buffer, 0, DecodeLengthBase16(base16BufLen)); ! for (int i = 0; i < base16BufLen; i++) { *************** *** 206,210 **** // Check to make sure that the given word falls inside a valid range byte word = 0; ! if (lookup < 0 || lookup >= BASE16_LOOKUP_MAX) word = 0xFF; --- 219,223 ---- // Check to make sure that the given word falls inside a valid range byte word = 0; ! if (lookup < 0 || lookup >= BASE16_LOOKUP_MAX) word = 0xFF; *************** *** 215,219 **** { buffer[i/2] = word << 4; ! } else { --- 228,232 ---- { buffer[i/2] = word << 4; ! } else { *************** *** 236,240 **** { CharString Base32Buff; ! unsigned int i, index; unsigned char word; --- 249,253 ---- { CharString Base32Buff; ! unsigned int i, index; unsigned char word; *************** *** 263,269 **** // assert(word < 32); - Base32Buff += (char) base32Chars[word]; - //*(base32Buffer++) = (char) base32Chars[word]; } // end for --- 276,285 ---- // assert(word < 32); + #ifdef OPENGCC // no EOS, += doesn't work; neither does this workaround... + Base32Buff.AddString(base32Chars[word], 1); + #else + Base32Buff += base32Chars[word]; + #endif //*(base32Buffer++) = (char) base32Chars[word]; } // end for *************** *** 323,326 **** --- 339,343 ---- } + #ifndef OPENGCC // Converts a string representation to a CTime CTime StrToCTime(CharString& str) *************** *** 435,438 **** --- 452,456 ---- return strBlocked; } + #endif // OPENGCC CharString HashIDtoTag(int HashID) *************** *** 483,488 **** CharString CommaIze(CharString in) { ! if (in.GetLength() > 3) ! return CommaIze(in.Left(in.GetLength() - 3)) + "," + in.Right(3); else return in; --- 501,513 ---- CharString CommaIze(CharString in) { ! int Len = in.GetLength(); ! ! if (Len > 3) ! { ! CharString out; ! for (int pos = Len % 4; pos < Len; pos + 4, Len++) ! out.Insert(pos, ","); ! return out; ! } else return in; *************** *** 497,510 **** //char* buffer; ! CharString strNumber(_fcvt(dNumber, 2, &decimal, &sign)); ! if (decimal == 0) ! strNumber.Insert(0, "0."); ! else if (decimal == -1) ! strNumber.Insert(0, "0.0"); ! else if (decimal < -1) ! return "0.00"; ! else ! strNumber.Insert(decimal, '.'); return strNumber; --- 522,537 ---- //char* buffer; ! CharString strNumber(FloatToString(dNumber)); ! ! //CharString strNumber(_fcvt(dNumber, 2, &decimal, &sign)); ! // if (decimal == 0) ! // strNumber.Insert(0, "0."); ! // else if (decimal == -1) ! // strNumber.Insert(0, "0.0"); ! // else if (decimal < -1) ! // return "0.00"; ! // else ! // strNumber.Insert(decimal, '.'); return strNumber; *************** *** 523,527 **** if (result.GetLength() > 2) ! result.Insert( result.GetLength() - 2, "."); else { --- 550,554 ---- if (result.GetLength() > 2) ! result.Insert(result.GetLength() - 2, "."); else { *************** *** 564,568 **** { copy++; ! Front = Front.Left(spacepos) + " " + DWrdtoStr(copy); } } --- 591,596 ---- { copy++; ! Front = Front.Left(spacepos) + " "; ! Front += DWrdtoStr(copy); } } *************** *** 573,577 **** if (dotpos != -1) ! Front += FileName.Right( FileName.GetLength() - dotpos); return Front; --- 601,605 ---- if (dotpos != -1) ! Front += FileName.Right(FileName.GetLength() - dotpos); return Front; *************** *** 681,682 **** --- 709,832 ---- } + + wchar_t *AsciiToWide(char *ConvertMe, int& Len) + { + int i = 0; + if (Len <= 0) + { // we need to get the proper Len + for (i = 0; *(ConvertMe + i) != '\0'; i++) { + ; } + Len = i; + } + + wchar_t *ConvertedArray = new wchar_t[Len]; + for (i = 0; i < Len; i++) + ConvertedArray[i] = (wchar_t) *(ConvertMe + i); + ConvertedArray[i] = '\0'; + + return ConvertedArray; + } + + char *FloatToString(double in) + { // check that this works; untested + int i; + int temp_int = (int) in; + char *part_one = IntToString(temp_int); + in = (in - temp_int) * 100000; + temp_int = (int) in; + char *part_two = IntToString(temp_int); + + for (i = 0; *(part_one + i) != '\0'; i++) { + ; } + temp_int = i; + for (i = 0; *(part_two + i) != '\0'; i++) { + ; } + temp_int += i + 1; // +1 for '.' + + char return_array[temp_int]; + char *return_me = return_array; + + for (i = 0; *(part_one + i) != '\0'; i++) + *(return_me + i) = *(part_one + i); + temp_int = i + 1; + *(return_me + temp_int) = '.'; + for (i = 0; *(part_two + i) != '\0'; i++) + *(return_me + i + temp_int) = *(part_one + i); + *(return_me + i + temp_int) = '\0'; + + return return_me; + } + + char *IntToString(int number) + { // with significant thanks owed to other open implementations... + static char buf[21]; + char *p = buf + 20; + if (number >= 0) + { + do + { + *--p = '0' + (number % 10); + number /= 10; + } while (number != 0); + + return p; + } + else /* number < 0 */ + { + do + { + *--p = '0' - (number % 10); + number /= 10; + } while (number != 0); + + *--p = '-'; + } + return p; + } + + float StringToFloat(char *convert_me) + { + int i = 0, j = 0; + float return_me = 0; + static char temp[7]; + for (i = 0; (*(convert_me + i) != '.' && *(convert_me + i) != '\0' && i < 7); i++) + temp[i] = *(convert_me + i); + + temp[i] = '\0'; + return_me = StringToInt(temp); + if (*(convert_me + i) == '.') + { + j = i; + for (i = 0; (*(convert_me + i + j) != '\0' && *(convert_me + i + j) != '\n' && i < 7); i++) + temp[i] = *(convert_me + i + j); + temp[i] = '\0'; + + return_me += atof(temp); + } + return return_me; + } + + int StringToInt(char *convert_me) + { + return atoi(convert_me); + } + + #ifdef OPENGCC + int atoi(CharString convert_me) + { + int Len = convert_me.GetLength(); + char TempArray[Len]; + char *Temp = TempArray; + convert_me.CopyText(Temp); + return atoi(convert_me); + } + + int atol(CharString convert_me) + { + int Len = convert_me.GetLength(); + char TempArray[Len]; + char *Temp = TempArray; + convert_me.CopyText(Temp); + return atol(convert_me); + } + #endif Index: Conversions.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Conversions.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Conversions.h 9 Jul 2003 05:50:08 -0000 1.9 --- Conversions.h 10 Jul 2003 08:31:41 -0000 1.10 *************** *** 33,36 **** --- 33,37 ---- #else #include "./platform/opengcc/typedefs.h" + #endif *************** *** 39,42 **** --- 40,44 ---- CharString DWrdtoStr(UINT); // Convert DWORD to a CharString + #ifndef OPENGCC // need IP and CTime workarounds CharString IPtoStr(IP); // Convert IP to CharString IP StrtoIP(CharString in); // Convert CharString to an IP *************** *** 47,50 **** --- 49,53 ---- CTime StrToCTime(CharString& str); // Converts a string representation to a CTime CharString CTimeToStr(CTime& time); // reverse of above + #endif CharString EncodeBase16(const byte* buffer, unsigned int bufLen); *************** *** 61,66 **** --- 64,71 ---- CharString GetSpeedString(DWORD dwSpeed); + #ifndef OPENGCC BlockedHost StrtoBlocked(CharString strBlocked); CharString BlockedtoStr(BlockedHost badHost); + #endif CharString HashIDtoTag(int HashID); *************** *** 74,77 **** --- 79,94 ---- CharString GetPercentage(DWORD , DWORD ); CharString IncrementName(CharString); + + wchar_t *AsciiToWide(char *, int&); + + char *FloatToString(double); + char *IntToString(int); + float StringToFloat(char *); + int StringToInt(char *); + + #ifdef OPENGCC + int atoi(CharString); + int atol(CharString); + #endif #endif // CONVERSIONS_H Index: GnuUploadQueue.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuUploadQueue.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GnuUploadQueue.cpp 31 May 2003 01:17:58 -0000 1.7 --- GnuUploadQueue.cpp 10 Jul 2003 08:31:41 -0000 1.8 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 23,29 **** ********************************************************************************/ - - - #include "stdafx.h" #include "GnuPrefs.h" --- 23,26 ---- Index: GnuUploadQueue.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuUploadQueue.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GnuUploadQueue.h 9 Jul 2003 06:37:44 -0000 1.7 --- GnuUploadQueue.h 10 Jul 2003 08:31:41 -0000 1.8 *************** *** 24,27 **** --- 24,30 ---- ********************************************************************************/ + #ifndef GNU_UPLOAD_QUEUE_H + #define GNU_UPLOAD_QUEUE_H + #ifndef OPENGCC *************** *** 30,36 **** #endif - #ifndef GNU_UPLOAD_QUEUE_H - #define GNU_UPLOAD_QUEUE_H - #include "stdafx.h" #include "GnuUploadShell.h" --- 33,36 ---- *************** *** 45,49 **** int UploadID; IP Host; ! CString RequestURI; int SecsLeft; --- 45,49 ---- int UploadID; IP Host; ! CharString RequestURI; int SecsLeft; Index: GnuUploadShell.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuUploadShell.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GnuUploadShell.cpp 4 Jul 2003 20:23:12 -0000 1.10 --- GnuUploadShell.cpp 10 Jul 2003 08:31:41 -0000 1.11 *************** *** 126,130 **** } ! void CGnuUploadShell::ParseRequest(CString Handshake) { if (!m_Socket) --- 126,130 ---- } ! void CGnuUploadShell::ParseRequest(CharString Handshake) { if (!m_Socket) *************** *** 150,154 **** //Parse Request-Line ! CString FirstLine = Handshake.Left(Handshake.Find("\r\n") ); FirstLine.MakeLower(); --- 150,154 ---- //Parse Request-Line ! CharString FirstLine = Handshake.Left(Handshake.Find("\r\n") ); FirstLine.MakeLower(); *************** *** 188,192 **** m_RequestURI = DecodeURL(m_RequestURI); ! CString LowRequestURI = m_RequestURI; LowRequestURI.MakeLower(); --- 188,192 ---- m_RequestURI = DecodeURL(m_RequestURI); ! CharString LowRequestURI = m_RequestURI; LowRequestURI.MakeLower(); *************** *** 201,205 **** else if (LowRequestURI.Left(5) == "/get/") { ! CString IndexString = m_RequestURI.Mid(5, m_RequestURI.Find("/", 5) - 5); m_Index = atoi(IndexString); --- 201,205 ---- else if (LowRequestURI.Left(5) == "/get/") { ! CharString IndexString = m_RequestURI.Mid(5, m_RequestURI.Find("/", 5) - 5); m_Index = atoi(IndexString); *************** *** 226,230 **** // Parse X-Gnutella-Content-URN ! CString urn = ParsedHeaders.FindHeader("X-Gnutella-Content-URN"); urn.MakeLower(); --- 226,230 ---- // Parse X-Gnutella-Content-URN ! CharString urn = ParsedHeaders.FindHeader("X-Gnutella-Content-URN"); urn.MakeLower(); *************** *** 240,244 **** if (m_Index) { ! CString UploadPath = m_pShare->GetFilePath(m_Index); m_Name = m_pShare->GetFileName(m_Index); --- 240,244 ---- if (m_Index) { ! CharString UploadPath = m_pShare->GetFilePath(m_Index); m_Name = m_pShare->GetFileName(m_Index); *************** *** 310,315 **** // Parse Keep-Alive, set as default in HTTP/1.1 ! m_KeepAlive = (m_HTTPVersion == "HTTP/1.1") ? true : false; ! CString ConnectionValue = ParsedHeaders.FindHeader("Connection"); ConnectionValue.MakeLower(); --- 310,315 ---- // Parse Keep-Alive, set as default in HTTP/1.1 ! m_KeepAlive = (m_HTTPVersion == "HTTP/1.1") ? true : false; // ? extension probably not needed ! CharString ConnectionValue = ParsedHeaders.FindHeader("Connection"); ConnectionValue.MakeLower(); *************** *** 331,336 **** { //For each header ! CString HeaderName = ParsedHeaders.m_Headers[i].Name; ! CString HeaderValue = ParsedHeaders.m_Headers[i].Value; HeaderName.MakeLower(); --- 331,336 ---- { //For each header ! CharString HeaderName = ParsedHeaders.m_Headers[i].Name; ! CharString HeaderValue = ParsedHeaders.m_Headers[i].Value; HeaderName.MakeLower(); *************** *** 488,492 **** } ! CString CGnuUploadShell::GetFilePath() { return m_pShare->GetFilePath(m_Index); --- 488,492 ---- } ! CharString CGnuUploadShell::GetFilePath() { return m_pShare->GetFilePath(m_Index); *************** *** 495,499 **** void CGnuUploadShell::RunFile() { ! CString Path = GetFilePath(); if (Path != "") --- 495,499 ---- void CGnuUploadShell::RunFile() { ! CharString Path = GetFilePath(); if (Path != "") *************** *** 675,679 **** } ! bool CGnuUploadShell::ParseRangeHeader(CString Value) { // Example HeaderValue: "bytes=100-200" --- 675,679 ---- } ! bool CGnuUploadShell::ParseRangeHeader(CharString Value) { // Example HeaderValue: "bytes=100-200" *************** *** 697,702 **** // bytes=FirstValue-LastValue ! CString FirstValue = Value.Mid(6, dashpos-6); ! CString LastValue = Value.Mid(dashpos+1); // Full range request --- 697,702 ---- // bytes=FirstValue-LastValue ! CharString FirstValue = Value.Mid(6, dashpos-6); ! CharString LastValue = Value.Mid(dashpos+1); // Full range request Index: GnuUploadShell.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuUploadShell.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GnuUploadShell.h 4 Jul 2003 20:23:12 -0000 1.10 --- GnuUploadShell.h 10 Jul 2003 08:31:41 -0000 1.11 *************** *** 27,30 **** --- 27,33 ---- #ifndef OPENGCC #pragma once + typedef CString CharString; + #else + #include "./platform/opengcc/typedefs.h" #endif *************** *** 60,64 **** int GetETD(); ! CString GetFilePath(); void RunFile(); --- 63,67 ---- int GetETD(); ! CharString GetFilePath(); void RunFile(); *************** *** 69,87 **** int m_Attempts; ! CString m_Name; int m_Index; CFileLock m_File; //CFile m_CheckFile; //CFile m_MirrorFile; ! CString m_Sha1Hash; ! CString m_TigerHash; bool m_TigerTreeRequest; byte* m_TigerTree; int m_TreeSize; ! CString m_RequestURI; ! CString m_HTTPMethod; ! CString m_HTTPVersion; bool m_IsPartial; --- 72,90 ---- int m_Attempts; ! CharString m_Name; int m_Index; CFileLock m_File; //CFile m_CheckFile; //CFile m_MirrorFile; ! CharString m_Sha1Hash; ! CharString m_TigerHash; bool m_TigerTreeRequest; byte* m_TigerTree; int m_TreeSize; ! CharString m_RequestURI; ! CharString m_HTTPMethod; ! CharString m_HTTPVersion; bool m_IsPartial; *************** *** 94,98 **** int m_CurrentPos; DWORD m_Status; ! CString m_Error; bool m_UpdatedInSecond; --- 97,101 ---- int m_CurrentPos; DWORD m_Status; ! CharString m_Error; bool m_UpdatedInSecond; *************** *** 104,108 **** int m_QueuePos; ! CString m_Handshake; int m_BytesSent; --- 107,111 ---- int m_QueuePos; ! CharString m_Handshake; int m_BytesSent; Index: GnuWordHash.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuWordHash.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GnuWordHash.cpp 6 Jul 2003 20:35:33 -0000 1.8 --- GnuWordHash.cpp 10 Jul 2003 08:31:41 -0000 1.9 *************** *** 299,303 **** } ! void CGnuWordHash::BreakupName(std::basic_string<char> Name, std::vector< std::basic_string<char> > &Keywords) { // all non-alphanumric characters 0 - 127 are treated as spaces, except for apostraphe --- 299,303 ---- } ! void CGnuWordHash::BreakupName(std::basic_string<char> Name, std::vector<std::basic_string<char>> &Keywords) { // all non-alphanumric characters 0 - 127 are treated as spaces, except for apostraphe *************** *** 384,389 **** { // Break Query into individual words ! std::vector< std::basic_string<char> > Keywords; ! BreakupName( (LPCTSTR) SearchQuery.QueryText, Keywords); --- 384,389 ---- { // Break Query into individual words ! std::vector<std::basic_string<char>> Keywords; ! BreakupName((LPCTSTR) SearchQuery.QueryText, Keywords); *************** *** 393,400 **** for (i = 0; i < SearchQuery.QueryExtended.size(); i++) { ! CString QueryEx = SearchQuery.QueryExtended[i]; QueryEx.MakeLower(); - // detect urn:etc... --- 393,399 ---- for (i = 0; i < SearchQuery.QueryExtended.size(); i++) { ! CharString QueryEx = SearchQuery.QueryExtended[i]; QueryEx.MakeLower(); // detect urn:etc... *************** *** 404,409 **** // Insert [HashID]:[hash] into table Keywords.push_back((LPCTSTR) QueryEx) ; ! ! // break out meta data BreakupMeta(QueryEx, Keywords); --- 403,407 ---- // Insert [HashID]:[hash] into table Keywords.push_back((LPCTSTR) QueryEx) ; ! // break out meta data BreakupMeta(QueryEx, Keywords); *************** *** 419,423 **** UINT WordHash = Hash(Keywords[i], TABLE_BITS); - // Intersect with local files to get results if (LocalMatch) --- 417,420 ---- *************** *** 547,551 **** } ! void CGnuWordHash::BreakupMeta(CString &QueryEx, std::vector< std::basic_string<char> > &Keywords) { // Get rid of <?xml version='1.0'?> --- 544,548 ---- } ! void CGnuWordHash::BreakupMeta(CharString &QueryEx, std::vector< std::basic_string<char> > &Keywords) { // Get rid of <?xml version='1.0'?> *************** *** 582,586 **** if (SpacePos != -1) { ! CString MetaName = QueryEx.Left(SpacePos); if (!MetaName.IsEmpty()) --- 579,583 ---- if (SpacePos != -1) { ! CharString MetaName = QueryEx.Left(SpacePos); if (!MetaName.IsEmpty()) *************** *** 595,599 **** while (EqualPos != -1 && SpacePos != -1 && SpacePos < EqualPos) { ! CString AttributeName = QueryEx.Mid(SpacePos + 1, EqualPos - SpacePos - 1); int FrontQuotePos = QueryEx.Find("'", EqualPos); --- 592,596 ---- while (EqualPos != -1 && SpacePos != -1 && SpacePos < EqualPos) { ! CharString AttributeName = QueryEx.Mid(SpacePos + 1, EqualPos - SpacePos - 1); int FrontQuotePos = QueryEx.Find("'", EqualPos); *************** *** 602,613 **** if (!AttributeName.IsEmpty() && FrontQuotePos < BackQuotePos) { ! CString AttributeValue = QueryEx.Mid(FrontQuotePos + 1, BackQuotePos - FrontQuotePos - 1); // Break up any value into keywords std::vector< std::basic_string<char> > KeyValues; ! BreakupName( (LPCTSTR) AttributeValue, KeyValues); for (int i = 0; i < KeyValues.size(); i++) ! Keywords.push_back( (LPCTSTR) (MetaName + "." + AttributeName + "=" + KeyValues[i].c_str()) ) ; } else --- 599,610 ---- if (!AttributeName.IsEmpty() && FrontQuotePos < BackQuotePos) { ! CharString AttributeValue = QueryEx.Mid(FrontQuotePos + 1, BackQuotePos - FrontQuotePos - 1); // Break up any value into keywords std::vector< std::basic_string<char> > KeyValues; ! BreakupName((LPCTSTR) AttributeValue, KeyValues); for (int i = 0; i < KeyValues.size(); i++) ! Keywords.push_back((LPCTSTR) (MetaName + "." + AttributeName + "=" + KeyValues[i].c_str()) ) ; } else *************** *** 620,624 **** } } - } } --- 617,620 ---- Index: GnuWordHash.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuWordHash.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GnuWordHash.h 28 May 2003 21:01:56 -0000 1.7 --- GnuWordHash.h 10 Jul 2003 08:31:41 -0000 1.8 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 24,35 **** ********************************************************************************/ #ifndef OPENGCC #pragma once #endif - #ifndef GNU_WORD_HASH_H - #define GNU_WORD_HASH_H - #define TABLE_BITS 16 --- 24,38 ---- ********************************************************************************/ + #ifndef GNU_WORD_HASH_H + #define GNU_WORD_HASH_H + #ifndef OPENGCC #pragma once + typedef CString CharString; + #else + #include "./platform/opengcc/typedefs.h" #endif #define TABLE_BITS 16 *************** *** 56,60 **** void BreakupName(std::basic_string<char> Name, std::vector< std::basic_string<char> > &Keywords); ! void BreakupMeta(CString &QueryEx, std::vector< std::basic_string<char> > &Keywords); void AddWord(std::vector< std::basic_string<char> > &Keywords, std::basic_string<char> Word); --- 59,63 ---- void BreakupName(std::basic_string<char> Name, std::vector< std::basic_string<char> > &Keywords); ! void BreakupMeta(CharString &QueryEx, std::vector< std::basic_string<char> > &Keywords); void AddWord(std::vector< std::basic_string<char> > &Keywords, std::basic_string<char> Word); Index: Sha1.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Sha1.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Sha1.cpp 8 Jul 2003 00:33:08 -0000 1.7 --- Sha1.cpp 10 Jul 2003 08:31:41 -0000 1.8 *************** *** 384,388 **** // from conversions, not here in DNA anymore ! CharString EncodeBase32(const unsigned char* buffer, unsigned int bufLen) { CharString Base32Buff; --- 384,388 ---- // from conversions, not here in DNA anymore ! /*CharString EncodeBase32(const unsigned char* buffer, unsigned int bufLen) { CharString Base32Buff; *************** *** 394,398 **** for(i = 0, index = 0; i < bufLen;) { ! /* Is the current word going to span a byte boundary? */ if (index > 3) { --- 394,398 ---- for(i = 0, index = 0; i < bufLen;) { ! /* Is the current word going to span a byte boundary? *//* if (index > 3) { *************** *** 424,426 **** return Base32Buff; ! } --- 424,426 ---- return Base32Buff; ! }*/ Index: Sha1.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/Sha1.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Sha1.h 9 Jul 2003 05:50:08 -0000 1.8 --- Sha1.h 10 Jul 2003 08:31:41 -0000 1.9 *************** *** 35,39 **** void SubSha1toBase32(BYTE *out, const BYTE *in); ! CharString EncodeBase32(const byte* buffer, unsigned int bufLen); #if 1 --- 35,39 ---- void SubSha1toBase32(BYTE *out, const BYTE *in); ! // CharString EncodeBase32(const byte* buffer, unsigned int bufLen); #if 1 Index: stdafx.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/stdafx.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** stdafx.h 9 Jul 2003 05:50:08 -0000 1.14 --- stdafx.h 10 Jul 2003 08:31:41 -0000 1.15 *************** *** 92,95 **** --- 92,96 ---- #include "platform/opengcc/typedefs.h" // some type workarounds #include "platform/opengcc/strings.h" + #include "platform/opengcc/w_strings.h" #include "zlib/zlib.h" #endif // end OPENGCC *************** *** 104,109 **** ! // Debugging ! #define new DEBUG_NEW // Master Version --- 105,110 ---- ! // Debugging (screws up 'new' keyword; disabled.) ! // #define new DEBUG_NEW // Master Version Index: tiger.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/tiger.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tiger.cpp 4 Jul 2003 22:06:13 -0000 1.4 --- tiger.cpp 10 Jul 2003 08:31:41 -0000 1.5 *************** *** 154,158 **** --- 154,160 ---- void tiger_compress(word64 *str, word64 state[3]) { + #ifndef OPENGCC // right shift count >= width of type (compiler error) tiger_compress_macro(((word64*)str), ((word64*)state)); + #endif } *************** *** 170,176 **** --- 172,180 ---- unsigned char temp[64]; + #ifndef OPENGCC // integer constant out of range (compiler error) res[0]=0x0123456789ABCDEF; res[1]=0xFEDCBA9876543210; res[2]=0xF096A5B4C3B2E187; + #endif for (i=length; i>=64; i-=64) Index: tiger.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/tiger.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tiger.h 4 Jul 2003 20:23:12 -0000 1.5 --- tiger.h 10 Jul 2003 08:31:41 -0000 1.6 *************** *** 9,13 **** --- 9,18 ---- #define TIGER_H + #ifndef OPENGCC typedef unsigned __int64 word64; + #else + #include "platform/opengcc/typedefs.h" + #endif + typedef unsigned int word32; typedef unsigned short int word16; Index: tigertree2.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/tigertree2.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tigertree2.cpp 4 Jul 2003 20:23:12 -0000 1.1 --- tigertree2.cpp 10 Jul 2003 08:31:41 -0000 1.2 *************** *** 43,47 **** */ ! #include "StdAfx.h" #include "tigertree2.h" --- 43,47 ---- */ ! #include "stdafx.h" #include "tigertree2.h" Index: tigertree2.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/tigertree2.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tigertree2.h 4 Jul 2003 20:23:12 -0000 1.1 --- tigertree2.h 10 Jul 2003 08:31:41 -0000 1.2 *************** *** 15,19 **** --- 15,24 ---- * $Id$ */ + #ifndef TIGERTREE2_H + #define TIGERTREE2_H + + #ifndef OPENGCC #pragma once + #endif #include "tiger.h" *************** *** 60,61 **** --- 65,68 ---- static void tt2_block(TT2_CONTEXT *ctx); static void tt2_compose(TT2_CONTEXT *ctx); + + #endif TIGERTREE2_H |
From: <ri...@us...> - 2003-07-10 08:31:44
|
Update of /cvsroot/gnucula/Gnucula/platform/opengcc In directory sc8-pr-cvs1:/tmp/cvs-serv5110/platform/opengcc Modified Files: strings.cpp strings.h typedefs.h Log Message: Mostly just syntax fixes. Unicode strings added. Index: strings.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/strings.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** strings.cpp 9 Jul 2003 00:55:35 -0000 1.5 --- strings.cpp 10 Jul 2003 08:31:41 -0000 1.6 *************** *** 1,2 **** --- 1,3 ---- + /******************************************************************************** *************** *** 41,44 **** --- 42,59 ---- } + Strings::Strings(unsigned char *new_string, int Len) + { + if (Len <= 0); + // we need to get the proper Len + for (Len = 0; (new_string + Len) != '\0'; Len++) { + ; } + + char *NewText = new char[Len]; + for (int i = 0; i < Len; i++) + *(NewText + i) = (char) (new_string + i); + + AddString(NewText, Len); + } + void Strings::Flush(void) { *************** *** 48,51 **** --- 63,90 ---- } + bool Strings::AddString(unsigned char &u_text_to_add, int Len) + { + int i; + + if (Len == -1) + { // strings must be null terminated or have a valid Len /* todo - fix that */ + for (i = 0; (u_text_to_add + i) != '\0'; i++) { + ; } + Len = i; + } + + char *text_to_add = new char[Len]; + + for (i = 0; i <= Len; i++) + *(text_to_add + i) = (char) (u_text_to_add + i); + bool Added = AddString(text_to_add); + + if (!Added) + return false; + + return true; + } + + bool Strings::AddString(char *text_to_add, int Len) { *************** *** 202,205 **** --- 241,253 ---- } + int Strings::ReverseFind(char FindMe) + { + bool Mismatch = false; + for (int i = StringLength - 1; *(TextPointer + i) != '\0'; i--) + if (*(TextPointer + i) == FindMe) + return i; // pos of 'found' char + + return -1; + } int Strings::CompareNoCase(char *CompareMe) *************** *** 420,432 **** } ! void Strings::operator+=(Strings &CopyFrom) { int i; int length = CopyFrom.GetLength(); - //if (length <= 0) - // return; - char *new_text = new char[length + 1]; --- 468,508 ---- } + void Strings::operator+=(unsigned char *add_me) + { + // interpret unsigned bytes + int Len; + + // we need to get the proper Len + for (Len = 0; (add_me + Len) != '\0'; Len++) { + ; } + + char *NewText = new char[Len]; + for (int i = 0; i < Len; i++) + *(NewText + i) = (char) (add_me + i); + + AddString(NewText, Len); + } + + void Strings::operator+=(unsigned char &add_me) + { + // interpret unsigned bytes + int Len; + + // we need to get the proper Len + for (Len = 0; (add_me + Len) != '\0'; Len++) { + ; } ! char *NewText = new char[Len]; ! for (int i = 0; i < Len; i++) ! *(NewText + i) = (char) (add_me + i); ! ! AddString(NewText, Len); ! } ! ! void Strings::operator+=(Strings CopyFrom) { int i; int length = CopyFrom.GetLength(); char *new_text = new char[length + 1]; *************** *** 434,437 **** --- 510,527 ---- AddString(new_text); } + + //void Strings::operator+=(Strings &CopyFrom) + //{ + //int i; + //int length = CopyFrom.GetLength(); + // + ////if (length <= 0) + //// return; + // + //char *new_text = new char[length + 1]; + // + //CopyFrom.CopyText(new_text); + //AddString(new_text); + //} Index: strings.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/strings.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** strings.h 9 Jul 2003 05:50:08 -0000 1.8 --- strings.h 10 Jul 2003 08:31:41 -0000 1.9 *************** *** 46,52 **** --- 46,54 ---- Strings(void); Strings(char *, int = -1); + Strings(unsigned char *, int = -1); // local sort of stuff void Flush(void); + bool AddString(unsigned char &, int = -1); bool AddString(char *, int = -1); int GetLength(void); *************** *** 59,62 **** --- 61,65 ---- int Find(char *, int = 0); int ReverseFind(char *); + int ReverseFind(char); int CompareNoCase(char *); Strings Mid(int = 0, int = 0); *************** *** 72,76 **** char *operator+(Strings &); void operator+=(char *); ! void operator+=(Strings &); void operator=(char *); bool operator==(Strings &); --- 75,82 ---- char *operator+(Strings &); void operator+=(char *); ! void operator+=(unsigned char *); ! void operator+=(unsigned char &); ! void operator+=(Strings); ! //void operator+=(Strings &); void operator=(char *); bool operator==(Strings &); *************** *** 78,82 **** bool operator!=(Strings &); bool operator!=(char *); - //void operator=(Strings &); //don't need }; --- 84,87 ---- Index: typedefs.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/typedefs.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** typedefs.h 9 Jul 2003 05:50:08 -0000 1.5 --- typedefs.h 10 Jul 2003 08:31:41 -0000 1.6 *************** *** 36,41 **** --- 36,43 ---- class Strings; // forward declaration + class W_Strings; typedef Strings CharString; + typedef W_Strings W_String; typedef unsigned int word32, UINT; typedef unsigned char word8, BYTE, byte, u_char; |
From: <ri...@us...> - 2003-07-09 07:34:09
|
Update of /cvsroot/gnucula/Gnucula In directory sc8-pr-cvs1:/tmp/cvs-serv14440 Modified Files: GnuUpdateSock.h GnuUpload.cpp GnuUpload.h Log Message: Syntax fixes, mostly Index: GnuUpdateSock.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuUpdateSock.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GnuUpdateSock.h 9 Jul 2003 06:37:44 -0000 1.6 --- GnuUpdateSock.h 9 Jul 2003 07:34:05 -0000 1.7 *************** *** 48,62 **** void Download(byte* pBuff, int nSize); ! CString m_Host; int m_Port; ! CString m_Path; int m_Status; ! CString m_Error; CFile m_File; int m_BytesCompleted; int m_FileSize; ! CString m_DownloadPath; CGnuUpdate* m_pUpdate; --- 48,62 ---- void Download(byte* pBuff, int nSize); ! CharString m_Host; int m_Port; ! CharString m_Path; int m_Status; ! CharString m_Error; CFile m_File; int m_BytesCompleted; int m_FileSize; ! CharString m_DownloadPath; CGnuUpdate* m_pUpdate; Index: GnuUpload.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuUpload.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GnuUpload.cpp 4 Jul 2003 20:23:12 -0000 1.8 --- GnuUpload.cpp 9 Jul 2003 07:34:05 -0000 1.9 *************** *** 97,101 **** } ! CString HttpGiv = "GIV " + DWrdtoStr(m_pShell->m_Index) + ":" + EncodeBase16((byte*) &m_pComm->m_ClientID, 16) + "/" + m_pShell->m_Name + "\n\n"; Send(HttpGiv, HttpGiv.GetLength()); --- 97,104 ---- } ! CharString HttpGiv = "GIV "; ! HttpGiv += DWrdtoStr(m_pShell->m_Index) + ":"; ! HttpGiv += EncodeBase16((byte*) &m_pComm->m_ClientID, 16) + "/"; ! HttpGiv += m_pShell->m_Name + "\n\n"; Send(HttpGiv, HttpGiv.GetLength()); *************** *** 131,135 **** pBuff[dwBuffLength] = 0; ! CString Header(pBuff); // Clear old GetRequest when new one comes in --- 134,138 ---- pBuff[dwBuffLength] = 0; ! CharString Header(pBuff); // Clear old GetRequest when new one comes in *************** *** 149,153 **** { // Get Node info ! CString Host; UINT nPort; GetPeerName(Host, nPort); --- 152,156 ---- { // Get Node info ! CharString Host; UINT nPort; GetPeerName(Host, nPort); *************** *** 183,187 **** return; ! CString HttpOK; //HTTP Version --- 186,190 ---- return; ! CharString HttpOK; //HTTP Version *************** *** 198,202 **** // Server ! HttpOK += "Server: " + m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type --- 201,206 ---- // Server ! HttpOK += "Server: "; ! HttpOK += m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type *************** *** 207,214 **** // Conent-Range, it is "bytes x-y/z" not "bytes=x-y/z" ! HttpOK += "Content-Range: bytes " + DWrdtoStr(m_pShell->m_StartPos) + "-" + DWrdtoStr(m_pShell->m_StopPos - 1) + "/" + DWrdtoStr(m_pShell->m_FileLength) + "\r\n"; // Content-Length ! HttpOK += "Content-Length: " + DWrdtoStr(m_pShell->m_StopPos - m_pShell->m_StartPos) + "\r\n"; // Connection --- 211,222 ---- // Conent-Range, it is "bytes x-y/z" not "bytes=x-y/z" ! HttpOK += "Content-Range: bytes "; ! HttpOK += DWrdtoStr(m_pShell->m_StartPos) + "-"; ! HttpOK += DWrdtoStr(m_pShell->m_StopPos - 1) + "/"; ! HttpOK += DWrdtoStr(m_pShell->m_FileLength) + "\r\n"; // Content-Length ! HttpOK += "Content-Length: "; ! HttpOK += DWrdtoStr(m_pShell->m_StopPos - m_pShell->m_StartPos) + "\r\n"; // Connection *************** *** 227,231 **** if (itPart != m_pTrans->m_DownloadMap.end()) ! HttpOK += "X-Available-Ranges: bytes " + itPart->second->AvailableRangesCommaSeparated() + "\r\n"; } --- 235,242 ---- if (itPart != m_pTrans->m_DownloadMap.end()) ! { ! HttpOK += "X-Available-Ranges: bytes "; ! HttpOK += itPart->second->AvailableRangesCommaSeparated() + "\r\n"; ! } } *************** *** 237,241 **** // X-TigerTree-Path if (!m_pShell->m_TigerHash.IsEmpty()) ! HttpOK += "X-TigerTree-Path: /gnutella/tigertree/v3?urn:tree:tiger/:" + m_pShell->m_TigerHash + "\r\n"; // Alt-Locations --- 248,255 ---- // X-TigerTree-Path if (!m_pShell->m_TigerHash.IsEmpty()) ! { ! HttpOK += "X-TigerTree-Path: /gnutella/tigertree/v3?urn:tree:tiger/:"; ! HttpOK += m_pShell->m_TigerHash + "\r\n"; ! } // Alt-Locations *************** *** 253,257 **** // X-Filename if (m_pShell->m_RequestURI.Left(9) == "/uri-res/") ! HttpOK += "X-Filename: " + m_pShell->m_Name + "\r\n"; // End header --- 267,274 ---- // X-Filename if (m_pShell->m_RequestURI.Left(9) == "/uri-res/") ! { ! HttpOK += "X-Filename: "; ! HttpOK += m_pShell->m_Name + "\r\n"; ! } // End header *************** *** 297,301 **** return; ! CString HttpTree; //HTTP Version --- 314,318 ---- return; ! CharString HttpTree; //HTTP Version *************** *** 312,316 **** // Server ! HttpTree += "Server: " + m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type --- 329,334 ---- // Server ! HttpTree += "Server: "; ! HttpTree += m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type *************** *** 321,328 **** // Conent-Range, it is "bytes x-y/z" not "bytes=x-y/z" ! HttpTree += "Content-Range: bytes " + DWrdtoStr(m_pShell->m_StartPos) + "-" + DWrdtoStr(m_pShell->m_StopPos - 1) + "/" + DWrdtoStr(m_pShell->m_FileLength) + "\r\n"; // Content-Length ! HttpTree += "Content-Length: " + DWrdtoStr(m_pShell->m_StopPos - m_pShell->m_StartPos) + "\r\n"; // Connection --- 339,350 ---- // Conent-Range, it is "bytes x-y/z" not "bytes=x-y/z" ! HttpTree += "Content-Range: bytes "; ! HttpTree += DWrdtoStr(m_pShell->m_StartPos) + "-"; ! HttpTree += DWrdtoStr(m_pShell->m_StopPos - 1) + "/"; ! HttpTree += DWrdtoStr(m_pShell->m_FileLength) + "\r\n"; // Content-Length ! HttpTree += "Content-Length: "; ! HttpTree += DWrdtoStr(m_pShell->m_StopPos - m_pShell->m_StartPos) + "\r\n"; // Connection *************** *** 366,375 **** void CGnuUpload::Send_HttpBusy() { ! CString Http503; Http503 += "HTTP 503 Upload Slots Full\r\n"; // Server ! Http503 += "Server: " + m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content Type --- 388,398 ---- void CGnuUpload::Send_HttpBusy() { ! CharString Http503; Http503 += "HTTP 503 Upload Slots Full\r\n"; // Server ! Http503 += "Server: "; ! Http503 += m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content Type *************** *** 383,388 **** itPart = m_pTrans->m_DownloadMap.find(m_pShell->m_PartialID); ! if (itPart != m_pTrans->m_DownloadMap.end()) ! Http503 += "X-Available-Ranges: bytes " + itPart->second->AvailableRangesCommaSeparated() + "\r\n"; } --- 406,414 ---- itPart = m_pTrans->m_DownloadMap.find(m_pShell->m_PartialID); ! if (itPart != m_pTrans->m_DownloadMap.end()) ! { ! Http503 += "X-Available-Ranges: bytes "; ! Http503 += itPart->second->AvailableRangesCommaSeparated() + "\r\n"; ! } } *************** *** 396,400 **** //Queued int PollMin = MAX_POLL / 2; ! Http503 += "X-Queue: position=" + DWrdtoStr(m_pShell->m_QueuePos) + ",length=" + DWrdtoStr(m_pTrans->m_UploadQueue.m_Queue.size()) + ",limit=" + DWrdtoStr(m_pTrans->m_UploadQueue.m_SameHostLimit) + ",pollMin=" + DWrdtoStr(PollMin) + ",pollMax=" + DWrdtoStr(MAX_POLL) + "\r\n"; Http503 += "Connection: Keep-Alive\r\n"; } --- 422,431 ---- //Queued int PollMin = MAX_POLL / 2; ! Http503 += "X-Queue: position="; ! Http503 += DWrdtoStr(m_pShell->m_QueuePos) + ",length="; ! Http503 += DWrdtoStr(m_pTrans->m_UploadQueue.m_Queue.size()) + ",limit="; ! Http503 += DWrdtoStr(m_pTrans->m_UploadQueue.m_SameHostLimit) + ",pollMin="; ! Http503 += DWrdtoStr(PollMin) + ",pollMax="; ! Http503 += DWrdtoStr(MAX_POLL) + "\r\n"; Http503 += "Connection: Keep-Alive\r\n"; } *************** *** 403,407 **** //Queue is full //TODO: 10 minutes pollMin when queue is full, ok? ! Http503 += "X-Queue: position=full,length=" + DWrdtoStr(m_pTrans->m_UploadQueue.m_Queue.size()) + ",limit=" + DWrdtoStr(m_pTrans->m_UploadQueue.m_SameHostLimit) + ",pollMin=" + DWrdtoStr(FULL_POLL) + "\r\n"; Http503 += "Connection: Close\r\n"; } --- 434,441 ---- //Queue is full //TODO: 10 minutes pollMin when queue is full, ok? ! Http503 += "X-Queue: position=full,length="; ! Http503 += DWrdtoStr(m_pTrans->m_UploadQueue.m_Queue.size()) + ",limit="; ! Http503 += DWrdtoStr(m_pTrans->m_UploadQueue.m_SameHostLimit) + ",pollMin="; ! Http503 += DWrdtoStr(FULL_POLL) + "\r\n"; Http503 += "Connection: Close\r\n"; } *************** *** 412,416 **** if (!m_pShell->m_Sha1Hash.IsEmpty()) { ! Http503 += "X-Gnutella-Content-URN: urn:sha1:" + m_pShell->m_Sha1Hash + "\r\n"; // Alt-Locations --- 446,451 ---- if (!m_pShell->m_Sha1Hash.IsEmpty()) { ! Http503 += "X-Gnutella-Content-URN: urn:sha1:"; ! Http503 += m_pShell->m_Sha1Hash + "\r\n"; // Alt-Locations *************** *** 478,487 **** void CGnuUpload::Send_HttpFailed() { ! CString Http503; Http503 += "HTTP 503 Limit reached\r\n"; // Server ! Http503 += "Server: " + m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type --- 513,523 ---- void CGnuUpload::Send_HttpFailed() { ! CharString Http503; Http503 += "HTTP 503 Limit reached\r\n"; // Server ! Http503 += "Server: "; ! Http503 += m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type *************** *** 495,500 **** itPart = m_pTrans->m_DownloadMap.find(m_pShell->m_PartialID); ! if (itPart != m_pTrans->m_DownloadMap.end()) ! Http503 += "X-Available-Ranges: bytes " + itPart->second->AvailableRangesCommaSeparated() + "\r\n"; } --- 531,539 ---- itPart = m_pTrans->m_DownloadMap.find(m_pShell->m_PartialID); ! if (itPart != m_pTrans->m_DownloadMap.end()) ! { ! Http503 += "X-Available-Ranges: bytes "; ! Http503 += itPart->second->AvailableRangesCommaSeparated() + "\r\n"; ! } } *************** *** 502,506 **** if (!m_pShell->m_Sha1Hash.IsEmpty()) { ! Http503 += "X-Gnutella-Content-URN: urn:sha1:" + m_pShell->m_Sha1Hash + "\r\n"; // Alt-Locations --- 541,546 ---- if (!m_pShell->m_Sha1Hash.IsEmpty()) { ! Http503 += "X-Gnutella-Content-URN: urn:sha1:"; ! Http503 += m_pShell->m_Sha1Hash + "\r\n"; // Alt-Locations *************** *** 546,555 **** void CGnuUpload::Send_HttpNotFound() { ! CString Http404; Http404 += "HTTP 404 Not Found\r\n"; // Server ! Http404 += "Server: " + m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type --- 586,596 ---- void CGnuUpload::Send_HttpNotFound() { ! CharString Http404; Http404 += "HTTP 404 Not Found\r\n"; // Server ! Http404 += "Server: "; ! Http404 += m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type *************** *** 582,591 **** void CGnuUpload::Send_HttpBadRequest() { ! CString Http400; Http400 += "HTTP 400 Bad Request\r\n"; // Server ! Http400 += "Server: " + m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type --- 623,633 ---- void CGnuUpload::Send_HttpBadRequest() { ! CharString Http400; Http400 += "HTTP 400 Bad Request\r\n"; // Server ! Http400 += "Server: "; ! Http400 += m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type *************** *** 618,627 **** void CGnuUpload::Send_HttpInternalError() { ! CString Http500; Http500 += "HTTP 500 Internal Server Error\r\n"; // Server ! Http500 += "Server: " + m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type --- 660,670 ---- void CGnuUpload::Send_HttpInternalError() { ! CharString Http500; Http500 += "HTTP 500 Internal Server Error\r\n"; // Server ! Http500 += "Server: "; ! Http500 += m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type *************** *** 631,635 **** if (!m_pShell->m_Sha1Hash.IsEmpty()) { ! Http500 += "X-Gnutella-Content-URN: urn:sha1:" + m_pShell->m_Sha1Hash + "\r\n"; // Alt-Locations --- 674,679 ---- if (!m_pShell->m_Sha1Hash.IsEmpty()) { ! Http500 += "X-Gnutella-Content-URN: urn:sha1:"; ! Http500 += m_pShell->m_Sha1Hash + "\r\n"; // Alt-Locations *************** *** 674,683 **** void CGnuUpload::Send_BrowserBlock() { ! CString Http403; Http403 += "HTTP 403 Browser access blocked\r\n"; // Server ! Http403 += "Server: " + m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type --- 718,728 ---- void CGnuUpload::Send_BrowserBlock() { ! CharString Http403; Http403 += "HTTP 403 Browser access blocked\r\n"; // Server ! Http403 += "Server: "; ! Http403 += m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type *************** *** 711,722 **** } ! void CGnuUpload::Send_ClientBlock(CString ClientName) { ! CString Http403; Http403 += "HTTP 403 Access blocked\r\n"; // Server ! Http403 += "Server: " + m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type --- 756,768 ---- } ! void CGnuUpload::Send_ClientBlock(CharString ClientName) { ! CharString Http403; Http403 += "HTTP 403 Access blocked\r\n"; // Server ! Http403 += "Server: "; ! Http403 += m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type *************** *** 744,748 **** Send(Http403, Http403.GetLength()); ! m_pShell->m_Error = "Client " + ClientName + " Blocked"; m_pShell->m_Handshake += Http403; --- 790,795 ---- Send(Http403, Http403.GetLength()); ! m_pShell->m_Error = "Client "; ! m_pShell->m_Error += ClientName + " Blocked"; m_pShell->m_Handshake += Http403; *************** *** 753,762 **** void CGnuUpload::Send_HttpRangeNotAvailable() { ! CString Http503; Http503 += "HTTP 503 Requested Range Not Available\r\n"; // Server ! Http503 += "Server: " + m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type --- 800,810 ---- void CGnuUpload::Send_HttpRangeNotAvailable() { ! CharString Http503; Http503 += "HTTP 503 Requested Range Not Available\r\n"; // Server ! Http503 += "Server: "; ! Http503 += m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Content-Type *************** *** 767,776 **** if (itPart != m_pTrans->m_DownloadMap.end()) ! Http503 += "X-Available-Ranges: bytes " + itPart->second->AvailableRangesCommaSeparated() + "\r\n"; // X-Gnutella-Content-URN if (!m_pShell->m_Sha1Hash.IsEmpty()) { ! Http503 += "X-Gnutella-Content-URN: urn:sha1:" + m_pShell->m_Sha1Hash + "\r\n"; // Alt-Locations --- 815,828 ---- if (itPart != m_pTrans->m_DownloadMap.end()) ! { ! Http503 += "X-Available-Ranges: bytes "; ! Http503 += itPart->second->AvailableRangesCommaSeparated() + "\r\n"; ! } // X-Gnutella-Content-URN if (!m_pShell->m_Sha1Hash.IsEmpty()) { ! Http503 += "X-Gnutella-Content-URN: urn:sha1:"; ! Http503 += m_pShell->m_Sha1Hash + "\r\n"; // Alt-Locations *************** *** 943,947 **** if( memcmp(pBuff + BytesSent, CheckBytes, AttemptSend) != 0 ) { ! CString Problem = "Read Check Failed: " + pShell->m_Name + " -- ReadPos=" + DWrdtoStr(pShell->m_CurrentPos) + ", BytesSent=" + DWrdtoStr(BytesSent) + ", BytesSent=" + DWrdtoStr(AttemptSend); pShell->m_pTrans->m_pCore->DebugLog(Problem); } --- 995,999 ---- if( memcmp(pBuff + BytesSent, CheckBytes, AttemptSend) != 0 ) { ! CharString Problem = "Read Check Failed: " + pShell->m_Name + " -- ReadPos=" + DWrdtoStr(pShell->m_CurrentPos) + ", BytesSent=" + DWrdtoStr(BytesSent) + ", BytesSent=" + DWrdtoStr(AttemptSend); pShell->m_pTrans->m_pCore->DebugLog(Problem); } *************** *** 1065,1070 **** ExitThread(0); } - - - - --- 1117,1118 ---- Index: GnuUpload.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuUpload.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GnuUpload.h 4 Jul 2003 20:23:12 -0000 1.9 --- GnuUpload.h 9 Jul 2003 07:34:05 -0000 1.10 *************** *** 24,34 **** ********************************************************************************/ #ifndef OPENGCC #pragma once #endif - #ifndef GNU_UPLOAD_H - #define GNU_UPLOAD_H #define SEND_BUFF 32768 --- 24,37 ---- ********************************************************************************/ + #ifndef GNU_UPLOAD_H + #define GNU_UPLOAD_H #ifndef OPENGCC #pragma once + typedef CString CharString; + #else + #include "./platform/opengcc/typedefs.h" #endif #define SEND_BUFF 32768 *************** *** 54,58 **** void Send_HttpInternalError(); void Send_HttpBadRequest(); ! void Send_ClientBlock(CString ClientName); void Send_HttpRangeNotAvailable(); void Send_TigerTree(); --- 57,61 ---- void Send_HttpInternalError(); void Send_HttpBadRequest(); ! void Send_ClientBlock(CharString ClientName); void Send_HttpRangeNotAvailable(); void Send_TigerTree(); *************** *** 60,69 **** void Timer(); ! CString m_ListenIP; bool m_ThreadRunning; CWinThread* m_pUploadThread; ! CString m_GetRequest; CEvent m_CanWrite; --- 63,72 ---- void Timer(); ! CharString m_ListenIP; bool m_ThreadRunning; CWinThread* m_pUploadThread; ! CharString m_GetRequest; CEvent m_CanWrite; |
From: <ri...@us...> - 2003-07-09 05:50:12
|
Update of /cvsroot/gnucula/Gnucula/platform/opengcc In directory sc8-pr-cvs1:/tmp/cvs-serv892/platform/opengcc Modified Files: strings.h typedefs.h Log Message: Syntax changes, mostly. Index: strings.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/strings.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** strings.h 9 Jul 2003 00:55:35 -0000 1.7 --- strings.h 9 Jul 2003 05:50:08 -0000 1.8 *************** *** 32,40 **** #define STRINGS_H ! //#ifndef TYPEDEFS_H ! //#include "typedefs.h" ! ! #include <stddef.h> ! using namespace std; class Strings --- 32,37 ---- #define STRINGS_H ! //#include <stddef.h> ! //using namespace std; // was for NULL class Strings *************** *** 69,72 **** --- 66,70 ---- void Replace(char *, char *); void Remove(char *); + // Strings Format(char *, int, int); // operator overloads Index: typedefs.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/typedefs.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** typedefs.h 8 Jul 2003 00:33:08 -0000 1.4 --- typedefs.h 9 Jul 2003 05:50:08 -0000 1.5 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall GCC extended code - Clayton Rollins (also LGPL) --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall GCC extended code - Clayton Rollins (also LGPL) *************** *** 35,43 **** using namespace std; ! class Strings; - // ,__default_alloc_template<true,80> - //typedef std::basic_string<char> CString, charString; - //typedef std::basic_string<wchar_t> BSTR, wideString; typedef Strings CharString; typedef unsigned int word32, UINT; --- 35,40 ---- using namespace std; ! class Strings; // forward declaration typedef Strings CharString; typedef unsigned int word32, UINT; *************** *** 47,50 **** --- 44,48 ---- typedef bool BOOL; typedef wchar_t* LPCTSTR; + typedef const char GUID[32]; |
From: <ri...@us...> - 2003-07-09 01:28:03
|
Update of /cvsroot/gnucula/Gnucula In directory sc8-pr-cvs1:/tmp/cvs-serv28148 Modified Files: GnuDownload.cpp GnuFileHash.cpp GnuFileHash.h GnuLocal.cpp GnuLocal.h Log Message: syntactical fixes Index: GnuDownload.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuDownload.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** GnuDownload.cpp 8 Jul 2003 08:55:08 -0000 1.11 --- GnuDownload.cpp 9 Jul 2003 00:55:34 -0000 1.12 *************** *** 50,54 **** m_pPrefs = pShell->m_pPrefs; ! m_HostID = HostID; m_Status = TRANSFER_PENDING; m_Push = false; --- 50,54 ---- m_pPrefs = pShell->m_pPrefs; ! m_HostID = HostID; m_Status = TRANSFER_PENDING; m_Push = false; *************** *** 60,64 **** m_PausePos = 0; ! m_DoHead = false; m_HeadNotSupported = false; --- 60,64 ---- m_PausePos = 0; ! m_DoHead = false; m_HeadNotSupported = false; *************** *** 276,281 **** if (m_Header.Find("\r\n\r\n") != -1) { ! HostInfo()->Handshake += m_Header; ! HostInfo()->Handshake += "\r\n"; m_Header = m_Header.Left(m_Header.Find("\r\n\r\n") + 4); --- 276,280 ---- if (m_Header.Find("\r\n\r\n") != -1) { ! HostInfo()->Handshake += m_Header + "\r\n"; m_Header = m_Header.Left(m_Header.Find("\r\n\r\n") + 4); Index: GnuFileHash.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuFileHash.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GnuFileHash.cpp 4 Jul 2003 20:23:12 -0000 1.7 --- GnuFileHash.cpp 9 Jul 2003 00:55:35 -0000 1.8 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 91,95 **** CFile HashFile = NULL; ! CString FileName; int FileIndex = 0; --- 91,95 ---- CFile HashFile = NULL; ! CharString FileName; int FileIndex = 0; *************** *** 206,214 **** tt2_digest(&Tiger_Context, Tiger_Digest); ! CString Sha1_String = EncodeBase32(Sha1_Digest, 20); ! CString MD5_String = EncodeBase32(MD5_Digest, 16); ! CString MD4_String = EncodeBase16(MD4_Digest, 16); ! CString Tiger_String = EncodeBase32(Tiger_Digest, 24); ! CString Bitprint_String = Sha1_String + "." + Tiger_String; --- 206,214 ---- tt2_digest(&Tiger_Context, Tiger_Digest); ! CharString Sha1_String = EncodeBase32(Sha1_Digest, 20); ! CharString MD5_String = EncodeBase32(MD5_Digest, 16); ! CharString MD4_String = EncodeBase16(MD4_Digest, 16); ! CharString Tiger_String = EncodeBase32(Tiger_Digest, 24); ! CharString Bitprint_String = Sha1_String + "." + Tiger_String; *************** *** 365,369 **** // Returns a Byte32 SHA1 hash string from the provided filename // ! CString CGnuFileHash::GetFileHash(CString FileName) { CFile HashFile; --- 365,369 ---- // Returns a Byte32 SHA1 hash string from the provided filename // ! CharString CGnuFileHash::GetFileHash(CharString FileName) { CFile HashFile; *************** *** 420,428 **** // if no entry found create a new entry // ! void CGnuFileHash::LookupFileHash(CString FilePath, CString TimeStamp, SharedFile &File) { m_HashAccess.Lock(); ! std::map<CString, int>::iterator itPos = m_HashMap.find(FilePath); if (itPos != m_HashMap.end()) --- 420,428 ---- // if no entry found create a new entry // ! void CGnuFileHash::LookupFileHash(CharString FilePath, CharString TimeStamp, SharedFile &File) { m_HashAccess.Lock(); ! std::map<CharString, int>::iterator itPos = m_HashMap.find(FilePath); if (itPos != m_HashMap.end()) *************** *** 470,474 **** } ! void CGnuFileHash::SetFileHash(int FileIndex, int HashID, CString Hash) { m_HashAccess.Lock(); --- 470,474 ---- } ! void CGnuFileHash::SetFileHash(int FileIndex, int HashID, CharString Hash) { m_HashAccess.Lock(); *************** *** 519,528 **** // return a file index for a matching Hash // ! int CGnuFileHash::GetHashIndex(int HashID, CString Hash) { m_pShare->m_FilesAccess.Lock(); for (int i = 0; i < m_pShare->m_SharedFiles.size(); i++) ! if(Hash.CompareNoCase(m_pShare->m_SharedFiles[i].HashValues[HashID].c_str()) == 0) { m_pShare->m_FilesAccess.Unlock(); --- 519,528 ---- // return a file index for a matching Hash // ! int CGnuFileHash::GetHashIndex(int HashID, CharString Hash) { m_pShare->m_FilesAccess.Lock(); for (int i = 0; i < m_pShare->m_SharedFiles.size(); i++) ! if (Hash.CompareNoCase(m_pShare->m_SharedFiles[i].HashValues[HashID].c_str()) == 0) { m_pShare->m_FilesAccess.Unlock(); *************** *** 537,541 **** // Load saved file hashes so we don't have to keep recalculating them // ! void CGnuFileHash::LoadShareHashes(CString HashFileName) { CStdioFile HashFile; --- 537,541 ---- // Load saved file hashes so we don't have to keep recalculating them // ! void CGnuFileHash::LoadShareHashes(CharString HashFileName) { CStdioFile HashFile; *************** *** 547,553 **** HashedFile hf; ! for (;;) { ! CString ReadString; if (HashFile.ReadString(ReadString) == false) --- 547,553 ---- HashedFile hf; ! for ( ; ; ) { ! CharString ReadString; if (HashFile.ReadString(ReadString) == false) *************** *** 576,581 **** if (ColonPos != -1) { ! CString Ident = ReadString.Left(ColonPos); ! CString Value = ReadString.Mid(ColonPos + 1); if (Ident == "Name") --- 576,581 ---- if (ColonPos != -1) { ! CharString Ident = ReadString.Left(ColonPos); ! CharString Value = ReadString.Mid(ColonPos + 1); if (Ident == "Name") *************** *** 599,603 **** if (BackColon != -1) { ! int HashID = TagtoHashID( ReadString.Mid(ColonPos + 1, BackColon - ColonPos)); if (HashID != HASH_UNKNOWN) --- 599,603 ---- if (BackColon != -1) { ! int HashID = TagtoHashID(ReadString.Mid(ColonPos + 1, BackColon - ColonPos)); if (HashID != HASH_UNKNOWN) *************** *** 644,651 **** // Save the Shared files hashes // ! void CGnuFileHash::SaveShareHashes(CString HashFileName) { CStdioFile HashFile; ! CString Buffer; if (HashFile.Open(HashFileName, CFile::modeCreate | CFile::modeWrite | CFile::shareExclusive) == false) --- 644,651 ---- // Save the Shared files hashes // ! void CGnuFileHash::SaveShareHashes(CharString HashFileName) { CStdioFile HashFile; ! CharString Buffer, Temp; if (HashFile.Open(HashFileName, CFile::modeCreate | CFile::modeWrite | CFile::shareExclusive) == false) *************** *** 656,668 **** for (int i = 0; i < m_pShare->m_SharedFiles.size(); i++) { ! HashFile.WriteString("Name:" + CString(m_pShare->m_SharedFiles[i].Dir.c_str()) + "\n"); ! HashFile.WriteString("Index:" + DWrdtoStr(m_pShare->m_SharedFiles[i].Index) + "\n"); ! HashFile.WriteString("Time:" + CString(m_pShare->m_SharedFiles[i].TimeStamp.c_str()) + "\n"); for (int j = 0; j < HASH_TYPES; j++) ! HashFile.WriteString("urn:" + HashIDtoTag(j) + CString(m_pShare->m_SharedFiles[i].HashValues[j].c_str()) + "\n"); ! HashFile.WriteString("TreeSize:" + DWrdtoStr(m_pShare->m_SharedFiles[i].TreeSize) + "\n"); ! HashFile.WriteString("TreeDepth:" + DWrdtoStr(m_pShare->m_SharedFiles[i].TreeDepth) + "\n"); HashFile.WriteString("TigerTree:"); for (int j = 0; j < m_pShare->m_SharedFiles[i].TreeSize; j += 24) --- 656,682 ---- for (int i = 0; i < m_pShare->m_SharedFiles.size(); i++) { ! Temp = "Name:"; ! Temp += CharString(m_pShare->m_SharedFiles[i].Dir.c_str()) + "\n"; ! HashFile.WriteString(Temp); ! Temp = "Index:"; ! Temp += DWrdtoStr(m_pShare->m_SharedFiles[i].Index) + "\n"; ! HashFile.WriteString(Temp); ! Temp = "Time:"; ! Temp += CharString(m_pShare->m_SharedFiles[i].TimeStamp.c_str()) + "\n"; ! HashFile.WriteString(Temp); for (int j = 0; j < HASH_TYPES; j++) ! { ! Temp = "urn:"; ! Temp += HashIDtoTag(j) + CharString(m_pShare->m_SharedFiles[i].HashValues[j].c_str()) + "\n"; ! HashFile.WriteString(Temp); ! } ! Temp = "TreeSize:"; ! Temp += DWrdtoStr(m_pShare->m_SharedFiles[i].TreeSize) + "\n"; ! HashFile.WriteString(Temp); ! Temp = "TreeDepth:"; ! Temp += DWrdtoStr(m_pShare->m_SharedFiles[i].TreeDepth) + "\n"; ! HashFile.WriteString(Temp); HashFile.WriteString("TigerTree:"); for (int j = 0; j < m_pShare->m_SharedFiles[i].TreeSize; j += 24) *************** *** 671,675 **** for (int j = 0; j < m_pShare->m_SharedFiles[i].AltHosts.size(); j++) ! HashFile.WriteString("Alt-Loc:" + m_pShare->m_SharedFiles[i].AltHosts[j].GetString() + "\n"); HashFile.WriteString("End\n"); --- 685,693 ---- for (int j = 0; j < m_pShare->m_SharedFiles[i].AltHosts.size(); j++) ! { ! Temp = "Alt-Loc:"; ! Temp += m_pShare->m_SharedFiles[i].AltHosts[j].GetString() + "\n"; ! HashFile.WriteString(Temp); ! } HashFile.WriteString("End\n"); *************** *** 684,688 **** if (!m_EverythingHashed && !m_StopHashing) m_HashEvent.SetEvent(); - if (m_HashQueue.size()) --- 702,705 ---- Index: GnuFileHash.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuFileHash.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GnuFileHash.h 4 Jul 2003 20:23:12 -0000 1.8 --- GnuFileHash.h 9 Jul 2003 00:55:35 -0000 1.9 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 27,30 **** --- 27,31 ---- #ifndef OPENGCC #pragma once + typedef CString CharString; #endif *************** *** 42,52 **** void endThreads(); ! void LoadShareHashes(CString); ! void SaveShareHashes(CString); ! void SetFileHash(int FileIndex, int HashID, CString Hash); ! CString GetFileHash(CString FileName); ! void LookupFileHash(CString, CString, SharedFile &); ! int GetHashIndex(int HashID, CString); void Timer(); --- 43,53 ---- void endThreads(); ! void LoadShareHashes(CharString); ! void SaveShareHashes(CharString); ! void SetFileHash(int FileIndex, int HashID, CharString Hash); ! CharString GetFileHash(CharString FileName); ! void LookupFileHash(CharString, CharString, SharedFile &); ! int GetHashIndex(int HashID, CharString); void Timer(); *************** *** 61,65 **** int m_NextIndex; ! std::map<CString, int> m_HashMap; std::vector<HashedFile> m_HashedFiles; // Stored Hashes of Files --- 62,66 ---- int m_NextIndex; ! std::map<CharString, int> m_HashMap; std::vector<HashedFile> m_HashedFiles; // Stored Hashes of Files Index: GnuLocal.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuLocal.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GnuLocal.cpp 1 Jun 2003 00:19:43 -0000 1.5 --- GnuLocal.cpp 9 Jul 2003 00:55:35 -0000 1.6 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 97,112 **** } ! void CGnuLocal::JoinLan(CString LanName) { m_pPrefs->m_LanName = LanName; ! ! CString LocalHost; UINT nPort; GetSockName(LocalHost, nPort); std::map<int, LanNode>::iterator itLanNode; ! for(itLanNode = m_LanNodeIDMap.begin(); itLanNode != m_LanNodeIDMap.end(); itLanNode++) ! if(itLanNode->second.Name == LanName) { Node PermNode; --- 97,111 ---- } ! void CGnuLocal::JoinLan(CharString LanName) { m_pPrefs->m_LanName = LanName; ! CharString LocalHost; UINT nPort; GetSockName(LocalHost, nPort); std::map<int, LanNode>::iterator itLanNode; ! for (itLanNode = m_LanNodeIDMap.begin(); itLanNode != m_LanNodeIDMap.end(); itLanNode++) ! if (itLanNode->second.Name == LanName) { Node PermNode; *************** *** 114,118 **** PermNode.Port = itLanNode->second.Port; ! if(PermNode.Host != LocalHost) m_pComm->m_pCache->m_PermNodes.push_back(PermNode); } --- 113,117 ---- PermNode.Port = itLanNode->second.Port; ! if (PermNode.Host != LocalHost) m_pComm->m_pCache->m_PermNodes.push_back(PermNode); } *************** *** 142,163 **** m_LanNodeIDMap.clear(); ! CString NetworkPing; ! NetworkPing = m_pCore->NetworkName; ! NetworkPing += " PING\r\n"; ! NetworkPing += "Port: " + DWrdtoStr(m_pComm->m_CurrentPort) + "\r\n"; if(m_pPrefs->m_LanMode && m_pPrefs->m_LanName != "") { ! NetworkPing += "LAN: " + m_pPrefs->m_LanName + "\r\n"; ! CString RandCache = m_pCore->m_pCache->GetRandWebCache(true); ! if(!RandCache.IsEmpty()) ! NetworkPing += "WebCache: " + RandCache + "\r\n"; } - - NetworkPing += "\r\n"; --- 141,164 ---- m_LanNodeIDMap.clear(); ! CharString NetworkPing; ! NetworkPing = m_pCore->NetworkName + " PING\r\n"; ! NetworkPing += "Port: "; ! NetworkPing += DWrdtoStr(m_pComm->m_CurrentPort) + "\r\n"; if(m_pPrefs->m_LanMode && m_pPrefs->m_LanName != "") { ! NetworkPing += "LAN: "; ! NetworkPing += m_pPrefs->m_LanName + "\r\n"; ! CharString RandCache = m_pCore->m_pCache->GetRandWebCache(true); ! if (!RandCache.IsEmpty()) ! { ! NetworkPing += "WebCache: "; ! NetworkPing += RandCache + "\r\n"; ! } } NetworkPing += "\r\n"; *************** *** 172,177 **** byte buffer[1024]; ! CString Host, LocalHost, NetworkPing, NetworkPong; ! CString LanName, IRCAddr, InfoURL; UINT Port, LocalPort, Leaves = 0; --- 173,178 ---- byte buffer[1024]; ! CharString Host, LocalHost, NetworkPing, NetworkPong; ! CharString LanName, IRCAddr, InfoURL; UINT Port, LocalPort, Leaves = 0; *************** *** 182,201 **** // Handle Errors ! if(!buffLength || buffLength == SOCKET_ERROR) return; ! CString strBuffer((char*) buffer, 128); ! NetworkPing = m_pCore->NetworkName; ! NetworkPing += " PING\r\n"; ! NetworkPong = m_pCore->NetworkName; ! NetworkPong += " PONG\r\n"; // Handle Ping over LAN ! if(strBuffer.Find(NetworkPing) == 0) { ! if(Host == LocalHost) { m_pCore->LogError("UDP: Ping received from localhost"); --- 183,200 ---- // Handle Errors ! if (!buffLength || buffLength == SOCKET_ERROR) return; ! CharString strBuffer((char*) buffer, 128); ! NetworkPing = m_pCore->NetworkName + " PING\r\n"; ! NetworkPong = m_pCore->NetworkName + " PONG\r\n"; // Handle Ping over LAN ! if (strBuffer.Find(NetworkPing) == 0) { ! if (Host == LocalHost) { m_pCore->LogError("UDP: Ping received from localhost"); *************** *** 204,226 **** // Send back pong only if not a leaf ! NetworkPong += "Port: " + DWrdtoStr(m_pComm->m_CurrentPort) + "\r\n"; ! if(m_pPrefs->m_LanMode) { ! NetworkPong += "LAN: " + m_pPrefs->m_LanName + "\r\n"; ! CString RandCache = m_pCore->m_pCache->GetRandWebCache(true); ! if(!RandCache.IsEmpty()) ! NetworkPing += "WebCache: " + RandCache + "\r\n"; } // Leaves header ! if(m_pComm->m_NodeCapability == CLIENT_ULTRAPEER) { int Leaves = m_pComm->CountLeafConnects(); ! if(Leaves) ! NetworkPong += "Leaves: " + DWrdtoStr(Leaves) + "\r\n"; } --- 203,233 ---- // Send back pong only if not a leaf ! NetworkPong += "Port: "; ! NetworkPong += DWrdtoStr(m_pComm->m_CurrentPort) + "\r\n"; ! if (m_pPrefs->m_LanMode) { ! NetworkPong += "LAN: "; ! NetworkPong += m_pPrefs->m_LanName + "\r\n"; ! CharString RandCache = m_pCore->m_pCache->GetRandWebCache(true); ! if (!RandCache.IsEmpty()) ! { ! NetworkPing += "WebCache: "; ! NetworkPing += RandCache + "\r\n"; ! } } // Leaves header ! if (m_pComm->m_NodeCapability == CLIENT_ULTRAPEER) { int Leaves = m_pComm->CountLeafConnects(); ! if (Leaves) ! { ! NetworkPong += "Leaves: "; ! NetworkPong += DWrdtoStr(Leaves) + "\r\n"; ! } } *************** *** 236,245 **** SendTo(NetworkPong, NetworkPong.GetLength(), UDP_PORT, Host); ! m_pCore->LogError("UDP: Pong Sent to " + Host + ":" + DWrdtoStr(Port)); } // Extract Data from ping/pong ! if(strBuffer.Find(NetworkPing) == 0 || strBuffer.Find(NetworkPong) == 0) { int pos, backpos; --- 243,252 ---- SendTo(NetworkPong, NetworkPong.GetLength(), UDP_PORT, Host); ! m_pCore->LogError ("UDP: Pong Sent to " + Host + ":" + DWrdtoStr(Port)); } // Extract Data from ping/pong ! if (strBuffer.Find(NetworkPing) == 0 || strBuffer.Find(NetworkPong) == 0) { int pos, backpos; *************** *** 265,269 **** pos += 2; backpos = strBuffer.Find("\r\n", pos); ! CString NewWebCache = strBuffer.Mid(pos + 10, backpos - pos - 10); m_pCore->m_pCache->WebCacheAddCache(NewWebCache); --- 272,276 ---- pos += 2; backpos = strBuffer.Find("\r\n", pos); ! CharString NewWebCache = strBuffer.Mid(pos + 10, backpos - pos - 10); m_pCore->m_pCache->WebCacheAddCache(NewWebCache); *************** *** 297,306 **** // Handle Pong over LAN ! if(strBuffer.Find(NetworkPong) == 0) { ! CString Extra; ! if(Leaves) ! Extra = " with " + DWrdtoStr(Leaves) + " leaves"; m_pCore->LogError("UDP: Pong Received from " + Host + ":" + DWrdtoStr(Port) + Extra); --- 304,316 ---- // Handle Pong over LAN ! if (strBuffer.Find(NetworkPong) == 0) { ! CharString Extra; ! if (Leaves) ! { ! Extra = " with "; ! Extra += DWrdtoStr(Leaves) + " leaves"; ! } m_pCore->LogError("UDP: Pong Received from " + Host + ":" + DWrdtoStr(Port) + Extra); *************** *** 309,314 **** std::map<int, LanNode>::iterator itNode; ! for(itNode = m_LanNodeIDMap.begin(); itNode != m_LanNodeIDMap.end(); itNode++) ! if( itNode->second.Host == Host && itNode->second.Port == Port) return; --- 319,324 ---- std::map<int, LanNode>::iterator itNode; ! for (itNode = m_LanNodeIDMap.begin(); itNode != m_LanNodeIDMap.end(); itNode++) ! if (itNode->second.Host == Host && itNode->second.Port == Port) return; *************** *** 327,331 **** // If we're not in lan mode, just add to cache ! if(!m_pPrefs->m_LanMode) { Node PermNode; --- 337,341 ---- // If we're not in lan mode, just add to cache ! if (!m_pPrefs->m_LanMode) { Node PermNode; *************** *** 333,337 **** PermNode.Port = Port; ! if(PermNode.Host != LocalHost) m_pComm->m_pCache->m_PermNodes.push_back(PermNode); } --- 343,347 ---- PermNode.Port = Port; ! if (PermNode.Host != LocalHost) m_pComm->m_pCache->m_PermNodes.push_back(PermNode); } Index: GnuLocal.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuLocal.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GnuLocal.h 28 May 2003 05:18:09 -0000 1.5 --- GnuLocal.h 9 Jul 2003 00:55:35 -0000 1.6 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 27,30 **** --- 27,31 ---- #ifndef OPENGCC #pragma once + typedef CString CharString; #endif *************** *** 48,52 **** void LanModeOn(); void LanModeOff(); ! void JoinLan(CString LanName); void SendPing(); --- 49,53 ---- void LanModeOn(); void LanModeOff(); ! void JoinLan(CharString LanName); void SendPing(); |
From: <ri...@us...> - 2003-07-09 01:28:03
|
Update of /cvsroot/gnucula/Gnucula/platform/opengcc In directory sc8-pr-cvs1:/tmp/cvs-serv28148/platform/opengcc Modified Files: strings.cpp strings.h Log Message: syntactical fixes Index: strings.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/strings.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** strings.cpp 8 Jul 2003 22:08:59 -0000 1.4 --- strings.cpp 9 Jul 2003 00:55:35 -0000 1.5 *************** *** 203,208 **** ! bool Strings::CompareNoCase(char *CompareMe) ! { int i; --- 203,208 ---- ! int Strings::CompareNoCase(char *CompareMe) ! { // exit conditions?? why int?? int i; *************** *** 211,220 **** if (*(TextPointer + i) + 32 != *(CompareMe + i)) if (*(TextPointer + i) != *(CompareMe + i) + 32) ! return false; if (*(CompareMe + i) != '\0') ! return false; ! return true; } --- 211,220 ---- if (*(TextPointer + i) + 32 != *(CompareMe + i)) if (*(TextPointer + i) != *(CompareMe + i) + 32) ! return -1; if (*(CompareMe + i) != '\0') ! return -1; ! return 0; } *************** *** 391,394 **** --- 391,395 ---- { int i = 0; + //Strings Ret; while (*(add_me + i) != '\0') i++; *************** *** 399,410 **** --- 400,414 ---- *(text_out + StringLength + i + 1) = '\0'; return text_out; + //return Ret; } char *Strings::operator+(Strings &CopyFrom) { + //Strings Ret; int length = CopyFrom.GetLength(); char *new_text = new char[length]; CopyFrom.CopyText(new_text); + //Ret = new_text; return new_text; } Index: strings.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/strings.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** strings.h 8 Jul 2003 22:08:59 -0000 1.6 --- strings.h 9 Jul 2003 00:55:35 -0000 1.7 *************** *** 62,66 **** int Find(char *, int = 0); int ReverseFind(char *); ! bool CompareNoCase(char *); Strings Mid(int = 0, int = 0); Strings Left(int); // start 'til int --- 62,66 ---- int Find(char *, int = 0); int ReverseFind(char *); ! int CompareNoCase(char *); Strings Mid(int = 0, int = 0); Strings Left(int); // start 'til int |
From: <ri...@us...> - 2003-07-08 22:09:02
|
Update of /cvsroot/gnucula/Gnucula In directory sc8-pr-cvs1:/tmp/cvs-serv30280 Modified Files: GnuDownloadShell.cpp GnuDownloadShell.h Log Message: string enhancements; syntax fixes Index: GnuDownloadShell.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuDownloadShell.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GnuDownloadShell.cpp 4 Jul 2003 20:23:12 -0000 1.8 --- GnuDownloadShell.cpp 8 Jul 2003 22:08:59 -0000 1.9 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall [...1045 lines suppressed...] *** 1482,1486 **** m_Queue[itHost->second].Corrupt = true; ! for (i = PartNumber; i < m_PartList.size(); i++) if (m_PartList[i].StartByte < pPart->StartByte + m_TreeRes) { --- 1494,1498 ---- m_Queue[itHost->second].Corrupt = true; ! for (int i = PartNumber; i < m_PartList.size(); i++) if (m_PartList[i].StartByte < pPart->StartByte + m_TreeRes) { *************** *** 1488,1492 **** m_PartList[i].SourceHostID = 0; } - return false; } --- 1500,1503 ---- Index: GnuDownloadShell.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuDownloadShell.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GnuDownloadShell.h 4 Jul 2003 20:23:12 -0000 1.9 --- GnuDownloadShell.h 8 Jul 2003 22:08:59 -0000 1.10 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 27,30 **** --- 27,31 ---- #ifndef OPENGCC #pragma once + typedef CString CharString; #endif *************** *** 47,51 **** virtual ~CGnuDownloadShell(); ! void Init(CString Name, int FileSize, int HashID, CString Hash); void AddHost(Result); --- 48,52 ---- virtual ~CGnuDownloadShell(); ! void Init(CharString Name, int FileSize, int HashID, CharString Hash); void AddHost(Result); *************** *** 54,60 **** bool CheckCompletion(); ! void AddAltLocation(CString); void AddAltLocation(AltLocation); ! CString GetAltLocationHeader(CString ToIP, int HostCount=5); bool CheckCompletion(); --- 55,61 ---- bool CheckCompletion(); ! void AddAltLocation(CharString); void AddAltLocation(AltLocation); ! CharString GetAltLocationHeader(CharString ToIP, int HostCount=5); bool CheckCompletion(); *************** *** 76,80 **** int GetBytesCompleted(); ! CString GetFilePath(); void RunFile(); --- 77,81 ---- int GetBytesCompleted(); ! CharString GetFilePath(); void RunFile(); *************** *** 89,93 **** int m_BackupInterval; ! CString AvailableRangesCommaSeparated(); int GetRange(int pos, unsigned char *buf, int len); --- 90,94 ---- int m_BackupInterval; ! CharString AvailableRangesCommaSeparated(); int GetRange(int pos, unsigned char *buf, int len); *************** *** 120,133 **** int m_Retry; ! CString m_ReasonDead; bool m_UpdatedInSecond; ! CString m_Name; ! CString m_FilePath; ! CString m_PartialPath; ! CString m_BackupPath; ! CString m_Sha1Hash; ! CString m_TigerHash; byte* m_TigerTree; --- 121,134 ---- int m_Retry; ! CharString m_ReasonDead; bool m_UpdatedInSecond; ! CharString m_Name; ! CharString m_FilePath; ! CharString m_PartialPath; ! CharString m_BackupPath; ! CharString m_Sha1Hash; ! CharString m_TigerHash; byte* m_TigerTree; *************** *** 135,141 **** int m_TreeRes; ! CString m_Search; GUID m_SearchGuid; ! CString m_Meta; std::vector<CGnuDownload*> m_Sockets; --- 136,142 ---- int m_TreeRes; ! CharString m_Search; GUID m_SearchGuid; ! CharString m_Meta; std::vector<CGnuDownload*> m_Sockets; |
From: <ri...@us...> - 2003-07-08 22:09:02
|
Update of /cvsroot/gnucula/Gnucula/platform/opengcc In directory sc8-pr-cvs1:/tmp/cvs-serv30280/platform/opengcc Modified Files: strings.cpp strings.h Log Message: string enhancements; syntax fixes Index: strings.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/strings.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** strings.cpp 8 Jul 2003 07:43:50 -0000 1.3 --- strings.cpp 8 Jul 2003 22:08:59 -0000 1.4 *************** *** 26,30 **** #include "strings.h" ! #ifdef DEBUG #include "../../../console_interface/console_io.h" #endif --- 26,30 ---- #include "strings.h" ! #ifdef DEBUG // used for debugging. external to gnuc. #include "../../../console_interface/console_io.h" #endif *************** *** 149,161 **** ! int Strings::Find(char *FindMe) { ! for (int i = 0; *(TextPointer + i) != '\0'; i++) if (*(TextPointer + i) == *FindMe) { for (int j = 0; *(FindMe + j) != '\0'; j++) if (*(TextPointer + i + j) != *(FindMe + j)) break; ! return i; // start-pos } --- 149,200 ---- ! void Strings::MakeUpper(void) { ! for (int i = 0; *(TextPointer + i); i++) ! if (*(TextPointer + i) >= 'a' && *(TextPointer + i) <= 'z') ! *(TextPointer + i) = *(TextPointer + i) - 32; ! } ! ! ! int Strings::Find(char *FindMe, int startpos) ! { ! bool Mismatch = false; ! for (int i = startpos; *(TextPointer + i) != '\0'; i++) ! if (*(TextPointer + i) == *FindMe) ! { ! for (int j = 0; *(FindMe + j) != '\0'; j++) ! if (*(TextPointer + i + j) != *(FindMe + j)) ! { ! Mismatch = true; ! break; ! } ! else ! Mismatch = false; ! ! if (!Mismatch) ! return i; // startpos of 'found' chars ! } ! ! return -1; ! } ! ! ! int Strings::ReverseFind(char *FindMe) ! { ! bool Mismatch = false; ! for (int i = StringLength - 1; *(TextPointer + i) != '\0'; i--) if (*(TextPointer + i) == *FindMe) { for (int j = 0; *(FindMe + j) != '\0'; j++) if (*(TextPointer + i + j) != *(FindMe + j)) + { + Mismatch = true; break; ! } ! else ! Mismatch = false; ! ! if (!Mismatch) ! return i; // startpos of 'found' chars } *************** *** 163,166 **** --- 202,223 ---- } + + bool Strings::CompareNoCase(char *CompareMe) + { + int i; + + for (i = 0; *(TextPointer + i) != '\0'; i++) + if (*(TextPointer + i) != *(CompareMe + i)) + if (*(TextPointer + i) + 32 != *(CompareMe + i)) + if (*(TextPointer + i) != *(CompareMe + i) + 32) + return false; + + if (*(CompareMe + i) != '\0') + return false; + + return true; + } + + Strings Strings::Mid(int startpos, int endpos) { *************** *** 194,197 **** --- 251,388 ---- + Strings Strings::Right(int startpos) + { + Strings ret = Mid(startpos); + return ret; + } + + + void Strings::Insert(int pos, char *InsertMe) + { + int i, j; + + // count strings length + for (i = 0; *(InsertMe + i) != '\0'; i++) { + ; } + + if (i == 0) + return; + + StringLength += i; + char *NewString = new char[StringLength]; + + for (i = 0; i < pos; i++) + *(NewString + i) = *(TextPointer + i); + + for (j = 0; *(InsertMe + j) != '\0'; j++) + { + *(NewString + i + j) = *(InsertMe + j); + } + // copy the rest and cap the string + for ( ; *(TextPointer + i) != '\0'; i++) + *(NewString + i + j) = *(TextPointer + i); + *(NewString + i + j) = '\0'; + + TextPointer = NewString; + } + + + void Strings::Replace(char *ReplaceMe, char *NewText) + { + int ReplacePos = 0, NewTextLen = 0, OldTextLen = 0, Occurrences = 0, i; + #ifdef DDEBUG + Console_Output debug_io; + // debug_io.kwik_out("in replace"); + #endif + + // count strings length + for (i = 0; *(NewText + i) != '\0'; i++) { + ; } + NewTextLen = i; + for (i = 0; *(ReplaceMe + i) != '\0'; i++) { + ; } + OldTextLen = i; + #ifdef DDEBUG + debug_io.multiline_output("NewTextLen:", " "); + debug_io.kwik_out(NewTextLen); + debug_io.multiline_output("OldTextLen:", " "); + debug_io.kwik_out(OldTextLen); + #endif + // count occurrences + i = 0; + while (i >= 0) + { + Occurrences++; + i = Find(ReplaceMe, i + 1); + #ifdef DDEBUG + debug_io.multiline_output("Occurrences:", " "); + debug_io.kwik_out(Occurrences); + debug_io.multiline_output("i:", " "); + debug_io.kwik_out(i); + #endif + } + Occurrences--; + + #ifdef DDEBUG + debug_io.multiline_output("Occurrences:", " "); + debug_io.kwik_out(Occurrences); + #endif + + if (Occurrences == 0) + return; + + int OrigLen = StringLength; + StringLength = StringLength + ((NewTextLen - OldTextLen) * Occurrences) + 1; + char *NewString = new char[StringLength]; + int lastread = 0, lastwrite = 0; + + #ifdef DDEBUG + debug_io.multiline_output("New length:", " "); + debug_io.kwik_out(StringLength); + debug_io.multiline_output("Old length:", " "); + debug_io.kwik_out(OrigLen); + #endif + + while (ReplacePos >= 0) + { + ReplacePos = Find(ReplaceMe, lastread + 1); + #ifdef DDEBUG + debug_io.multiline_output("Replacing at:", " "); + debug_io.kwik_out(ReplacePos); + #endif + if (ReplacePos >= 0) + { + for (i = lastread; i < ReplacePos; i++) + { + *(NewString + lastwrite) = *(TextPointer + i); + lastwrite++; + lastread++; + } + for (int j = 0; j <= NewTextLen; j++) + *(NewString + lastwrite + j) = *(NewText + j); + lastwrite += NewTextLen; + } + else + { // copy the rest and cap the string + for (i = lastread; i < OrigLen; i++, lastwrite++) + *(NewString + lastwrite) = *(TextPointer + i); + *(NewString + StringLength) = '\0'; + } + lastread += OldTextLen; + #ifdef DDEBUG + debug_io.multiline_output("lastread is:", " "); + debug_io.kwik_out(lastread); + debug_io.multiline_output("lastwrite is:", " "); + debug_io.kwik_out(lastwrite); + #endif + } + TextPointer = NewString; + } + + + void Strings::Remove(char *RemoveMe) + { + Replace(RemoveMe, ""); + } Index: strings.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/strings.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** strings.h 8 Jul 2003 08:55:08 -0000 1.5 --- strings.h 8 Jul 2003 22:08:59 -0000 1.6 *************** *** 24,27 **** --- 24,32 ---- ********************************************************************************/ + + /* Note that the code here, though similar to base classes in some compilers and libraries, + it is solely intended as a workaround to maintain semantics of existing code, not to + replace those libraries. It will not be developed beyond what is needed by existing code. */ + #ifndef STRINGS_H #define STRINGS_H *************** *** 54,66 **** bool IsEmpty(void); void MakeLower(void); ! // void MakeUpper(void); ! int Find(char *); //int startpos); ! // int ReverseFind(char *); ! // bool CompareNoCase Strings Mid(int = 0, int = 0); Strings Left(int); // start 'til int ! // Strings Right(int); ! // void Replace(char *, char *); ! // void Remove(char *); // operator overloads --- 59,72 ---- bool IsEmpty(void); void MakeLower(void); ! void MakeUpper(void); ! int Find(char *, int = 0); ! int ReverseFind(char *); ! bool CompareNoCase(char *); Strings Mid(int = 0, int = 0); Strings Left(int); // start 'til int ! Strings Right(int); ! void Insert(int, char *); ! void Replace(char *, char *); ! void Remove(char *); // operator overloads |
From: <ri...@us...> - 2003-07-08 08:55:12
|
Update of /cvsroot/gnucula/Gnucula In directory sc8-pr-cvs1:/tmp/cvs-serv32282 Modified Files: GnuControl.cpp GnuControl.h GnuCore.cpp GnuCore.h GnuDownload.cpp GnuDownload.h Log Message: syntactical changes (new string class) Index: GnuControl.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuControl.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** GnuControl.cpp 6 Jul 2003 20:35:33 -0000 1.12 --- GnuControl.cpp 8 Jul 2003 08:55:08 -0000 1.13 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 282,286 **** // See if any downloads have the same keywords and use same guid int i; ! CString QueryText = (char*) Packet + 25; if (!QueryText.IsEmpty()) --- 282,286 ---- // See if any downloads have the same keywords and use same guid int i; ! CharString QueryText = (char*) Packet + 25; if (!QueryText.IsEmpty()) *************** *** 420,424 **** // Node control ! void CGnuControl::AddNode(CString Host, UINT Port) { if (FindNode(Host, Port) != NULL) --- 420,424 ---- // Node control ! void CGnuControl::AddNode(CharString Host, UINT Port) { if (FindNode(Host, Port) != NULL) *************** *** 462,466 **** } ! CGnuNode* CGnuControl::FindNode(CString Host, UINT Port) { for (int i = 0; i < m_NodeList.size(); i++) --- 462,466 ---- } ! CGnuNode* CGnuControl::FindNode(CharString Host, UINT Port) { for (int i = 0; i < m_NodeList.size(); i++) Index: GnuControl.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuControl.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GnuControl.h 4 Jul 2003 20:23:12 -0000 1.8 --- GnuControl.h 8 Jul 2003 08:55:08 -0000 1.9 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 27,30 **** --- 27,31 ---- #ifndef OPENGCC #pragma once + typedef CString CharString; #endif *************** *** 82,88 **** // Node control ! void AddNode(CString, UINT); void RemoveNode(CGnuNode*); ! CGnuNode* FindNode(CString, UINT); --- 83,89 ---- // Node control ! void AddNode(CharString, UINT); void RemoveNode(CGnuNode*); ! CGnuNode* FindNode(CharString, UINT); Index: GnuCore.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuCore.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** GnuCore.cpp 4 Jul 2003 22:06:13 -0000 1.12 --- GnuCore.cpp 8 Jul 2003 08:55:08 -0000 1.13 *************** *** 2,6 **** Gnucula - A Gnutella Library Based On GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based On GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 271,280 **** } ! CString CGnuCore::GetUserAgent() { ! return m_ClientName + " " + m_ClientVersion + " (Gnucula " + CString(GNUCULA_VERSION) + ")"; } ! void CGnuCore::LogError(CString Error) { ////ASSERT(0); --- 271,280 ---- } ! CharString CGnuCore::GetUserAgent() { ! return m_ClientName + " " + m_ClientVersion + " (Gnucula " + CharString(GNUCULA_VERSION) + ")"; } ! void CGnuCore::LogError(CharString Error) { ////ASSERT(0); Index: GnuCore.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuCore.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GnuCore.h 31 May 2003 08:53:00 -0000 1.9 --- GnuCore.h 8 Jul 2003 08:55:08 -0000 1.10 *************** *** 2,6 **** Gnucula - A Gnutella Library Based On GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based On GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 28,31 **** --- 28,32 ---- #ifndef OPENGCC #pragma once + typedef CString CharString; #endif *************** *** 60,75 **** void _SetCPUSpeed(); ! void LogError(CString); ! CString GetUserAgent(); ! void InitTimer (); void EndTimer (); // Client properties ! CString m_ClientName; ! CString m_ClientVersion; ! CString m_ClientCode; bool ModeVersion6; ! CString NetworkName; ! CString m_RunPath; bool m_ConnectingActive; // Auto-Connecting or user managed? --- 61,77 ---- void _SetCPUSpeed(); ! void LogError(CharString); ! CharString GetUserAgent(); ! void InitTimer (); ! void EndTimer (); // Client properties ! CharString m_ClientName; ! CharString m_ClientVersion; ! CharString m_ClientCode; bool ModeVersion6; ! CharString NetworkName; ! CharString m_RunPath; bool m_ConnectingActive; // Auto-Connecting or user managed? *************** *** 86,91 **** ! std::vector<CString> m_Credits; ! CString m_License; //CComCore* m_comCore; // Parent object --- 88,93 ---- ! std::vector<CharString> m_Credits; ! CharString m_License; //CComCore* m_comCore; // Parent object Index: GnuDownload.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuDownload.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GnuDownload.cpp 6 Jul 2003 20:35:33 -0000 1.10 --- GnuDownload.cpp 8 Jul 2003 08:55:08 -0000 1.11 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 209,213 **** if( memcmp(m_pBuff, CheckBytes, BuffLength) != 0 ) { ! CString Problem = "Write Check Failed: " + m_pShell->m_Name *//*IPtoStr(HostInfo()->Host) + " (" + m_ServerName + ")*//* + " -- StartByte=" + DWrdtoStr(CurrentPart.StartByte) + ", CurrentPos=" + DWrdtoStr(CurrentPart.StartByte + CurrentPart.BytesCompleted) + ", RecvBytes=" + DWrdtoStr(BuffLength); m_pShell->m_pTrans->m_pCore->DebugLog(Problem); } --- 209,213 ---- if( memcmp(m_pBuff, CheckBytes, BuffLength) != 0 ) { ! CharString Problem = "Write Check Failed: " + m_pShell->m_Name *//*IPtoStr(HostInfo()->Host) + " (" + m_ServerName + ")*//* + " -- StartByte=" + DWrdtoStr(CurrentPart.StartByte) + ", CurrentPos=" + DWrdtoStr(CurrentPart.StartByte + CurrentPart.BytesCompleted) + ", RecvBytes=" + DWrdtoStr(BuffLength); m_pShell->m_pTrans->m_pCore->DebugLog(Problem); } *************** *** 243,247 **** } ! int FileBegin = -1; // Read buffer --- 243,247 ---- } ! int FileBegin = -1; // Read buffer *************** *** 255,259 **** char* xFilename = "X-Filename"; ! if( BuffLength > i + 11 && memcmp( &m_pBuff[i + 1], xFilename, 10) == 0) { m_Header.Replace("\r\n\r\n", "\r\n"); --- 255,259 ---- char* xFilename = "X-Filename"; ! if (BuffLength > i + 11 && memcmp( &m_pBuff[i + 1], xFilename, 10) == 0) { m_Header.Replace("\r\n\r\n", "\r\n"); *************** *** 282,291 **** // Verify HTTP header ! CString StatusLine = m_Header.Left(m_Header.Find("\r\n")); m_Header = m_Header.Mid(StatusLine.GetLength() + 2); int Code = 0; ! CString httpVersion; ! CString ReasonPhrase; int spacepos = StatusLine.Find(' '); --- 282,291 ---- // Verify HTTP header ! CharString StatusLine = m_Header.Left(m_Header.Find("\r\n")); m_Header = m_Header.Mid(StatusLine.GetLength() + 2); int Code = 0; ! CharString httpVersion; ! CharString ReasonPhrase; int spacepos = StatusLine.Find(' '); *************** *** 330,339 **** // Get Tiger Root Hash ! CString TigerURN = ParsedHeaders.FindHeader("X-TigerTree-Path"); TigerURN.MakeLower(); if (TigerURN.Left(39) == "/gnutella/tigertree/v3?urn:tree:tiger/:") { ! CString TigerHash = TigerURN.Mid(39); TigerHash.MakeUpper(); --- 330,339 ---- // Get Tiger Root Hash ! CharString TigerURN = ParsedHeaders.FindHeader("X-TigerTree-Path"); TigerURN.MakeLower(); if (TigerURN.Left(39) == "/gnutella/tigertree/v3?urn:tree:tiger/:") { ! CharString TigerHash = TigerURN.Mid(39); TigerHash.MakeUpper(); *************** *** 353,359 **** // Get Hash and add host as an alt-loc ! CString Sha1URN = ParsedHeaders.FindHeader("X-Gnutella-Content-URN"); Sha1URN.MakeLower(); ! CString RemoteFileHash; if (Sha1URN.Left(9) == "urn:sha1:") --- 353,359 ---- // Get Hash and add host as an alt-loc ! CharString Sha1URN = ParsedHeaders.FindHeader("X-Gnutella-Content-URN"); Sha1URN.MakeLower(); ! CharString RemoteFileHash; if (Sha1URN.Left(9) == "urn:sha1:") *************** *** 396,400 **** //Look for X-Available-Ranges header ! CString RemoteRanges = ParsedHeaders.FindHeader("X-Available-Ranges"); HostInfo()->AvailableRanges.clear(); --- 396,400 ---- //Look for X-Available-Ranges header ! CharString RemoteRanges = ParsedHeaders.FindHeader("X-Available-Ranges"); HostInfo()->AvailableRanges.clear(); *************** *** 405,413 **** if (RemoteRanges.Left(6) == "bytes ") { ! CString AvailableRanges = RemoteRanges.Mid(6); while(!AvailableRanges.IsEmpty()) { ! CString tmpRange = ParseString(AvailableRanges); RangeType NewRange; --- 405,413 ---- if (RemoteRanges.Left(6) == "bytes ") { ! CharString AvailableRanges = RemoteRanges.Mid(6); while(!AvailableRanges.IsEmpty()) { ! CharString tmpRange = ParseString(AvailableRanges); RangeType NewRange; *************** *** 432,437 **** for (i = 0; i < ParsedHeaders.m_Headers.size(); i++) { ! CString HeaderName = ParsedHeaders.m_Headers[i].Name; ! CString HeaderValue = ParsedHeaders.m_Headers[i].Value; // Conent-Length --- 432,437 ---- for (i = 0; i < ParsedHeaders.m_Headers.size(); i++) { ! CharString HeaderName = ParsedHeaders.m_Headers[i].Name; ! CharString HeaderValue = ParsedHeaders.m_Headers[i].Value; // Conent-Length *************** *** 593,599 **** for (i = 0; i < ParsedHeaders.m_Headers.size(); i++) { ! CString HeaderName = ParsedHeaders.m_Headers[i].Name; HeaderName.MakeLower(); ! CString HeaderValue = ParsedHeaders.m_Headers[i].Value; if (HeaderName.Right(12) == "alt-location" || HeaderName.Right(18) == "alternate-location") --- 593,599 ---- for (i = 0; i < ParsedHeaders.m_Headers.size(); i++) { ! CharString HeaderName = ParsedHeaders.m_Headers[i].Name; HeaderName.MakeLower(); ! CharString HeaderValue = ParsedHeaders.m_Headers[i].Value; if (HeaderName.Right(12) == "alt-location" || HeaderName.Right(18) == "alternate-location") *************** *** 608,612 **** if (HeaderValue.Find("position=full") != -1 || \ ! (ReasonPhrase.Right(10).CompareNoCase("queue full") == 0)) RemotelyQueued = false; --- 608,612 ---- if (HeaderValue.Find("position=full") != -1 || \ ! (ReasonPhrase.Right(10).CompareNoCase("queue full") == 0)) RemotelyQueued = false; *************** *** 648,652 **** if (RemotelyQueued) { ! SetError("Number " + DWrdtoStr(m_QueuePos) + " in Queue of " + DWrdtoStr(m_QueueLength)); StatusUpdate(TRANSFER_QUEUED); /* TODO: Tor: Remove (QueueTrace) */ --- 648,656 ---- if (RemotelyQueued) { ! CharString Error; ! Error = "Number ";; ! Error += DWrdtoStr(m_QueuePos) + " in Queue of "; ! Error += DWrdtoStr(m_QueueLength); ! SetError(Error); StatusUpdate(TRANSFER_QUEUED); /* TODO: Tor: Remove (QueueTrace) */ *************** *** 844,848 **** } ! CString GetFile; // If we have a hash, request by hash --- 848,852 ---- } ! CharString GetFile; // If we have a hash, request by hash *************** *** 859,871 **** // Add host header ! CString Host; Host.Format("Host: %s:%i\r\n", IPtoStr(HostInfo()->Host), HostInfo()->Port); GetFile += Host; // Add user-agent header ! GetFile += "User-Agent: " + m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Listen-IP header Listen-IP: 0.0.0.0:634 ! GetFile += "Listen-IP: " + IPtoStr(m_pComm->m_CurrentIP) + ":" + DWrdtoStr(m_pComm->m_CurrentPort) + "\r\n"; // Connection header --- 863,878 ---- // Add host header ! CharString Host; Host.Format("Host: %s:%i\r\n", IPtoStr(HostInfo()->Host), HostInfo()->Port); GetFile += Host; // Add user-agent header ! GetFile += "User-Agent: "; ! GetFile += m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Listen-IP header Listen-IP: 0.0.0.0:634 ! GetFile += "Listen-IP: "; ! GetFile += IPtoStr(m_pComm->m_CurrentIP) + ":"; ! GetFile += DWrdtoStr(m_pComm->m_CurrentPort) + "\r\n"; // Connection header *************** *** 873,887 **** if (!m_DoHead) ! GetFile += "Range: bytes=" + DWrdtoStr(m_StartPos) + "-" + DWrdtoStr(m_PausePos - 1) + "\r\n"; ! // X-Queue GetFile += "X-Queue: 0.1\r\n"; - // X-Gnutella-Content-URN if (!m_pShell->m_Sha1Hash.IsEmpty()) { ! GetFile += "X-Gnutella-Content-URN: urn:sha1:" + m_pShell->m_Sha1Hash + "\r\n"; //Include self if not firewalled. File is partially shared. --- 880,897 ---- if (!m_DoHead) ! { ! GetFile += "Range: bytes="; ! GetFile += DWrdtoStr(m_StartPos) + "-"; ! GetFile += DWrdtoStr(m_PausePos - 1) + "\r\n"; ! } // X-Queue GetFile += "X-Queue: 0.1\r\n"; // X-Gnutella-Content-URN if (!m_pShell->m_Sha1Hash.IsEmpty()) { ! GetFile += "X-Gnutella-Content-URN: urn:sha1:"; ! GetFile += m_pShell->m_Sha1Hash + "\r\n"; //Include self if not firewalled. File is partially shared. *************** *** 889,893 **** if (!m_pTrans->m_pCore->m_RealFirewall && m_pShell->GetBytesCompleted()) { ! CString LocalIP = IPtoStr( m_pComm->m_CurrentIP); if (m_pPrefs->m_ForcedHost.S_addr) --- 899,903 ---- if (!m_pTrans->m_pCore->m_RealFirewall && m_pShell->GetBytesCompleted()) { ! CharString LocalIP = IPtoStr( m_pComm->m_CurrentIP); if (m_pPrefs->m_ForcedHost.S_addr) *************** *** 895,900 **** DWORD LocalPort = m_pComm->m_CurrentPort; ! CString AltStr = "http://" + LocalIP + ":" + DWrdtoStr(LocalPort) + "/uri-res/N2R?urn:sha1:" + m_pShell->m_Sha1Hash + " " + CTimeToStr(CTime::GetCurrentTime() - LocalTimeZone()); ! GetFile += "X-Gnutella-Alternate-Location: " + AltStr + "\r\n"; } --- 905,915 ---- DWORD LocalPort = m_pComm->m_CurrentPort; ! CharString AltStr = "http://"; ! AltStr += LocalIP + ":"; ! AltStr += DWrdtoStr(LocalPort) + "/uri-res/N2R?urn:sha1:"; ! AltStr += m_pShell->m_Sha1Hash + " "; ! AltStr += CTimeToStr(CTime::GetCurrentTime() - LocalTimeZone()); ! GetFile += "X-Gnutella-Alternate-Location: "; ! GetFile += AltStr + "\r\n"; } *************** *** 926,942 **** m_TigerRequest = true; ! CString GetTree; GetTree.Format("GET /gnutella/tigertree/v3?urn:tree:tiger/:%s HTTP/1.1\r\n", m_pShell->m_TigerHash); // Add host header ! CString Host; Host.Format("Host: %s:%i\r\n", IPtoStr(HostInfo()->Host), HostInfo()->Port); GetTree += Host; // Add user-agent header ! GetTree += "User-Agent: " + m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Listen-IP header Listen-IP: 0.0.0.0:634 ! GetTree += "Listen-IP: " + IPtoStr(m_pComm->m_CurrentIP) + ":" + DWrdtoStr(m_pComm->m_CurrentPort) + "\r\n"; // Connection header --- 941,960 ---- m_TigerRequest = true; ! CharString GetTree; GetTree.Format("GET /gnutella/tigertree/v3?urn:tree:tiger/:%s HTTP/1.1\r\n", m_pShell->m_TigerHash); // Add host header ! CharString Host; Host.Format("Host: %s:%i\r\n", IPtoStr(HostInfo()->Host), HostInfo()->Port); GetTree += Host; // Add user-agent header ! GetTree += "User-Agent: "; ! GetTree += m_pComm->m_pCore->GetUserAgent() + "\r\n"; // Listen-IP header Listen-IP: 0.0.0.0:634 ! GetTree += "Listen-IP: "; ! GetTree += IPtoStr(m_pComm->m_CurrentIP) + ":"; ! GetTree += DWrdtoStr(m_pComm->m_CurrentPort) + "\r\n"; // Connection header *************** *** 953,957 **** // End header ! GetTree += "\r\n"; // Send Header --- 971,975 ---- // End header ! GetTree += "\r\n"; // Send Header *************** *** 1145,1149 **** } ! void CGnuDownload::SetError(CString Error) { HostInfo()->Error = Error; --- 1163,1167 ---- } ! void CGnuDownload::SetError(CharString Error) { HostInfo()->Error = Error; *************** *** 1252,1258 **** } ! bool CGnuDownload::HandleAltLocation(CString Handshake) { ! CString FileHash; int urnPos = m_Header.Find("x-gnutella-content-urn: urn:sha1:"); if (urnPos != -1) --- 1270,1276 ---- } ! bool CGnuDownload::HandleAltLocation(CharString Handshake) { ! CharString FileHash; int urnPos = m_Header.Find("x-gnutella-content-urn: urn:sha1:"); if (urnPos != -1) *************** *** 1282,1286 **** endpos = m_Header.Find("\r\n", altpos); ! CString AltLocString = m_Header.Mid(altpos, endpos - altpos); m_pShell->AddAltLocation(AltLocString); --- 1300,1304 ---- endpos = m_Header.Find("\r\n", altpos); ! CharString AltLocString = m_Header.Mid(altpos, endpos - altpos); m_pShell->AddAltLocation(AltLocString); Index: GnuDownload.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuDownload.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GnuDownload.h 4 Jul 2003 20:23:12 -0000 1.8 --- GnuDownload.h 8 Jul 2003 08:55:08 -0000 1.9 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 27,30 **** --- 27,31 ---- #ifndef OPENGCC #pragma once + typedef CString CharString; #else #include "./platform/opengcc/typedefs.h" *************** *** 53,57 **** void StopDownload(); ! bool HandleAltLocation(CString); bool GetStartPos(); --- 54,58 ---- void StopDownload(); ! bool HandleAltLocation(CharString); bool GetStartPos(); *************** *** 67,71 **** void StatusUpdate(DWORD); ! void SetError(CString); void Timer(); --- 68,72 ---- void StatusUpdate(DWORD); ! void SetError(CharString); void Timer(); *************** *** 101,107 **** // Download Properties ! CString m_Request; ! CString m_Header; ! CString m_ServerName; int m_Status; bool m_Push; --- 102,108 ---- // Download Properties ! CharString m_Request; ! CharString m_Header; ! CharString m_ServerName; int m_Status; bool m_Push; |
From: <ri...@us...> - 2003-07-08 08:55:12
|
Update of /cvsroot/gnucula/Gnucula/platform/opengcc In directory sc8-pr-cvs1:/tmp/cvs-serv32282/platform/opengcc Modified Files: strings.h Log Message: syntactical changes (new string class) Index: strings.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/strings.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** strings.h 8 Jul 2003 08:11:03 -0000 1.4 --- strings.h 8 Jul 2003 08:55:08 -0000 1.5 *************** *** 55,60 **** void MakeLower(void); // void MakeUpper(void); ! int Find(char *); // int ReverseFind(char *); Strings Mid(int = 0, int = 0); Strings Left(int); // start 'til int --- 55,61 ---- void MakeLower(void); // void MakeUpper(void); ! int Find(char *); //int startpos); // int ReverseFind(char *); + // bool CompareNoCase Strings Mid(int = 0, int = 0); Strings Left(int); // start 'til int |
From: <ri...@us...> - 2003-07-08 08:32:33
|
Update of /cvsroot/gnucula/Gnucula In directory sc8-pr-cvs1:/tmp/cvs-serv29834 Modified Files: GnuAltLoc.cpp GnuAltLoc.h GnuCache.cpp GnuCache.h Log Message: syntactical changes (new string class) Index: GnuAltLoc.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuAltLoc.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GnuAltLoc.cpp 28 May 2003 05:18:09 -0000 1.4 --- GnuAltLoc.cpp 8 Jul 2003 08:32:30 -0000 1.5 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 46,50 **** } ! void CGnuAltLoc::AddAltLocation(CString& locStr, CString& Sha1Hash) { // Need to tidy up the string first --- 46,50 ---- } ! void CGnuAltLoc::AddAltLocation(CharString& locStr, CharString& Sha1Hash) { // Need to tidy up the string first *************** *** 54,58 **** // Parse first altlocations by comma ! CString temp = ParseString(locStr); while (!temp.IsEmpty()) --- 54,58 ---- // Parse first altlocations by comma ! CharString temp = ParseString(locStr); while (!temp.IsEmpty()) *************** *** 62,75 **** AltLoc.Sha1Hash = Sha1Hash; ! if( AltLoc.isValid() && m_pPrefs->AllowedIP(StrtoIP(AltLoc.HostPort.Host)) ) { m_pShare->m_FilesAccess.Lock(); ! for(int i = 0; i < m_pShare->m_SharedFiles.size(); i++) ! if(AltLoc.Sha1Hash == m_pShare->m_SharedFiles[i].HashValues[HASH_SHA1].c_str()) { bool found = false; ! for(int j = 0; j < m_pShare->m_SharedFiles[i].AltHosts.size(); j++) if (AltLoc == m_pShare->m_SharedFiles[i].AltHosts[j]) { --- 62,75 ---- AltLoc.Sha1Hash = Sha1Hash; ! if (AltLoc.isValid() && m_pPrefs->AllowedIP(StrtoIP(AltLoc.HostPort.Host))) { m_pShare->m_FilesAccess.Lock(); ! for (int i = 0; i < m_pShare->m_SharedFiles.size(); i++) ! if (AltLoc.Sha1Hash == m_pShare->m_SharedFiles[i].HashValues[HASH_SHA1].c_str()) { bool found = false; ! for (int j = 0; j < m_pShare->m_SharedFiles[i].AltHosts.size(); j++) if (AltLoc == m_pShare->m_SharedFiles[i].AltHosts[j]) { *************** *** 78,95 **** } ! if(!found) m_pShare->m_SharedFiles[i].AltHosts.push_back(AltLoc); ! ! if(m_pShare->m_SharedFiles[i].AltHosts.size() > 15) m_pShare->m_SharedFiles[i].AltHosts.pop_front(); } - m_pShare->m_FilesAccess.Unlock(); } - temp = ParseString(locStr); } - } --- 78,91 ---- } ! if (!found) m_pShare->m_SharedFiles[i].AltHosts.push_back(AltLoc); ! if (m_pShare->m_SharedFiles[i].AltHosts.size() > 15) m_pShare->m_SharedFiles[i].AltHosts.pop_front(); } m_pShare->m_FilesAccess.Unlock(); } temp = ParseString(locStr); } } *************** *** 97,112 **** // TODO: keep track of whats been returned and return only different // AltLocations to the same client ! CString CGnuAltLoc::GetAltLocationHeader(CString Sha1Hash, CString Host, int HostCount) { ! CString AltLocHeader; m_pShare->m_FilesAccess.Lock(); ! for(int i = 0; i < m_pShare->m_SharedFiles.size(); i++) ! if(Sha1Hash == m_pShare->m_SharedFiles[i].HashValues[HASH_SHA1].c_str()) { int j = 0; ! if(m_pShare->m_SharedFiles[i].AltHosts.size() < HostCount) HostCount = m_pShare->m_SharedFiles[i].AltHosts.size(); --- 93,108 ---- // TODO: keep track of whats been returned and return only different // AltLocations to the same client ! CharString CGnuAltLoc::GetAltLocationHeader(CharString Sha1Hash, CharString Host, int HostCount) { ! CharString AltLocHeader; m_pShare->m_FilesAccess.Lock(); ! for (int i = 0; i < m_pShare->m_SharedFiles.size(); i++) ! if (Sha1Hash == m_pShare->m_SharedFiles[i].HashValues[HASH_SHA1].c_str()) { int j = 0; ! if (m_pShare->m_SharedFiles[i].AltHosts.size() < HostCount) HostCount = m_pShare->m_SharedFiles[i].AltHosts.size(); *************** *** 114,118 **** // Get random indexes to send to host ! while(HostCount > 0) { HostCount--; --- 110,114 ---- // Get random indexes to send to host ! while (HostCount > 0) { HostCount--; *************** *** 120,144 **** int NewIndex = rand() % m_pShare->m_SharedFiles[i].AltHosts.size() + 0; ! if(Host == m_pShare->m_SharedFiles[i].AltHosts[NewIndex].HostPort.Host) continue; bool found = false; ! for(j = 0; j < HostIndexes.size(); j++) ! if(HostIndexes[j] == NewIndex) found = true; ! if(!found) HostIndexes.push_back(NewIndex); } ! for(j = 0; j < HostIndexes.size(); j++) { ! CString AltStr = m_pShare->m_SharedFiles[i].AltHosts[ HostIndexes[j] ].GetString(); ! if(!AltStr.IsEmpty()) AltLocHeader += "X-Gnutella-Alternate-Location: " + AltStr + "\r\n"; } - break; } --- 116,139 ---- int NewIndex = rand() % m_pShare->m_SharedFiles[i].AltHosts.size() + 0; ! if (Host == m_pShare->m_SharedFiles[i].AltHosts[NewIndex].HostPort.Host) continue; bool found = false; ! for (j = 0; j < HostIndexes.size(); j++) ! if (HostIndexes[j] == NewIndex) found = true; ! if (!found) HostIndexes.push_back(NewIndex); } ! for (j = 0; j < HostIndexes.size(); j++) { ! CharString AltStr = m_pShare->m_SharedFiles[i].AltHosts[ HostIndexes[j] ].GetString(); ! if (!AltStr.IsEmpty()) AltLocHeader += "X-Gnutella-Alternate-Location: " + AltStr + "\r\n"; } break; } Index: GnuAltLoc.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuAltLoc.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GnuAltLoc.h 4 Jul 2003 20:23:12 -0000 1.6 --- GnuAltLoc.h 8 Jul 2003 08:32:30 -0000 1.7 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 27,30 **** --- 27,31 ---- #ifndef OPENGCC #pragma once + typedef CString CharString; #endif *************** *** 43,50 **** virtual ~CGnuAltLoc(); ! void AddAltLocation(CString& locStr, CString& Sha1Hash); ! CString GetAltLocationHeader(CString Sha1Hash, CString Host="", int HostCount=5); ! CGnuCore* m_pCore; CGnuShare* m_pShare; CGnuPrefs* m_pPrefs; --- 44,51 ---- virtual ~CGnuAltLoc(); ! void AddAltLocation(CharString& locStr, CharString& Sha1Hash); ! CharString GetAltLocationHeader(CharString Sha1Hash, CharString Host="", int HostCount=5); ! CGnuCore* m_pCore; CGnuShare* m_pShare; CGnuPrefs* m_pPrefs; Index: GnuCache.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuCache.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GnuCache.cpp 31 May 2003 08:53:00 -0000 1.8 --- GnuCache.cpp 8 Jul 2003 08:32:30 -0000 1.9 *************** *** 85,94 **** } ! void CGnuCache::LoadNodes(CString HostFile) { CStdioFile infile; // Add permanent servers from preferences ! for(int i = 0; i < m_pPrefs->m_HostServers.size(); i++) m_PermNodes.push_back(m_pPrefs->m_HostServers[i]); [...1360 lines suppressed...] ! if(WebHost.GetAt(WebHost.GetLength() - 1) == '/' || WebHost.Find("//") != -1) return false; --- 936,950 ---- // basic check to see if a URL is valid ! bool CGnuCache::ValidURL(CharString WebHost) { ! if (WebHost.Find("http://") != 0) return false; WebHost.Replace("http://",""); ! if (WebHost.IsEmpty()) return false; ! if (WebHost.GetAt(WebHost.GetLength() - 1) == '/' || WebHost.Find("//") != -1) return false; Index: GnuCache.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/GnuCache.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GnuCache.h 29 May 2003 01:14:35 -0000 1.8 --- GnuCache.h 8 Jul 2003 08:32:30 -0000 1.9 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2002 John Marshall This library is free software; you can redistribute it and/or --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall This library is free software; you can redistribute it and/or *************** *** 27,30 **** --- 27,31 ---- #ifndef OPENGCC #pragma once + typedef CString Charstring; #endif *************** *** 43,50 **** struct AltWebCache { ! CString URL; int State; ! AltWebCache(CString nURL = "", int nState = UNTESTED) { URL = nURL; --- 44,51 ---- struct AltWebCache { ! CharString URL; int State; ! AltWebCache(CharString nURL = "", int nState = UNTESTED) { URL = nURL; *************** *** 60,72 **** void endThreads(); ! void LoadNodes(CString); ! void LoadUltraNodes(CString); ! void SaveNodes(CString); ! void SaveUltraNodes(CString); bool NotRecent(IP); bool NotRecentSuperNodes(IP); void UpdateCache(Node ActiveNode, bool Super=false); ! void RemoveIP(CString); void AddLinkList(Node); --- 61,73 ---- void endThreads(); ! void LoadNodes(CharString); ! void LoadUltraNodes(CharString); ! void SaveNodes(CharString); ! void SaveUltraNodes(CharString); bool NotRecent(IP); bool NotRecentSuperNodes(IP); void UpdateCache(Node ActiveNode, bool Super=false); ! void RemoveIP(CharString); void AddLinkList(Node); *************** *** 77,94 **** // Web Cache funtions ! void LoadWebCacheList(CString); ! void SaveWebCacheList(CString); void WebCacheRequest(bool HostFileOnly=false); void WebCacheUpdate(); ! bool WebCacheAddCache(CString); ! CString WebCacheDoRequest(CString); ! void MarkWebCache(CString, bool); void DebugDumpWebCaches(); ! bool ValidURL(CString); ! CString EscapeEncode(CString &what); ! CString GetRandWebCache(bool); void Timer(); --- 78,95 ---- // Web Cache funtions ! void LoadWebCacheList(CharString); ! void SaveWebCacheList(CharString); void WebCacheRequest(bool HostFileOnly=false); void WebCacheUpdate(); ! bool WebCacheAddCache(CharString); ! CharString WebCacheDoRequest(CharString); ! void MarkWebCache(CharString, bool); void DebugDumpWebCaches(); ! bool ValidURL(CharString); ! CharString EscapeEncode(CharString &what); ! CharString GetRandWebCache(bool); void Timer(); *************** *** 108,113 **** UINT m_WebMode; ! CString m_WebCommand; ! CString m_NewSite; int m_TriedSites; --- 109,114 ---- UINT m_WebMode; ! CharString m_WebCommand; ! CharString m_NewSite; int m_TriedSites; *************** *** 123,127 **** CCriticalSection m_TransferAccess; ! std::vector<CString> m_WebTransferList; CGnuCore* m_pCore; --- 124,128 ---- CCriticalSection m_TransferAccess; ! std::vector<CharString> m_WebTransferList; CGnuCore* m_pCore; |
From: <ri...@us...> - 2003-07-08 08:11:08
|
Update of /cvsroot/gnucula/Gnucula/platform/opengcc In directory sc8-pr-cvs1:/tmp/cvs-serv27079/platform/opengcc Modified Files: strings.h Log Message: syntactical changes (new string class) Index: strings.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/strings.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** strings.h 8 Jul 2003 07:43:50 -0000 1.3 --- strings.h 8 Jul 2003 08:11:03 -0000 1.4 *************** *** 54,60 **** --- 54,63 ---- bool IsEmpty(void); void MakeLower(void); + // void MakeUpper(void); int Find(char *); + // int ReverseFind(char *); Strings Mid(int = 0, int = 0); Strings Left(int); // start 'til int + // Strings Right(int); // void Replace(char *, char *); // void Remove(char *); |