You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(33) |
Jun
(104) |
Jul
(55) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <tu...@us...> - 2010-03-02 04:33:55
|
Revision: 241 http://mchef.svn.sourceforge.net/mchef/?rev=241&view=rev Author: tux316 Date: 2010-03-02 04:33:48 +0000 (Tue, 02 Mar 2010) Log Message: ----------- - Renamed Gen to mlib, Genscripts's mIRC Library. This was done in order to avoid confusion with a future Genscripts project. - Looked at the current code and went "what the hell is this?" It's a good thing our code is well documented. Modified Paths: -------------- trunk/Credits.txt trunk/mChef.sln trunk/src/mChef/Chef.h trunk/src/mChef/StdAfx.h trunk/src/mlib/Console.hpp trunk/src/mlib/Error.hpp trunk/src/mlib/mIRC/Map.hpp trunk/src/mlib/mIRC/Moo.hpp Added Paths: ----------- trunk/src/mlib/ trunk/src/mlib/mlib.hpp Removed Paths: ------------- trunk/src/Gen/ trunk/src/mlib/Gen.hpp Modified: trunk/Credits.txt =================================================================== --- trunk/Credits.txt 2009-09-21 16:22:48 UTC (rev 240) +++ trunk/Credits.txt 2010-03-02 04:33:48 UTC (rev 241) @@ -1,9 +1,9 @@ # mChef Credits # # Authors of mChef -Juan Baez <tu...@so...> (Developer) -Joshua "JD" Davison <jd...@oz...> (Developer) -Alex Lusco <lu...@au...> (Developer) +Juan Baez <jb...@ge...> +Joshua "JD" Davison <jd...@oz...> +Alex Lusco <lu...@au...> # The following personnel contributed towards mChef in some shape or form: Modified: trunk/mChef.sln =================================================================== --- trunk/mChef.sln 2009-09-21 16:22:48 UTC (rev 240) +++ trunk/mChef.sln 2010-03-02 04:33:48 UTC (rev 241) @@ -77,17 +77,17 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DLL", "DLL", "{5895FB9D-8234-4E84-A704-3FB849561343}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Genscripts", "Genscripts", "{044D0C73-AB41-4652-B7FB-7EB2D5CBABE1}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Genscripts mIRC Library", "Genscripts mIRC Library", "{044D0C73-AB41-4652-B7FB-7EB2D5CBABE1}" ProjectSection(SolutionItems) = preProject - src\Gen\Console.hpp = src\Gen\Console.hpp - src\Gen\Error.hpp = src\Gen\Error.hpp - src\Gen\Gen.hpp = src\Gen\Gen.hpp + src\mlib\Console.hpp = src\mlib\Console.hpp + src\mlib\Error.hpp = src\mlib\Error.hpp + src\mlib\mlib.hpp = src\mlib\mlib.hpp EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "mIRC", "mIRC", "{0031810E-F08C-4D50-81E6-F7C642CA4BB0}" ProjectSection(SolutionItems) = preProject - src\Gen\mIRC\Map.hpp = src\Gen\mIRC\Map.hpp - src\Gen\mIRC\Moo.hpp = src\Gen\mIRC\Moo.hpp + src\mlib\mIRC\Map.hpp = src\mlib\mIRC\Map.hpp + src\mlib\mIRC\Moo.hpp = src\mlib\mIRC\Moo.hpp EndProjectSection EndProject Global Modified: trunk/src/mChef/Chef.h =================================================================== --- trunk/src/mChef/Chef.h 2009-09-21 16:22:48 UTC (rev 240) +++ trunk/src/mChef/Chef.h 2010-03-02 04:33:48 UTC (rev 241) @@ -27,19 +27,19 @@ /* Changing any of the macros below will only be waisting your time.*/ /* Number of times that the project has been built */ -#define VERSION_BUILD 238 +#define VERSION_BUILD 240 /* Current mChef Version */ -#define MCHEF_VERSION_STR "1.1.238" -#define MCHEF_VERSION_STRWC L"1.1.238" +#define MCHEF_VERSION_STR "1.1.240" +#define MCHEF_VERSION_STRWC L"1.1.240" -#define VERSION_FULL "1.1.238" -#define VERSION_WFULL L"1.1.238" +#define VERSION_FULL "1.1.240" +#define VERSION_WFULL L"1.1.240" -#define VERSION_FILE 1,1,0,238 -#define VERSION_PRODUCT 1,1,0,238 -#define VERSION_FSTR "1, 1, 0, 238" -#define VERSION_PSTR "1, 1, 0, 238" +#define VERSION_FILE 1,1,0,240 +#define VERSION_PRODUCT 1,1,0,240 +#define VERSION_FSTR "1, 1, 0, 240" +#define VERSION_PSTR "1, 1, 0, 240" #endif Modified: trunk/src/mChef/StdAfx.h =================================================================== --- trunk/src/mChef/StdAfx.h 2009-09-21 16:22:48 UTC (rev 240) +++ trunk/src/mChef/StdAfx.h 2010-03-02 04:33:48 UTC (rev 241) @@ -47,6 +47,6 @@ #include "cef_capi.h" #define MIRC_DLL -#include "Gen/Gen.hpp" +#include "mlib/mlib.hpp" /* EOF */ Modified: trunk/src/mlib/Console.hpp =================================================================== --- trunk/src/Gen/Console.hpp 2009-09-21 16:22:48 UTC (rev 240) +++ trunk/src/mlib/Console.hpp 2010-03-02 04:33:48 UTC (rev 241) @@ -15,10 +15,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -#ifndef __CONSOLE_HPP__ -# define __CONSOLE_HPP__ +#ifndef __MLIB_CONSOLE_HPP__ +# define __MLIB_CONSOLE_HPP__ -#pragma message("Genscripts Library: Compiling Console.hpp") +#pragma message("Genscripts mIRC Library: Compiling Console.hpp") #include <io.h> #include <fcntl.h> @@ -119,7 +119,7 @@ } -#endif /* __CONSOLE_H__ */ +#endif /* __MLIB_CONSOLE_HPP__ */ /* EOF */ Modified: trunk/src/mlib/Error.hpp =================================================================== --- trunk/src/Gen/Error.hpp 2009-09-21 16:22:48 UTC (rev 240) +++ trunk/src/mlib/Error.hpp 2010-03-02 04:33:48 UTC (rev 241) @@ -15,10 +15,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -#ifndef __ERROR_HPP -# define __ERROR_HPP +#ifndef __MLIB_ERROR_HPP +# define __MLIB_ERROR_HPP -#pragma message("Genscripts Library: Compiling Error.hpp") +#pragma message("Genscripts mIRC Library: Compiling Error.hpp") #include <strsafe.h> @@ -41,5 +41,5 @@ } } -#endif /* __GENERROR_HPP */ +#endif /* __MLIB_ERROR_HPP */ Deleted: trunk/src/mlib/Gen.hpp =================================================================== --- trunk/src/Gen/Gen.hpp 2009-09-21 16:22:48 UTC (rev 240) +++ trunk/src/mlib/Gen.hpp 2010-03-02 04:33:48 UTC (rev 241) @@ -1,50 +0,0 @@ -/* Genscripts Library - Gen.h - * Copyright (C) 2009 Genscripts - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -#ifndef __GEN_H__ -# define __GEN_H__ - -#pragma message("Genscripts Library: Compiling Gen.hpp") -#pragma warning(disable : 4995) - -#include "Gen/Console.hpp" -#include "Gen/Error.hpp" - -#ifdef MIRC_DLL -#include "Gen/mIRC/Moo.hpp" -#include "Gen/mIRC/Map.hpp" - - -namespace Gen { - - /** - * LOADINFO. Structure used by mIRC when loading a DLL. - */ - typedef struct { - DWORD mVersion; - HWND mHwnd; - BOOL mKeep; - } LoadInfo; - -} - -#endif - -#endif /* __GEN_H__ */ - -/* EOF */ - Modified: trunk/src/mlib/mIRC/Map.hpp =================================================================== --- trunk/src/Gen/mIRC/Map.hpp 2009-09-21 16:22:48 UTC (rev 240) +++ trunk/src/mlib/mIRC/Map.hpp 2010-03-02 04:33:48 UTC (rev 241) @@ -15,10 +15,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -#ifndef __MAP_HPP__ -# define __MAP_HPP__ +#ifndef __MLIB_MIRC_MAP_HPP__ +# define __MLIB_MIRC_MAP_HPP__ -#pragma message("Genscripts Library: Compiling Map.hpp") +#pragma message("Genscripts mIRC Library: Compiling Map.hpp") #include <stdarg.h> @@ -180,7 +180,7 @@ } }; } -#endif /* __GENMAP_HPP__*/ +#endif /* __MLIB_MIRC_MAP_HPP__*/ /* EOF */ Modified: trunk/src/mlib/mIRC/Moo.hpp =================================================================== --- trunk/src/Gen/mIRC/Moo.hpp 2009-09-21 16:22:48 UTC (rev 240) +++ trunk/src/mlib/mIRC/Moo.hpp 2010-03-02 04:33:48 UTC (rev 241) @@ -15,12 +15,12 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -#ifndef __MOO_HPP__ -# define __MOO_HPP__ +#ifndef __MLIB_MIRC_MOO_HPP__ +# define __MLIB_MIRC_MOO_HPP__ -#pragma message("Genscripts Library: Compiling Moo.hpp") +#pragma message("Genscripts mIRC Library: Compiling Moo.hpp") -#include "Gen/mIRC/Map.hpp" +#include "mlib/mIRC/Map.hpp" namespace Gen { class CGenMoo : public CGenMap @@ -42,7 +42,7 @@ }; } -#endif /* __GENMOO_HPP__ */ +#endif /* __MLIB_MIRC_MOO_HPP__ */ /* EOF */ Copied: trunk/src/mlib/mlib.hpp (from rev 240, trunk/src/Gen/Gen.hpp) =================================================================== --- trunk/src/mlib/mlib.hpp (rev 0) +++ trunk/src/mlib/mlib.hpp 2010-03-02 04:33:48 UTC (rev 241) @@ -0,0 +1,50 @@ +/* Genscripts Library - mlib.hpp + * Copyright (C) 2009 Genscripts + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +#ifndef __MLIB_MLIB_H__ +# define __MLIB_MLIB_H__ + +#pragma message("Genscripts mIRC Library: Compiling mlib.hpp") +#pragma warning(disable : 4995) + +#include "mlib/Console.hpp" +#include "mlib/Error.hpp" + +#ifdef MIRC_DLL +#include "mlib/mIRC/Moo.hpp" +#include "mlib/mIRC/Map.hpp" + + +namespace Gen { + + /** + * LOADINFO. Structure used by mIRC when loading a DLL. + */ + typedef struct { + DWORD mVersion; + HWND mHwnd; + BOOL mKeep; + } LoadInfo; + +} + +#endif + +#endif /* __MLIB_MLIB_H__ */ + +/* EOF */ + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-09-21 16:23:00
|
Revision: 240 http://mchef.svn.sourceforge.net/mchef/?rev=240&view=rev Author: tux316 Date: 2009-09-21 16:22:48 +0000 (Mon, 21 Sep 2009) Log Message: ----------- - Implemented mChef Revision 42. - Implemented new icudt42.dll (old icudt38.dll = baleted). - Commented out code for address bar. We will worry about this later on down the line (if there is even a line). For now we should concentrate on a pre-alpha launch. - Updated ignore list and certain project files to match the new icudt42 and CEF 42 configuration. - May the force be with you. - May you find guidance and peace in Master Yoda's teachings. Revision Links: -------------- http://mchef.svn.sourceforge.net/mchef/?rev=42&view=rev Modified Paths: -------------- trunk/src/ThirdParty/cef/README.txt trunk/src/ThirdParty/cef/build/Debug/libcef.dll trunk/src/ThirdParty/cef/build/Release/libcef.dll trunk/src/ThirdParty/cef/include/cef.h trunk/src/ThirdParty/cef/include/cef_capi.h trunk/src/ThirdParty/cef/include/cef_nplugin.h trunk/src/ThirdParty/cef/include/cef_nplugin_capi.h trunk/src/ThirdParty/cef/include/cef_types.h trunk/src/ThirdParty/cef/lib/Debug/libcef.lib trunk/src/ThirdParty/cef/lib/Debug/libcef_dll_wrapper.lib trunk/src/ThirdParty/cef/lib/Release/libcef.lib trunk/src/ThirdParty/cef/lib/Release/libcef_dll_wrapper.lib trunk/src/Tools/Deploy/Deploy.bat trunk/src/Tools/VersionTool/VersionTool.vcproj trunk/src/mChef/ChefBrowser.cpp trunk/src/mChef/Main.cpp trunk/src/mChef/mChef.vcproj Added Paths: ----------- trunk/src/ThirdParty/cef/build/Debug/icudt42.dll trunk/src/ThirdParty/cef/build/Release/icudt42.dll Removed Paths: ------------- trunk/src/ThirdParty/cef/build/Debug/icudt38.dll trunk/src/ThirdParty/cef/build/Release/icudt38.dll Property Changed: ---------------- trunk/ trunk/src/ThirdParty/lbmg/ trunk/src/Tools/Deploy/ trunk/src/Tools/VersionTool/ trunk/src/mChef/ Property changes on: trunk ___________________________________________________________________ Added: svn:ignore + *.ncb *.suo Debug Deployment Release Modified: trunk/src/ThirdParty/cef/README.txt =================================================================== --- trunk/src/ThirdParty/cef/README.txt 2009-08-27 01:47:29 UTC (rev 239) +++ trunk/src/ThirdParty/cef/README.txt 2009-09-21 16:22:48 UTC (rev 240) @@ -1,9 +1,9 @@ Chromium Embedded Framework (CEF) Binary Distribution ------------------------------------------------------------------------------- -CEF Revision: 27 -Chromium Revision: 16080 -Date: June 1, 2009 +CEF Revision: 42 +Chromium Revision: 26432 +Date: September 17, 2009 This distribution contains all files necessary to build an application using CEF. Please read the included LICENSE.txt file for licensing terms and Deleted: trunk/src/ThirdParty/cef/build/Debug/icudt38.dll =================================================================== (Binary files differ) Added: trunk/src/ThirdParty/cef/build/Debug/icudt42.dll =================================================================== (Binary files differ) Property changes on: trunk/src/ThirdParty/cef/build/Debug/icudt42.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/ThirdParty/cef/build/Debug/libcef.dll =================================================================== (Binary files differ) Deleted: trunk/src/ThirdParty/cef/build/Release/icudt38.dll =================================================================== (Binary files differ) Added: trunk/src/ThirdParty/cef/build/Release/icudt42.dll =================================================================== (Binary files differ) Property changes on: trunk/src/ThirdParty/cef/build/Release/icudt42.dll ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/ThirdParty/cef/build/Release/libcef.dll =================================================================== (Binary files differ) Modified: trunk/src/ThirdParty/cef/include/cef.h =================================================================== --- trunk/src/ThirdParty/cef/include/cef.h 2009-08-27 01:47:29 UTC (rev 239) +++ trunk/src/ThirdParty/cef/include/cef.h 2009-09-21 16:22:48 UTC (rev 240) @@ -50,6 +50,8 @@ class CefPostData; class CefPostDataElement; class CefRequest; +class CefSchemeHandler; +class CefSchemeHandlerFactory; class CefStreamReader; class CefStreamWriter; class CefV8Handler; @@ -141,6 +143,16 @@ CefRefPtr<CefV8Handler> handler); +// Register a custom scheme handler factory for the specified |scheme_name| and +// |host_name|. All URLs beginning with scheme_name://host_name/ can be handled +// by CefSchemeHandler instances returned by the factory. Specify an empty +// |host_name| value to match all host names. +/*--cef()--*/ +bool CefRegisterScheme(const std::wstring& scheme_name, + const std::wstring& host_name, + CefRefPtr<CefSchemeHandlerFactory> factory); + + // Interface defining the the reference count implementation methods. All // framework classes must implement the CefBase class. class CefBase @@ -733,6 +745,30 @@ }; +// Interface the client can implement to provide a custom stream reader. +/*--cef(source=client)--*/ +class CefReadHandler : public CefBase +{ +public: + // Read raw binary data. + /*--cef()--*/ + virtual size_t Read(void* ptr, size_t size, size_t n) =0; + + // Seek to the specified offset position. |whence| may be any one of + // SEEK_CUR, SEEK_END or SEEK_SET. + /*--cef()--*/ + virtual int Seek(long offset, int whence) =0; + + // Return the current offset position. + /*--cef()--*/ + virtual long Tell() =0; + + // Return non-zero if at end of file. + /*--cef()--*/ + virtual int Eof() =0; +}; + + // Class used to read data from a stream. /*--cef(source=library)--*/ class CefStreamReader : public CefBase @@ -743,6 +779,8 @@ static CefRefPtr<CefStreamReader> CreateForFile(const std::wstring& fileName); /*--cef()--*/ static CefRefPtr<CefStreamReader> CreateForData(void* data, size_t size); + /*--cef()--*/ + static CefRefPtr<CefStreamReader> CreateForHandler(CefRefPtr<CefReadHandler> handler); // Read raw binary data. /*--cef()--*/ @@ -763,11 +801,41 @@ }; +// Interface the client can implement to provide a custom stream writer. +/*--cef(source=client)--*/ +class CefWriteHandler : public CefBase +{ +public: + // Write raw binary data. + /*--cef()--*/ + virtual size_t Write(const void* ptr, size_t size, size_t n) =0; + + // Seek to the specified offset position. |whence| may be any one of + // SEEK_CUR, SEEK_END or SEEK_SET. + /*--cef()--*/ + virtual int Seek(long offset, int whence) =0; + + // Return the current offset position. + /*--cef()--*/ + virtual long Tell() =0; + + // Flush the stream. + /*--cef()--*/ + virtual int Flush() =0; +}; + + // Class used to write data to a stream. /*--cef(source=library)--*/ class CefStreamWriter : public CefBase { public: + // Create a new CefStreamWriter object. + /*--cef()--*/ + static CefRefPtr<CefStreamWriter> CreateForFile(const std::wstring& fileName); + /*--cef()--*/ + static CefRefPtr<CefStreamWriter> CreateForHandler(CefRefPtr<CefWriteHandler> handler); + // Write raw binary data. /*--cef()--*/ virtual size_t Write(const void* ptr, size_t size, size_t n) =0; @@ -930,4 +998,47 @@ std::wstring& exception) =0; }; + +// Class that creates CefSchemeHandler instances. +/*--cef(source=client)--*/ +class CefSchemeHandlerFactory : public CefBase +{ +public: + // Return a new scheme handler instance to handle the request. + /*--cef()--*/ + virtual CefRefPtr<CefSchemeHandler> Create() =0; +}; + + +// Class used to represent a custom scheme handler interface. +/*--cef(source=client)--*/ +class CefSchemeHandler : public CefBase +{ +public: + // Process the request. All response generation should take place in this + // method. If there is no response set |response_length| to zero and + // ReadResponse() will not be called. If the response length is not known then + // set |response_length| to -1 and ReadResponse() will be called until it + // returns false or until the value of |bytes_read| is set to 0. Otherwise, + // set |response_length| to a positive value and ReadResponse() will be called + // until it returns false, the value of |bytes_read| is set to 0 or the + // specified number of bytes have been read. If there is a response set + // |mime_type| to the mime type for the response. + /*--cef()--*/ + virtual bool ProcessRequest(CefRefPtr<CefRequest> request, + std::wstring& mime_type, int* response_length) =0; + + // Cancel processing of the request. + /*--cef()--*/ + virtual void Cancel() =0; + + // Copy up to |bytes_to_read| bytes into |data_out|. If the copy succeeds + // set |bytes_read| to the number of bytes copied and return true. If the + // copy fails return false and ReadResponse() will not be called again. + /*--cef()--*/ + virtual bool ReadResponse(void* data_out, int bytes_to_read, + int* bytes_read) =0; +}; + + #endif // _CEF_H Modified: trunk/src/ThirdParty/cef/include/cef_capi.h =================================================================== --- trunk/src/ThirdParty/cef/include/cef_capi.h 2009-08-27 01:47:29 UTC (rev 239) +++ trunk/src/ThirdParty/cef/include/cef_capi.h 2009-09-21 16:22:48 UTC (rev 240) @@ -126,6 +126,13 @@ CEF_EXPORT int cef_register_extension(const wchar_t* extension_name, const wchar_t* javascript_code, struct _cef_v8handler_t* handler); +// Register a custom scheme handler factory for the specified |scheme_name| and +// |host_name|. All URLs beginning with scheme_name://host_name/ can be handled +// by cef_scheme_handler_t instances returned by the factory. Specify an NULL +// |host_name| value to match all host names. +CEF_EXPORT int cef_register_scheme(const wchar_t* scheme_name, + const wchar_t* host_name, struct _cef_scheme_handler_factory_t* factory); + typedef struct _cef_base_t { // Size of the data structure. @@ -593,6 +600,30 @@ CEF_EXPORT cef_post_data_element_t* cef_post_data_element_create(); +// Structure the client can implement to provide a custom stream reader. +typedef struct _cef_read_handler_t +{ + // Base structure. + cef_base_t base; + + // Read raw binary data. + size_t (CEF_CALLBACK *read)(struct _cef_read_handler_t* self, void* ptr, + size_t size, size_t n); + + // Seek to the specified offset position. |whence| may be any one of SEEK_CUR, + // SEEK_END or SEEK_SET. + int (CEF_CALLBACK *seek)(struct _cef_read_handler_t* self, long offset, + int whence); + + // Return the current offset position. + long (CEF_CALLBACK *tell)(struct _cef_read_handler_t* self); + + // Return non-zero if at end of file. + int (CEF_CALLBACK *eof)(struct _cef_read_handler_t* self); + +} cef_read_handler_t; + + // Structure used to read data from a stream. typedef struct _cef_stream_reader_t { @@ -622,8 +653,34 @@ const wchar_t* fileName); CEF_EXPORT cef_stream_reader_t* cef_stream_reader_create_for_data(void* data, size_t size); +CEF_EXPORT cef_stream_reader_t* cef_stream_reader_create_for_handler( + cef_read_handler_t* handler); +// Structure the client can implement to provide a custom stream writer. +typedef struct _cef_write_handler_t +{ + // Base structure. + cef_base_t base; + + // Write raw binary data. + size_t (CEF_CALLBACK *write)(struct _cef_write_handler_t* self, + const void* ptr, size_t size, size_t n); + + // Seek to the specified offset position. |whence| may be any one of SEEK_CUR, + // SEEK_END or SEEK_SET. + int (CEF_CALLBACK *seek)(struct _cef_write_handler_t* self, long offset, + int whence); + + // Return the current offset position. + long (CEF_CALLBACK *tell)(struct _cef_write_handler_t* self); + + // Flush the stream. + int (CEF_CALLBACK *flush)(struct _cef_write_handler_t* self); + +} cef_write_handler_t; + + // Structure used to write data to a stream. typedef struct _cef_stream_writer_t { @@ -648,6 +705,13 @@ } cef_stream_writer_t; +// Create a new cef_stream_writer_t object. +CEF_EXPORT cef_stream_writer_t* cef_stream_writer_create_for_file( + const wchar_t* fileName); +CEF_EXPORT cef_stream_writer_t* cef_stream_writer_create_for_handler( + cef_write_handler_t* handler); + + // Structure that should be implemented to handle V8 function calls. typedef struct _cef_v8handler_t { @@ -769,6 +833,50 @@ cef_v8handler_t* handler); +// Structure that creates cef_scheme_handler_t instances. +typedef struct _cef_scheme_handler_factory_t +{ + // Base structure. + cef_base_t base; + + // Return a new scheme handler instance to handle the request. + struct _cef_scheme_handler_t* (CEF_CALLBACK *create)( + struct _cef_scheme_handler_factory_t* self); + +} cef_scheme_handler_factory_t; + + +// Structure used to represent a custom scheme handler structure. +typedef struct _cef_scheme_handler_t +{ + // Base structure. + cef_base_t base; + + // Process the request. All response generation should take place in this + // function. If there is no response set |response_length| to zero and + // read_response() will not be called. If the response length is not known + // then set |response_length| to -1 and read_response() will be called until + // it returns false (0) or until the value of |bytes_read| is set to 0. + // Otherwise, set |response_length| to a positive value and read_response() + // will be called until it returns false (0), the value of |bytes_read| is set + // to 0 or the specified number of bytes have been read. If there is a + // response set |mime_type| to the mime type for the response. + int (CEF_CALLBACK *process_request)(struct _cef_scheme_handler_t* self, + struct _cef_request_t* request, cef_string_t* mime_type, + int* response_length); + + // Cancel processing of the request. + void (CEF_CALLBACK *cancel)(struct _cef_scheme_handler_t* self); + + // Copy up to |bytes_to_read| bytes into |data_out|. If the copy succeeds set + // |bytes_read| to the number of bytes copied and return true (1). If the copy + // fails return false (0) and read_response() will not be called again. + int (CEF_CALLBACK *read_response)(struct _cef_scheme_handler_t* self, + void* data_out, int bytes_to_read, int* bytes_read); + +} cef_scheme_handler_t; + + #ifdef __cplusplus } #endif Modified: trunk/src/ThirdParty/cef/include/cef_nplugin.h =================================================================== --- trunk/src/ThirdParty/cef/include/cef_nplugin.h 2009-08-27 01:47:29 UTC (rev 239) +++ trunk/src/ThirdParty/cef/include/cef_nplugin.h 2009-09-21 16:22:48 UTC (rev 240) @@ -33,8 +33,8 @@ #include <string> #include <vector> -#include "webkit/glue/plugins/nphostapi.h" -#include "third_party/npapi/bindings/npapi.h" +#include "npapi/nphostapi.h" +#include "npapi/npapi.h" // Netscape plugins are normally built at separate DLLs that are loaded by the // browser when needed. This interface supports the creation of plugins that Modified: trunk/src/ThirdParty/cef/include/cef_nplugin_capi.h =================================================================== --- trunk/src/ThirdParty/cef/include/cef_nplugin_capi.h 2009-08-27 01:47:29 UTC (rev 239) +++ trunk/src/ThirdParty/cef/include/cef_nplugin_capi.h 2009-09-21 16:22:48 UTC (rev 240) @@ -36,8 +36,8 @@ #endif #include "cef_export.h" -#include "webkit/glue/plugins/nphostapi.h" -#include "third_party/npapi/bindings/npapi.h" +#include "npapi/nphostapi.h" +#include "npapi/npapi.h" // Netscape plugins are normally built at separate DLLs that are loaded by the // browser when needed. This interface supports the creation of plugins that Modified: trunk/src/ThirdParty/cef/include/cef_types.h =================================================================== --- trunk/src/ThirdParty/cef/include/cef_types.h 2009-08-27 01:47:29 UTC (rev 239) +++ trunk/src/ThirdParty/cef/include/cef_types.h 2009-09-21 16:22:48 UTC (rev 240) @@ -50,7 +50,7 @@ enum cef_retval_t { RV_HANDLED = 0, - RV_CONTINUE = 1 + RV_CONTINUE = 1, }; // Various browser navigation types supported by chrome. @@ -61,7 +61,7 @@ NAVTYPE_BACKFORWARD, NAVTYPE_RELOAD, NAVTYPE_FORMRESUBMITTED, - NAVTYPE_OTHER + NAVTYPE_OTHER, }; // Supported error code values. See net\base\net_error_list.h for complete @@ -115,7 +115,7 @@ ERR_EMPTY_RESPONSE = -324, ERR_RESPONSE_HEADERS_TOO_BIG = -325, ERR_CACHE_MISS = -400, - ERR_INSECURE_RESPONSE = -501 + ERR_INSECURE_RESPONSE = -501, }; // Structure representing menu information. @@ -157,7 +157,7 @@ // A video node is selected MENUTYPE_VIDEO = 0x80, // A video node is selected - MENUTYPE_AUDIO = 0x100 + MENUTYPE_AUDIO = 0x100, }; // The cef_handler_menuinfo_t editFlags value will be a combination of the @@ -173,7 +173,7 @@ MENU_CAN_DELETE = 0x20, MENU_CAN_SELECT_ALL = 0x40, MENU_CAN_GO_FORWARD = 0x80, - MENU_CAN_GO_BACK = 0x100 + MENU_CAN_GO_BACK = 0x100, }; // Supported menu ID values. @@ -191,7 +191,7 @@ MENU_ID_DELETE = 25, MENU_ID_SELECTALL = 26, MENU_ID_PRINT = 30, - MENU_ID_VIEWSOURCE = 31 + MENU_ID_VIEWSOURCE = 31, }; // Post data elements may represent either bytes or files. @@ -199,7 +199,7 @@ { PDE_TYPE_EMPTY = 0, PDE_TYPE_BYTES, - PDE_TYPE_FILE + PDE_TYPE_FILE, }; Modified: trunk/src/ThirdParty/cef/lib/Debug/libcef.lib =================================================================== (Binary files differ) Modified: trunk/src/ThirdParty/cef/lib/Debug/libcef_dll_wrapper.lib =================================================================== (Binary files differ) Modified: trunk/src/ThirdParty/cef/lib/Release/libcef.lib =================================================================== (Binary files differ) Modified: trunk/src/ThirdParty/cef/lib/Release/libcef_dll_wrapper.lib =================================================================== (Binary files differ) Property changes on: trunk/src/ThirdParty/lbmg ___________________________________________________________________ Added: svn:ignore + *.user Property changes on: trunk/src/Tools/Deploy ___________________________________________________________________ Added: svn:ignore + *.user Modified: trunk/src/Tools/Deploy/Deploy.bat =================================================================== --- trunk/src/Tools/Deploy/Deploy.bat 2009-08-27 01:47:29 UTC (rev 239) +++ trunk/src/Tools/Deploy/Deploy.bat 2009-09-21 16:22:48 UTC (rev 240) @@ -3,7 +3,7 @@ SET MCHEF_DIR=%~dp1 SET DLL_MCHEF="%~dp1Release\mChef.dll" SET DLL_CEF="%~dp1Release\libcef.dll" -SET DLL_ICU="%~dp1Release\icudt38.dll" +SET DLL_ICU="%~dp1Release\icudt42.dll" SET DEP_DIR=%~dp1Deployment echo ----------------------------------------------------------------- @@ -36,8 +36,8 @@ xcopy "%MCHEF_DIR%docs" "%DEP_DIR%\docs" /Y /E echo All files have been copied over to "%DEP_DIR%" echo. -echo Compressing icudt38.dll... -"%MCHEF_DIR%src\Tools\upx.exe" --ultra-brute "%DEP_DIR%\icudt38.dll" +echo Compressing icudt42.dll... +"%MCHEF_DIR%src\Tools\upx.exe" --ultra-brute "%DEP_DIR%\icudt42.dll" echo Compressing mChef.dll... "%MCHEF_DIR%src\Tools\upx.exe" --ultra-brute "%DEP_DIR%\mChef.dll" echo . Property changes on: trunk/src/Tools/VersionTool ___________________________________________________________________ Added: svn:ignore + *.user Modified: trunk/src/Tools/VersionTool/VersionTool.vcproj =================================================================== --- trunk/src/Tools/VersionTool/VersionTool.vcproj 2009-08-27 01:47:29 UTC (rev 239) +++ trunk/src/Tools/VersionTool/VersionTool.vcproj 2009-09-21 16:22:48 UTC (rev 240) @@ -95,7 +95,7 @@ <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" + IntermediateDirectory="$(SolutionDir)$(ConfigurationName)\obj\$(ProjectName)" ConfigurationType="1" CharacterSet="1" WholeProgramOptimization="1" Property changes on: trunk/src/mChef ___________________________________________________________________ Added: svn:ignore + *.user Modified: trunk/src/mChef/ChefBrowser.cpp =================================================================== --- trunk/src/mChef/ChefBrowser.cpp 2009-08-27 01:47:29 UTC (rev 239) +++ trunk/src/mChef/ChefBrowser.cpp 2009-09-21 16:22:48 UTC (rev 240) @@ -94,6 +94,7 @@ } CF_DB(printf("Run Create Browser\n")); +#if 0 if (HasAddressBar(curChef)) { CF_DB(printf("Has Address Bar were running\n")); @@ -146,6 +147,7 @@ CreateWindowEx(0L, L"Edit", NULL, WS_CHILD | WS_BORDER | WS_VISIBLE | ES_LEFT, 0, // now we just catch when buttons are clicked and do what it is we do 0, 250, 30, curChef->m_Toolbar, (HMENU)MC_TOOLBAR_EDIT, 0, 0 ); } +#endif CEF_String cs(url != NULL ? url : "about:blank"); cef_browser_create(curChef->mWindowInfo,0, CreateMyHandler(), Modified: trunk/src/mChef/Main.cpp =================================================================== --- trunk/src/mChef/Main.cpp 2009-08-27 01:47:29 UTC (rev 239) +++ trunk/src/mChef/Main.cpp 2009-09-21 16:22:48 UTC (rev 240) @@ -204,10 +204,9 @@ CF_DB_END; return 3; } + + // m_WindowType |= FLAG_ADDRESSBAR; - - m_WindowType |= FLAG_ADDRESSBAR; - if (m_hwFound) ShowWindow(m_hwFound, SW_HIDE); Modified: trunk/src/mChef/mChef.vcproj =================================================================== --- trunk/src/mChef/mChef.vcproj 2009-08-27 01:47:29 UTC (rev 239) +++ trunk/src/mChef/mChef.vcproj 2009-09-21 16:22:48 UTC (rev 240) @@ -93,6 +93,7 @@ /> <Tool Name="VCPostBuildEventTool" + CommandLine="copy /B /Y "$(SolutionDir)src\ThirdParty\cef\build\$(ConfigurationName)\icudt42.dll" "$(SolutionDir)$(ConfigurationName)"
copy /B /Y "$(SolutionDir)src\ThirdParty\cef\build\$(ConfigurationName)\libcef.dll" "$(SolutionDir)$(ConfigurationName)"
" /> </Configuration> <Configuration @@ -174,6 +175,7 @@ /> <Tool Name="VCPostBuildEventTool" + CommandLine="copy /B /Y "$(SolutionDir)src\ThirdParty\cef\build\$(ConfigurationName)\icudt42.dll" "$(SolutionDir)$(ConfigurationName)"
copy /B /Y "$(SolutionDir)src\ThirdParty\cef\build\$(ConfigurationName)\libcef.dll" "$(SolutionDir)$(ConfigurationName)"
" /> </Configuration> </Configurations> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-08-27 01:47:42
|
Revision: 239 http://mchef.svn.sourceforge.net/mchef/?rev=239&view=rev Author: tux316 Date: 2009-08-27 01:47:29 +0000 (Thu, 27 Aug 2009) Log Message: ----------- Renamed global variables so they start with a g_ in front. Modified Paths: -------------- trunk/src/mChef/Chef.cpp trunk/src/mChef/Chef.h trunk/src/mChef/ChefExtern.h trunk/src/mChef/ChefGlobal.cpp trunk/src/mChef/ChefHandler.cpp trunk/src/mChef/ChefMacros.h trunk/src/mChef/ChefMisc.cpp trunk/src/mChef/ChefPrinter.cpp trunk/src/mChef/Main.cpp trunk/src/mChef/V8Splash.cpp Modified: trunk/src/mChef/Chef.cpp =================================================================== --- trunk/src/mChef/Chef.cpp 2009-08-06 22:13:27 UTC (rev 238) +++ trunk/src/mChef/Chef.cpp 2009-08-27 01:47:29 UTC (rev 239) @@ -28,12 +28,6 @@ static vector<lpChef> ChefWindows; /** - * ChefCount. Integer variable used to keep an accurate count of how many - * Chef instances we have attached. - */ -unsigned int ChefCount = 0; - -/** * ChefInsert. Inserts a Chef into our vector. * * @param curChef Chef Pointer @@ -216,8 +210,8 @@ Free(curChef->m_WindowName); Free(curChef); - ChefCount--; - CF_DB(printf("ChefCount: %i\n", ChefCount)); + g_iChefCount--; + CF_DB(printf("g_iChefCount: %i\n", g_iChefCount)); CF_DB_END } @@ -312,7 +306,7 @@ curChef->bCanGoBack = curChef->bCanGoForward = curChef->bIsLoading = false; ChefInsert(curChef); - ChefCount++; + g_iChefCount++; CF_DB_END return curChef; @@ -469,22 +463,22 @@ CF_DB(fprintf(stderr, "Initializing Chef.\n")); - if (!cachePath && !memCache) - cachePath = wBuildPath(cachePath, L"Cache"); + if (!g_lpCachePath && !memCache) + g_lpCachePath = wBuildPath(g_lpCachePath, L"Cache"); - if (cef_initialize(true, memCache ? NULL : cachePath)) { - CF_DB(fwprintf(stderr, L"CefInitialize: Ok\n\nCache Directory: %s\n", memCache ? L"Memory" : cachePath)); - signal = new ChefSignals(mIRC_Window, L"mIRC3"); - bCefInit = true; + if (cef_initialize(true, memCache ? NULL : g_lpCachePath)) { + CF_DB(fwprintf(stderr, L"CefInitialize: Ok\n\nCache Directory: %s\n", memCache ? L"Memory" : g_lpCachePath)); + g_Signal = new ChefSignals(g_mIRC_hWnd, L"mIRC3"); + g_bCefInit = true; } else { CF_DB(fprintf(stderr, "CefInitialization failed.\n")); } - bCacheInMemory = memCache; + g_bCacheInMemory = memCache; CF_DB_END - return bCefInit; + return g_bCefInit; } /* EOF */ Modified: trunk/src/mChef/Chef.h =================================================================== --- trunk/src/mChef/Chef.h 2009-08-06 22:13:27 UTC (rev 238) +++ trunk/src/mChef/Chef.h 2009-08-27 01:47:29 UTC (rev 239) @@ -27,19 +27,19 @@ /* Changing any of the macros below will only be waisting your time.*/ /* Number of times that the project has been built */ -#define VERSION_BUILD 235 +#define VERSION_BUILD 238 /* Current mChef Version */ -#define MCHEF_VERSION_STR "1.1.235" -#define MCHEF_VERSION_STRWC L"1.1.235" +#define MCHEF_VERSION_STR "1.1.238" +#define MCHEF_VERSION_STRWC L"1.1.238" -#define VERSION_FULL "1.1.235" -#define VERSION_WFULL L"1.1.235" +#define VERSION_FULL "1.1.238" +#define VERSION_WFULL L"1.1.238" -#define VERSION_FILE 1,1,0,235 -#define VERSION_PRODUCT 1,1,0,235 -#define VERSION_FSTR "1, 1, 0, 235" -#define VERSION_PSTR "1, 1, 0, 235" +#define VERSION_FILE 1,1,0,238 +#define VERSION_PRODUCT 1,1,0,238 +#define VERSION_FSTR "1, 1, 0, 238" +#define VERSION_PSTR "1, 1, 0, 238" #endif Modified: trunk/src/mChef/ChefExtern.h =================================================================== --- trunk/src/mChef/ChefExtern.h 2009-08-06 22:13:27 UTC (rev 238) +++ trunk/src/mChef/ChefExtern.h 2009-08-27 01:47:29 UTC (rev 239) @@ -22,7 +22,7 @@ extern inline void ChefInsert(lpChef curChef); -extern HWND mIRC_Window; +extern HWND g_mIRC_hWnd; extern void BasePopThemAll(); extern void *ChefCalloc(size_t numOfElements, size_t Size); @@ -44,7 +44,7 @@ extern lpChef ChefFindCount(const int iCount); extern lpChef ChefFindByResize(const HWND m_hWnd); -extern FlagsTable curFlags[]; +extern FlagsTable g_curFlags[]; extern char *ChefErrorLookup(cef_handler_errorcode_t error); extern char *ChefNavTypeLookup(cef_handler_navtype_t nav); extern char *ChefStrDup(const char *_string); @@ -52,12 +52,12 @@ extern lpBases BaseFind(cef_base_t *); -extern ChefSignals *signal; +extern ChefSignals *g_Signal; extern cef_handler_t *CreateMyHandler(); extern cef_base_t *InitBaseStruct(cef_base_t *base); -extern bool bCefInit, bClearCacheOnExit, bCacheInMemory; +extern bool g_bCefInit, g_bClearCacheOnExit, g_bCacheInMemory; extern bool BasePop(cef_base_t *base); extern bool IsAllNum(char *String); extern bool ChefInitialize(bool memCache); @@ -73,10 +73,10 @@ extern cef_v8value_t *InitializeMIRCJSLink(lpChef); -extern wchar_t *cachePath; +extern wchar_t *g_lpCachePath; extern wchar_t *wBuildPath(wchar_t *wPtr, const wchar_t *wDir); -extern unsigned int ChefCount; +extern unsigned int g_iChefCount; #ifdef CHEF_DEBUG extern void ChefGetLastError(); Modified: trunk/src/mChef/ChefGlobal.cpp =================================================================== --- trunk/src/mChef/ChefGlobal.cpp 2009-08-06 22:13:27 UTC (rev 238) +++ trunk/src/mChef/ChefGlobal.cpp 2009-08-27 01:47:29 UTC (rev 239) @@ -21,44 +21,52 @@ /* Global Scope Definitions */ /** - * cachePath. Our cache path. + * g_lpCachePath. Our cache path. */ -wchar_t *cachePath = NULL; +wchar_t *g_lpCachePath = NULL; /** - * mIRC_Window. Handle to the mIRC Window. + * g_mIRC_hWnd. Handle to the mIRC Window. */ -HWND mIRC_Window = NULL; +HWND g_mIRC_hWnd = NULL; /** - * bCefInit. Boolean indicating whether CEF has been initalized or not. + * g_bCefInit. Boolean indicating whether CEF has been initalized or not. */ -bool bCefInit = false; +bool g_bCefInit = false; /** - * bClearCacheOnExit. Boolean indicating if we should clear our cache on exit. + * g_bClearCacheOnExit. Boolean indicating if we should clear our cache on exit. */ -bool bClearCacheOnExit = false; +bool g_bClearCacheOnExit = false; /** - * bCacheInMemory. Boolean indicating if we are using memory cache. + * g_bCacheInMemory. Boolean indicating if we are using memory cache. */ -bool bCacheInMemory = false; +bool g_bCacheInMemory = false; /** - * signal. Global instance of our signals class. + * g_Signal. Global instance of our signals class. */ -ChefSignals *signal = NULL; +ChefSignals *g_Signal = NULL; /** - * curFlags. Table used for parsing "SetFlags." + * g_curFlags. Table used for parsing "SetFlags." */ -FlagsTable curFlags[] = { +FlagsTable g_curFlags[] = { { "CanFocus", FLAG_CANFOCUS }, { "CanFocusWidget", FLAG_CANFOCUSWIDGET }, { 0 } }; + +/** + * g_iChefCount. Integer variable used to keep an accurate count of how many + * Chef instances we have attached. + */ +unsigned int g_iChefCount = 0; + + /* EOF */ Modified: trunk/src/mChef/ChefHandler.cpp =================================================================== --- trunk/src/mChef/ChefHandler.cpp 2009-08-06 22:13:27 UTC (rev 238) +++ trunk/src/mChef/ChefHandler.cpp 2009-08-27 01:47:29 UTC (rev 239) @@ -66,7 +66,7 @@ curChef->m_BrowserHwnd = m_BrowserHwnd; curChef->mBrowser = browse; BaseAddRef(curChef->mBrowser); - signal->CustomNotify(curChef, SIGNAL_CHEFATTACHED, NULL); + g_Signal->CustomNotify(curChef, SIGNAL_CHEFATTACHED, NULL); } else { CF_DB(printf("Could not find Chef for %d\n", m_hWnd)); } @@ -103,7 +103,7 @@ lpChef curChef = ChefFindBrowser(browser->get_window_handle(browser)); if (curChef) - signal->AddressBarChanged(curChef,CEF_String(url).ToMultiByte()); + g_Signal->AddressBarChanged(curChef,CEF_String(url).ToMultiByte()); else { CF_DB(fprintf(stderr, "\t%s called on non-mChef window. Handle: %d, Popup: %i.\n", __FUNCTION__, browser->get_window_handle(browser), browser->is_popup(browser))); @@ -133,8 +133,8 @@ lpChef curChef = ChefFindBrowser(browser->get_window_handle(browser)); - if (curChef && signal->TitleBarChanged(curChef,CEF_String(title).ToMultiByte())) - SetWindowTextA(curChef->m_hWnd,signal->GetEvaluatedData()); // ease of use force ansi string one so we dont have to convert back to multi char + if (curChef && g_Signal->TitleBarChanged(curChef,CEF_String(title).ToMultiByte())) + SetWindowTextA(curChef->m_hWnd,g_Signal->GetEvaluatedData()); // ease of use force ansi string one so we dont have to convert back to multi char else { CF_DB(fprintf(stderr, "\t%s called on non-mChef window. Handle: %d, Popup: %i.\n", __FUNCTION__, browser->get_window_handle(browser), browser->is_popup(browser))); @@ -169,8 +169,8 @@ lpChef curChef = ChefFindBrowser(browser->get_window_handle(browser)); if (curChef) { - bool bSuccess = signal->NavigateBegin(curChef, navType,isRedirect,CEF_String(request->get_url(request)).ToMultiByte()); - if (bSuccess && !_strcmpi(signal->GetEvaluatedData(),"C_Cancel")) + bool bSuccess = g_Signal->NavigateBegin(curChef, navType,isRedirect,CEF_String(request->get_url(request)).ToMultiByte()); + if (bSuccess && !_strcmpi(g_Signal->GetEvaluatedData(),"C_Cancel")) { BaseRelease(frame); BaseRelease(request); @@ -178,7 +178,7 @@ return RV_HANDLED; } else if (bSuccess) - request->set_url(request, CEF_String(signal->GetEvaluatedData()).ToWideChar()); + request->set_url(request, CEF_String(g_Signal->GetEvaluatedData()).ToWideChar()); } else { CF_DB(fprintf(stderr, "\t%s called on non-mChef window. Handle: %d, Popup: %i.\n", @@ -214,7 +214,7 @@ curChef->bIsLoading = true; curChef->bCanGoBack = curChef->bCanGoForward = false; } - signal->LoadStart(curChef); + g_Signal->LoadStart(curChef); } else { CF_DB(fprintf(stderr, "\t%s called on non-mChef window. Handle: %d, Popup: %i.\n", @@ -250,7 +250,7 @@ curChef->bCanGoForward = browser->can_go_forward(browser) ? true : false; curChef->bCanGoBack = browser->can_go_back(browser) ? true : false; } - signal->LoadEnd(curChef); + g_Signal->LoadEnd(curChef); } else { CF_DB(fprintf(stderr, "\t%s called on non-mChef window. Handle: %d, Popup: %i.\n", @@ -283,8 +283,8 @@ CF_DB_START lpChef curChef = ChefFindBrowser(browser->get_window_handle(browser)); - if (curChef && signal->LoadError(curChef,errorCode,CEF_String(failedUrl).ToMultiByte())) { - cef_string_t eText = CEF_String(signal->GetEvaluatedData()).ToCefString(); + if (curChef && g_Signal->LoadError(curChef,errorCode,CEF_String(failedUrl).ToMultiByte())) { + cef_string_t eText = CEF_String(g_Signal->GetEvaluatedData()).ToCefString(); errorText = &eText; BaseRelease(frame); @@ -541,7 +541,7 @@ return handler->handle_before_window_close(handler, browser); } - signal->Cmd("/%s %s %s", curChef->callbackAlias, curChef->m_WindowName, SIGNAL_CHEFCLOSED); + g_Signal->Cmd("/%s %s %s", curChef->callbackAlias, curChef->m_WindowName, SIGNAL_CHEFCLOSED); ChefPop(curChef); } CF_DB(printf("[%08X] closed.\n", m_hWnd)); @@ -625,8 +625,8 @@ if (curChef) { // basically if they dont return C_CANCEL and they do handle the JSBind event - if (frame->get_url(frame) && signal->JSBind(curChef,CEF_String(frame->get_url(frame)).ToMultiByte()) && - _strcmpi(signal->GetEvaluatedData(),"C_CANCEL")) + if (frame->get_url(frame) && g_Signal->JSBind(curChef,CEF_String(frame->get_url(frame)).ToMultiByte()) && + _strcmpi(g_Signal->GetEvaluatedData(),"C_CANCEL")) object->set_value_bykey(object,L"mCHEF",InitializeMIRCJSLink(curChef)); } else{ Modified: trunk/src/mChef/ChefMacros.h =================================================================== --- trunk/src/mChef/ChefMacros.h 2009-08-06 22:13:27 UTC (rev 238) +++ trunk/src/mChef/ChefMacros.h 2009-08-27 01:47:29 UTC (rev 239) @@ -148,7 +148,7 @@ */ #define SanityCheck()\ do {\ - if ((!bCefInit) && !ChefInitialize(false)) {\ + if ((!g_bCefInit) && !ChefInitialize(false)) {\ sprintf(data, "C_ERR Initialization of CEF failed");\ return 3;\ }\ Modified: trunk/src/mChef/ChefMisc.cpp =================================================================== --- trunk/src/mChef/ChefMisc.cpp 2009-08-06 22:13:27 UTC (rev 238) +++ trunk/src/mChef/ChefMisc.cpp 2009-08-27 01:47:29 UTC (rev 239) @@ -18,6 +18,7 @@ #include "StdAfx.h" #include <direct.h> #include "h.h" + /** * wBuildPath. Builds a path appending "wDir" to the end.. * @@ -93,12 +94,12 @@ */ bool ChefSetFlags(lpChef curChef, const char *lpFlag, bool set) { - for (int i = 0; curFlags[i].FlagName; i++) { - if (_stricmp(curFlags[i].FlagName, lpFlag) == 0) { + for (int i = 0; g_curFlags[i].FlagName; i++) { + if (_stricmp(g_curFlags[i].FlagName, lpFlag) == 0) { if (set) - curChef->flags |= curFlags[i].flag; + curChef->flags |= g_curFlags[i].flag; else - curChef->flags &= ~curFlags[i].flag; + curChef->flags &= ~g_curFlags[i].flag; return true; } Modified: trunk/src/mChef/ChefPrinter.cpp =================================================================== --- trunk/src/mChef/ChefPrinter.cpp 2009-08-06 22:13:27 UTC (rev 238) +++ trunk/src/mChef/ChefPrinter.cpp 2009-08-27 01:47:29 UTC (rev 239) @@ -162,7 +162,7 @@ if (fp) fclose(fp); - signal->PrinterSend(m_curChef, m_ImageName, m_FullImagePath, bStatus); + g_Signal->PrinterSend(m_curChef, m_ImageName, m_FullImagePath, bStatus); CF_DB_END } @@ -176,7 +176,7 @@ if (SaveBitmapToPNGFile(hBitmap, m_FullImagePath) == BMG_OK) bStatus = true; - signal->PrinterSend(m_curChef, m_ImageName, m_FullImagePath, bStatus); + g_Signal->PrinterSend(m_curChef, m_ImageName, m_FullImagePath, bStatus); CF_DB_END } Modified: trunk/src/mChef/Main.cpp =================================================================== --- trunk/src/mChef/Main.cpp 2009-08-06 22:13:27 UTC (rev 238) +++ trunk/src/mChef/Main.cpp 2009-08-27 01:47:29 UTC (rev 239) @@ -85,7 +85,7 @@ CF_DB(fprintf(stderr, "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n")); CF_DB(fprintf(stderr, "Begin mChef Debug: %s\n\n", __TIMESTAMP__)); - mIRC_Window = pLoadInfo->mHwnd; + g_mIRC_hWnd = pLoadInfo->mHwnd; } @@ -106,10 +106,10 @@ CF_DB(printf("Shutting down Cef...\n")); cef_shutdown(); - if (bClearCacheOnExit && !bCacheInMemory && cachePath) { + if (g_bClearCacheOnExit && !g_bCacheInMemory && g_lpCachePath) { /* Create double null terminated string that's needed for SHFileOperation. */ WCHAR wCachePath[MAX_PATH] = {0}; - wnsprintf(wCachePath, MAX_PATH, L"%s", cachePath); + wnsprintf(wCachePath, MAX_PATH, L"%s", g_lpCachePath); SHFILEOPSTRUCT fileOp = { NULL, @@ -129,10 +129,10 @@ // In a correcth world this hsould have nothing left to delete, since all items should be released to 0 to skip the debug assert's in cef_shutdown CF_DB(printf("Closing Handles and Signal System...\n")); - delete signal; + delete g_Signal; OleUninitialize(); - MyFreeEx(cachePath); + MyFreeEx(g_lpCachePath); CF_DB(printf("Terminating mChef.dll...OK\nClosing down stderr...\n")); CF_DB( @@ -406,21 +406,21 @@ CF_DB_START ParseParameters(data); - if (bCefInit) { + if (g_bCefInit) { sprintf(data, "C_ERR AlreadyInitialized"); CF_DB_END; return 3; } - if ((*data) && (!cachePath)) { - cachePath = (wchar_t *)new wchar_t[MAX_PATH]; - swprintf(cachePath, MAX_PATH, L"%s", CEF_String(parv[0]).ToWideChar()); - cachePath[wcslen(cachePath)+1]='\0'; + if ((*data) && (!g_lpCachePath)) { + g_lpCachePath = (wchar_t *)new wchar_t[MAX_PATH]; + swprintf(g_lpCachePath, MAX_PATH, L"%s", CEF_String(parv[0]).ToWideChar()); + g_lpCachePath[wcslen(g_lpCachePath)+1]='\0'; ChefInitialize(false); } else if (parc == 0) { ChefInitialize(true); } - sprintf(data, "%s", bCefInit ? "C_OK" : "C_ERR"); + sprintf(data, "%s", g_bCefInit ? "C_OK" : "C_ERR"); CF_DB_END return 3; @@ -572,7 +572,7 @@ lpChef m_curChef = NULL; if ((iRequest <= 0) || !(m_curChef = ChefFindCount(iRequest))) { - sprintf(data, "%i", ChefCount); + sprintf(data, "%i", g_iChefCount); CF_DB_END return 3; } @@ -637,7 +637,7 @@ CF_DB_START; SanityCheck(); - bClearCacheOnExit = true; + g_bClearCacheOnExit = true; sprintf(data, "C_OK"); Modified: trunk/src/mChef/V8Splash.cpp =================================================================== --- trunk/src/mChef/V8Splash.cpp 2009-08-06 22:13:27 UTC (rev 238) +++ trunk/src/mChef/V8Splash.cpp 2009-08-27 01:47:29 UTC (rev 239) @@ -29,10 +29,10 @@ // Do Eval Stuff if (numargs != 1) *exception = CEF_String("Invalid Parameters: Evaluate(\"mIRC Script\");").ToCefString(); - else if (!signal->JSSignal(CEF_String((wchar_t*)args[0]->get_string_value(args[0])).ToMultiByte(),true)) + else if (!g_Signal->JSSignal(CEF_String((wchar_t*)args[0]->get_string_value(args[0])).ToMultiByte(),true)) *exception = CEF_String("mIRC Communication Failed").ToCefString(); else - *retval = cef_v8value_create_string(CEF_String(signal->GetEvaluatedData()).ToWideChar()); + *retval = cef_v8value_create_string(CEF_String(g_Signal->GetEvaluatedData()).ToWideChar()); bHandled = true; } else if (!wcscmp(name,L"command")) @@ -40,7 +40,7 @@ // Do Command Stuff if (numargs != 1) *exception = CEF_String("Invalid Parameters: Command(\"mIRC Script\");").ToCefString(); - else if (!signal->JSSignal(CEF_String((wchar_t*)args[0]->get_string_value(args[0])).ToMultiByte(),false)) + else if (!g_Signal->JSSignal(CEF_String((wchar_t*)args[0]->get_string_value(args[0])).ToMultiByte(),false)) *exception = CEF_String("mIRC Communication Failed").ToCefString(); bHandled = true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-08-06 22:13:39
|
Revision: 238 http://mchef.svn.sourceforge.net/mchef/?rev=238&view=rev Author: tux316 Date: 2009-08-06 22:13:27 +0000 (Thu, 06 Aug 2009) Log Message: ----------- - Removed member m_Rect from lpChef structure. It is not needed. - Changed some weird crap in the window procedure...Not sure why we had it like that... http://genscriptsreview.appspot.com/3001 Modified Paths: -------------- trunk/src/mChef/Chef.cpp trunk/src/mChef/ChefBrowser.cpp trunk/src/mChef/ChefStruct.h trunk/src/mChef/SubClass.cpp Modified: trunk/src/mChef/Chef.cpp =================================================================== --- trunk/src/mChef/Chef.cpp 2009-08-01 04:26:16 UTC (rev 237) +++ trunk/src/mChef/Chef.cpp 2009-08-06 22:13:27 UTC (rev 238) @@ -287,10 +287,12 @@ curChef->m_hWnd = m_hWnd; curChef->m_BrowserHwnd = NULL; curChef->m_ResizeTarget = hwResizeTarget; - GetClientRect(curChef->m_hWnd, &curChef->m_Rect); + + RECT m_Rect; + GetClientRect(curChef->m_hWnd, &m_Rect); if (hwResizeTarget) { - GetClientRect(curChef->m_ResizeTarget, &curChef->m_Rect); + GetClientRect(curChef->m_ResizeTarget, &m_Rect); curChef->wpResizeTarget = (WNDPROC)SetWindowLongPtr(curChef->m_ResizeTarget, GWL_WNDPROC, (LONG_PTR)ResizeWndProc); } @@ -303,11 +305,10 @@ curChef->mWindowInfo->m_dwStyle = WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS; curChef->mWindowInfo->m_hWndParent = m_hWnd; curChef->mWindowInfo->m_windowName = CEF_String(m_WindowName).ToCefString(); - curChef->mWindowInfo->m_x = curChef->mWindowInfo->m_y = 0; - curChef->mWindowInfo->m_nWidth = curChef->m_Rect.right; - curChef->mWindowInfo->m_nHeight = curChef->m_Rect.bottom; + curChef->mWindowInfo->m_nWidth = m_Rect.right; + curChef->mWindowInfo->m_nHeight = m_Rect.bottom; curChef->bCanGoBack = curChef->bCanGoForward = curChef->bIsLoading = false; ChefInsert(curChef); Modified: trunk/src/mChef/ChefBrowser.cpp =================================================================== --- trunk/src/mChef/ChefBrowser.cpp 2009-08-01 04:26:16 UTC (rev 237) +++ trunk/src/mChef/ChefBrowser.cpp 2009-08-06 22:13:27 UTC (rev 238) @@ -87,7 +87,6 @@ ScreenToClient(hwParent,(LPPOINT)&rc.left); ScreenToClient(hwParent,(LPPOINT)&rc.right); - curChef->m_Rect = rc; curChef->mWindowInfo->m_x = rc.left; curChef->mWindowInfo->m_y = rc.top; curChef->mWindowInfo->m_nWidth = rc.right-rc.left; @@ -157,7 +156,7 @@ SetWindowLongPtr(hwResizeTarget,GWL_WNDPROC,(LONG)curChef->wpResizeTarget); DestroyWindow(hwResizeTarget); SetWindowLong(hwResizeTarget,GWL_ID,id); - // curChef->m_ResizeTarget = NULL; Dialogs seem to be broken when this is in place, let's comment it out until bama takes a look at it. + curChef->m_ResizeTarget = NULL; curChef->wpResizeTarget = NULL; } Modified: trunk/src/mChef/ChefStruct.h =================================================================== --- trunk/src/mChef/ChefStruct.h 2009-08-01 04:26:16 UTC (rev 237) +++ trunk/src/mChef/ChefStruct.h 2009-08-06 22:13:27 UTC (rev 238) @@ -58,7 +58,6 @@ HWND m_ResizeTarget; /* Handle to a resize target */ HWND m_Toolbar; /* Handle to the toolbar */ - RECT m_Rect; /* Rectangular information about the window */ long flags; /* What type of Window is this? */ bool bIsLoading; /* Are we currently loading? */ Modified: trunk/src/mChef/SubClass.cpp =================================================================== --- trunk/src/mChef/SubClass.cpp 2009-08-01 04:26:16 UTC (rev 237) +++ trunk/src/mChef/SubClass.cpp 2009-08-06 22:13:27 UTC (rev 238) @@ -41,43 +41,44 @@ switch (message) { case WM_COMMAND: - switch(wParam) - { - case MC_TOOLBAR_BACK: - if (curChef->mBrowser->can_go_back(curChef->mBrowser)) - curChef->mBrowser->go_back(curChef->mBrowser); - break; - case MC_TOOLBAR_FORWARD: - if (curChef->mBrowser->can_go_forward(curChef->mBrowser)) - curChef->mBrowser->go_forward(curChef->mBrowser); - break; - case MC_TOOLBAR_REFRESH: - curChef->mBrowser->reload(curChef->mBrowser); - break; - case MC_TOOLBAR_GO: - { - cef_frame_t *frame = curChef->mBrowser->get_main_frame(curChef->mBrowser); - wchar_t text[255]; - GetWindowText(GetDlgItem(curChef->m_Toolbar,MC_TOOLBAR_EDIT),text,255); - frame->load_url(frame,text); - } - break; - } + { + switch(wParam) + { + case MC_TOOLBAR_BACK: + if (curChef->mBrowser->can_go_back(curChef->mBrowser)) + curChef->mBrowser->go_back(curChef->mBrowser); + break; + case MC_TOOLBAR_FORWARD: + if (curChef->mBrowser->can_go_forward(curChef->mBrowser)) + curChef->mBrowser->go_forward(curChef->mBrowser); + break; + case MC_TOOLBAR_REFRESH: + curChef->mBrowser->reload(curChef->mBrowser); + break; + case MC_TOOLBAR_GO: + { + cef_frame_t *frame = curChef->mBrowser->get_main_frame(curChef->mBrowser); + wchar_t text[255]; + GetWindowText(GetDlgItem(curChef->m_Toolbar,MC_TOOLBAR_EDIT),text,255); + frame->load_url(frame,text); + } + break; + } + } break; - case WM_PAINT: - case WM_SETFOCUS: - case WM_ERASEBKGND: case WM_SIZE: { if (curChef->m_ResizeTarget) // if theres a resize target use it instead of this cruddy function break; - HWND hwWindow = curChef->m_BrowserHwnd; - curChef->m_Rect.right = LOWORD(lParam); //width - curChef->m_Rect.bottom = HIWORD(lParam); // height - SetWindowPos(hwWindow,NULL,0,0,curChef->m_Rect.right,curChef->m_Rect.bottom,SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER); + SetWindowPos(curChef->m_BrowserHwnd, NULL, 0, 0, LOWORD(lParam), + HIWORD(lParam), SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER); } - break; + break; + case WM_PAINT: + case WM_SETFOCUS: + case WM_ERASEBKGND: + break; } /* mIRC Can't handle our attached dialogs, so we send them to DefWindowProc instead. */ @@ -90,21 +91,16 @@ lpChef curChef = ChefFindByResize(hWnd); if (!curChef) { - CF_DB(printf("ERROR: ResizeWndProc called on a Window (HWND: %08x) that we are not attached to!\n", hWnd)); + CF_DB(printf("\nERROR: ResizeWndProc called on a Window (HWND: %08x) that we are not attached to!\n", hWnd)); return 0; /* This should NOT happen!! */ } switch (message) { case WM_WINDOWPOSCHANGED: - HWND hwWindow = curChef->m_BrowserHwnd; LPWINDOWPOS pos = (LPWINDOWPOS)lParam; - curChef->m_Rect.left = pos->x; - curChef->m_Rect.top = pos->y; - curChef->m_Rect.right = pos->cx; //width - curChef->m_Rect.bottom = pos->cy; // height - SetWindowPos(hwWindow,NULL,curChef->m_Rect.left,curChef->m_Rect.top, - curChef->m_Rect.right,curChef->m_Rect.bottom,SWP_NOACTIVATE|SWP_NOZORDER); + SetWindowPos(curChef->m_BrowserHwnd, NULL, pos->x, pos->y, pos->cx, + pos->cy, SWP_NOACTIVATE | SWP_NOZORDER); break; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-08-01 04:26:25
|
Revision: 237 http://mchef.svn.sourceforge.net/mchef/?rev=237&view=rev Author: tux316 Date: 2009-08-01 04:26:16 +0000 (Sat, 01 Aug 2009) Log Message: ----------- - Optimized list constructors on Gen/Console.hpp - Removed some debugging code. - Removed unused variables in Chef.cpp and ChefBaseStruct.cpp - Deleted old icons and took the folks who made them (twig's little buddy) out of the Credits.txt since we're not using their ripped icons anyways. - Added the Chromium wheel as an icon instead. It might not be original (not like the previous ones where, I found them on fucking Google) but it has an open source feeling to it. Modified Paths: -------------- trunk/Credits.txt trunk/src/Gen/Console.hpp trunk/src/mChef/Chef.cpp trunk/src/mChef/ChefBaseStruct.cpp trunk/src/mChef/ChefBrowser.cpp trunk/src/mChef/Main.cpp trunk/src/mChef/Misc/mChef.rc trunk/src/mChef/mChef.vcproj trunk/src/mChef/resource.h Added Paths: ----------- trunk/src/mChef/Misc/chromium.ico Removed Paths: ------------- trunk/src/mChef/Misc/icon1.ico trunk/src/mChef/Misc/icon2.ico Modified: trunk/Credits.txt =================================================================== --- trunk/Credits.txt 2009-07-31 22:41:41 UTC (rev 236) +++ trunk/Credits.txt 2009-08-01 04:26:16 UTC (rev 237) @@ -12,5 +12,4 @@ Ook (Moral Support/Tester/Troubleshooter) Rafael Medina <gen...@me...> (Moral Support/Tester) Danny Bailey <phi...@gm...> (Moral Support/Tester) -Daniel Maresca Jr <dma...@gm...> (Tester/Icons) Modified: trunk/src/Gen/Console.hpp =================================================================== --- trunk/src/Gen/Console.hpp 2009-07-31 22:41:41 UTC (rev 236) +++ trunk/src/Gen/Console.hpp 2009-08-01 04:26:16 UTC (rev 237) @@ -49,10 +49,9 @@ /** * Constructor #1. Console does not close on exit. */ - CGenConsole() + CGenConsole() : bCloseOnExit(false) { Initialize(); - bCloseOnExit = false; } /** Modified: trunk/src/mChef/Chef.cpp =================================================================== --- trunk/src/mChef/Chef.cpp 2009-07-31 22:41:41 UTC (rev 236) +++ trunk/src/mChef/Chef.cpp 2009-08-01 04:26:16 UTC (rev 237) @@ -68,7 +68,7 @@ } } catch (std::out_of_range) { - printf ("VECTOR OUT OF RANGE!!!!!!!!!!!!!!!!!!\n"); + CF_DB(printf ("VECTOR OUT OF RANGE!!!!!!!!!!!!!!!!!!\n")); CF_DB(__debugbreak()); } @@ -150,16 +150,14 @@ */ lpChef ChefFindByResize(const HWND m_hWnd) { - CF_DB_START if (m_hWnd) { for (vector<lpChef>::iterator it = ChefWindows.begin(); it != ChefWindows.end(); it++) { if ((*it)->m_ResizeTarget == m_hWnd) { - CF_DB_END return (*it); } } } - CF_DB_END + return NULL; } @@ -219,7 +217,7 @@ Free(curChef); ChefCount--; - printf("ChefCount: %i\n", ChefCount); + CF_DB(printf("ChefCount: %i\n", ChefCount)); CF_DB_END } @@ -468,7 +466,7 @@ { CF_DB_START - CF_DB(fprintf(stderr, "Initalizing Chef.\n")); + CF_DB(fprintf(stderr, "Initializing Chef.\n")); if (!cachePath && !memCache) cachePath = wBuildPath(cachePath, L"Cache"); Modified: trunk/src/mChef/ChefBaseStruct.cpp =================================================================== --- trunk/src/mChef/ChefBaseStruct.cpp 2009-07-31 22:41:41 UTC (rev 236) +++ trunk/src/mChef/ChefBaseStruct.cpp 2009-08-01 04:26:16 UTC (rev 237) @@ -18,11 +18,6 @@ #include "StdAfx.h" #include "h.h" -#ifdef CHEF_DEBUG - //Keep an accurate count of how many bases we have thus far. - static int iBaseCount = 0; -#endif - /* Vector for our lpBases */ static std::vector<lpBases> vBases; @@ -31,7 +26,7 @@ * I think it only makes sense that we store them instead of checking them * every time that we need to find out what's what. */ -size_t SizeOfCefBase = sizeof(cef_base_t); +static size_t SizeOfCefBase = sizeof(cef_base_t); static size_t SizeOfCefBrowser = sizeof(cef_browser_t); static size_t SizeOfCefHandler = sizeof(cef_handler_t); static size_t SizeOfV8Handler = sizeof(cef_v8handler_t); Modified: trunk/src/mChef/ChefBrowser.cpp =================================================================== --- trunk/src/mChef/ChefBrowser.cpp 2009-07-31 22:41:41 UTC (rev 236) +++ trunk/src/mChef/ChefBrowser.cpp 2009-08-01 04:26:16 UTC (rev 237) @@ -157,7 +157,7 @@ SetWindowLongPtr(hwResizeTarget,GWL_WNDPROC,(LONG)curChef->wpResizeTarget); DestroyWindow(hwResizeTarget); SetWindowLong(hwResizeTarget,GWL_ID,id); - curChef->m_ResizeTarget = NULL; + // curChef->m_ResizeTarget = NULL; Dialogs seem to be broken when this is in place, let's comment it out until bama takes a look at it. curChef->wpResizeTarget = NULL; } Modified: trunk/src/mChef/Main.cpp =================================================================== --- trunk/src/mChef/Main.cpp 2009-07-31 22:41:41 UTC (rev 236) +++ trunk/src/mChef/Main.cpp 2009-08-01 04:26:16 UTC (rev 237) @@ -78,8 +78,6 @@ */ void __stdcall LoadDll(Gen::LoadInfo *pLoadInfo) { - CF_DB_START - CF_DB(m_Console = new CGenConsole(true); m_Console->OpenConsole();); OleInitialize(NULL); @@ -88,8 +86,6 @@ CF_DB(fprintf(stderr, "Begin mChef Debug: %s\n\n", __TIMESTAMP__)); mIRC_Window = pLoadInfo->mHwnd; - - CF_DB_END } @@ -100,15 +96,14 @@ */ int __stdcall UnloadDll(int mTimeout) { - CF_DB_START if (mTimeout == 1) return 0; - CF_DB(fprintf(stderr, "Popping Chef vectors...\n")); + CF_DB(printf("Popping Chef vectors...\n")); ChefPopThemAll(); // Good reason to do this before cef_shutdown (has to release the reference of the handler or we get fail) - CF_DB(fprintf(stderr, "Shutting down Cef...\n")); + CF_DB(printf("Shutting down Cef...\n")); cef_shutdown(); if (bClearCacheOnExit && !bCacheInMemory && cachePath) { @@ -129,19 +124,17 @@ SHFileOperation(&fileOp); } - CF_DB(fprintf(stderr,"Popping all Base vectors\n")); + CF_DB(printf("Popping all Base vectors\n")); BasePopThemAll(); // Good reason to do this after cef_shutdown, cef will release a reference to our handler and if we do this before we will make that pointer invalid // In a correcth world this hsould have nothing left to delete, since all items should be released to 0 to skip the debug assert's in cef_shutdown - CF_DB(fprintf(stderr,"Closing Handles and Signal System...\n")); + CF_DB(printf("Closing Handles and Signal System...\n")); delete signal; OleUninitialize(); MyFreeEx(cachePath); + CF_DB(printf("Terminating mChef.dll...OK\nClosing down stderr...\n")); - CF_DB(fprintf(stderr, "Terminating mChef.dll...OK\nClosing down stderr...\n")); - CF_DB_END - CF_DB( fclose(stderr); if (m_Console) Added: trunk/src/mChef/Misc/chromium.ico =================================================================== (Binary files differ) Property changes on: trunk/src/mChef/Misc/chromium.ico ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: trunk/src/mChef/Misc/icon1.ico =================================================================== (Binary files differ) Deleted: trunk/src/mChef/Misc/icon2.ico =================================================================== (Binary files differ) Modified: trunk/src/mChef/Misc/mChef.rc =================================================================== --- trunk/src/mChef/Misc/mChef.rc 2009-07-31 22:41:41 UTC (rev 236) +++ trunk/src/mChef/Misc/mChef.rc 2009-08-01 04:26:16 UTC (rev 237) @@ -1,7 +1,6 @@ // Microsoft Visual C++ generated resource script. // #include "resource.h" -#include "Chef.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// @@ -54,8 +53,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION VERSION_FILE - PRODUCTVERSION VERSION_PRODUCT + FILEVERSION 1,1,0,235 + PRODUCTVERSION 1,1,0,235 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -72,12 +71,12 @@ BEGIN VALUE "CompanyName", "Genscripts" VALUE "FileDescription", "mIRC Chromium Embedded Framework (CEF) Plugin" - VALUE "FileVersion", VERSION_FSTR + VALUE "FileVersion", "1, 1, 0, 235" VALUE "InternalName", "mChef" VALUE "LegalCopyright", "Copyright (C) 2009 Genscripts" VALUE "OriginalFilename", "mChef.dll" VALUE "ProductName", "mChef Dynamic Link Library" - VALUE "ProductVersion", VERSION_PSTR + VALUE "ProductVersion", "1, 1, 0, 235" END END BLOCK "VarFileInfo" @@ -94,8 +93,7 @@ // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_ICON1 ICON "icon1.ico" -IDI_ICON2 ICON "icon2.ico" +IDI_ICON1 ICON "chromium.ico" #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// Modified: trunk/src/mChef/mChef.vcproj =================================================================== --- trunk/src/mChef/mChef.vcproj 2009-07-31 22:41:41 UTC (rev 236) +++ trunk/src/mChef/mChef.vcproj 2009-08-01 04:26:16 UTC (rev 237) @@ -310,14 +310,10 @@ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" > <File - RelativePath=".\Misc\icon1.ico" + RelativePath=".\Misc\chromium.ico" > </File> <File - RelativePath=".\Misc\icon2.ico" - > - </File> - <File RelativePath=".\Misc\mChef.rc" > </File> Modified: trunk/src/mChef/resource.h =================================================================== --- trunk/src/mChef/resource.h 2009-07-31 22:41:41 UTC (rev 236) +++ trunk/src/mChef/resource.h 2009-08-01 04:26:16 UTC (rev 237) @@ -3,7 +3,6 @@ // Used by mChef.rc #define IDI_ICON1 101 -#define IDI_ICON2 102 // Next default values for new objects // This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2009-07-31 21:48:19
|
Revision: 235 http://mchef.svn.sourceforge.net/mchef/?rev=235&view=rev Author: bamaboy Date: 2009-07-31 21:47:50 +0000 (Fri, 31 Jul 2009) Log Message: ----------- New Version Minor Build Modified Paths: -------------- trunk/src/mChef/Chef.h Modified: trunk/src/mChef/Chef.h =================================================================== --- trunk/src/mChef/Chef.h 2009-07-31 21:40:32 UTC (rev 234) +++ trunk/src/mChef/Chef.h 2009-07-31 21:47:50 UTC (rev 235) @@ -20,26 +20,26 @@ /* Change only these macros */ #define VERSION_MAJOR 1 -#define VERSION_MINOR 0 +#define VERSION_MINOR 1 #define VERSION_PATCH 0 /* Changing any of the macros below will only be waisting your time.*/ /* Number of times that the project has been built */ -#define VERSION_BUILD 233 +#define VERSION_BUILD 234 /* Current mChef Version */ -#define MCHEF_VERSION_STR "1.0.233" -#define MCHEF_VERSION_STRWC L"1.0.233" +#define MCHEF_VERSION_STR "1.0.234" +#define MCHEF_VERSION_STRWC L"1.0.234" -#define VERSION_FULL "1.0.233" -#define VERSION_WFULL L"1.0.233" +#define VERSION_FULL "1.0.234" +#define VERSION_WFULL L"1.0.234" -#define VERSION_FILE 1,0,0,233 -#define VERSION_PRODUCT 1,0,0,233 -#define VERSION_FSTR "1, 0, 0, 233" -#define VERSION_PSTR "1, 0, 0, 233" +#define VERSION_FILE 1,0,0,234 +#define VERSION_PRODUCT 1,0,0,234 +#define VERSION_FSTR "1, 0, 0, 234" +#define VERSION_PSTR "1, 0, 0, 234" #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-07-31 21:40:42
|
Revision: 234 http://mchef.svn.sourceforge.net/mchef/?rev=234&view=rev Author: tux316 Date: 2009-07-31 21:40:32 +0000 (Fri, 31 Jul 2009) Log Message: ----------- - Changed it so console closes on exit. - Forcing address bars on all windows for the time being (until we come up with a better way of doing it). Modified Paths: -------------- trunk/src/mChef/Chef.h trunk/src/mChef/ChefMisc.cpp trunk/src/mChef/Main.cpp Modified: trunk/src/mChef/Chef.h =================================================================== --- trunk/src/mChef/Chef.h 2009-07-31 21:28:14 UTC (rev 233) +++ trunk/src/mChef/Chef.h 2009-07-31 21:40:32 UTC (rev 234) @@ -27,19 +27,19 @@ /* Changing any of the macros below will only be waisting your time.*/ /* Number of times that the project has been built */ -#define VERSION_BUILD 1049 +#define VERSION_BUILD 233 /* Current mChef Version */ -#define MCHEF_VERSION_STR "1.0.1049" -#define MCHEF_VERSION_STRWC L"1.0.1049" +#define MCHEF_VERSION_STR "1.0.233" +#define MCHEF_VERSION_STRWC L"1.0.233" -#define VERSION_FULL "1.0.1049" -#define VERSION_WFULL L"1.0.1049" +#define VERSION_FULL "1.0.233" +#define VERSION_WFULL L"1.0.233" -#define VERSION_FILE 1,0,0,1049 -#define VERSION_PRODUCT 1,0,0,1049 -#define VERSION_FSTR "1, 0, 0, 1049" -#define VERSION_PSTR "1, 0, 0, 1049" +#define VERSION_FILE 1,0,0,233 +#define VERSION_PRODUCT 1,0,0,233 +#define VERSION_FSTR "1, 0, 0, 233" +#define VERSION_PSTR "1, 0, 0, 233" #endif Modified: trunk/src/mChef/ChefMisc.cpp =================================================================== --- trunk/src/mChef/ChefMisc.cpp 2009-07-31 21:28:14 UTC (rev 233) +++ trunk/src/mChef/ChefMisc.cpp 2009-07-31 21:40:32 UTC (rev 234) @@ -171,10 +171,10 @@ curChef->mWindowInfo->m_nHeight = rc.bottom-rc.top; } - CF_DB(printf("Run Create Browser")); + CF_DB(printf("Run Create Browser\n")); if (HasAddressBar(curChef)) { - CF_DB(printf("Has Address Bar were running")); + CF_DB(printf("Has Address Bar were running\n")); curChef->mWindowInfo->m_y += 25; curChef->mWindowInfo->m_nHeight -= 25; @@ -183,7 +183,7 @@ ex.dwSize = sizeof(INITCOMMONCONTROLSEX); ex.dwICC = ICC_BAR_CLASSES; BOOL Inited = InitCommonControlsEx(&ex); - CF_DB(printf("Initied Common Controls for AddressBar: %i",Inited)); + CF_DB(printf("Initied Common Controls for AddressBar: %i\n",Inited)); TBBUTTON *btns = new TBBUTTON[4]; memset(btns,0,sizeof(TBBUTTON)*4); Modified: trunk/src/mChef/Main.cpp =================================================================== --- trunk/src/mChef/Main.cpp 2009-07-31 21:28:14 UTC (rev 233) +++ trunk/src/mChef/Main.cpp 2009-07-31 21:40:32 UTC (rev 234) @@ -80,7 +80,7 @@ { CF_DB_START - CF_DB(m_Console = new CGenConsole(); m_Console->OpenConsole();); + CF_DB(m_Console = new CGenConsole(true); m_Console->OpenConsole();); OleInitialize(NULL); CF_DB(freopen("stderr.txt", "wt", stderr)); @@ -212,7 +212,7 @@ return 3; } - if (parc == 5 && !_strcmpi(parv[4],"ADDRESSBAR")) + m_WindowType |= FLAG_ADDRESSBAR; if (m_hwFound) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2009-07-31 21:28:21
|
Revision: 233 http://mchef.svn.sourceforge.net/mchef/?rev=233&view=rev Author: bamaboy Date: 2009-07-31 21:28:14 +0000 (Fri, 31 Jul 2009) Log Message: ----------- Commiting some updates to addressbar stuff Modified Paths: -------------- trunk/src/Tools/VersionTool/VersionTool.vcproj trunk/src/mChef/ChefMacros.h trunk/src/mChef/ChefMisc.cpp trunk/src/mChef/ChefStruct.h trunk/src/mChef/Main.cpp trunk/src/mChef/SubClass.cpp trunk/src/mChef/mChef.vcproj Modified: trunk/src/Tools/VersionTool/VersionTool.vcproj =================================================================== --- trunk/src/Tools/VersionTool/VersionTool.vcproj 2009-07-31 21:24:55 UTC (rev 232) +++ trunk/src/Tools/VersionTool/VersionTool.vcproj 2009-07-31 21:28:14 UTC (rev 233) @@ -178,10 +178,6 @@ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > - <File - RelativePath=".\VersionTool.c" - > - </File> </Filter> <Filter Name="Header Files" Modified: trunk/src/mChef/ChefMacros.h =================================================================== --- trunk/src/mChef/ChefMacros.h 2009-07-31 21:24:55 UTC (rev 232) +++ trunk/src/mChef/ChefMacros.h 2009-07-31 21:28:14 UTC (rev 233) @@ -178,6 +178,7 @@ #define FLAG_CANFOCUSWIDGET 0x000020 #define FLAG_TREEBAR 0x000040 #define FLAG_TOOLBAR 0x000080 +#define FLAG_ADDRESSBAR 0x000200 /** * Macros for verifying flags. @@ -190,6 +191,7 @@ #define CanFocusWidget(x) ((x)->flags & FLAG_CANFOCUSWIDGET) #define IsTreeBar(x) ((x)->flags & FLAG_TREEBAR) #define IsToolBar(x) ((x)->flags & FLAG_TOOLBAR) +#define HasAddressBar(x) ((x)->flags & FLAG_ADDRESSBAR) /** * Macros for setting flags. @@ -202,6 +204,7 @@ #define SetFocusWidget(x) ((x)->flags |= FLAG_CANFOCUSWIDGET) #define SetTreeBar(x) ((x)->flags |= FLAG_TREEBAR) #define SetToolBar(x) ((x)->flags |= FLAG_TOOLBAR) +#define SetAddressBar(x) ((x)->flags |= FLAG_ADDRESSBAR) /** * Macros for clearing flags. @@ -214,6 +217,18 @@ #define ClearFocusWidget(x) ((x)->flags &= ~FLAG_CANFOCUSWIDGET) #define ClearTreeBar(x) ((x)->flags &= ~FLAG_TREEBAR) #define ClearToolBar(x) ((x)->flags &= ~FLAG_TOOLBAR) +#define ClearAddressBar(x) ((x)->flags &= ~FLAG_ADDRESSBAR) + +/** + * Toolbar Defines + * + */ +#define MC_TOOLBAR_BACK 301 +#define MC_TOOLBAR_FORWARD 302 +#define MC_TOOLBAR_REFRESH 303 +#define MC_TOOLBAR_GO 304 +#define MC_TOOLBAR_EDIT 305 + /* EOF */ Modified: trunk/src/mChef/ChefMisc.cpp =================================================================== --- trunk/src/mChef/ChefMisc.cpp 2009-07-31 21:24:55 UTC (rev 232) +++ trunk/src/mChef/ChefMisc.cpp 2009-07-31 21:28:14 UTC (rev 233) @@ -17,6 +17,7 @@ */ #include "StdAfx.h" #include <direct.h> +#include <commctrl.h> #ifdef CHEF_DEBUG # include <fcntl.h> @@ -102,7 +103,7 @@ { CF_DB_START - (void)CreateBrowser(curBrowser->m_hWnd, curBrowser->m_WindowName, + CreateBrowser(curBrowser->m_hWnd, curBrowser->m_WindowName, curBrowser->m_CallBack, curBrowser->m_URL, curBrowser->m_Flags, curBrowser->m_hwResizeTarget); @@ -169,16 +170,62 @@ curChef->mWindowInfo->m_nWidth = rc.right-rc.left; curChef->mWindowInfo->m_nHeight = rc.bottom-rc.top; } + + CF_DB(printf("Run Create Browser")); + if (HasAddressBar(curChef)) + { + CF_DB(printf("Has Address Bar were running")); + curChef->mWindowInfo->m_y += 25; + curChef->mWindowInfo->m_nHeight -= 25; + + INITCOMMONCONTROLSEX ex; + ex.dwSize = sizeof(INITCOMMONCONTROLSEX); + ex.dwICC = ICC_BAR_CLASSES; + BOOL Inited = InitCommonControlsEx(&ex); + CF_DB(printf("Initied Common Controls for AddressBar: %i",Inited)); + + TBBUTTON *btns = new TBBUTTON[4]; + memset(btns,0,sizeof(TBBUTTON)*4); + btns[0].iBitmap = 250; + btns[0].idCommand = 0; + btns[0].fsState = TBSTATE_ENABLED; + btns[0].fsStyle = BTNS_SEP; + btns[0].iString = -1; + + // Buffers for the buttons + wchar_t wcBack[20], wcForward[20], wcGo[20]; + lstrcpy(wcBack,L"Back"); lstrcpy(wcForward,L"Forward"); lstrcpy(wcGo,L"Go"); + + btns[1].iBitmap = I_IMAGENONE; + btns[1].idCommand = MC_TOOLBAR_BACK; + btns[1].fsState = TBSTATE_ENABLED; + btns[1].fsStyle = BTNS_BUTTON|BTNS_SHOWTEXT|BTNS_AUTOSIZE ; + btns[1].iString = (INT_PTR)wcBack; + + btns[2].iBitmap = I_IMAGENONE; + btns[2].idCommand = MC_TOOLBAR_BACK; + btns[2].fsState = TBSTATE_ENABLED; + btns[2].fsStyle = BTNS_BUTTON|BTNS_SHOWTEXT|BTNS_AUTOSIZE ; + btns[2].iString = (INT_PTR)wcForward; + + btns[3].iBitmap = I_IMAGENONE; + btns[3].idCommand = MC_TOOLBAR_BACK; + btns[3].fsState = TBSTATE_ENABLED; + btns[3].fsStyle = BTNS_BUTTON|BTNS_SHOWTEXT|BTNS_AUTOSIZE ; + btns[3].iString = (INT_PTR)wcGo; + + curChef->m_Toolbar = CreateToolbarEx(curChef->m_hWnd, WS_CHILD | WS_VISIBLE | TBSTYLE_LIST, NULL, + 0, NULL, NULL, btns, 4, 0, 0, 100, 30, sizeof (TBBUTTON)); + + CreateWindowEx(0L, L"Edit", NULL, WS_CHILD | WS_BORDER | WS_VISIBLE | ES_LEFT, 0, // now we just catch when buttons are clicked and do what it is we do + 0, 250, 30, curChef->m_Toolbar, (HMENU)MC_TOOLBAR_EDIT, 0, 0 ); + } + CEF_String cs(url != NULL ? url : "about:blank"); cef_browser_create(curChef->mWindowInfo,0, CreateMyHandler(), (const WCHAR*)cs.ToWideChar()); - /* For Bama: - * if (HasAddressBar(curChef) - * SetTimer(curChef->m_hWnd, 1, 250, NULL); - */ - if (IsDialog(curChef)) { long id = GetWindowLong(hwResizeTarget,GWL_ID); SetWindowLongPtr(hwResizeTarget,GWL_WNDPROC,(LONG)curChef->wpResizeTarget); Modified: trunk/src/mChef/ChefStruct.h =================================================================== --- trunk/src/mChef/ChefStruct.h 2009-07-31 21:24:55 UTC (rev 232) +++ trunk/src/mChef/ChefStruct.h 2009-07-31 21:28:14 UTC (rev 233) @@ -56,6 +56,7 @@ HWND m_hWnd; /* Handle to the window */ HWND m_BrowserHwnd; /* Handle to our browser */ HWND m_ResizeTarget; /* Handle to a resize target */ + HWND m_Toolbar; /* Handle to the toolbar */ RECT m_Rect; /* Rectangular information about the window */ long flags; /* What type of Window is this? */ Modified: trunk/src/mChef/Main.cpp =================================================================== --- trunk/src/mChef/Main.cpp 2009-07-31 21:24:55 UTC (rev 232) +++ trunk/src/mChef/Main.cpp 2009-07-31 21:28:14 UTC (rev 233) @@ -212,6 +212,9 @@ return 3; } + if (parc == 5 && !_strcmpi(parv[4],"ADDRESSBAR")) + m_WindowType |= FLAG_ADDRESSBAR; + if (m_hwFound) ShowWindow(m_hwFound, SW_HIDE); Modified: trunk/src/mChef/SubClass.cpp =================================================================== --- trunk/src/mChef/SubClass.cpp 2009-07-31 21:24:55 UTC (rev 232) +++ trunk/src/mChef/SubClass.cpp 2009-07-31 21:28:14 UTC (rev 233) @@ -40,18 +40,30 @@ } switch (message) { - case WM_TIMER: - /* We need to handle navigation state and update "EnableWindow" accordingly, - * for example: - * if (HasAddressBar(curChef)) { - * EnableWindow(curChef->AddrBar->m_ForwardWnd, curChef->bCanGoForward); - * EnableWindow(curChef->AddrBar->m_BackWnd, curChef->bCanGoBack); - * EnableWindow(curChef->AddrBar->m_ReloadWnd, !curChef->bIsLoading); - * EnableWindow(curChef->AddrBar->m_StopWnd, curChef->bIsLoading); - * } - */ - break; case WM_COMMAND: + switch(wParam) + { + case MC_TOOLBAR_BACK: + if (curChef->mBrowser->can_go_back(curChef->mBrowser)) + curChef->mBrowser->go_back(curChef->mBrowser); + break; + case MC_TOOLBAR_FORWARD: + if (curChef->mBrowser->can_go_forward(curChef->mBrowser)) + curChef->mBrowser->go_forward(curChef->mBrowser); + break; + case MC_TOOLBAR_REFRESH: + curChef->mBrowser->reload(curChef->mBrowser); + break; + case MC_TOOLBAR_GO: + { + cef_frame_t *frame = curChef->mBrowser->get_main_frame(curChef->mBrowser); + wchar_t text[255]; + GetWindowText(GetDlgItem(curChef->m_Toolbar,MC_TOOLBAR_EDIT),text,255); + frame->load_url(frame,text); + } + break; + } + break; case WM_PAINT: case WM_SETFOCUS: case WM_ERASEBKGND: @@ -66,9 +78,6 @@ SetWindowPos(hwWindow,NULL,0,0,curChef->m_Rect.right,curChef->m_Rect.bottom,SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER); } break; - case WM_DESTROY: - //KillTimer(curChef->m_hWnd, 1); - break; } /* mIRC Can't handle our attached dialogs, so we send them to DefWindowProc instead. */ Modified: trunk/src/mChef/mChef.vcproj =================================================================== --- trunk/src/mChef/mChef.vcproj 2009-07-31 21:24:55 UTC (rev 232) +++ trunk/src/mChef/mChef.vcproj 2009-07-31 21:28:14 UTC (rev 233) @@ -64,6 +64,7 @@ <Tool Name="VCLinkerTool" AdditionalOptions="/IGNORE:4099" + AdditionalDependencies="comctl32.lib" OutputFile="$(OutDir)\$(ProjectName).dll" LinkIncremental="2" GenerateDebugInformation="false" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-07-31 21:25:03
|
Revision: 232 http://mchef.svn.sourceforge.net/mchef/?rev=232&view=rev Author: tux316 Date: 2009-07-31 21:24:55 +0000 (Fri, 31 Jul 2009) Log Message: ----------- - SF FR#2830514 - Still experimental. Modified Paths: -------------- trunk/src/Tools/VersionTool/VersionTool.c Modified: trunk/src/Tools/VersionTool/VersionTool.c =================================================================== --- trunk/src/Tools/VersionTool/VersionTool.c 2009-07-31 20:14:35 UTC (rev 231) +++ trunk/src/Tools/VersionTool/VersionTool.c 2009-07-31 21:24:55 UTC (rev 232) @@ -25,7 +25,6 @@ if (versionMajor == 0) versionMajor++; - printf("Incrementing Build Number to %i\n", ++versionBuild); printf(" VERSION_MAJOR: %i\n VERSION_MINOR: %i\n VERSION_PATCH: %i\n VERSION_BUILD: %i\n", versionMajor, versionMinor, versionPatch, versionBuild); fprintf(fp, @@ -81,9 +80,10 @@ FILE *fp = NULL; char lineBuffer[BUFSIZ]; char *token = NULL, *delims = " \t"; - int lineNum, versionMajor, versionMinor, versionPatch, versionBuild; + int lineNum, versionMajor, versionMinor, versionPatch, versionBuild, curBuild; + int i = 0; - lineNum = versionMajor = versionMinor = versionPatch = versionBuild = 0; + lineNum = versionMajor = versionMinor = versionPatch = versionBuild = curBuild = 0; if (parc != 2) { printf("Syntax: VersionTool.exe \"../include/ChefVersion.h\"\n"); @@ -122,13 +122,27 @@ lineNum++; } fclose(fp); - printf("Writing new %s\n", parv[1]); - if (!(fp = fopen(parv[1], "w"))) { - printf("Error opening file for writting\n"); + + if (!(fp = fopen("../.svn/entries", "r"))) { + printf("Error opening svn entries file.\n"); return 0; } - WriteChefHeader(fp, versionMajor, versionMinor, versionPatch, versionBuild); + memset(lineBuffer, 0, BUFSIZ); + for (i = 0; i < 4 && fgets(lineBuffer, sizeof(lineBuffer), fp); i++) + ;; + curBuild = atoi(lineBuffer); + fclose(fp); + + if (curBuild != versionBuild) { + printf("Writing new %s\n", parv[1]); + if (!(fp = fopen(parv[1], "w"))) { + printf("Error opening file for witting\n"); + return 0; + } + WriteChefHeader(fp, versionMajor, versionMinor, versionPatch, curBuild); + fclose(fp); + } printf(" mChef VersionTool Done\n"); return 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-07-31 20:14:48
|
Revision: 231 http://mchef.svn.sourceforge.net/mchef/?rev=231&view=rev Author: tux316 Date: 2009-07-31 20:14:35 +0000 (Fri, 31 Jul 2009) Log Message: ----------- - Fixed bug that triggered a crash if the window was closed before it finished loading: http://sourceforge.net/support/tracker.php?aid=2830503 - Inserted a bit of debug code (for the debug configuration that is). Modified Paths: -------------- trunk/src/mChef/Chef.cpp trunk/src/mChef/Chef.h trunk/src/mChef/ChefHandler.cpp trunk/src/mChef/SubClass.cpp Modified: trunk/src/mChef/Chef.cpp =================================================================== --- trunk/src/mChef/Chef.cpp 2009-07-29 18:53:00 UTC (rev 230) +++ trunk/src/mChef/Chef.cpp 2009-07-31 20:14:35 UTC (rev 231) @@ -197,11 +197,15 @@ * if (HasAddressBar(curChef)) * KillTimer(curChef->m_hWnd, 1); */ - if (curChef->OldProc) + if (curChef->OldProc) { + CF_DB(printf("[ChefDelete:%08X] Restoring old window procedure.\n", curChef->m_hWnd)); SetWindowLongPtr(curChef->m_hWnd, GWL_WNDPROC, (LONG_PTR)curChef->OldProc); + } - if (curChef->wpResizeTarget) + if (curChef->wpResizeTarget) { + CF_DB(printf("[ChefDelete:%08X] Restoring old resize target.\n", curChef->m_hWnd)); SetWindowLongPtr(curChef->m_ResizeTarget, GWL_WNDPROC, (LONG_PTR)curChef->wpResizeTarget); + } BaseRelease(curChef->mBrowser); Modified: trunk/src/mChef/Chef.h =================================================================== --- trunk/src/mChef/Chef.h 2009-07-29 18:53:00 UTC (rev 230) +++ trunk/src/mChef/Chef.h 2009-07-31 20:14:35 UTC (rev 231) @@ -27,19 +27,19 @@ /* Changing any of the macros below will only be waisting your time.*/ /* Number of times that the project has been built */ -#define VERSION_BUILD 1009 +#define VERSION_BUILD 1049 /* Current mChef Version */ -#define MCHEF_VERSION_STR "1.0.1009" -#define MCHEF_VERSION_STRWC L"1.0.1009" +#define MCHEF_VERSION_STR "1.0.1049" +#define MCHEF_VERSION_STRWC L"1.0.1049" -#define VERSION_FULL "1.0.1009" -#define VERSION_WFULL L"1.0.1009" +#define VERSION_FULL "1.0.1049" +#define VERSION_WFULL L"1.0.1049" -#define VERSION_FILE 1,0,0,1009 -#define VERSION_PRODUCT 1,0,0,1009 -#define VERSION_FSTR "1, 0, 0, 1009" -#define VERSION_PSTR "1, 0, 0, 1009" +#define VERSION_FILE 1,0,0,1049 +#define VERSION_PRODUCT 1,0,0,1049 +#define VERSION_FSTR "1, 0, 0, 1049" +#define VERSION_PSTR "1, 0, 0, 1049" #endif Modified: trunk/src/mChef/ChefHandler.cpp =================================================================== --- trunk/src/mChef/ChefHandler.cpp 2009-07-29 18:53:00 UTC (rev 230) +++ trunk/src/mChef/ChefHandler.cpp 2009-07-31 20:14:35 UTC (rev 231) @@ -528,8 +528,22 @@ if (curChef) { CF_DB(printf("Chef %s [%08X] was closed.\n", curChef->m_WindowName, curChef->m_hWnd)); + + // If the browser window is still loading, we tell it to stop, and basically + // run this handler again. So in turn, this is now a recursive function. + // http://sourceforge.net/support/tracker.php?aid=2830503 + if (curChef->bIsLoading) { + curChef->bIsLoading = false; + browser->stop_load(browser); + BaseRelease(handler); + BaseRelease(browser); + + return handler->handle_before_window_close(handler, browser); + } + ChefPop(curChef); } + CF_DB(printf("[%08X] closed.\n", m_hWnd)); BaseRelease(handler); BaseRelease(browser); Modified: trunk/src/mChef/SubClass.cpp =================================================================== --- trunk/src/mChef/SubClass.cpp 2009-07-29 18:53:00 UTC (rev 230) +++ trunk/src/mChef/SubClass.cpp 2009-07-31 20:14:35 UTC (rev 231) @@ -67,7 +67,7 @@ } break; case WM_DESTROY: - KillTimer(curChef->m_hWnd, 1); + //KillTimer(curChef->m_hWnd, 1); break; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-07-29 18:53:09
|
Revision: 230 http://mchef.svn.sourceforge.net/mchef/?rev=230&view=rev Author: tux316 Date: 2009-07-29 18:53:00 +0000 (Wed, 29 Jul 2009) Log Message: ----------- - Added upx.exe into the mix, to use it you must be on the release configuration and build the project "Deploy" by hand. - Added upload.py into the mix. This is esoteric python. Borderline Satanic. \o/ (o/ \o) Modified Paths: -------------- trunk/src/Tools/Deploy/Deploy.bat trunk/src/Tools/Deploy/Deploy.vcproj trunk/src/mChef/Chef.h Added Paths: ----------- trunk/src/Tools/upx.exe trunk/upload.py Modified: trunk/src/Tools/Deploy/Deploy.bat =================================================================== --- trunk/src/Tools/Deploy/Deploy.bat 2009-07-29 13:40:05 UTC (rev 229) +++ trunk/src/Tools/Deploy/Deploy.bat 2009-07-29 18:53:00 UTC (rev 230) @@ -36,6 +36,11 @@ xcopy "%MCHEF_DIR%docs" "%DEP_DIR%\docs" /Y /E echo All files have been copied over to "%DEP_DIR%" echo. +echo Compressing icudt38.dll... +"%MCHEF_DIR%src\Tools\upx.exe" --ultra-brute "%DEP_DIR%\icudt38.dll" +echo Compressing mChef.dll... +"%MCHEF_DIR%src\Tools\upx.exe" --ultra-brute "%DEP_DIR%\mChef.dll" +echo . goto end :MissingFile Modified: trunk/src/Tools/Deploy/Deploy.vcproj =================================================================== --- trunk/src/Tools/Deploy/Deploy.vcproj 2009-07-29 13:40:05 UTC (rev 229) +++ trunk/src/Tools/Deploy/Deploy.vcproj 2009-07-29 18:53:00 UTC (rev 230) @@ -28,7 +28,7 @@ Name="VCNMakeTool" BuildCommandLine=""$(ProjectDir)Deploy.bat" "$(SolutionDir)"" ReBuildCommandLine="" - CleanCommandLine="" + CleanCommandLine="rmdir /s /q "$(SolutionDir)Deployment"" Output="" PreprocessorDefinitions="" IncludeSearchPath="" Added: trunk/src/Tools/upx.exe =================================================================== (Binary files differ) Property changes on: trunk/src/Tools/upx.exe ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/mChef/Chef.h =================================================================== --- trunk/src/mChef/Chef.h 2009-07-29 13:40:05 UTC (rev 229) +++ trunk/src/mChef/Chef.h 2009-07-29 18:53:00 UTC (rev 230) @@ -27,19 +27,19 @@ /* Changing any of the macros below will only be waisting your time.*/ /* Number of times that the project has been built */ -#define VERSION_BUILD 1005 +#define VERSION_BUILD 1009 /* Current mChef Version */ -#define MCHEF_VERSION_STR "1.0.1005" -#define MCHEF_VERSION_STRWC L"1.0.1005" +#define MCHEF_VERSION_STR "1.0.1009" +#define MCHEF_VERSION_STRWC L"1.0.1009" -#define VERSION_FULL "1.0.1005" -#define VERSION_WFULL L"1.0.1005" +#define VERSION_FULL "1.0.1009" +#define VERSION_WFULL L"1.0.1009" -#define VERSION_FILE 1,0,0,1005 -#define VERSION_PRODUCT 1,0,0,1005 -#define VERSION_FSTR "1, 0, 0, 1005" -#define VERSION_PSTR "1, 0, 0, 1005" +#define VERSION_FILE 1,0,0,1009 +#define VERSION_PRODUCT 1,0,0,1009 +#define VERSION_FSTR "1, 0, 0, 1009" +#define VERSION_PSTR "1, 0, 0, 1009" #endif Added: trunk/upload.py =================================================================== --- trunk/upload.py (rev 0) +++ trunk/upload.py 2009-07-29 18:53:00 UTC (rev 230) @@ -0,0 +1,1456 @@ +#!/usr/bin/env python +# +# Copyright 2007 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Tool for uploading diffs from a version control system to the codereview app. + +Usage summary: upload.py [options] [-- diff_options] + +Diff options are passed to the diff command of the underlying system. + +Supported version control systems: + Git + Mercurial + Subversion + +It is important for Git/Mercurial users to specify a tree/node/branch to diff +against by using the '--rev' option. +""" +# This code is derived from appcfg.py in the App Engine SDK (open source), +# and from ASPN recipe #146306. + +import cookielib +import getpass +import logging +import mimetypes +import optparse +import os +import re +import socket +import subprocess +import sys +import urllib +import urllib2 +import urlparse + +# The md5 module was deprecated in Python 2.5. +try: + from hashlib import md5 +except ImportError: + from md5 import md5 + +try: + import readline +except ImportError: + pass + +# The logging verbosity: +# 0: Errors only. +# 1: Status messages. +# 2: Info logs. +# 3: Debug logs. +verbosity = 1 + +# Max size of patch or base file. +MAX_UPLOAD_SIZE = 900 * 1024 + +# Constants for version control names. Used by GuessVCSName. +VCS_GIT = "Git" +VCS_MERCURIAL = "Mercurial" +VCS_SUBVERSION = "Subversion" +VCS_UNKNOWN = "Unknown" + + +def GetEmail(prompt): + """Prompts the user for their email address and returns it. + + The last used email address is saved to a file and offered up as a suggestion + to the user. If the user presses enter without typing in anything the last + used email address is used. If the user enters a new address, it is saved + for next time we prompt. + + """ + last_email_file_name = os.path.expanduser("~/.last_codereview_email_address") + last_email = "" + if os.path.exists(last_email_file_name): + try: + last_email_file = open(last_email_file_name, "r") + last_email = last_email_file.readline().strip("\n") + last_email_file.close() + prompt += " [%s]" % last_email + except IOError, e: + pass + email = raw_input(prompt + ": ").strip() + if email: + try: + last_email_file = open(last_email_file_name, "w") + last_email_file.write(email) + last_email_file.close() + except IOError, e: + pass + else: + email = last_email + return email + + +def StatusUpdate(msg): + """Print a status message to stdout. + + If 'verbosity' is greater than 0, print the message. + + Args: + msg: The string to print. + """ + if verbosity > 0: + print msg + + +def ErrorExit(msg): + """Print an error message to stderr and exit.""" + print >>sys.stderr, msg + sys.exit(1) + + +class ClientLoginError(urllib2.HTTPError): + """Raised to indicate there was an error authenticating with ClientLogin.""" + + def __init__(self, url, code, msg, headers, args): + urllib2.HTTPError.__init__(self, url, code, msg, headers, None) + self.args = args + self.reason = args["Error"] + + +class AbstractRpcServer(object): + """Provides a common interface for a simple RPC server.""" + + def __init__(self, host, auth_function, host_override=None, extra_headers={}, + save_cookies=False): + """Creates a new HttpRpcServer. + + Args: + host: The host to send requests to. + auth_function: A function that takes no arguments and returns an + (email, password) tuple when called. Will be called if authentication + is required. + host_override: The host header to send to the server (defaults to host). + extra_headers: A dict of extra headers to append to every request. + save_cookies: If True, save the authentication cookies to local disk. + If False, use an in-memory cookiejar instead. Subclasses must + implement this functionality. Defaults to False. + """ + self.host = host + self.host_override = host_override + self.auth_function = auth_function + self.authenticated = False + self.extra_headers = extra_headers + self.save_cookies = save_cookies + self.opener = self._GetOpener() + if self.host_override: + logging.info("Server: %s; Host: %s", self.host, self.host_override) + else: + logging.info("Server: %s", self.host) + + def _GetOpener(self): + """Returns an OpenerDirector for making HTTP requests. + + Returns: + A urllib2.OpenerDirector object. + """ + raise NotImplementedError() + + def _CreateRequest(self, url, data=None): + """Creates a new urllib request.""" + logging.debug("Creating request for: '%s' with payload:\n%s", url, data) + req = urllib2.Request(url, data=data) + if self.host_override: + req.add_header("Host", self.host_override) + for key, value in self.extra_headers.iteritems(): + req.add_header(key, value) + return req + + def _GetAuthToken(self, email, password): + """Uses ClientLogin to authenticate the user, returning an auth token. + + Args: + email: The user's email address + password: The user's password + + Raises: + ClientLoginError: If there was an error authenticating with ClientLogin. + HTTPError: If there was some other form of HTTP error. + + Returns: + The authentication token returned by ClientLogin. + """ + account_type = "GOOGLE" + if self.host.endswith(".google.com"): + # Needed for use inside Google. + account_type = "HOSTED" + req = self._CreateRequest( + url="https://www.google.com/accounts/ClientLogin", + data=urllib.urlencode({ + "Email": email, + "Passwd": password, + "service": "ah", + "source": "rietveld-codereview-upload", + "accountType": account_type, + }), + ) + try: + response = self.opener.open(req) + response_body = response.read() + response_dict = dict(x.split("=") + for x in response_body.split("\n") if x) + return response_dict["Auth"] + except urllib2.HTTPError, e: + if e.code == 403: + body = e.read() + response_dict = dict(x.split("=", 1) for x in body.split("\n") if x) + raise ClientLoginError(req.get_full_url(), e.code, e.msg, + e.headers, response_dict) + else: + raise + + def _GetAuthCookie(self, auth_token): + """Fetches authentication cookies for an authentication token. + + Args: + auth_token: The authentication token returned by ClientLogin. + + Raises: + HTTPError: If there was an error fetching the authentication cookies. + """ + # This is a dummy value to allow us to identify when we're successful. + continue_location = "http://localhost/" + args = {"continue": continue_location, "auth": auth_token} + req = self._CreateRequest("http://%s/_ah/login?%s" % + (self.host, urllib.urlencode(args))) + try: + response = self.opener.open(req) + except urllib2.HTTPError, e: + response = e + if (response.code != 302 or + response.info()["location"] != continue_location): + raise urllib2.HTTPError(req.get_full_url(), response.code, response.msg, + response.headers, response.fp) + self.authenticated = True + + def _Authenticate(self): + """Authenticates the user. + + The authentication process works as follows: + 1) We get a username and password from the user + 2) We use ClientLogin to obtain an AUTH token for the user + (see http://code.google.com/apis/accounts/AuthForInstalledApps.html). + 3) We pass the auth token to /_ah/login on the server to obtain an + authentication cookie. If login was successful, it tries to redirect + us to the URL we provided. + + If we attempt to access the upload API without first obtaining an + authentication cookie, it returns a 401 response and directs us to + authenticate ourselves with ClientLogin. + """ + for i in range(3): + credentials = self.auth_function() + try: + auth_token = self._GetAuthToken(credentials[0], credentials[1]) + except ClientLoginError, e: + if e.reason == "BadAuthentication": + print >>sys.stderr, "Invalid username or password." + continue + if e.reason == "CaptchaRequired": + print >>sys.stderr, ( + "Please go to\n" + "https://www.google.com/accounts/DisplayUnlockCaptcha\n" + "and verify you are a human. Then try again.") + break + if e.reason == "NotVerified": + print >>sys.stderr, "Account not verified." + break + if e.reason == "TermsNotAgreed": + print >>sys.stderr, "User has not agreed to TOS." + break + if e.reason == "AccountDeleted": + print >>sys.stderr, "The user account has been deleted." + break + if e.reason == "AccountDisabled": + print >>sys.stderr, "The user account has been disabled." + break + if e.reason == "ServiceDisabled": + print >>sys.stderr, ("The user's access to the service has been " + "disabled.") + break + if e.reason == "ServiceUnavailable": + print >>sys.stderr, "The service is not available; try again later." + break + raise + self._GetAuthCookie(auth_token) + return + + def Send(self, request_path, payload=None, + content_type="application/octet-stream", + timeout=None, + **kwargs): + """Sends an RPC and returns the response. + + Args: + request_path: The path to send the request to, eg /api/appversion/create. + payload: The body of the request, or None to send an empty request. + content_type: The Content-Type header to use. + timeout: timeout in seconds; default None i.e. no timeout. + (Note: for large requests on OS X, the timeout doesn't work right.) + kwargs: Any keyword arguments are converted into query string parameters. + + Returns: + The response body, as a string. + """ + # TODO: Don't require authentication. Let the server say + # whether it is necessary. + if not self.authenticated: + self._Authenticate() + + old_timeout = socket.getdefaulttimeout() + socket.setdefaulttimeout(timeout) + try: + tries = 0 + while True: + tries += 1 + args = dict(kwargs) + url = "http://%s%s" % (self.host, request_path) + if args: + url += "?" + urllib.urlencode(args) + req = self._CreateRequest(url=url, data=payload) + req.add_header("Content-Type", content_type) + try: + f = self.opener.open(req) + response = f.read() + f.close() + return response + except urllib2.HTTPError, e: + if tries > 3: + raise + elif e.code == 401: + self._Authenticate() +## elif e.code >= 500 and e.code < 600: +## # Server Error - try again. +## continue + else: + raise + finally: + socket.setdefaulttimeout(old_timeout) + + +class HttpRpcServer(AbstractRpcServer): + """Provides a simplified RPC-style interface for HTTP requests.""" + + def _Authenticate(self): + """Save the cookie jar after authentication.""" + super(HttpRpcServer, self)._Authenticate() + if self.save_cookies: + StatusUpdate("Saving authentication cookies to %s" % self.cookie_file) + self.cookie_jar.save() + + def _GetOpener(self): + """Returns an OpenerDirector that supports cookies and ignores redirects. + + Returns: + A urllib2.OpenerDirector object. + """ + opener = urllib2.OpenerDirector() + opener.add_handler(urllib2.ProxyHandler()) + opener.add_handler(urllib2.UnknownHandler()) + opener.add_handler(urllib2.HTTPHandler()) + opener.add_handler(urllib2.HTTPDefaultErrorHandler()) + opener.add_handler(urllib2.HTTPSHandler()) + opener.add_handler(urllib2.HTTPErrorProcessor()) + if self.save_cookies: + self.cookie_file = os.path.expanduser("~/.codereview_upload_cookies") + self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file) + if os.path.exists(self.cookie_file): + try: + self.cookie_jar.load() + self.authenticated = True + StatusUpdate("Loaded authentication cookies from %s" % + self.cookie_file) + except (cookielib.LoadError, IOError): + # Failed to load cookies - just ignore them. + pass + else: + # Create an empty cookie file with mode 600 + fd = os.open(self.cookie_file, os.O_CREAT, 0600) + os.close(fd) + # Always chmod the cookie file + os.chmod(self.cookie_file, 0600) + else: + # Don't save cookies across runs of update.py. + self.cookie_jar = cookielib.CookieJar() + opener.add_handler(urllib2.HTTPCookieProcessor(self.cookie_jar)) + return opener + + +parser = optparse.OptionParser(usage="%prog [options] [-- diff_options]") +parser.add_option("-y", "--assume_yes", action="store_true", + dest="assume_yes", default=False, + help="Assume that the answer to yes/no questions is 'yes'.") +# Logging +group = parser.add_option_group("Logging options") +group.add_option("-q", "--quiet", action="store_const", const=0, + dest="verbose", help="Print errors only.") +group.add_option("-v", "--verbose", action="store_const", const=2, + dest="verbose", default=1, + help="Print info level logs (default).") +group.add_option("--noisy", action="store_const", const=3, + dest="verbose", help="Print all logs.") +# Review server +group = parser.add_option_group("Review server options") +group.add_option("-s", "--server", action="store", dest="server", + default="genscriptsreview.appspot.com", + metavar="SERVER", + help=("The server to upload to. The format is host[:port]. " + "Defaults to '%default'.")) +group.add_option("-e", "--email", action="store", dest="email", + metavar="EMAIL", default=None, + help="The username to use. Will prompt if omitted.") +group.add_option("-H", "--host", action="store", dest="host", + metavar="HOST", default=None, + help="Overrides the Host header sent with all RPCs.") +group.add_option("--no_cookies", action="store_false", + dest="save_cookies", default=True, + help="Do not save authentication cookies to local disk.") +# Issue +group = parser.add_option_group("Issue options") +group.add_option("-d", "--description", action="store", dest="description", + metavar="DESCRIPTION", default=None, + help="Optional description when creating an issue.") +group.add_option("-f", "--description_file", action="store", + dest="description_file", metavar="DESCRIPTION_FILE", + default=None, + help="Optional path of a file that contains " + "the description when creating an issue.") +group.add_option("-r", "--reviewers", action="store", dest="reviewers", + metavar="REVIEWERS", default=None, + help="Add reviewers (comma separated email addresses).") +group.add_option("--cc", action="store", dest="cc", + metavar="CC", default=None, + help="Add CC (comma separated email addresses).") +group.add_option("--private", action="store_true", dest="private", + default=False, + help="Make the issue restricted to reviewers and those CCed") +# Upload options +group = parser.add_option_group("Patch options") +group.add_option("-m", "--message", action="store", dest="message", + metavar="MESSAGE", default=None, + help="A message to identify the patch. " + "Will prompt if omitted.") +group.add_option("-i", "--issue", type="int", action="store", + metavar="ISSUE", default=None, + help="Issue number to which to add. Defaults to new issue.") +group.add_option("--download_base", action="store_true", + dest="download_base", default=False, + help="Base files will be downloaded by the server " + "(side-by-side diffs may not work on files with CRs).") +group.add_option("--rev", action="store", dest="revision", + metavar="REV", default=None, + help="Branch/tree/revision to diff against (used by DVCS).") +group.add_option("--send_mail", action="store_true", + dest="send_mail", default=False, + help="Send notification email to reviewers.") + + +def GetRpcServer(options): + """Returns an instance of an AbstractRpcServer. + + Returns: + A new AbstractRpcServer, on which RPC calls can be made. + """ + + rpc_server_class = HttpRpcServer + + def GetUserCredentials(): + """Prompts the user for a username and password.""" + email = options.email + if email is None: + email = GetEmail("Email (login for uploading to %s)" % options.server) + password = getpass.getpass("Password for %s: " % email) + return (email, password) + + # If this is the dev_appserver, use fake authentication. + host = (options.host or options.server).lower() + if host == "localhost" or host.startswith("localhost:"): + email = options.email + if email is None: + email = "te...@ex..." + logging.info("Using debug user %s. Override with --email" % email) + server = rpc_server_class( + options.server, + lambda: (email, "password"), + host_override=options.host, + extra_headers={"Cookie": + 'dev_appserver_login="%s:False"' % email}, + save_cookies=options.save_cookies) + # Don't try to talk to ClientLogin. + server.authenticated = True + return server + + return rpc_server_class(options.server, GetUserCredentials, + host_override=options.host, + save_cookies=options.save_cookies) + + +def EncodeMultipartFormData(fields, files): + """Encode form fields for multipart/form-data. + + Args: + fields: A sequence of (name, value) elements for regular form fields. + files: A sequence of (name, filename, value) elements for data to be + uploaded as files. + Returns: + (content_type, body) ready for httplib.HTTP instance. + + Source: + http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146306 + """ + BOUNDARY = '-M-A-G-I-C---B-O-U-N-D-A-R-Y-' + CRLF = '\r\n' + lines = [] + for (key, value) in fields: + lines.append('--' + BOUNDARY) + lines.append('Content-Disposition: form-data; name="%s"' % key) + lines.append('') + lines.append(value) + for (key, filename, value) in files: + lines.append('--' + BOUNDARY) + lines.append('Content-Disposition: form-data; name="%s"; filename="%s"' % + (key, filename)) + lines.append('Content-Type: %s' % GetContentType(filename)) + lines.append('') + lines.append(value) + lines.append('--' + BOUNDARY + '--') + lines.append('') + body = CRLF.join(lines) + content_type = 'multipart/form-data; boundary=%s' % BOUNDARY + return content_type, body + + +def GetContentType(filename): + """Helper to guess the content-type from the filename.""" + return mimetypes.guess_type(filename)[0] or 'application/octet-stream' + + +# Use a shell for subcommands on Windows to get a PATH search. +use_shell = sys.platform.startswith("win") + +def RunShellWithReturnCode(command, print_output=False, + universal_newlines=True): + """Executes a command and returns the output from stdout and the return code. + + Args: + command: Command to execute. + print_output: If True, the output is printed to stdout. + If False, both stdout and stderr are ignored. + universal_newlines: Use universal_newlines flag (default: True). + + Returns: + Tuple (output, return code) + """ + logging.info("Running %s", command) + p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, + shell=use_shell, universal_newlines=universal_newlines) + if print_output: + output_array = [] + while True: + line = p.stdout.readline() + if not line: + break + print line.strip("\n") + output_array.append(line) + output = "".join(output_array) + else: + output = p.stdout.read() + p.wait() + errout = p.stderr.read() + if print_output and errout: + print >>sys.stderr, errout + p.stdout.close() + p.stderr.close() + return output, p.returncode + + +def RunShell(command, silent_ok=False, universal_newlines=True, + print_output=False): + data, retcode = RunShellWithReturnCode(command, print_output, + universal_newlines) + if retcode: + ErrorExit("Got error status from %s:\n%s" % (command, data)) + if not silent_ok and not data: + ErrorExit("No output from %s" % command) + return data + + +class VersionControlSystem(object): + """Abstract base class providing an interface to the VCS.""" + + def __init__(self, options): + """Constructor. + + Args: + options: Command line options. + """ + self.options = options + + def GenerateDiff(self, args): + """Return the current diff as a string. + + Args: + args: Extra arguments to pass to the diff command. + """ + raise NotImplementedError( + "abstract method -- subclass %s must override" % self.__class__) + + def GetUnknownFiles(self): + """Return a list of files unknown to the VCS.""" + raise NotImplementedError( + "abstract method -- subclass %s must override" % self.__class__) + + def CheckForUnknownFiles(self): + """Show an "are you sure?" prompt if there are unknown files.""" + unknown_files = self.GetUnknownFiles() + if unknown_files: + print "The following files are not added to version control:" + for line in unknown_files: + print line + prompt = "Are you sure to continue?(y/N) " + answer = raw_input(prompt).strip() + if answer != "y": + ErrorExit("User aborted") + + def GetBaseFile(self, filename): + """Get the content of the upstream version of a file. + + Returns: + A tuple (base_content, new_content, is_binary, status) + base_content: The contents of the base file. + new_content: For text files, this is empty. For binary files, this is + the contents of the new file, since the diff output won't contain + information to reconstruct the current file. + is_binary: True iff the file is binary. + status: The status of the file. + """ + + raise NotImplementedError( + "abstract method -- subclass %s must override" % self.__class__) + + + def GetBaseFiles(self, diff): + """Helper that calls GetBase file for each file in the patch. + + Returns: + A dictionary that maps from filename to GetBaseFile's tuple. Filenames + are retrieved based on lines that start with "Index:" or + "Property changes on:". + """ + files = {} + for line in diff.splitlines(True): + if line.startswith('Index:') or line.startswith('Property changes on:'): + unused, filename = line.split(':', 1) + # On Windows if a file has property changes its filename uses '\' + # instead of '/'. + filename = filename.strip().replace('\\', '/') + files[filename] = self.GetBaseFile(filename) + return files + + + def UploadBaseFiles(self, issue, rpc_server, patch_list, patchset, options, + files): + """Uploads the base files (and if necessary, the current ones as well).""" + + def UploadFile(filename, file_id, content, is_binary, status, is_base): + """Uploads a file to the server.""" + file_too_large = False + if is_base: + type = "base" + else: + type = "current" + if len(content) > MAX_UPLOAD_SIZE: + print ("Not uploading the %s file for %s because it's too large." % + (type, filename)) + file_too_large = True + content = "" + checksum = md5(content).hexdigest() + if options.verbose > 0 and not file_too_large: + print "Uploading %s file for %s" % (type, filename) + url = "/%d/upload_content/%d/%d" % (int(issue), int(patchset), file_id) + form_fields = [("filename", filename), + ("status", status), + ("checksum", checksum), + ("is_binary", str(is_binary)), + ("is_current", str(not is_base)), + ] + if file_too_large: + form_fields.append(("file_too_large", "1")) + if options.email: + form_fields.append(("user", options.email)) + ctype, body = EncodeMultipartFormData(form_fields, + [("data", filename, content)]) + response_body = rpc_server.Send(url, body, + content_type=ctype) + if not response_body.startswith("OK"): + StatusUpdate(" --> %s" % response_body) + sys.exit(1) + + patches = dict() + [patches.setdefault(v, k) for k, v in patch_list] + for filename in patches.keys(): + base_content, new_content, is_binary, status = files[filename] + file_id_str = patches.get(filename) + if file_id_str.find("nobase") != -1: + base_content = None + file_id_str = file_id_str[file_id_str.rfind("_") + 1:] + file_id = int(file_id_str) + if base_content != None: + UploadFile(filename, file_id, base_content, is_binary, status, True) + if new_content != None: + UploadFile(filename, file_id, new_content, is_binary, status, False) + + def IsImage(self, filename): + """Returns true if the filename has an image extension.""" + mimetype = mimetypes.guess_type(filename)[0] + if not mimetype: + return False + return mimetype.startswith("image/") + + def IsBinary(self, filename): + """Returns true if the guessed mimetyped isnt't in text group.""" + mimetype = mimetypes.guess_type(filename)[0] + if not mimetype: + return False # e.g. README, "real" binaries usually have an extension + return not mimetype.startswith("text/") + + +class SubversionVCS(VersionControlSystem): + """Implementation of the VersionControlSystem interface for Subversion.""" + + def __init__(self, options): + super(SubversionVCS, self).__init__(options) + if self.options.revision: + match = re.match(r"(\d+)(:(\d+))?", self.options.revision) + if not match: + ErrorExit("Invalid Subversion revision %s." % self.options.revision) + self.rev_start = match.group(1) + self.rev_end = match.group(3) + else: + self.rev_start = self.rev_end = None + # Cache output from "svn list -r REVNO dirname". + # Keys: dirname, Values: 2-tuple (ouput for start rev and end rev). + self.svnls_cache = {} + # SVN base URL is required to fetch files deleted in an older revision. + # Result is cached to not guess it over and over again in GetBaseFile(). + required = self.options.download_base or self.options.revision is not None + self.svn_base = self._GuessBase(required) + + def GuessBase(self, required): + """Wrapper for _GuessBase.""" + return self.svn_base + + def _GuessBase(self, required): + """Returns the SVN base URL. + + Args: + required: If true, exits if the url can't be guessed, otherwise None is + returned. + """ + info = RunShell(["svn", "info"]) + for line in info.splitlines(): + words = line.split() + if len(words) == 2 and words[0] == "URL:": + url = words[1] + scheme, netloc, path, params, query, fragment = urlparse.urlparse(url) + username, netloc = urllib.splituser(netloc) + if username: + logging.info("Removed username from base URL") + if netloc.endswith("svn.python.org"): + if netloc == "svn.python.org": + if path.startswith("/projects/"): + path = path[9:] + elif netloc != "pyt...@sv...": + ErrorExit("Unrecognized Python URL: %s" % url) + base = "http://svn.python.org/view/*checkout*%s/" % path + logging.info("Guessed Python base = %s", base) + elif netloc.endswith("svn.collab.net"): + if path.startswith("/repos/"): + path = path[6:] + base = "http://svn.collab.net/viewvc/*checkout*%s/" % path + logging.info("Guessed CollabNet base = %s", base) + elif netloc.endswith(".googlecode.com"): + path = path + "/" + base = urlparse.urlunparse(("http", netloc, path, params, + query, fragment)) + logging.info("Guessed Google Code base = %s", base) + else: + path = path + "/" + base = urlparse.urlunparse((scheme, netloc, path, params, + query, fragment)) + logging.info("Guessed base = %s", base) + return base + if required: + ErrorExit("Can't find URL in output from svn info") + return None + + def GenerateDiff(self, args): + cmd = ["svn", "diff"] + if self.options.revision: + cmd += ["-r", self.options.revision] + cmd.extend(args) + data = RunShell(cmd) + count = 0 + for line in data.splitlines(): + if line.startswith("Index:") or line.startswith("Property changes on:"): + count += 1 + logging.info(line) + if not count: + ErrorExit("No valid patches found in output from svn diff") + return data + + def _CollapseKeywords(self, content, keyword_str): + """Collapses SVN keywords.""" + # svn cat translates keywords but svn diff doesn't. As a result of this + # behavior patching.PatchChunks() fails with a chunk mismatch error. + # This part was originally written by the Review Board development team + # who had the same problem (http://reviews.review-board.org/r/276/). + # Mapping of keywords to known aliases + svn_keywords = { + # Standard keywords + 'Date': ['Date', 'LastChangedDate'], + 'Revision': ['Revision', 'LastChangedRevision', 'Rev'], + 'Author': ['Author', 'LastChangedBy'], + 'HeadURL': ['HeadURL', 'URL'], + 'Id': ['Id'], + + # Aliases + 'LastChangedDate': ['LastChangedDate', 'Date'], + 'LastChangedRevision': ['LastChangedRevision', 'Rev', 'Revision'], + 'LastChangedBy': ['LastChangedBy', 'Author'], + 'URL': ['URL', 'HeadURL'], + } + + def repl(m): + if m.group(2): + return "$%s::%s$" % (m.group(1), " " * len(m.group(3))) + return "$%s$" % m.group(1) + keywords = [keyword + for name in keyword_str.split(" ") + for keyword in svn_keywords.get(name, [])] + return re.sub(r"\$(%s):(:?)([^\$]+)\$" % '|'.join(keywords), repl, content) + + def GetUnknownFiles(self): + status = RunShell(["svn", "status", "--ignore-externals"], silent_ok=True) + unknown_files = [] + for line in status.split("\n"): + if line and line[0] == "?": + unknown_files.append(line) + return unknown_files + + def ReadFile(self, filename): + """Returns the contents of a file.""" + file = open(filename, 'rb') + result = "" + try: + result = file.read() + finally: + file.close() + return result + + def GetStatus(self, filename): + """Returns the status of a file.""" + if not self.options.revision: + status = RunShell(["svn", "status", "--ignore-externals", filename]) + if not status: + ErrorExit("svn status returned no output for %s" % filename) + status_lines = status.splitlines() + # If file is in a cl, the output will begin with + # "\n--- Changelist 'cl_name':\n". See + # http://svn.collab.net/repos/svn/trunk/notes/changelist-design.txt + if (len(status_lines) == 3 and + not status_lines[0] and + status_lines[1].startswith("--- Changelist")): + status = status_lines[2] + else: + status = status_lines[0] + # If we have a revision to diff against we need to run "svn list" + # for the old and the new revision and compare the results to get + # the correct status for a file. + else: + dirname, relfilename = os.path.split(filename) + if dirname not in self.svnls_cache: + cmd = ["svn", "list", "-r", self.rev_start, dirname or "."] + out, returncode = RunShellWithReturnCode(cmd) + if returncode: + ErrorExit("Failed to get status for %s." % filename) + old_files = out.splitlines() + args = ["svn", "list"] + if self.rev_end: + args += ["-r", self.rev_end] + cmd = args + [dirname or "."] + out, returncode = RunShellWithReturnCode(cmd) + if returncode: + ErrorExit("Failed to run command %s" % cmd) + self.svnls_cache[dirname] = (old_files, out.splitlines()) + old_files, new_files = self.svnls_cache[dirname] + if relfilename in old_files and relfilename not in new_files: + status = "D " + elif relfilename in old_files and relfilename in new_files: + status = "M " + else: + status = "A " + return status + + def GetBaseFile(self, filename): + status = self.GetStatus(filename) + base_content = None + new_content = None + + # If a file is copied its status will be "A +", which signifies + # "addition-with-history". See "svn st" for more information. We need to + # upload the original file or else diff parsing will fail if the file was + # edited. + if status[0] == "A" and status[3] != "+": + # We'll need to upload the new content if we're adding a binary file + # since diff's output won't contain it. + mimetype = RunShell(["svn", "propget", "svn:mime-type", filename], + silent_ok=True) + base_content = "" + is_binary = bool(mimetype) and not mimetype.startswith("text/") + if is_binary and self.IsImage(filename): + new_content = self.ReadFile(filename) + elif (status[0] in ("M", "D", "R") or + (status[0] == "A" and status[3] == "+") or # Copied file. + (status[0] == " " and status[1] == "M")): # Property change. + args = [] + if self.options.revision: + url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start) + else: + # Don't change filename, it's needed later. + url = filename + args += ["-r", "BASE"] + cmd = ["svn"] + args + ["propget", "svn:mime-type", url] + mimetype, returncode = RunShellWithReturnCode(cmd) + if returncode: + # File does not exist in the requested revision. + # Reset mimetype, it contains an error message. + mimetype = "" + get_base = False + is_binary = bool(mimetype) and not mimetype.startswith("text/") + if status[0] == " ": + # Empty base content just to force an upload. + base_content = "" + elif is_binary: + if self.IsImage(filename): + get_base = True + if status[0] == "M": + if not self.rev_end: + new_content = self.ReadFile(filename) + else: + url = "%s/%s@%s" % (self.svn_base, filename, self.rev_end) + new_content = RunShell(["svn", "cat", url], + universal_newlines=True, silent_ok=True) + else: + base_content = "" + else: + get_base = True + + if get_base: + if is_binary: + universal_newlines = False + else: + universal_newlines = True + if self.rev_start: + # "svn cat -r REV delete_file.txt" doesn't work. cat requires + # the full URL with "@REV" appended instead of using "-r" option. + url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start) + base_content = RunShell(["svn", "cat", url], + universal_newlines=universal_newlines, + silent_ok=True) + else: + base_content = RunShell(["svn", "cat", filename], + universal_newlines=universal_newlines, + silent_ok=True) + if not is_binary: + args = [] + if self.rev_start: + url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start) + else: + url = filename + args += ["-r", "BASE"] + cmd = ["svn"] + args + ["propget", "svn:keywords", url] + keywords, returncode = RunShellWithReturnCode(cmd) + if keywords and not returncode: + base_content = self._CollapseKeywords(base_content, keywords) + else: + StatusUpdate("svn status returned unexpected output: %s" % status) + sys.exit(1) + return base_content, new_content, is_binary, status[0:5] + + +class GitVCS(VersionControlSystem): + """Implementation of the VersionControlSystem interface for Git.""" + + NULL_HASH = "0"*40 + + def __init__(self, options): + super(GitVCS, self).__init__(options) + # Map of filename -> (hash before, hash after) of base file. + self.base_hashes = {} + + def GenerateDiff(self, extra_args): + # This is more complicated than svn's GenerateDiff because we must convert + # the diff output to include an svn-style "Index:" line as well as record + # the hashes of the base files, so we can upload them along with our diff. + if self.options.revision: + extra_args = [self.options.revision] + extra_args + gitdiff = RunShell(["git", "diff", "--full-index"] + extra_args) + svndiff = [] + filecount = 0 + filename = None + for line in gitdiff.splitlines(): + match = re.match(r"diff --git a/(.*) b/.*$", line) + if match: + filecount += 1 + filename = match.group(1) + svndiff.append("Index: %s\n" % filename) + else: + # The "index" line in a git diff looks like this (long hashes elided): + # index 82c0d44..b2cee3f 100755 + # We want to save the left hash, as that identifies the base file. + match = re.match(r"index (\w+)\.\.(\w+)", line) + if match: + self.base_hashes[filename] = (match.group(1), match.group(2)) + svndiff.append(line + "\n") + if not filecount: + ErrorExit("No valid patches found in output from git diff") + return "".join(svndiff) + + def GetUnknownFiles(self): + status = RunShell(["git", "ls-files", "--exclude-standard", "--others"], + silent_ok=True) + return status.splitlines() + + def GetFileContent(self, file_hash, is_binary): + """Returns the content of a file identified by its git hash.""" + data, retcode = RunShellWithReturnCode(["git", "show", file_hash], + universal_newlines=not is_binary) + if retcode: + ErrorExit("Got error status from 'git show %s'" % file_hash) + return data + + def GetBaseFile(self, filename): + hash_before, hash_after = self.base_hashes[filename] + base_content = None + new_content = None + is_binary = self.IsBinary(filename) + + if hash_before == self.NULL_HASH: # All-zero hash indicates no base file. + status = "A" + base_content = "" + else: + status = "M" + if not is_binary or self.IsImage(filename): + base_content = self.GetFileContent(hash_before, is_binary) + + if is_binary and self.IsImage(filename) and not hash_after == "0" * 40: + new_content = self.GetFileContent(hash_after, is_binary) + + if hash_after == self.NULL_HASH: + status = "D" + return (base_content, new_content, is_binary, status) + + +class MercurialVCS(VersionControlSystem): + """Implementation of the VersionControlSystem interface for Mercurial.""" + + def __init__(self, options, repo_dir): + super(MercurialVCS, self).__init__(options) + # Absolute path to repository (we can be in a subdir) + self.repo_dir = os.path.normpath(repo_dir) + # Compute the subdir + cwd = os.path.normpath(os.getcwd()) + assert cwd.startswith(self.repo_dir) + self.subdir = cwd[len(self.repo_dir):].lstrip(r"\/") + if self.options.revision: + self.base_rev = self.options.revision + else: + self.base_rev = RunShell(["hg", "parent", "-q"]).split(':')[1].strip() + + def _GetRelPath(self, filename): + """Get relative path of a file according to the current directory, + given its logical path in the repo.""" + assert filename.startswith(self.subdir), filename + return filename[len(self.subdir):].lstrip(r"\/") + + def GenerateDiff(self, extra_args): + # If no file specified, restrict to the current subdir + extra_args = extra_args or ["."] + cmd = ["hg", "diff", "--git", "-r", self.base_rev] + extra_args + data = RunShell(cmd, silent_ok=True) + svndiff = [] + filecount = 0 + for line in data.splitlines(): + m = re.match("diff --git a/(\S+) b/(\S+)", line) + if m: + # Modify line to make it look like as it comes from svn diff. + # With this modification no changes on the server side are required + # to make upload.py work with Mercurial repos. + # NOTE: for proper handling of moved/copied files, we have to use + # the second filename. + filename = m.group(2) + svndiff.append("Index: %s" % filename) + svndiff.append("=" * 67) + filecount += 1 + logging.info(line) + else: + svndiff.append(line) + if not filecount: + ErrorExit("No valid patches found in output from hg diff") + return "\n".join(svndiff) + "\n" + + def GetUnknownFiles(self): + """Return a list of files unknown to the VCS.""" + args = [] + status = RunShell(["hg", "status", "--rev", self.base_rev, "-u", "."], + silent_ok=True) + unknown_files = [] + for line in status.splitlines(): + st, fn = line.split(" ", 1) + if st == "?": + unknown_files.append(fn) + return unknown_files + + def GetBaseFile(self, filename): + # "hg status" and "hg cat" both take a path relative to the current subdir + # rather than to the repo root, but "hg diff" has given us the full path + # to the repo root. + base_content = "" + new_content = None + is_binary = False + oldrelpath = relpath = self._GetRelPath(filename) + # "hg status -C" returns two lines for moved/copied files, one otherwise + out = RunShell(["hg", "status", "-C", "--rev", self.base_rev, relpath]) + out = out.splitlines() + # HACK: strip error message about missing file/directory if it isn't in + # the working copy + if out[0].startswith('%s: ' % relpath): + out = out[1:] + if len(out) > 1: + # Moved/copied => considered as modified, use old filename to + # retrieve base contents + oldrelpath = out[1].strip() + status = "M" + else: + status, _ = out[0].split(' ', 1) + if ":" in self.base_rev: + base_rev = self.base_rev.split(":", 1)[0] + else: + base_rev = self.base_rev + if status != "A": + base_content = RunShell(["hg", "cat", "-r", base_rev, oldrelpath], + silent_ok=True) + is_binary = "\0" in base_content # Mercurial's heuristic + if status != "R": + new_content = open(relpath, "rb").read() + is_binary = is_binary or "\0" in new_content + if is_binary and base_content: + # Fetch again without converting newlines + base_content = RunShell(["hg", "cat", "-r", base_rev, oldrelpath], + silent_ok=True, universal_newlines=False) + if not is_binary or not self.IsImage(relpath): + new_content = None + return base_content, new_content, is_binary, status + + +# NOTE: The SplitPatch function is duplicated in engine.py, keep them in sync. +def SplitPatch(data): + """Splits a patch into separate pieces for each file. + + Args: + data: A string containing the output of svn diff. + + Returns: + A list of 2-tuple (filename, text) where text is the svn diff output + pertaining to filename. + """ + patches = [] + filename = None + diff = [] + for line in data.splitlines(True): + new_filename = None + if line.startswith('Index:'): + unused, new_filename = line.split(':', 1) + new_filename = new_filename.strip() + elif line.startswith('Property changes on:'): + unused, temp_filename = line.split(':', 1) + # When a file is modified, paths use '/' between directories, however + # when a property is modified '\' is used on Windows. Make them the same + # otherwise the file shows up twice. + temp_filename = temp_filename.strip().replace('\\', '/') + if temp_filename != filename: + # File has property changes but no modifications, create a new diff. + new_filename = temp_filename + if new_filename: + if filename and diff: + patches.append((filename, ''.join(diff))) + filename = new_filename + diff = [line] + continue + if diff is not None: + diff.append(line) + if filename and diff: + patches.append((filename, ''.join(diff))) + return patches + + +def UploadSeparatePatches(issue, rpc_server, patchset, data, options): + """Uploads a separate patch for each file in the diff output. + + Returns a list of [patch_key, filename] for each file. + """ + patches = SplitPatch(data) + rv = [] + for patch in patches: + if len(patch[1]) > MAX_UPLOAD_SIZE: + print ("Not uploading the patch for " + patch[0] + + " because the file is too large.") + continue + form_fields = [("filename", patch[0])] + if not options.download_base: + form_fields.append(("content_upload", "1")) + files = [("data", "data.diff", patch[1])] + ctype, body = EncodeMultipartFormData(form_fields, files) + url = "/%d/upload_patch/%d" % (int(issue), int(patchset)) + print "Uploading patch for " + patch[0] + response_body = rpc_server.Send(url, body, content_type=ctype) + lines = response_body.splitlines() + if not lines or lines[0] != "OK": + StatusUpdate(" --> %s" % response_body) + sys.exit(1) + rv.append([lines[1], patch[0]]) + return rv + + +def GuessVCSName(): + """Helper to guess the version control system. + + This examines the current directory, guesses which VersionControlSystem + we're using, and returns an string indicating which VCS is detected. + + Returns: + A pair (vcs, output). vcs is a string indicating which VCS was detected + and is one of VCS_GIT, VCS_MERCURIAL, VCS_SUBVERSION, or VCS_UNKNOWN. + output is a string containing any interesting output from the vcs + detection routine, or None if there is nothing interesting. + """ + # Mercurial has a command to get the base directory of a repository + # Try running it, but don't die if we don't have hg installed. + # NOTE: we try Mercurial first as it can sit on top of an SVN working copy. + try: + out, returncode = RunShellWithReturnCode(["hg", "root"]) + if returncode == 0: + return (VCS_MERCURIAL, out.strip()) + except OSError, (errno, message): + if errno != 2: # ENOENT -- they don't have hg installed. + raise + + # Subversion has a .svn in all working directories. + if os.path.isdir('.svn'): + logging.info("Guessed VCS = Subversion") + return (VCS_SUBVERSION, None) + + # Git has a command to test if you're in a git tree. + # Try running it, but don't die if we don't have git installed. + try: + out, returncode = RunShellWithReturnCode(["git", "rev-parse", + "--is-inside-work-tree"]) + if returncode == 0: + return (VCS_GIT, None) + except OSError, (errno, message): + if errno != 2: # ENOENT -- they don't have git installed. + raise + + return (VCS_UNKNOWN, None) + + +def GuessVCS(options): + """Helper to guess the version control system. + + This examines the current directory, guesses which VersionControlSystem + we're using, and returns an instance of the appropriate class. Exit with an + error if we can't figure it out. + + Returns: + A VersionControlSystem instance. Exits if the VCS can't be guessed. + """ + (vcs, extra_output) = GuessVCSName() + if vcs == VCS_MERCURIAL: + return MercurialVCS(options, extra_output) + elif vcs == VCS_SUBVERSION: + return SubversionVCS(options) + elif vcs == VCS_GIT: + return GitVCS(options) + + ErrorExit(("Could not guess version control system. " + "Are you in a working copy directory?")) + + +def RealMain(argv, data=None): + """The real main function. + + Args: + argv: Command line arguments. + data: Diff contents. If None (default) the diff is generated by + the VersionControlSystem implementation returned by GuessVCS(). + + Returns: + A 2-tuple (issue id, patchset id). + The patchset id is None if the base files are not uploaded by this + script (applies only to SVN checkouts). + """ + logging.basicConfig(format=("%(asctime).19s %(levelname)s %(filename)s:" + "%(lineno)s %(message)s ")) + os.environ['LC_ALL'] = 'C' + options, args = parser.parse_args(argv[1:]) + global verbosity + verbosity = options.verbose + if verbosity >= 3: + logging.getLogger().setLevel(logging.DEBUG) + elif verbosity >= 2: + logging.getLogger().setLevel(logging.INFO) + vcs = GuessVCS(options) + if isinstance(vcs, SubversionVCS): + # base field is only allowed for Subversion. + # Note: Fetching base files may become deprecated in future releases. + base = vcs.GuessBase(options.download_base) + else: + base = None + if not base and options.download_base: + options.download_base = True + logging.info("Enabled upload of base file") + if not options.assume_yes: + vcs.CheckForUnknownFiles() + if data is None: + data = vcs.GenerateDiff(args) + files = vcs.GetBaseFiles(data) + if verbosity >= 1: + print "Upload server:", options.server, "(change with -s/--server)" + if options.issue: + prompt = "Message describing this patch set: " + else: + prompt = "New issue subject: " + message = options.message or raw_input(prompt).strip() + if not message: + ErrorExit("A non-empty message is required") + rpc_server = GetRpcServer(options) + form_fields = [("subject", message)] + if base: + form_fields.append(("base", base)) + if options.issue: + form_fields.append(("issue", str(options.issue))) + if options.email: + form_fields.append(("user", options.email)) + if options.reviewers: + for reviewer in options.reviewers.split(','): + if "@" in reviewer and not reviewer.split("@")[1].count(".") == 1: + ErrorExit("Invalid email address: %s" % reviewer) + form_fields.append(("reviewers", options.reviewers)) + if options.cc: + for cc in options.cc.split(','): + if "@" in cc and not cc.split("@")[1].count(".") == 1: + ErrorExit("Invalid email address: %s" % cc) + form_fields.append(("cc", options.cc)) + description = options.description + if options.description_file: + if options.description: + ErrorExit("Can't specify description and description_file") + file = open(options.description_file, 'r') + description = file.read() + file.close() + if description: + form_fields.append(("description", description)) + # Send a hash of all the base file so the server can determine if a copy + # already exists in an earlier patchset. + base_hashes = "" + for file, info in files.iteritems(): + if not info[0] is None: + checksum = md5(info[0]).hexdigest() + if base_hashes: + base_hashes += "|" + base_hashes += checksum + ":" + file + form_fields.append(("base_hashes", base_hashes)) + if options.private: + if options.issue: + print "Warning: Private flag ignored when updating an existing issue." + else: + form_fields.append(("private", "1")) + # If we're uploading base files, don't send the email before the uploads, so + # that it contains the file status. + if options.send_mail and options.download_base: + form_fields.append(("send_mail", "1")) + if not options.download_base: + form_fields.append(("content_upload", "1")) + if len(data) > MAX_UPLOAD_SIZE: + print "Patch is large, so uploading file patches separately." + uploaded_diff_file = [] + form_fields.append(("separate_patches", "1")) + else: + uploaded_diff_file = [("data", "data.diff", data)] + ctype, body = EncodeMultipartFormData(form_fields, uploaded_diff_file) + response_body = rpc_server.Send("/upload", body, content_type=ctype) + patchset = None + if not options.download_base or not uploaded_diff_file: + lines = response_body.splitlines() + if len(lines) >= 2: + msg = lines[0] + patchset = lines[1].strip() + patches = [x.split(" ", 1) for x in lines[2:]] + else: + msg = response_body + else: + msg = response_body + StatusUpdate(msg) + if not response_body.startswith("Issue created.") and \ + not response_body.startswith("Issue updated."): + sys.exit(0) + issue = msg[msg.rfind("/")+1:] + + if not uploaded_diff_file: + result = UploadSeparatePatches(issue, rpc_server, patchset, data, options) + if not options.download_base: + patches = result + + if not options.download_base: + vcs.UploadBaseFiles(issue, rpc_server, patches, patchset, options, files) + if options.send_mail: + rpc_server.Send("/" + issue + "/mail", payload="") + return issue, patchset + + +def main(): + try: + RealMain(sys.argv) + except KeyboardInterrupt: + print + StatusUpdate("Interrupted.") + sys.exit(1) + + +if __name__ == "__main__": + main() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-07-29 13:40:22
|
Revision: 229 http://mchef.svn.sourceforge.net/mchef/?rev=229&view=rev Author: tux316 Date: 2009-07-29 13:40:05 +0000 (Wed, 29 Jul 2009) Log Message: ----------- Made some small changes to the Genscripts Library. Moved the mIRC specifics to its own directory "Gen/mIRC," additionally the user can #define mIRC_DLL and then include "Gen/Gen.hpp" Modified Paths: -------------- trunk/mChef.sln trunk/src/Gen/Console.hpp trunk/src/Gen/Gen.hpp trunk/src/mChef/StdAfx.h Added Paths: ----------- trunk/src/Gen/mIRC/ trunk/src/Gen/mIRC/Map.hpp trunk/src/Gen/mIRC/Moo.hpp Removed Paths: ------------- trunk/src/Gen/Map.hpp trunk/src/Gen/Moo.hpp Modified: trunk/mChef.sln =================================================================== --- trunk/mChef.sln 2009-07-29 06:46:27 UTC (rev 228) +++ trunk/mChef.sln 2009-07-29 13:40:05 UTC (rev 229) @@ -82,10 +82,14 @@ src\Gen\Console.hpp = src\Gen\Console.hpp src\Gen\Error.hpp = src\Gen\Error.hpp src\Gen\Gen.hpp = src\Gen\Gen.hpp - src\Gen\Map.hpp = src\Gen\Map.hpp - src\Gen\Moo.hpp = src\Gen\Moo.hpp EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "mIRC", "mIRC", "{0031810E-F08C-4D50-81E6-F7C642CA4BB0}" + ProjectSection(SolutionItems) = preProject + src\Gen\mIRC\Map.hpp = src\Gen\mIRC\Map.hpp + src\Gen\mIRC\Moo.hpp = src\Gen\mIRC\Moo.hpp + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -123,5 +127,6 @@ {B2001935-BDFE-4A45-9B3B-1C0596A8D249} = {A3246FF9-A597-4B7D-A6D9-14A5D6D72869} {23A7F338-7A32-4EC0-B5FD-1AD5E59B4548} = {44C3C3E9-05E3-4C88-8812-64B5681BBE9C} {87184500-EA71-45E9-B2D7-4B6C0AD1563B} = {054DA7DE-6E9E-40DF-A2E9-8EA68E15426C} + {0031810E-F08C-4D50-81E6-F7C642CA4BB0} = {044D0C73-AB41-4652-B7FB-7EB2D5CBABE1} EndGlobalSection EndGlobal Modified: trunk/src/Gen/Console.hpp =================================================================== --- trunk/src/Gen/Console.hpp 2009-07-29 06:46:27 UTC (rev 228) +++ trunk/src/Gen/Console.hpp 2009-07-29 13:40:05 UTC (rev 229) @@ -25,7 +25,7 @@ namespace Gen { /** - * CGenConsole. Class used to open an mIRC Console Window. + * CGenConsole. Class used to open a Console Window. */ class CGenConsole { Modified: trunk/src/Gen/Gen.hpp =================================================================== --- trunk/src/Gen/Gen.hpp 2009-07-29 06:46:27 UTC (rev 228) +++ trunk/src/Gen/Gen.hpp 2009-07-29 13:40:05 UTC (rev 229) @@ -22,15 +22,18 @@ #pragma warning(disable : 4995) #include "Gen/Console.hpp" -#include "Gen/Map.hpp" -#include "Gen/Moo.hpp" #include "Gen/Error.hpp" +#ifdef MIRC_DLL +#include "Gen/mIRC/Moo.hpp" +#include "Gen/mIRC/Map.hpp" + + namespace Gen { /** - * LOADINFO. Structure used by mIRC when loading a DLL. - */ + * LOADINFO. Structure used by mIRC when loading a DLL. + */ typedef struct { DWORD mVersion; HWND mHwnd; @@ -39,6 +42,7 @@ } +#endif #endif /* __GEN_H__ */ Deleted: trunk/src/Gen/Map.hpp =================================================================== --- trunk/src/Gen/Map.hpp 2009-07-29 06:46:27 UTC (rev 228) +++ trunk/src/Gen/Map.hpp 2009-07-29 13:40:05 UTC (rev 229) @@ -1,186 +0,0 @@ -/* Genscripts Library - Map.hpp - * Copyright (C) 2009 Genscripts - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -#ifndef __MAP_HPP__ -# define __MAP_HPP__ - -#pragma message("Genscripts Library: Compiling Map.hpp") - -#include <stdarg.h> - -namespace Gen { - /** - * CGenMap. Classed used for Mapping mIRC. - */ - class CGenMap - { - private: - HANDLE m_Map; /* Handle to mIRC's Map. */ - LPSTR m_Data; /* Handle to a file shared with mIRC's Map. */ - HWND m_MoohWnd; /* Handle to mIRC's Window Handle */ - - /** - * SendMooData. Sends mIRC a command or evaulation. - * - * @param bEvaluate. Should the command be valuated? - */ - inline int SendMooData(BOOL bEvaluate) - { - return SendMessage(m_MoohWnd, WM_USER + (bEvaluate ? 201 : 200), 1, 3); - } - - public: - - /** - * Class Constructor. - */ - CGenMap() - { - m_Data = NULL; - } - - /** - * Class Destructor. Closes all maps. - */ - virtual ~CGenMap() - { - CloseMapView(); - CloseMap(); - } - - /** - * SetMooHandle. Sets the mIRC Window handle. - */ - void SetMooHandle(HWND m_hWnd) - { - m_MoohWnd = m_hWnd; - } - - /** - * OpenMap. Opens a map with mIRC using the specified map name. - * - * @param lpName Name of file mapping object. - * - * @return true If the map was created. - * @return false If we could not map. - */ - BOOL OpenMap(LPCWSTR lpName) - { - if ((m_Map = CreateFileMapping(INVALID_HANDLE_VALUE,0,PAGE_READWRITE,0,4096, lpName))) - return true; - - return false; - } - - /** - * CloseMap. Closes a map with mIRC. - * - * @return true If the map was closed. - * @return false If we could not close it. - */ - BOOL CloseMap() - { - if (m_Map && CloseHandle(m_Map)) - return true; - - return false; - } - - /** - * OpenMapView. Maps a view of the current file map with mIRC. - * - * @return m_Data Starting address of the mapped view. - */ - LPSTR OpenMapView() - { - m_Data = (LPSTR) MapViewOfFile(m_Map, - FILE_MAP_ALL_ACCESS, 0, 0, 0); - - return m_Data; - } - - /** - * CloseMapView. Closes a view of the current file map with mIRC. - * - * @return true If the view was unmapped. - * @return false If it was not. - */ - BOOL CloseMapView() - { - return UnmapViewOfFile(m_Data); - } - - /** - * Cmd. Sends mIRC a command. - */ - int Cmd(const char *fmt, ...) - { - char sBuffer[1024]; - - memset(sBuffer, 0, sizeof(sBuffer)); - OpenMapView(); - - va_list vl; - - va_start(vl, fmt); - vsnprintf(sBuffer, sizeof(sBuffer) - 1, fmt, vl); - sprintf(m_Data, "%s", sBuffer); - int iReturn = SendMooData(false); - CloseMapView(); - - va_end(vl); - - return iReturn; - - } - /** - * Eval. Sends mIRC an "evaluation" command. - */ - int Eval(char *ReturnBuff, int BuffSize, const char *fmt, ...) - { - char sBuffer[1024]; - - memset(sBuffer, 0, sizeof(sBuffer)); - OpenMapView(); - - va_list vl; - - va_start(vl, fmt); - vsnprintf(sBuffer, sizeof(sBuffer) - 1, fmt, vl); - sprintf(m_Data, "%s", sBuffer); - - ZeroMemory(ReturnBuff, BuffSize); - - int iReturn = 0; - - if ((iReturn = SendMooData(true)) == 1) - sprintf(ReturnBuff, "%s", m_Data); - else - *ReturnBuff = '\0'; - - CloseMapView(); - - va_end(vl); - - return iReturn; - } - }; -} -#endif /* __GENMAP_HPP__*/ - -/* EOF */ - Deleted: trunk/src/Gen/Moo.hpp =================================================================== --- trunk/src/Gen/Moo.hpp 2009-07-29 06:46:27 UTC (rev 228) +++ trunk/src/Gen/Moo.hpp 2009-07-29 13:40:05 UTC (rev 229) @@ -1,48 +0,0 @@ -/* Genscripts Library - Moo.hpp - * Copyright (C) 2009 Genscripts - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -#ifndef __MOO_HPP__ -# define __MOO_HPP__ - -#pragma message("Genscripts Library: Compiling Moo.hpp") - -#include "Gen/Map.hpp" - -namespace Gen { - class CGenMoo : public CGenMap - { - private: - HWND m_MoohWnd; - LPWSTR m_MapName; - - public: - CGenMoo(HWND m_hWnd, LPWSTR m_Name) - : m_MoohWnd(m_hWnd), m_MapName(m_Name) - { - SetMooHandle(m_hWnd); - OpenMap(m_MapName); - } - ~CGenMoo() - { - } - }; -} - -#endif /* __GENMOO_HPP__ */ - -/* EOF */ - Copied: trunk/src/Gen/mIRC/Map.hpp (from rev 228, trunk/src/Gen/Map.hpp) =================================================================== --- trunk/src/Gen/mIRC/Map.hpp (rev 0) +++ trunk/src/Gen/mIRC/Map.hpp 2009-07-29 13:40:05 UTC (rev 229) @@ -0,0 +1,186 @@ +/* Genscripts Library - Map.hpp + * Copyright (C) 2009 Genscripts + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +#ifndef __MAP_HPP__ +# define __MAP_HPP__ + +#pragma message("Genscripts Library: Compiling Map.hpp") + +#include <stdarg.h> + +namespace Gen { + /** + * CGenMap. Classed used for Mapping mIRC. + */ + class CGenMap + { + private: + HANDLE m_Map; /* Handle to mIRC's Map. */ + LPSTR m_Data; /* Handle to a file shared with mIRC's Map. */ + HWND m_MoohWnd; /* Handle to mIRC's Window Handle */ + + /** + * SendMooData. Sends mIRC a command or evaulation. + * + * @param bEvaluate. Should the command be valuated? + */ + inline int SendMooData(BOOL bEvaluate) + { + return SendMessage(m_MoohWnd, WM_USER + (bEvaluate ? 201 : 200), 1, 3); + } + + public: + + /** + * Class Constructor. + */ + CGenMap() + { + m_Data = NULL; + } + + /** + * Class Destructor. Closes all maps. + */ + virtual ~CGenMap() + { + CloseMapView(); + CloseMap(); + } + + /** + * SetMooHandle. Sets the mIRC Window handle. + */ + void SetMooHandle(HWND m_hWnd) + { + m_MoohWnd = m_hWnd; + } + + /** + * OpenMap. Opens a map with mIRC using the specified map name. + * + * @param lpName Name of file mapping object. + * + * @return true If the map was created. + * @return false If we could not map. + */ + BOOL OpenMap(LPCWSTR lpName) + { + if ((m_Map = CreateFileMapping(INVALID_HANDLE_VALUE,0,PAGE_READWRITE,0,4096, lpName))) + return true; + + return false; + } + + /** + * CloseMap. Closes a map with mIRC. + * + * @return true If the map was closed. + * @return false If we could not close it. + */ + BOOL CloseMap() + { + if (m_Map && CloseHandle(m_Map)) + return true; + + return false; + } + + /** + * OpenMapView. Maps a view of the current file map with mIRC. + * + * @return m_Data Starting address of the mapped view. + */ + LPSTR OpenMapView() + { + m_Data = (LPSTR) MapViewOfFile(m_Map, + FILE_MAP_ALL_ACCESS, 0, 0, 0); + + return m_Data; + } + + /** + * CloseMapView. Closes a view of the current file map with mIRC. + * + * @return true If the view was unmapped. + * @return false If it was not. + */ + BOOL CloseMapView() + { + return UnmapViewOfFile(m_Data); + } + + /** + * Cmd. Sends mIRC a command. + */ + int Cmd(const char *fmt, ...) + { + char sBuffer[1024]; + + memset(sBuffer, 0, sizeof(sBuffer)); + OpenMapView(); + + va_list vl; + + va_start(vl, fmt); + vsnprintf(sBuffer, sizeof(sBuffer) - 1, fmt, vl); + sprintf(m_Data, "%s", sBuffer); + int iReturn = SendMooData(false); + CloseMapView(); + + va_end(vl); + + return iReturn; + + } + /** + * Eval. Sends mIRC an "evaluation" command. + */ + int Eval(char *ReturnBuff, int BuffSize, const char *fmt, ...) + { + char sBuffer[1024]; + + memset(sBuffer, 0, sizeof(sBuffer)); + OpenMapView(); + + va_list vl; + + va_start(vl, fmt); + vsnprintf(sBuffer, sizeof(sBuffer) - 1, fmt, vl); + sprintf(m_Data, "%s", sBuffer); + + ZeroMemory(ReturnBuff, BuffSize); + + int iReturn = 0; + + if ((iReturn = SendMooData(true)) == 1) + sprintf(ReturnBuff, "%s", m_Data); + else + *ReturnBuff = '\0'; + + CloseMapView(); + + va_end(vl); + + return iReturn; + } + }; +} +#endif /* __GENMAP_HPP__*/ + +/* EOF */ + Copied: trunk/src/Gen/mIRC/Moo.hpp (from rev 228, trunk/src/Gen/Moo.hpp) =================================================================== --- trunk/src/Gen/mIRC/Moo.hpp (rev 0) +++ trunk/src/Gen/mIRC/Moo.hpp 2009-07-29 13:40:05 UTC (rev 229) @@ -0,0 +1,48 @@ +/* Genscripts Library - Moo.hpp + * Copyright (C) 2009 Genscripts + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +#ifndef __MOO_HPP__ +# define __MOO_HPP__ + +#pragma message("Genscripts Library: Compiling Moo.hpp") + +#include "Gen/mIRC/Map.hpp" + +namespace Gen { + class CGenMoo : public CGenMap + { + private: + HWND m_MoohWnd; + LPWSTR m_MapName; + + public: + CGenMoo(HWND m_hWnd, LPWSTR m_Name) + : m_MoohWnd(m_hWnd), m_MapName(m_Name) + { + SetMooHandle(m_hWnd); + OpenMap(m_MapName); + } + ~CGenMoo() + { + } + }; +} + +#endif /* __GENMOO_HPP__ */ + +/* EOF */ + Modified: trunk/src/mChef/StdAfx.h =================================================================== --- trunk/src/mChef/StdAfx.h 2009-07-29 06:46:27 UTC (rev 228) +++ trunk/src/mChef/StdAfx.h 2009-07-29 13:40:05 UTC (rev 229) @@ -46,6 +46,7 @@ #define USING_CEF_SHARED 1 #include "cef_capi.h" +#define MIRC_DLL #include "Gen/Gen.hpp" /* EOF */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-07-29 06:50:27
|
Revision: 227 http://mchef.svn.sourceforge.net/mchef/?rev=227&view=rev Author: tux316 Date: 2009-07-29 06:31:02 +0000 (Wed, 29 Jul 2009) Log Message: ----------- http://genscriptsreview.appspot.com/12/show -Fixed issue in which if the user detached a window, or unloaded the dll without closing all windows, we could crash (CEF never released the handler). - Added ChefGetLastError() to the mix. If in debug, it will print the last error to the screen. - Optimized constructors for ChefStrings, and ChefPrinter. Modified Paths: -------------- trunk/src/mChef/Chef.cpp trunk/src/mChef/Chef.h trunk/src/mChef/ChefExtern.h trunk/src/mChef/ChefHandler.cpp trunk/src/mChef/ChefMisc.cpp trunk/src/mChef/ChefPrinter.cpp trunk/src/mChef/ChefSignals.cpp trunk/src/mChef/ChefString.cpp trunk/src/mChef/Main.cpp Modified: trunk/src/mChef/Chef.cpp =================================================================== --- trunk/src/mChef/Chef.cpp 2009-07-28 01:46:41 UTC (rev 226) +++ trunk/src/mChef/Chef.cpp 2009-07-29 06:31:02 UTC (rev 227) @@ -253,6 +253,8 @@ while (!ChefWindows.empty()) { curChef = ChefWindows.front(); ChefWindows.erase(ChefWindows.begin()); + // Just in case the end-user never closed all windows, we tell CEF to close them. + SendMessage(curChef->m_BrowserHwnd, WM_DESTROY, 0, 0); ChefDelete(curChef); } CF_DB_END Modified: trunk/src/mChef/Chef.h =================================================================== --- trunk/src/mChef/Chef.h 2009-07-28 01:46:41 UTC (rev 226) +++ trunk/src/mChef/Chef.h 2009-07-29 06:31:02 UTC (rev 227) @@ -27,19 +27,19 @@ /* Changing any of the macros below will only be waisting your time.*/ /* Number of times that the project has been built */ -#define VERSION_BUILD 960 +#define VERSION_BUILD 1005 /* Current mChef Version */ -#define MCHEF_VERSION_STR "1.0.960" -#define MCHEF_VERSION_STRWC L"1.0.960" +#define MCHEF_VERSION_STR "1.0.1005" +#define MCHEF_VERSION_STRWC L"1.0.1005" -#define VERSION_FULL "1.0.960" -#define VERSION_WFULL L"1.0.960" +#define VERSION_FULL "1.0.1005" +#define VERSION_WFULL L"1.0.1005" -#define VERSION_FILE 1,0,0,960 -#define VERSION_PRODUCT 1,0,0,960 -#define VERSION_FSTR "1, 0, 0, 960" -#define VERSION_PSTR "1, 0, 0, 960" +#define VERSION_FILE 1,0,0,1005 +#define VERSION_PRODUCT 1,0,0,1005 +#define VERSION_FSTR "1, 0, 0, 1005" +#define VERSION_PSTR "1, 0, 0, 1005" #endif Modified: trunk/src/mChef/ChefExtern.h =================================================================== --- trunk/src/mChef/ChefExtern.h 2009-07-28 01:46:41 UTC (rev 226) +++ trunk/src/mChef/ChefExtern.h 2009-07-29 06:31:02 UTC (rev 227) @@ -76,7 +76,11 @@ extern unsigned int ChefCount; +#ifdef CHEF_DEBUG +extern void ChefGetLastError(); #endif +#endif + /* EOF */ Modified: trunk/src/mChef/ChefHandler.cpp =================================================================== --- trunk/src/mChef/ChefHandler.cpp 2009-07-28 01:46:41 UTC (rev 226) +++ trunk/src/mChef/ChefHandler.cpp 2009-07-29 06:31:02 UTC (rev 227) @@ -528,12 +528,7 @@ if (curChef) { CF_DB(printf("Chef %s [%08X] was closed.\n", curChef->m_WindowName, curChef->m_hWnd)); - ChefPop(curChef); - BaseRelease(handler); - BaseRelease(browser); - - return RV_CONTINUE; } BaseRelease(handler); BaseRelease(browser); Modified: trunk/src/mChef/ChefMisc.cpp =================================================================== --- trunk/src/mChef/ChefMisc.cpp 2009-07-28 01:46:41 UTC (rev 226) +++ trunk/src/mChef/ChefMisc.cpp 2009-07-29 06:31:02 UTC (rev 227) @@ -171,7 +171,6 @@ } CEF_String cs(url != NULL ? url : "http://www.google.com"); - cef_browser_create(curChef->mWindowInfo,0, CreateMyHandler(), (const WCHAR*)cs.ToWideChar()); @@ -179,6 +178,7 @@ * if (HasAddressBar(curChef) * SetTimer(curChef->m_hWnd, 1, 250, NULL); */ + if (IsDialog(curChef)) { long id = GetWindowLong(hwResizeTarget,GWL_ID); SetWindowLongPtr(hwResizeTarget,GWL_WNDPROC,(LONG)curChef->wpResizeTarget); @@ -191,5 +191,19 @@ CF_DB_END } +#ifdef CHEF_DEBUG +/** + * ChefGetLastError. Retrieves the last error and prints it to the console window. + */ +void ChefGetLastError() +{ + DWORD dwError = GetLastError(); + LPSTR lpErrorMsg = Gen::GetLastErrorMessage(dwError); + + printf("Error Code: %d, Error Message: %s\n", dwError, lpErrorMsg); + LocalFree(lpErrorMsg); +} +#endif + /* EOF */ Modified: trunk/src/mChef/ChefPrinter.cpp =================================================================== --- trunk/src/mChef/ChefPrinter.cpp 2009-07-28 01:46:41 UTC (rev 226) +++ trunk/src/mChef/ChefPrinter.cpp 2009-07-29 06:31:02 UTC (rev 227) @@ -23,15 +23,12 @@ #include "ChefPrinter.h" ChefPrinter::ChefPrinter(lpChef curChef, ImageType iType, bool bView) - : m_curChef(curChef), m_ImageOutputFormat(iType), bFullView(bView) + : m_curChef(curChef), m_ImageOutputFormat(iType), bFullView(bView), + m_SavePath(BuildPath(m_SavePath, "Screens\\")), pBuf(NULL) { CF_DB_START - - m_SavePath = NULL; - pBuf = NULL; ZeroMemory(m_FullImagePath, MAX_PATH); ZeroMemory(m_ImageName, MAX_PATH); - m_SavePath = BuildPath(m_SavePath, "Screens\\"); CF_DB_END } Modified: trunk/src/mChef/ChefSignals.cpp =================================================================== --- trunk/src/mChef/ChefSignals.cpp 2009-07-28 01:46:41 UTC (rev 226) +++ trunk/src/mChef/ChefSignals.cpp 2009-07-29 06:31:02 UTC (rev 227) @@ -27,8 +27,6 @@ ChefSignals::~ChefSignals() { - CloseMapView(); - CloseMap(); } char *ChefSignals::GetEvaluatedData() Modified: trunk/src/mChef/ChefString.cpp =================================================================== --- trunk/src/mChef/ChefString.cpp 2009-07-28 01:46:41 UTC (rev 226) +++ trunk/src/mChef/ChefString.cpp 2009-07-29 06:31:02 UTC (rev 227) @@ -22,8 +22,8 @@ * CEF_String. Constructor #1 */ CEF_String::CEF_String(void) + : _cstData(cef_string_alloc(L"")) { - _CHEFSSERT(this->_cstData = cef_string_alloc(L"")); } /** @@ -32,8 +32,8 @@ * @param str Wide Character String */ CEF_String::CEF_String(const wchar_t *str) + : _cstData(cef_string_alloc(str)) { - _CHEFSSERT(this->_cstData = cef_string_alloc(str)); } /** @@ -89,8 +89,8 @@ * @param old Old CEF_String */ CEF_String::CEF_String(CEF_String &old) + : _cstData(cef_string_alloc(old.ToWideChar())) { - _CHEFSSERT(this->_cstData = cef_string_alloc(old.ToWideChar())); } /** @@ -120,17 +120,11 @@ * decode one. */ if (WideCharToMultiByte(CP_UTF8,0,(WCHAR*)this->_cstData, curLen+1,data,newLen+1, NULL,NULL) == 0) { -#ifdef CHEF_DEBUG - DWORD dwError = GetLastError(); - LPSTR lpErrorMsg = Gen::GetLastErrorMessage(dwError); - - printf("Error Converting \"%s\" to MultiByte. Error Code: %d, Error Message: %s\n", - this->_cstData, dwError, lpErrorMsg); - LocalFree(lpErrorMsg); -#endif + CF_DB(ChefGetLastError();) } } else { - CF_DB(printf("Unable to get the size needed for new string!\n")); + CF_DB(printf("Unable to get the size needed for new string!\n"); + ChefGetLastError()); } Modified: trunk/src/mChef/Main.cpp =================================================================== --- trunk/src/mChef/Main.cpp 2009-07-28 01:46:41 UTC (rev 226) +++ trunk/src/mChef/Main.cpp 2009-07-29 06:31:02 UTC (rev 227) @@ -250,6 +250,8 @@ if (curChef->m_ResizeTarget) ShowWindow(curChef->m_ResizeTarget,SW_SHOWNORMAL); + // Tell CEF that we are done with this window. + SendMessage(curChef->m_BrowserHwnd, WM_DESTROY, 0, 0); ChefPop(curChef); sprintf(data, "C_OK Detach %s", parv[0]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ur...@us...> - 2009-07-29 06:46:39
|
Revision: 228 http://mchef.svn.sourceforge.net/mchef/?rev=228&view=rev Author: urjd Date: 2009-07-29 06:46:27 +0000 (Wed, 29 Jul 2009) Log Message: ----------- changed mChef default to ABOUT:BLANK instead of HTTP://GOOGLE.COM/ Modified Paths: -------------- trunk/src/mChef/ChefMisc.cpp Modified: trunk/src/mChef/ChefMisc.cpp =================================================================== --- trunk/src/mChef/ChefMisc.cpp 2009-07-29 06:31:02 UTC (rev 227) +++ trunk/src/mChef/ChefMisc.cpp 2009-07-29 06:46:27 UTC (rev 228) @@ -170,7 +170,7 @@ curChef->mWindowInfo->m_nHeight = rc.bottom-rc.top; } - CEF_String cs(url != NULL ? url : "http://www.google.com"); + CEF_String cs(url != NULL ? url : "about:blank"); cef_browser_create(curChef->mWindowInfo,0, CreateMyHandler(), (const WCHAR*)cs.ToWideChar()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-07-28 01:46:57
|
Revision: 226 http://mchef.svn.sourceforge.net/mchef/?rev=226&view=rev Author: tux316 Date: 2009-07-28 01:46:41 +0000 (Tue, 28 Jul 2009) Log Message: ----------- Removed the "cef_handler_t *mHandler" from the Chef structure members. This is not needed for the following reasons: cef/browser_impl.cc: bool CefBrowser::CreateBrowser(CefWindowInfo& windowInfo, bool popup, CefRefPtr<CefHandler> handler, const std::wstring& url) As per Marshall's declaration of CreateBrowser (See above), the handler that is passed as an argument, is passed as a reference pointer. This means that we don't need to keep track of it and free it ourselfs. If we did, what would be the point of spart pointers? We will never reference this pointer ourselfs or use it, since it's stricly for CEF. So with this in mind, it's gone. Bu bye o/ http://genscriptsreview.appspot.com/9/show Modified Paths: -------------- trunk/src/mChef/Chef.cpp trunk/src/mChef/Chef.h trunk/src/mChef/ChefHandler.cpp trunk/src/mChef/ChefMisc.cpp trunk/src/mChef/ChefStruct.h Modified: trunk/src/mChef/Chef.cpp =================================================================== --- trunk/src/mChef/Chef.cpp 2009-07-28 01:22:10 UTC (rev 225) +++ trunk/src/mChef/Chef.cpp 2009-07-28 01:46:41 UTC (rev 226) @@ -203,12 +203,7 @@ if (curChef->wpResizeTarget) SetWindowLongPtr(curChef->m_ResizeTarget, GWL_WNDPROC, (LONG_PTR)curChef->wpResizeTarget); - /* Sanity Check - Tell CEF that destroy if it already has not. */ - //if (IsWindow(curChef->m_BrowserHwnd)) - // SendMessage(curChef->m_BrowserHwnd, WM_DESTROY, 0, 0); - BaseRelease(curChef->mBrowser); - BaseRelease(curChef->mHandler); curChef->mBrowser = NULL; curChef->OldProc = curChef->wpResizeTarget = NULL; @@ -285,7 +280,6 @@ curChef->mark = NULL; curChef->m_WindowName = ChefStrDup(m_WindowName); - curChef->mHandler = CreateMyHandler(); curChef->m_hWnd = m_hWnd; curChef->m_BrowserHwnd = NULL; curChef->m_ResizeTarget = hwResizeTarget; Modified: trunk/src/mChef/Chef.h =================================================================== --- trunk/src/mChef/Chef.h 2009-07-28 01:22:10 UTC (rev 225) +++ trunk/src/mChef/Chef.h 2009-07-28 01:46:41 UTC (rev 226) @@ -27,19 +27,19 @@ /* Changing any of the macros below will only be waisting your time.*/ /* Number of times that the project has been built */ -#define VERSION_BUILD 950 +#define VERSION_BUILD 960 /* Current mChef Version */ -#define MCHEF_VERSION_STR "1.0.950" -#define MCHEF_VERSION_STRWC L"1.0.950" +#define MCHEF_VERSION_STR "1.0.960" +#define MCHEF_VERSION_STRWC L"1.0.960" -#define VERSION_FULL "1.0.950" -#define VERSION_WFULL L"1.0.950" +#define VERSION_FULL "1.0.960" +#define VERSION_WFULL L"1.0.960" -#define VERSION_FILE 1,0,0,950 -#define VERSION_PRODUCT 1,0,0,950 -#define VERSION_FSTR "1, 0, 0, 950" -#define VERSION_PSTR "1, 0, 0, 950" +#define VERSION_FILE 1,0,0,960 +#define VERSION_PRODUCT 1,0,0,960 +#define VERSION_FSTR "1, 0, 0, 960" +#define VERSION_PSTR "1, 0, 0, 960" #endif Modified: trunk/src/mChef/ChefHandler.cpp =================================================================== --- trunk/src/mChef/ChefHandler.cpp 2009-07-28 01:22:10 UTC (rev 225) +++ trunk/src/mChef/ChefHandler.cpp 2009-07-28 01:46:41 UTC (rev 226) @@ -530,11 +530,12 @@ curChef->m_hWnd)); ChefPop(curChef); + BaseRelease(handler); BaseRelease(browser); return RV_CONTINUE; } - + BaseRelease(handler); BaseRelease(browser); CF_DB_END @@ -666,6 +667,8 @@ m->handle_jsbinding = handle_jsbinding; m->handle_set_focus = handle_set_focus; + BaseAddRef(m); //Increase reference before passing it so it does not get killed on the spot. + CF_DB_END return m; } Modified: trunk/src/mChef/ChefMisc.cpp =================================================================== --- trunk/src/mChef/ChefMisc.cpp 2009-07-28 01:22:10 UTC (rev 225) +++ trunk/src/mChef/ChefMisc.cpp 2009-07-28 01:46:41 UTC (rev 226) @@ -172,9 +172,7 @@ CEF_String cs(url != NULL ? url : "http://www.google.com"); - BaseAddRef(curChef->mHandler); - - cef_browser_create(curChef->mWindowInfo,0, curChef->mHandler, + cef_browser_create(curChef->mWindowInfo,0, CreateMyHandler(), (const WCHAR*)cs.ToWideChar()); /* For Bama: Modified: trunk/src/mChef/ChefStruct.h =================================================================== --- trunk/src/mChef/ChefStruct.h 2009-07-28 01:22:10 UTC (rev 225) +++ trunk/src/mChef/ChefStruct.h 2009-07-28 01:46:41 UTC (rev 226) @@ -43,7 +43,6 @@ */ typedef struct chef_t { - cef_handler_t *mHandler; /* Instance of cHandler */ cef_browser_t *mBrowser; /* Browser Window... */ cef_window_info_t *mWindowInfo; /* Info about the window */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-07-28 01:22:20
|
Revision: 225 http://mchef.svn.sourceforge.net/mchef/?rev=225&view=rev Author: tux316 Date: 2009-07-28 01:22:10 +0000 (Tue, 28 Jul 2009) Log Message: ----------- There was a variable in UnloadDll that was declared, set, but never used. We can safely remove this. There was some redundancy in IsAttached. This fixes this as well. - http://genscriptsreview.appspot.com/1004/show Modified Paths: -------------- trunk/src/mChef/Chef.h trunk/src/mChef/Main.cpp Modified: trunk/src/mChef/Chef.h =================================================================== --- trunk/src/mChef/Chef.h 2009-07-27 18:32:54 UTC (rev 224) +++ trunk/src/mChef/Chef.h 2009-07-28 01:22:10 UTC (rev 225) @@ -27,19 +27,19 @@ /* Changing any of the macros below will only be waisting your time.*/ /* Number of times that the project has been built */ -#define VERSION_BUILD 948 +#define VERSION_BUILD 950 /* Current mChef Version */ -#define MCHEF_VERSION_STR "1.0.948" -#define MCHEF_VERSION_STRWC L"1.0.948" +#define MCHEF_VERSION_STR "1.0.950" +#define MCHEF_VERSION_STRWC L"1.0.950" -#define VERSION_FULL "1.0.948" -#define VERSION_WFULL L"1.0.948" +#define VERSION_FULL "1.0.950" +#define VERSION_WFULL L"1.0.950" -#define VERSION_FILE 1,0,0,948 -#define VERSION_PRODUCT 1,0,0,948 -#define VERSION_FSTR "1, 0, 0, 948" -#define VERSION_PSTR "1, 0, 0, 948" +#define VERSION_FILE 1,0,0,950 +#define VERSION_PRODUCT 1,0,0,950 +#define VERSION_FSTR "1, 0, 0, 950" +#define VERSION_PSTR "1, 0, 0, 950" #endif Modified: trunk/src/mChef/Main.cpp =================================================================== --- trunk/src/mChef/Main.cpp 2009-07-27 18:32:54 UTC (rev 224) +++ trunk/src/mChef/Main.cpp 2009-07-28 01:22:10 UTC (rev 225) @@ -112,8 +112,6 @@ cef_shutdown(); if (bClearCacheOnExit && !bCacheInMemory && cachePath) { - CF_DB(fwprintf(stderr, L"Attempting to remove: \"%s\"\n", cachePath)); - /* Create double null terminated string that's needed for SHFileOperation. */ WCHAR wCachePath[MAX_PATH] = {0}; wnsprintf(wCachePath, MAX_PATH, L"%s", cachePath); @@ -128,8 +126,7 @@ 0, L"" }; - int nRet = SHFileOperation(&fileOp); - CF_DB(fprintf(stderr, "SHFileOperation:%i\n", nRet)); + SHFileOperation(&fileOp); } CF_DB(fprintf(stderr,"Popping all Base vectors\n")); @@ -143,7 +140,6 @@ MyFreeEx(cachePath); CF_DB(fprintf(stderr, "Terminating mChef.dll...OK\nClosing down stderr...\n")); - CF_DB_END CF_DB( @@ -319,13 +315,10 @@ } lpChef curChef = NULL; - if (!(curChef = ChefFindEx(parv[0])) || !curChef->mBrowser) { + if (!(curChef = ChefFindEx(parv[0])) || !curChef->mBrowser) sprintf(data, "C_ERR %s", parv[0]); //No browser @ NAME|HWND - CF_DB_END; - return 3; - } - - sprintf(data, "C_OK %s", parv[0]); //Browser found @ NAME|HWND + else + sprintf(data, "C_OK %s", parv[0]); //Browser found @ NAME|HWND CF_DB_END return 3; @@ -654,6 +647,7 @@ int __stdcall ClearCache(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause) { CF_DB_START; + SanityCheck(); bClearCacheOnExit = true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-07-27 18:33:00
|
Revision: 224 http://mchef.svn.sourceforge.net/mchef/?rev=224&view=rev Author: tux316 Date: 2009-07-27 18:32:54 +0000 (Mon, 27 Jul 2009) Log Message: ----------- Private branch for the purpose of narrowing everything down to 1 DLL. Added Paths: ----------- branches/cef-icu-static/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-07-27 18:24:12
|
Revision: 223 http://mchef.svn.sourceforge.net/mchef/?rev=223&view=rev Author: tux316 Date: 2009-07-27 18:24:04 +0000 (Mon, 27 Jul 2009) Log Message: ----------- Removed Paths: ------------- tags/cef-stl/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-07-27 18:23:31
|
Revision: 222 http://mchef.svn.sourceforge.net/mchef/?rev=222&view=rev Author: tux316 Date: 2009-07-27 18:23:14 +0000 (Mon, 27 Jul 2009) Log Message: ----------- Removed Paths: ------------- branches/cefcpp/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-07-26 23:08:05
|
Revision: 221 http://mchef.svn.sourceforge.net/mchef/?rev=221&view=rev Author: tux316 Date: 2009-07-26 23:07:41 +0000 (Sun, 26 Jul 2009) Log Message: ----------- There were not that many important changes in this revision: - Added support for the Intel C++ Compiler. - Upgraded to the latest CEF Revision + personal mods to it for added flavor. - Removed debug code from our SubWndProc implementation. We don't need it any more. - Specified that the minimum version required to run mChef is Windows ME, and XP (or later). - Removed non reachable code as well as variables that were declared but never used (:3) - Moved chef_capi.h to StdAfx.h, our precompiled love nest. It only makes sense ?\226?\157?\164. - Fixed trailing comma in enumerators declared in cef_types. - New binaries for CEF. Modified Paths: -------------- trunk/mChef.sln trunk/src/Gen/Console.hpp trunk/src/Gen/Error.hpp trunk/src/Gen/Map.hpp trunk/src/ThirdParty/cef/build/Debug/libcef.dll trunk/src/ThirdParty/cef/build/Release/libcef.dll trunk/src/ThirdParty/cef/include/cef_export.h trunk/src/ThirdParty/cef/include/cef_nplugin.h trunk/src/ThirdParty/cef/include/cef_nplugin_capi.h trunk/src/ThirdParty/cef/include/cef_ptr.h trunk/src/ThirdParty/cef/include/cef_string.h trunk/src/ThirdParty/cef/include/cef_string_list.h trunk/src/ThirdParty/cef/include/cef_string_map.h trunk/src/ThirdParty/cef/include/cef_types.h trunk/src/ThirdParty/cef/include/cef_types_win.h trunk/src/ThirdParty/cef/include/cef_win.h trunk/src/ThirdParty/cef/lib/Debug/libcef.lib trunk/src/ThirdParty/cef/lib/Debug/libcef_dll_wrapper.lib trunk/src/ThirdParty/cef/lib/Release/libcef.lib trunk/src/ThirdParty/cef/lib/Release/libcef_dll_wrapper.lib trunk/src/ThirdParty/lbmg/BMGImage.h trunk/src/ThirdParty/lbmg/BMGLibPNG.h trunk/src/ThirdParty/lbmg/pngrw.h trunk/src/Tools/VersionTool/VersionTool.c trunk/src/mChef/Chef.cpp trunk/src/mChef/Chef.h trunk/src/mChef/ChefMacros.h trunk/src/mChef/ChefMisc.cpp trunk/src/mChef/ChefSignals.cpp trunk/src/mChef/ChefString.cpp trunk/src/mChef/Main.cpp trunk/src/mChef/StdAfx.h trunk/src/mChef/SubClass.cpp trunk/src/mChef/h.h Added Paths: ----------- trunk/src/mChef/mChef.icproj Modified: trunk/mChef.sln =================================================================== --- trunk/mChef.sln 2009-07-23 21:20:17 UTC (rev 220) +++ trunk/mChef.sln 2009-07-26 23:07:41 UTC (rev 221) @@ -111,17 +111,17 @@ HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution + {29AA2BB3-5DD2-46FE-B1B9-03CEB7E74144} = {5895FB9D-8234-4E84-A704-3FB849561343} + {1BD3D7D9-A2D1-497C-A235-19696D162E66} = {99D5EB91-3875-4C07-8870-0814C70DDAEF} {524AFB38-383C-48C1-A302-90C14FE7886B} = {99D5EB91-3875-4C07-8870-0814C70DDAEF} - {1BD3D7D9-A2D1-497C-A235-19696D162E66} = {99D5EB91-3875-4C07-8870-0814C70DDAEF} + {5B9F53DA-C7CE-4B8F-B25F-AE80FFBF10A3} = {B3248254-1A95-4ED5-A5B4-B556BAC88287} + {044D0C73-AB41-4652-B7FB-7EB2D5CBABE1} = {B3248254-1A95-4ED5-A5B4-B556BAC88287} + {A3246FF9-A597-4B7D-A6D9-14A5D6D72869} = {5B9F53DA-C7CE-4B8F-B25F-AE80FFBF10A3} {74E8FD64-950C-425E-B4DF-82ED0BB57FFF} = {5B9F53DA-C7CE-4B8F-B25F-AE80FFBF10A3} + {44C3C3E9-05E3-4C88-8812-64B5681BBE9C} = {5B9F53DA-C7CE-4B8F-B25F-AE80FFBF10A3} {054DA7DE-6E9E-40DF-A2E9-8EA68E15426C} = {5B9F53DA-C7CE-4B8F-B25F-AE80FFBF10A3} - {A3246FF9-A597-4B7D-A6D9-14A5D6D72869} = {5B9F53DA-C7CE-4B8F-B25F-AE80FFBF10A3} - {44C3C3E9-05E3-4C88-8812-64B5681BBE9C} = {5B9F53DA-C7CE-4B8F-B25F-AE80FFBF10A3} - {044D0C73-AB41-4652-B7FB-7EB2D5CBABE1} = {B3248254-1A95-4ED5-A5B4-B556BAC88287} - {5B9F53DA-C7CE-4B8F-B25F-AE80FFBF10A3} = {B3248254-1A95-4ED5-A5B4-B556BAC88287} {B2001935-BDFE-4A45-9B3B-1C0596A8D249} = {A3246FF9-A597-4B7D-A6D9-14A5D6D72869} {23A7F338-7A32-4EC0-B5FD-1AD5E59B4548} = {44C3C3E9-05E3-4C88-8812-64B5681BBE9C} {87184500-EA71-45E9-B2D7-4B6C0AD1563B} = {054DA7DE-6E9E-40DF-A2E9-8EA68E15426C} - {29AA2BB3-5DD2-46FE-B1B9-03CEB7E74144} = {5895FB9D-8234-4E84-A704-3FB849561343} EndGlobalSection EndGlobal Modified: trunk/src/Gen/Console.hpp =================================================================== --- trunk/src/Gen/Console.hpp 2009-07-23 21:20:17 UTC (rev 220) +++ trunk/src/Gen/Console.hpp 2009-07-26 23:07:41 UTC (rev 221) @@ -113,9 +113,11 @@ { if ((bConsole = FreeConsole())) return true; + + return false; } }; -}; +} #endif /* __CONSOLE_H__ */ Modified: trunk/src/Gen/Error.hpp =================================================================== --- trunk/src/Gen/Error.hpp 2009-07-23 21:20:17 UTC (rev 220) +++ trunk/src/Gen/Error.hpp 2009-07-26 23:07:41 UTC (rev 221) @@ -41,4 +41,5 @@ } } -#endif /* __GENERROR_HPP */ \ No newline at end of file +#endif /* __GENERROR_HPP */ + Modified: trunk/src/Gen/Map.hpp =================================================================== --- trunk/src/Gen/Map.hpp 2009-07-23 21:20:17 UTC (rev 220) +++ trunk/src/Gen/Map.hpp 2009-07-26 23:07:41 UTC (rev 221) @@ -56,7 +56,7 @@ /** * Class Destructor. Closes all maps. */ - ~CGenMap() + virtual ~CGenMap() { CloseMapView(); CloseMap(); @@ -129,7 +129,6 @@ */ int Cmd(const char *fmt, ...) { - int nSize = 0; char sBuffer[1024]; memset(sBuffer, 0, sizeof(sBuffer)); @@ -138,7 +137,7 @@ va_list vl; va_start(vl, fmt); - nSize = vsnprintf(sBuffer, sizeof(sBuffer) - 1, fmt, vl); + vsnprintf(sBuffer, sizeof(sBuffer) - 1, fmt, vl); sprintf(m_Data, "%s", sBuffer); int iReturn = SendMooData(false); CloseMapView(); @@ -153,7 +152,6 @@ */ int Eval(char *ReturnBuff, int BuffSize, const char *fmt, ...) { - int nSize = 0; char sBuffer[1024]; memset(sBuffer, 0, sizeof(sBuffer)); @@ -162,7 +160,7 @@ va_list vl; va_start(vl, fmt); - nSize = vsnprintf(sBuffer, sizeof(sBuffer) - 1, fmt, vl); + vsnprintf(sBuffer, sizeof(sBuffer) - 1, fmt, vl); sprintf(m_Data, "%s", sBuffer); ZeroMemory(ReturnBuff, BuffSize); Modified: trunk/src/ThirdParty/cef/build/Debug/libcef.dll =================================================================== (Binary files differ) Modified: trunk/src/ThirdParty/cef/build/Release/libcef.dll =================================================================== (Binary files differ) Modified: trunk/src/ThirdParty/cef/include/cef_export.h =================================================================== --- trunk/src/ThirdParty/cef/include/cef_export.h 2009-07-23 21:20:17 UTC (rev 220) +++ trunk/src/ThirdParty/cef/include/cef_export.h 2009-07-26 23:07:41 UTC (rev 221) @@ -1,32 +1,32 @@ // Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights -// reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifdef _MSC_VER // MSVC Modified: trunk/src/ThirdParty/cef/include/cef_nplugin.h =================================================================== --- trunk/src/ThirdParty/cef/include/cef_nplugin.h 2009-07-23 21:20:17 UTC (rev 220) +++ trunk/src/ThirdParty/cef/include/cef_nplugin.h 2009-07-26 23:07:41 UTC (rev 221) @@ -1,85 +1,85 @@ -// Copyright (c) 2008 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -#ifndef _CEF_PLUGIN_H -#define _CEF_PLUGIN_H - -#include <string> -#include <vector> -#include "webkit/glue/plugins/nphostapi.h" -#include "third_party/npapi/bindings/npapi.h" - -// Netscape plugins are normally built at separate DLLs that are loaded by the -// browser when needed. This interface supports the creation of plugins that -// are an embedded component of the application. Embedded plugins built using -// this interface use the same Netscape Plugin API as DLL-based plugins. -// See https://developer.mozilla.org/En/Gecko_Plugin_API_Reference for complete -// documentation on how to use the Netscape Plugin API. - -// This structure describes a mime type entry for a plugin. -struct CefPluginMimeType { - // The actual mime type. - std::wstring mime_type; - - // A list of all the file extensions for this mime type. - std::vector<std::wstring> file_extensions; - - // Description of the mime type. - std::wstring description; -}; - -// This structure provides attribute information and entry point functions for -// a plugin. -struct CefPluginInfo { - // The unique name that identifies the plugin. - std::wstring unique_name; - - // The friendly display name of the plugin. - std::wstring display_name; - - // The version string of the plugin. - std::wstring version; - - // A description of the plugin. - std::wstring description; - - // A list of all the mime types that this plugin supports. - std::vector<CefPluginMimeType> mime_types; - - // Entry point function pointers. - NP_GetEntryPointsFunc np_getentrypoints; - NP_InitializeFunc np_initialize; - NP_ShutdownFunc np_shutdown; -}; - -// Register a plugin with the system. -bool CefRegisterPlugin(const struct CefPluginInfo& plugin_info); - -#endif // _CEF_PLUGIN_H +// Copyright (c) 2008 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +#ifndef _CEF_PLUGIN_H +#define _CEF_PLUGIN_H + +#include <string> +#include <vector> +#include "webkit/glue/plugins/nphostapi.h" +#include "third_party/npapi/bindings/npapi.h" + +// Netscape plugins are normally built at separate DLLs that are loaded by the +// browser when needed. This interface supports the creation of plugins that +// are an embedded component of the application. Embedded plugins built using +// this interface use the same Netscape Plugin API as DLL-based plugins. +// See https://developer.mozilla.org/En/Gecko_Plugin_API_Reference for complete +// documentation on how to use the Netscape Plugin API. + +// This structure describes a mime type entry for a plugin. +struct CefPluginMimeType { + // The actual mime type. + std::wstring mime_type; + + // A list of all the file extensions for this mime type. + std::vector<std::wstring> file_extensions; + + // Description of the mime type. + std::wstring description; +}; + +// This structure provides attribute information and entry point functions for +// a plugin. +struct CefPluginInfo { + // The unique name that identifies the plugin. + std::wstring unique_name; + + // The friendly display name of the plugin. + std::wstring display_name; + + // The version string of the plugin. + std::wstring version; + + // A description of the plugin. + std::wstring description; + + // A list of all the mime types that this plugin supports. + std::vector<CefPluginMimeType> mime_types; + + // Entry point function pointers. + NP_GetEntryPointsFunc np_getentrypoints; + NP_InitializeFunc np_initialize; + NP_ShutdownFunc np_shutdown; +}; + +// Register a plugin with the system. +bool CefRegisterPlugin(const struct CefPluginInfo& plugin_info); + +#endif // _CEF_PLUGIN_H Modified: trunk/src/ThirdParty/cef/include/cef_nplugin_capi.h =================================================================== --- trunk/src/ThirdParty/cef/include/cef_nplugin_capi.h 2009-07-23 21:20:17 UTC (rev 220) +++ trunk/src/ThirdParty/cef/include/cef_nplugin_capi.h 2009-07-26 23:07:41 UTC (rev 221) @@ -1,64 +1,64 @@ -// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -#ifndef _CEF_PLUGIN_CAPI_H -#define _CEF_PLUGIN_CAPI_H - +// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +#ifndef _CEF_PLUGIN_CAPI_H +#define _CEF_PLUGIN_CAPI_H + #ifdef __cplusplus extern "C" { #endif #include "cef_export.h" -#include "webkit/glue/plugins/nphostapi.h" -#include "third_party/npapi/bindings/npapi.h" - -// Netscape plugins are normally built at separate DLLs that are loaded by the -// browser when needed. This interface supports the creation of plugins that -// are an embedded component of the application. Embedded plugins built using -// this interface use the same Netscape Plugin API as DLL-based plugins. -// See https://developer.mozilla.org/En/Gecko_Plugin_API_Reference for complete -// documentation on how to use the Netscape Plugin API. - -// This structure provides attribute information and entry point functions for -// a plugin. -typedef struct _cef_plugin_info_t { - // The unique name that identifies the plugin. - const wchar_t* unique_name; - - // The friendly display name of the plugin. - const wchar_t* display_name; - - // The version string of the plugin. - const wchar_t* version; - - // A description of the plugin. +#include "webkit/glue/plugins/nphostapi.h" +#include "third_party/npapi/bindings/npapi.h" + +// Netscape plugins are normally built at separate DLLs that are loaded by the +// browser when needed. This interface supports the creation of plugins that +// are an embedded component of the application. Embedded plugins built using +// this interface use the same Netscape Plugin API as DLL-based plugins. +// See https://developer.mozilla.org/En/Gecko_Plugin_API_Reference for complete +// documentation on how to use the Netscape Plugin API. + +// This structure provides attribute information and entry point functions for +// a plugin. +typedef struct _cef_plugin_info_t { + // The unique name that identifies the plugin. + const wchar_t* unique_name; + + // The friendly display name of the plugin. + const wchar_t* display_name; + + // The version string of the plugin. + const wchar_t* version; + + // A description of the plugin. const wchar_t* description; // A pipe (|) delimited list of mime type values that the plugin supports. @@ -71,20 +71,20 @@ // A pipe (|) delimited list of description values. Each value is associated // with the mime type value at the same position. - const wchar_t* type_descriptions; - - // Entry point function pointers. - NP_GetEntryPointsFunc np_getentrypoints; - NP_InitializeFunc np_initialize; - NP_ShutdownFunc np_shutdown; -} cef_plugin_info_t; - -// Register a plugin with the system. Returns true (1) on success. -CEF_EXPORT int cef_register_plugin(const cef_plugin_info_t* plugin_info); - + const wchar_t* type_descriptions; + // Entry point function pointers. + NP_GetEntryPointsFunc np_getentrypoints; + NP_InitializeFunc np_initialize; + NP_ShutdownFunc np_shutdown; +} cef_plugin_info_t; + +// Register a plugin with the system. Returns true (1) on success. +CEF_EXPORT int cef_register_plugin(const cef_plugin_info_t* plugin_info); + + #ifdef __cplusplus } #endif -#endif // _CEF_PLUGIN_CAPI_H +#endif // _CEF_PLUGIN_CAPI_H Modified: trunk/src/ThirdParty/cef/include/cef_ptr.h =================================================================== --- trunk/src/ThirdParty/cef/include/cef_ptr.h 2009-07-23 21:20:17 UTC (rev 220) +++ trunk/src/ThirdParty/cef/include/cef_ptr.h 2009-07-26 23:07:41 UTC (rev 221) @@ -1,193 +1,193 @@ -// Copyright (c) 2008 Marshall A. Greenblatt. Portions Copyright (c) -// 2006-2008 Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// Copyright (c) 2008 Marshall A. Greenblatt. Portions Copyright (c) +// 2006-2008 Google Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef _CEF_PTR_H #define _CEF_PTR_H // Smart pointer implementation borrowed from base/ref_counted.h -// -// A smart pointer class for reference counted objects. Use this class instead -// of calling AddRef and Release manually on a reference counted object to -// avoid common memory leaks caused by forgetting to Release an object -// reference. Sample usage: -// -// class MyFoo : public CefBase { -// ... -// }; -// -// void some_function() { -// // The MyFoo object that |foo| represents starts with a single -// // reference. -// CefRefPtr<MyFoo> foo = new MyFoo(); -// foo->Method(param); -// // |foo| is released when this function returns -// } -// -// void some_other_function() { -// CefRefPtr<MyFoo> foo = new MyFoo(); -// ... -// foo = NULL; // explicitly releases |foo| -// ... -// if (foo) -// foo->Method(param); -// } -// -// The above examples show how CefRefPtr<T> acts like a pointer to T. -// Given two CefRefPtr<T> classes, it is also possible to exchange -// references between the two objects, like so: -// -// { -// CefRefPtr<MyFoo> a = new MyFoo(); -// CefRefPtr<MyFoo> b; -// -// b.swap(a); -// // now, |b| references the MyFoo object, and |a| references NULL. -// } -// -// To make both |a| and |b| in the above example reference the same MyFoo -// object, simply use the assignment operator: -// -// { -// CefRefPtr<MyFoo> a = new MyFoo(); -// CefRefPtr<MyFoo> b; -// -// b = a; -// // now, |a| and |b| each own a reference to the same MyFoo object. -// // the reference count of the underlying MyFoo object will be 2. -// } -// -// Reference counted objects can also be passed as function parameters and -// used as function return values: -// -// void some_func_with_param(CefRefPtr<MyFoo> param) { -// // A reference is added to the MyFoo object that |param| represents -// // during the scope of some_func_with_param() and released when -// // some_func_with_param() goes out of scope. -// } -// -// CefRefPtr<MyFoo> some_func_with_retval() { -// // The MyFoo object that |foox| represents starts with a single -// // reference. -// CefRefPtr<MyFoo> foox = new MyFoo(); -// -// // Creating the return value adds an additional reference. -// return foox; -// -// // When some_func_with_retval() goes out of scope the original |foox| -// // reference is released. -// } -// -// void and_another_function() { -// CefRefPtr<MyFoo> foo = new MyFoo(); -// -// // pass |foo| as a parameter. -// some_function(foo); -// -// CefRefPtr<MyFoo> foo2 = some_func_with_retval(); -// // Now, since we kept a reference to the some_func_with_retval() return -// // value, |foo2| is the only class pointing to the MyFoo object created -// in some_func_with_retval(), and it has a reference count of 1. -// -// some_func_with_retval(); -// // Now, since we didn't keep a reference to the some_func_with_retval() -// // return value, the MyFoo object created in some_func_with_retval() -// // will automatically be released. -// } // +// A smart pointer class for reference counted objects. Use this class instead +// of calling AddRef and Release manually on a reference counted object to +// avoid common memory leaks caused by forgetting to Release an object +// reference. Sample usage: +// +// class MyFoo : public CefBase { +// ... +// }; +// +// void some_function() { +// // The MyFoo object that |foo| represents starts with a single +// // reference. +// CefRefPtr<MyFoo> foo = new MyFoo(); +// foo->Method(param); +// // |foo| is released when this function returns +// } +// +// void some_other_function() { +// CefRefPtr<MyFoo> foo = new MyFoo(); +// ... +// foo = NULL; // explicitly releases |foo| +// ... +// if (foo) +// foo->Method(param); +// } +// +// The above examples show how CefRefPtr<T> acts like a pointer to T. +// Given two CefRefPtr<T> classes, it is also possible to exchange +// references between the two objects, like so: +// +// { +// CefRefPtr<MyFoo> a = new MyFoo(); +// CefRefPtr<MyFoo> b; +// +// b.swap(a); +// // now, |b| references the MyFoo object, and |a| references NULL. +// } +// +// To make both |a| and |b| in the above example reference the same MyFoo +// object, simply use the assignment operator: +// +// { +// CefRefPtr<MyFoo> a = new MyFoo(); +// CefRefPtr<MyFoo> b; +// +// b = a; +// // now, |a| and |b| each own a reference to the same MyFoo object. +// // the reference count of the underlying MyFoo object will be 2. +// } +// +// Reference counted objects can also be passed as function parameters and +// used as function return values: +// +// void some_func_with_param(CefRefPtr<MyFoo> param) { +// // A reference is added to the MyFoo object that |param| represents +// // during the scope of some_func_with_param() and released when +// // some_func_with_param() goes out of scope. +// } +// +// CefRefPtr<MyFoo> some_func_with_retval() { +// // The MyFoo object that |foox| represents starts with a single +// // reference. +// CefRefPtr<MyFoo> foox = new MyFoo(); +// +// // Creating the return value adds an additional reference. +// return foox; +// +// // When some_func_with_retval() goes out of scope the original |foox| +// // reference is released. +// } +// +// void and_another_function() { +// CefRefPtr<MyFoo> foo = new MyFoo(); +// +// // pass |foo| as a parameter. +// some_function(foo); +// +// CefRefPtr<MyFoo> foo2 = some_func_with_retval(); +// // Now, since we kept a reference to the some_func_with_retval() return +// // value, |foo2| is the only class pointing to the MyFoo object created +// in some_func_with_retval(), and it has a reference count of 1. +// +// some_func_with_retval(); +// // Now, since we didn't keep a reference to the some_func_with_retval() +// // return value, the MyFoo object created in some_func_with_retval() +// // will automatically be released. +// } +// // And in standard containers: // // { // // Create a vector that holds MyFoo objects. // std::vector<CefRefPtr<MyFoo> > MyFooVec; // -// // The MyFoo object that |foo| represents starts with a single -// // reference. -// CefRefPtr<MyFoo> foo = new MyFoo(); -// -// // When the MyFoo object is added to |MyFooVec| the reference count -// // is increased to 2. -// MyFooVec.push_back(foo); +// // The MyFoo object that |foo| represents starts with a single +// // reference. +// CefRefPtr<MyFoo> foo = new MyFoo(); +// +// // When the MyFoo object is added to |MyFooVec| the reference count +// // is increased to 2. +// MyFooVec.push_back(foo); // } // -template <class T> -class CefRefPtr { - public: - CefRefPtr() : ptr_(NULL) { - } - - CefRefPtr(T* p) : ptr_(p) { - if (ptr_) - ptr_->AddRef(); - } - - CefRefPtr(const CefRefPtr<T>& r) : ptr_(r.ptr_) { - if (ptr_) - ptr_->AddRef(); - } - - ~CefRefPtr() { - if (ptr_) - ptr_->Release(); - } - - T* get() const { return ptr_; } - operator T*() const { return ptr_; } - T* operator->() const { return ptr_; } - - CefRefPtr<T>& operator=(T* p) { - // AddRef first so that self assignment should work - if (p) - p->AddRef(); - if (ptr_ ) - ptr_ ->Release(); - ptr_ = p; - return *this; - } - - CefRefPtr<T>& operator=(const CefRefPtr<T>& r) { - return *this = r.ptr_; - } - - void swap(T** pp) { - T* p = ptr_; - ptr_ = *pp; - *pp = p; - } - - void swap(CefRefPtr<T>& r) { - swap(&r.ptr_); - } - - private: - T* ptr_; +template <class T> +class CefRefPtr { + public: + CefRefPtr() : ptr_(NULL) { + } + + CefRefPtr(T* p) : ptr_(p) { + if (ptr_) + ptr_->AddRef(); + } + + CefRefPtr(const CefRefPtr<T>& r) : ptr_(r.ptr_) { + if (ptr_) + ptr_->AddRef(); + } + + ~CefRefPtr() { + if (ptr_) + ptr_->Release(); + } + + T* get() const { return ptr_; } + operator T*() const { return ptr_; } + T* operator->() const { return ptr_; } + + CefRefPtr<T>& operator=(T* p) { + // AddRef first so that self assignment should work + if (p) + p->AddRef(); + if (ptr_ ) + ptr_ ->Release(); + ptr_ = p; + return *this; + } + + CefRefPtr<T>& operator=(const CefRefPtr<T>& r) { + return *this = r.ptr_; + } + + void swap(T** pp) { + T* p = ptr_; + ptr_ = *pp; + *pp = p; + } + + void swap(CefRefPtr<T>& r) { + swap(&r.ptr_); + } + + private: + T* ptr_; }; #endif // _CEF_PTR_H Modified: trunk/src/ThirdParty/cef/include/cef_string.h =================================================================== --- trunk/src/ThirdParty/cef/include/cef_string.h 2009-07-23 21:20:17 UTC (rev 220) +++ trunk/src/ThirdParty/cef/include/cef_string.h 2009-07-26 23:07:41 UTC (rev 221) @@ -1,30 +1,30 @@ -// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef _CEF_STRING_H Modified: trunk/src/ThirdParty/cef/include/cef_string_list.h =================================================================== --- trunk/src/ThirdParty/cef/include/cef_string_list.h 2009-07-23 21:20:17 UTC (rev 220) +++ trunk/src/ThirdParty/cef/include/cef_string_list.h 2009-07-26 23:07:41 UTC (rev 221) @@ -1,30 +1,30 @@ -// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef _CEF_STRING_LIST_H Modified: trunk/src/ThirdParty/cef/include/cef_string_map.h =================================================================== --- trunk/src/ThirdParty/cef/include/cef_string_map.h 2009-07-23 21:20:17 UTC (rev 220) +++ trunk/src/ThirdParty/cef/include/cef_string_map.h 2009-07-26 23:07:41 UTC (rev 221) @@ -1,30 +1,30 @@ -// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef _CEF_STRING_MAP_H Modified: trunk/src/ThirdParty/cef/include/cef_types.h =================================================================== --- trunk/src/ThirdParty/cef/include/cef_types.h 2009-07-23 21:20:17 UTC (rev 220) +++ trunk/src/ThirdParty/cef/include/cef_types.h 2009-07-26 23:07:41 UTC (rev 221) @@ -1,31 +1,31 @@ -// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef _CEF_TYPES_H @@ -35,13 +35,13 @@ extern "C" { #endif - + // Bring in platform-specific definitions. #ifdef _WIN32 #include "cef_types_win.h" -#endif - +#endif + // Define handler return value types. Returning RV_HANDLED indicates // that the implementation completely handled the method and that no further // processing is required. Returning RV_CONTINUE indicates that the @@ -50,80 +50,80 @@ enum cef_retval_t { RV_HANDLED = 0, - RV_CONTINUE = 1, + RV_CONTINUE = 1 }; // Various browser navigation types supported by chrome. enum cef_handler_navtype_t { - NAVTYPE_LINKCLICKED = 0, - NAVTYPE_FORMSUBMITTED, - NAVTYPE_BACKFORWARD, - NAVTYPE_RELOAD, - NAVTYPE_FORMRESUBMITTED, - NAVTYPE_OTHER, + NAVTYPE_LINKCLICKED = 0, + NAVTYPE_FORMSUBMITTED, + NAVTYPE_BACKFORWARD, + NAVTYPE_RELOAD, + NAVTYPE_FORMRESUBMITTED, + NAVTYPE_OTHER }; // Supported error code values. See net\base\net_error_list.h for complete // descriptions of the error codes. enum cef_handler_errorcode_t { - ERR_FAILED = -2, - ERR_ABORTED = -3, - ERR_INVALID_ARGUMENT = -4, - ERR_INVALID_HANDLE = -5, - ERR_FILE_NOT_FOUND = -6, - ERR_TIMED_OUT = -7, - ERR_FILE_TOO_BIG = -8, - ERR_UNEXPECTED = -9, - ERR_ACCESS_DENIED = -10, - ERR_NOT_IMPLEMENTED = -11, - ERR_CONNECTION_CLOSED = -100, - ERR_CONNECTION_RESET = -101, - ERR_CONNECTION_REFUSED = -102, - ERR_CONNECTION_ABORTED = -103, - ERR_CONNECTION_FAILED = -104, - ERR_NAME_NOT_RESOLVED = -105, - ERR_INTERNET_DISCONNECTED = -106, - ERR_SSL_PROTOCOL_ERROR = -107, - ERR_ADDRESS_INVALID = -108, - ERR_ADDRESS_UNREACHABLE = -109, - ERR_SSL_CLIENT_AUTH_CERT_NEEDED = -110, - ERR_TUNNEL_CONNECTION_FAILED = -111, - ERR_NO_SSL_VERSIONS_ENABLED = -112, - ERR_SSL_VERSION_OR_CIPHER_MISMATCH = -113, - ERR_SSL_RENEGOTIATION_REQUESTED = -114, - ERR_CERT_COMMON_NAME_INVALID = -200, - ERR_CERT_DATE_INVALID = -201, - ERR_CERT_AUTHORITY_INVALID = -202, - ERR_CERT_CONTAINS_ERRORS = -203, - ERR_CERT_NO_REVOCATION_MECHANISM = -204, - ERR_CERT_UNABLE_TO_CHECK_REVOCATION = -205, - ERR_CERT_REVOKED = -206, - ERR_CERT_INVALID = -207, - ERR_CERT_END = -208, - ERR_INVALID_URL = -300, - ERR_DISALLOWED_URL_SCHEME = -301, - ERR_UNKNOWN_URL_SCHEME = -302, - ERR_TOO_MANY_REDIRECTS = -310, - ERR_UNSAFE_REDIRECT = -311, - ERR_UNSAFE_PORT = -312, - ERR_INVALID_RESPONSE = -320, - ERR_INVALID_CHUNKED_ENCODING = -321, - ERR_METHOD_NOT_SUPPORTED = -322, - ERR_UNEXPECTED_PROXY_AUTH = -323, - ERR_EMPTY_RESPONSE = -324, - ERR_RESPONSE_HEADERS_TOO_BIG = -325, - ERR_CACHE_MISS = -400, - ERR_INSECURE_RESPONSE = -501, + ERR_FAILED = -2, + ERR_ABORTED = -3, + ERR_INVALID_ARGUMENT = -4, + ERR_INVALID_HANDLE = -5, + ERR_FILE_NOT_FOUND = -6, + ERR_TIMED_OUT = -7, + ERR_FILE_TOO_BIG = -8, + ERR_UNEXPECTED = -9, + ERR_ACCESS_DENIED = -10, + ERR_NOT_IMPLEMENTED = -11, + ERR_CONNECTION_CLOSED = -100, + ERR_CONNECTION_RESET = -101, + ERR_CONNECTION_REFUSED = -102, + ERR_CONNECTION_ABORTED = -103, + ERR_CONNECTION_FAILED = -104, + ERR_NAME_NOT_RESOLVED = -105, + ERR_INTERNET_DISCONNECTED = -106, + ERR_SSL_PROTOCOL_ERROR = -107, + ERR_ADDRESS_INVALID = -108, + ERR_ADDRESS_UNREACHABLE = -109, + ERR_SSL_CLIENT_AUTH_CERT_NEEDED = -110, + ERR_TUNNEL_CONNECTION_FAILED = -111, + ERR_NO_SSL_VERSIONS_ENABLED = -112, + ERR_SSL_VERSION_OR_CIPHER_MISMATCH = -113, + ERR_SSL_RENEGOTIATION_REQUESTED = -114, + ERR_CERT_COMMON_NAME_INVALID = -200, + ERR_CERT_DATE_INVALID = -201, + ERR_CERT_AUTHORITY_INVALID = -202, + ERR_CERT_CONTAINS_ERRORS = -203, + ERR_CERT_NO_REVOCATION_MECHANISM = -204, + ERR_CERT_UNABLE_TO_CHECK_REVOCATION = -205, + ERR_CERT_REVOKED = -206, + ERR_CERT_INVALID = -207, + ERR_CERT_END = -208, + ERR_INVALID_URL = -300, + ERR_DISALLOWED_URL_SCHEME = -301, + ERR_UNKNOWN_URL_SCHEME = -302, + ERR_TOO_MANY_REDIRECTS = -310, + ERR_UNSAFE_REDIRECT = -311, + ERR_UNSAFE_PORT = -312, + ERR_INVALID_RESPONSE = -320, + ERR_INVALID_CHUNKED_ENCODING = -321, + ERR_METHOD_NOT_SUPPORTED = -322, + ERR_UNEXPECTED_PROXY_AUTH = -323, + ERR_EMPTY_RESPONSE = -324, + ERR_RESPONSE_HEADERS_TOO_BIG = -325, + ERR_CACHE_MISS = -400, + ERR_INSECURE_RESPONSE = -501 }; // Structure representing menu information. typedef struct _cef_handler_menuinfo_t { - int typeFlags; - int x; - int y; + int typeFlags; + int x; + int y; const wchar_t* linkUrl; const wchar_t* imageUrl; const wchar_t* pageUrl; @@ -137,57 +137,61 @@ // The cef_handler_menuinfo_t typeFlags value will be a combination of the // following values. enum cef_handler_menutypebits_t -{ - // No node is selected - MENUTYPE_NONE = 0x0, - // The top page is selected - MENUTYPE_PAGE = 0x1, - // A subframe page is selected - MENUTYPE_FRAME = 0x2, - // A link is selected - MENUTYPE_LINK = 0x4, - // An image is selected - MENUTYPE_IMAGE = 0x8, - // There is a textual or mixed selection that is selected - MENUTYPE_SELECTION = 0x10, - // An editable element is selected - MENUTYPE_EDITABLE = 0x20, - // A misspelled word is selected - MENUTYPE_MISSPELLED_WORD = 0x40, +{ + // No node is selected + MENUTYPE_NONE = 0x0, + // The top page is selected + MENUTYPE_PAGE = 0x1, + // A subframe page is selected + MENUTYPE_FRAME = 0x2, + // A link is selected + MENUTYPE_LINK = 0x4, + // An image is selected + MENUTYPE_IMAGE = 0x8, + // There is a textual or mixed selection that is selected + MENUTYPE_SELECTION = 0x10, + // An editable element is selected + MENUTYPE_EDITABLE = 0x20, + // A misspelled word is selected + MENUTYPE_MISSPELLED_WORD = 0x40, + // A video node is selected + MENUTYPE_VIDEO = 0x80, + // A video node is selected + MENUTYPE_AUDIO = 0x100 }; // The cef_handler_menuinfo_t editFlags value will be a combination of the // following values. -enum cef_handler_menucapabilitybits_t -{ - MENU_CAN_DO_NONE = 0x0, - MENU_CAN_UNDO = 0x1, - MENU_CAN_REDO = 0x2, - MENU_CAN_CUT = 0x4, - MENU_CAN_COPY = 0x8, - MENU_CAN_PASTE = 0x10, - MENU_CAN_DELETE = 0x20, - MENU_CAN_SELECT_ALL = 0x40, - MENU_CAN_GO_FORWARD = 0x80, - MENU_CAN_GO_BACK = 0x100, +enum cef_handler_menucapabilitybits_t +{ + MENU_CAN_DO_NONE = 0x0, + MENU_CAN_UNDO = 0x1, + MENU_CAN_REDO = 0x2, + MENU_CAN_CUT = 0x4, + MENU_CAN_COPY = 0x8, + MENU_CAN_PASTE = 0x10, + MENU_CAN_DELETE = 0x20, + MENU_CAN_SELECT_ALL = 0x40, + MENU_CAN_GO_FORWARD = 0x80, + MENU_CAN_GO_BACK = 0x100 }; // Supported menu ID values. enum cef_handler_menuid_t { - MENU_ID_NAV_BACK = 10, - MENU_ID_NAV_FORWARD = 11, - MENU_ID_NAV_RELOAD = 12, - MENU_ID_NAV_STOP = 13, - MENU_ID_UNDO = 20, - MENU_ID_REDO = 21, - MENU_ID_CUT = 22, - MENU_ID_COPY = 23, - MENU_ID_PASTE = 24, - MENU_ID_DELETE = 25, - MENU_ID_SELECTALL = 26, - MENU_ID_PRINT = 30, - MENU_ID_VIEWSOURCE = 31, + MENU_ID_NAV_BACK = 10, + MENU_ID_NAV_FORWARD = 11, + MENU_ID_NAV_RELOAD = 12, + MENU_ID_NAV_STOP = 13, + MENU_ID_UNDO = 20, + MENU_ID_REDO = 21, + MENU_ID_CUT = 22, + MENU_ID_COPY = 23, + MENU_ID_PASTE = 24, + MENU_ID_DELETE = 25, + MENU_ID_SELECTALL = 26, + MENU_ID_PRINT = 30, + MENU_ID_VIEWSOURCE = 31 }; // Post data elements may represent either bytes or files. @@ -195,7 +199,7 @@ { PDE_TYPE_EMPTY = 0, PDE_TYPE_BYTES, - PDE_TYPE_FILE, + PDE_TYPE_FILE }; Modified: trunk/src/ThirdParty/cef/include/cef_types_win.h =================================================================== --- trunk/src/ThirdParty/cef/include/cef_types_win.h 2009-07-23 21:20:17 UTC (rev 220) +++ trunk/src/ThirdParty/cef/include/cef_types_win.h 2009-07-26 23:07:41 UTC (rev 221) @@ -1,31 +1,31 @@ -// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with... [truncated message content] |
From: <tu...@us...> - 2009-07-23 21:20:29
|
Revision: 220 http://mchef.svn.sourceforge.net/mchef/?rev=220&view=rev Author: tux316 Date: 2009-07-23 21:20:17 +0000 (Thu, 23 Jul 2009) Log Message: ----------- - Made ChefInsert an inline function. - Removed debug code in ChefBaseStruct.cpp, I am somewhat content with the results. - Cleaned up some more macros. Our ultimate goal is to eliminate them to the best of our ability (with the exception of the flags). - Optimized ChefSignals. ----- The rest of the changes where to implement the Genscripts Library with mChef and eliminate redundancy in our code. And in doing so we had to remove code that was already implemented in the library. Modified Paths: -------------- trunk/mChef.sln trunk/src/build/include.vsprops trunk/src/mChef/Chef.cpp trunk/src/mChef/Chef.h trunk/src/mChef/ChefBaseStruct.cpp trunk/src/mChef/ChefExtern.h trunk/src/mChef/ChefGlobal.cpp trunk/src/mChef/ChefMacros.h trunk/src/mChef/ChefMisc.cpp trunk/src/mChef/ChefSignals.cpp trunk/src/mChef/ChefSignals.h trunk/src/mChef/ChefString.cpp trunk/src/mChef/ChefStruct.h trunk/src/mChef/Main.cpp trunk/src/mChef/StdAfx.h Added Paths: ----------- trunk/src/Gen/ trunk/src/Gen/Console.hpp trunk/src/Gen/Error.hpp trunk/src/Gen/Gen.hpp trunk/src/Gen/Map.hpp trunk/src/Gen/Moo.hpp Modified: trunk/mChef.sln =================================================================== --- trunk/mChef.sln 2009-07-22 00:16:12 UTC (rev 219) +++ trunk/mChef.sln 2009-07-23 21:20:17 UTC (rev 220) @@ -16,7 +16,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Third Party", "Third Party", "{5B9F53DA-C7CE-4B8F-B25F-AE80FFBF10A3}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Chef", "Chef", "{99D5EB91-3875-4C07-8870-0814C70DDAEF}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{99D5EB91-3875-4C07-8870-0814C70DDAEF}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CEF", "CEF", "{A3246FF9-A597-4B7D-A6D9-14A5D6D72869}" ProjectSection(SolutionItems) = preProject @@ -28,8 +28,6 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lbmg", "src\ThirdParty\lbmg\lbmg.vcproj", "{74E8FD64-950C-425E-B4DF-82ED0BB57FFF}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Read Only", "Read Only", "{7038C0AF-BCFF-4070-953B-B1321ED15A71}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lpng", "lpng", "{44C3C3E9-05E3-4C88-8812-64B5681BBE9C}" ProjectSection(SolutionItems) = preProject src\ThirdParty\lpng\LICENSE = src\ThirdParty\lpng\LICENSE @@ -77,6 +75,17 @@ src\ThirdParty\cef\include\cef_win.h = src\ThirdParty\cef\include\cef_win.h EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DLL", "DLL", "{5895FB9D-8234-4E84-A704-3FB849561343}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Genscripts", "Genscripts", "{044D0C73-AB41-4652-B7FB-7EB2D5CBABE1}" + ProjectSection(SolutionItems) = preProject + src\Gen\Console.hpp = src\Gen\Console.hpp + src\Gen\Error.hpp = src\Gen\Error.hpp + src\Gen\Gen.hpp = src\Gen\Gen.hpp + src\Gen\Map.hpp = src\Gen\Map.hpp + src\Gen\Moo.hpp = src\Gen\Moo.hpp + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -104,15 +113,15 @@ GlobalSection(NestedProjects) = preSolution {524AFB38-383C-48C1-A302-90C14FE7886B} = {99D5EB91-3875-4C07-8870-0814C70DDAEF} {1BD3D7D9-A2D1-497C-A235-19696D162E66} = {99D5EB91-3875-4C07-8870-0814C70DDAEF} - {29AA2BB3-5DD2-46FE-B1B9-03CEB7E74144} = {99D5EB91-3875-4C07-8870-0814C70DDAEF} - {B3248254-1A95-4ED5-A5B4-B556BAC88287} = {5B9F53DA-C7CE-4B8F-B25F-AE80FFBF10A3} - {7038C0AF-BCFF-4070-953B-B1321ED15A71} = {5B9F53DA-C7CE-4B8F-B25F-AE80FFBF10A3} - {74E8FD64-950C-425E-B4DF-82ED0BB57FFF} = {B3248254-1A95-4ED5-A5B4-B556BAC88287} + {74E8FD64-950C-425E-B4DF-82ED0BB57FFF} = {5B9F53DA-C7CE-4B8F-B25F-AE80FFBF10A3} + {054DA7DE-6E9E-40DF-A2E9-8EA68E15426C} = {5B9F53DA-C7CE-4B8F-B25F-AE80FFBF10A3} + {A3246FF9-A597-4B7D-A6D9-14A5D6D72869} = {5B9F53DA-C7CE-4B8F-B25F-AE80FFBF10A3} + {44C3C3E9-05E3-4C88-8812-64B5681BBE9C} = {5B9F53DA-C7CE-4B8F-B25F-AE80FFBF10A3} + {044D0C73-AB41-4652-B7FB-7EB2D5CBABE1} = {B3248254-1A95-4ED5-A5B4-B556BAC88287} + {5B9F53DA-C7CE-4B8F-B25F-AE80FFBF10A3} = {B3248254-1A95-4ED5-A5B4-B556BAC88287} {B2001935-BDFE-4A45-9B3B-1C0596A8D249} = {A3246FF9-A597-4B7D-A6D9-14A5D6D72869} - {A3246FF9-A597-4B7D-A6D9-14A5D6D72869} = {7038C0AF-BCFF-4070-953B-B1321ED15A71} - {44C3C3E9-05E3-4C88-8812-64B5681BBE9C} = {7038C0AF-BCFF-4070-953B-B1321ED15A71} - {054DA7DE-6E9E-40DF-A2E9-8EA68E15426C} = {7038C0AF-BCFF-4070-953B-B1321ED15A71} {23A7F338-7A32-4EC0-B5FD-1AD5E59B4548} = {44C3C3E9-05E3-4C88-8812-64B5681BBE9C} {87184500-EA71-45E9-B2D7-4B6C0AD1563B} = {054DA7DE-6E9E-40DF-A2E9-8EA68E15426C} + {29AA2BB3-5DD2-46FE-B1B9-03CEB7E74144} = {5895FB9D-8234-4E84-A704-3FB849561343} EndGlobalSection EndGlobal Added: trunk/src/Gen/Console.hpp =================================================================== --- trunk/src/Gen/Console.hpp (rev 0) +++ trunk/src/Gen/Console.hpp 2009-07-23 21:20:17 UTC (rev 220) @@ -0,0 +1,124 @@ +/* Genscripts Library - Console.hpp + * Copyright (C) 2009 Genscripts + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +#ifndef __CONSOLE_HPP__ +# define __CONSOLE_HPP__ + +#pragma message("Genscripts Library: Compiling Console.hpp") + +#include <io.h> +#include <fcntl.h> + +namespace Gen { + /** + * CGenConsole. Class used to open an mIRC Console Window. + */ + class CGenConsole + { + private: + FILE *m_fdOut; /* Output Stream */ + FILE *m_fdIn; /* Input Stream */ + BOOL bCloseOnExit; /* Should we close the console on exit? */ + BOOL bConsole; /* Is the console open? */ + + /** + * Initialize. Initializes this class instance. + */ + void Initialize() + { + m_fdIn = m_fdOut = NULL; + bConsole = false; + } + + public: + + /** + * Constructor #1. Console does not close on exit. + */ + CGenConsole() + { + Initialize(); + bCloseOnExit = false; + } + + /** + * Constructor #2. User tells us if we should close the console on exit. + * + * @param bCloseConsole Set to true if the console should be closed on class deconstruction. + */ + CGenConsole(BOOL bCloseConsole) : bCloseOnExit(bCloseConsole) + { + Initialize(); + } + + /** + * Deconstructor. Class deconstructor. + */ + ~CGenConsole() + { + if (bConsole && bCloseOnExit) + FreeConsole(); + } + + /** + * OpenConsole. Used to open a console window. + * + * @return True If the console was open. + * @return False If the console could not be open. + */ + bool OpenConsole() + { + if (!(bConsole = AllocConsole())) + return false; + + HANDLE m_StdHandle = GetStdHandle(STD_OUTPUT_HANDLE); + int m_StreamHandle =_open_osfhandle((intptr_t)m_StdHandle, _O_TEXT); + m_fdOut =_fdopen(m_StreamHandle, "w"); + + m_StdHandle = GetStdHandle(STD_INPUT_HANDLE); + m_StreamHandle =_open_osfhandle((intptr_t)m_StdHandle, _O_TEXT); + m_fdIn =_fdopen(m_StreamHandle, "r"); + setvbuf(m_fdIn, NULL, _IONBF, 1); + setvbuf(m_fdOut, NULL, _IONBF, 1); + + *stdin = *m_fdIn; + *stdout = *m_fdOut; + + printf("Genscripts Library Console.\n\n"); + + return true; + } + + /** + * CloseConsole. Used to close a console window. + * + * @return True If the console was closed. + * @return False If we could not close the console. + */ + bool CloseConsole() + { + if ((bConsole = FreeConsole())) + return true; + } + }; +}; + + +#endif /* __CONSOLE_H__ */ + +/* EOF */ + Added: trunk/src/Gen/Error.hpp =================================================================== --- trunk/src/Gen/Error.hpp (rev 0) +++ trunk/src/Gen/Error.hpp 2009-07-23 21:20:17 UTC (rev 220) @@ -0,0 +1,44 @@ +/* Genscripts Library - Error.hpp + * Copyright (C) 2009 Genscripts + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +#ifndef __ERROR_HPP +# define __ERROR_HPP + +#pragma message("Genscripts Library: Compiling Error.hpp") + +#include <strsafe.h> + +namespace Gen { + /** + * Calls Calls GetLastError() and formats a message to return to the user. + * User is responsible for freeing up the memory returned by this function via LocalFree(); + * + * @param dwCode Contains error code passed by GetLastError(). So pass it only if you called GetLastError(). + */ + inline LPSTR GetLastErrorMessage(DWORD dwCode = NULL) + { + DWORD dwErrorCode = dwCode ? dwCode : GetLastError(); + LPVOID lpMessageBuffer = NULL; + + FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&lpMessageBuffer, 0, NULL); + + return (LPSTR)lpMessageBuffer; + } +} + +#endif /* __GENERROR_HPP */ \ No newline at end of file Added: trunk/src/Gen/Gen.hpp =================================================================== --- trunk/src/Gen/Gen.hpp (rev 0) +++ trunk/src/Gen/Gen.hpp 2009-07-23 21:20:17 UTC (rev 220) @@ -0,0 +1,46 @@ +/* Genscripts Library - Gen.h + * Copyright (C) 2009 Genscripts + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +#ifndef __GEN_H__ +# define __GEN_H__ + +#pragma message("Genscripts Library: Compiling Gen.hpp") +#pragma warning(disable : 4995) + +#include "Gen/Console.hpp" +#include "Gen/Map.hpp" +#include "Gen/Moo.hpp" +#include "Gen/Error.hpp" + +namespace Gen { + + /** + * LOADINFO. Structure used by mIRC when loading a DLL. + */ + typedef struct { + DWORD mVersion; + HWND mHwnd; + BOOL mKeep; + } LoadInfo; + +} + + +#endif /* __GEN_H__ */ + +/* EOF */ + Added: trunk/src/Gen/Map.hpp =================================================================== --- trunk/src/Gen/Map.hpp (rev 0) +++ trunk/src/Gen/Map.hpp 2009-07-23 21:20:17 UTC (rev 220) @@ -0,0 +1,188 @@ +/* Genscripts Library - Map.hpp + * Copyright (C) 2009 Genscripts + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +#ifndef __MAP_HPP__ +# define __MAP_HPP__ + +#pragma message("Genscripts Library: Compiling Map.hpp") + +#include <stdarg.h> + +namespace Gen { + /** + * CGenMap. Classed used for Mapping mIRC. + */ + class CGenMap + { + private: + HANDLE m_Map; /* Handle to mIRC's Map. */ + LPSTR m_Data; /* Handle to a file shared with mIRC's Map. */ + HWND m_MoohWnd; /* Handle to mIRC's Window Handle */ + + /** + * SendMooData. Sends mIRC a command or evaulation. + * + * @param bEvaluate. Should the command be valuated? + */ + inline int SendMooData(BOOL bEvaluate) + { + return SendMessage(m_MoohWnd, WM_USER + (bEvaluate ? 201 : 200), 1, 3); + } + + public: + + /** + * Class Constructor. + */ + CGenMap() + { + m_Data = NULL; + } + + /** + * Class Destructor. Closes all maps. + */ + ~CGenMap() + { + CloseMapView(); + CloseMap(); + } + + /** + * SetMooHandle. Sets the mIRC Window handle. + */ + void SetMooHandle(HWND m_hWnd) + { + m_MoohWnd = m_hWnd; + } + + /** + * OpenMap. Opens a map with mIRC using the specified map name. + * + * @param lpName Name of file mapping object. + * + * @return true If the map was created. + * @return false If we could not map. + */ + BOOL OpenMap(LPCWSTR lpName) + { + if ((m_Map = CreateFileMapping(INVALID_HANDLE_VALUE,0,PAGE_READWRITE,0,4096, lpName))) + return true; + + return false; + } + + /** + * CloseMap. Closes a map with mIRC. + * + * @return true If the map was closed. + * @return false If we could not close it. + */ + BOOL CloseMap() + { + if (m_Map && CloseHandle(m_Map)) + return true; + + return false; + } + + /** + * OpenMapView. Maps a view of the current file map with mIRC. + * + * @return m_Data Starting address of the mapped view. + */ + LPSTR OpenMapView() + { + m_Data = (LPSTR) MapViewOfFile(m_Map, + FILE_MAP_ALL_ACCESS, 0, 0, 0); + + return m_Data; + } + + /** + * CloseMapView. Closes a view of the current file map with mIRC. + * + * @return true If the view was unmapped. + * @return false If it was not. + */ + BOOL CloseMapView() + { + return UnmapViewOfFile(m_Data); + } + + /** + * Cmd. Sends mIRC a command. + */ + int Cmd(const char *fmt, ...) + { + int nSize = 0; + char sBuffer[1024]; + + memset(sBuffer, 0, sizeof(sBuffer)); + OpenMapView(); + + va_list vl; + + va_start(vl, fmt); + nSize = vsnprintf(sBuffer, sizeof(sBuffer) - 1, fmt, vl); + sprintf(m_Data, "%s", sBuffer); + int iReturn = SendMooData(false); + CloseMapView(); + + va_end(vl); + + return iReturn; + + } + /** + * Eval. Sends mIRC an "evaluation" command. + */ + int Eval(char *ReturnBuff, int BuffSize, const char *fmt, ...) + { + int nSize = 0; + char sBuffer[1024]; + + memset(sBuffer, 0, sizeof(sBuffer)); + OpenMapView(); + + va_list vl; + + va_start(vl, fmt); + nSize = vsnprintf(sBuffer, sizeof(sBuffer) - 1, fmt, vl); + sprintf(m_Data, "%s", sBuffer); + + ZeroMemory(ReturnBuff, BuffSize); + + int iReturn = 0; + + if ((iReturn = SendMooData(true)) == 1) + sprintf(ReturnBuff, "%s", m_Data); + else + *ReturnBuff = '\0'; + + CloseMapView(); + + va_end(vl); + + return iReturn; + } + }; +} +#endif /* __GENMAP_HPP__*/ + +/* EOF */ + Added: trunk/src/Gen/Moo.hpp =================================================================== --- trunk/src/Gen/Moo.hpp (rev 0) +++ trunk/src/Gen/Moo.hpp 2009-07-23 21:20:17 UTC (rev 220) @@ -0,0 +1,48 @@ +/* Genscripts Library - Moo.hpp + * Copyright (C) 2009 Genscripts + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +#ifndef __MOO_HPP__ +# define __MOO_HPP__ + +#pragma message("Genscripts Library: Compiling Moo.hpp") + +#include "Gen/Map.hpp" + +namespace Gen { + class CGenMoo : public CGenMap + { + private: + HWND m_MoohWnd; + LPWSTR m_MapName; + + public: + CGenMoo(HWND m_hWnd, LPWSTR m_Name) + : m_MoohWnd(m_hWnd), m_MapName(m_Name) + { + SetMooHandle(m_hWnd); + OpenMap(m_MapName); + } + ~CGenMoo() + { + } + }; +} + +#endif /* __GENMOO_HPP__ */ + +/* EOF */ + Modified: trunk/src/build/include.vsprops =================================================================== --- trunk/src/build/include.vsprops 2009-07-22 00:16:12 UTC (rev 219) +++ trunk/src/build/include.vsprops 2009-07-23 21:20:17 UTC (rev 220) @@ -7,7 +7,7 @@ > <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories=""$(SolutionDir)src\ThirdParty\cef\include";"$(SolutionDir)src\ThirdParty\lpng";"$(SolutionDir)src\ThirdParty\zlib";"$(SolutionDir)src\ThirdParty\lbmg"" + AdditionalIncludeDirectories=""$(SolutionDir)src\ThirdParty\cef\include";"$(SolutionDir)src\ThirdParty\lpng";"$(SolutionDir)src\ThirdParty\zlib";"$(SolutionDir)src\ThirdParty\lbmg";"$(SolutionDir)src"" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;_BMG_LIBPNG_STANDALONE" /> <Tool Modified: trunk/src/mChef/Chef.cpp =================================================================== --- trunk/src/mChef/Chef.cpp 2009-07-22 00:16:12 UTC (rev 219) +++ trunk/src/mChef/Chef.cpp 2009-07-23 21:20:17 UTC (rev 220) @@ -38,7 +38,7 @@ * * @param curChef Chef Pointer */ -void ChefInsert(lpChef curChef) +inline void ChefInsert(lpChef curChef) { CF_DB_START ChefWindows.push_back(curChef); @@ -475,7 +475,7 @@ if (cef_initialize(true, memCache ? NULL : cachePath)) { CF_DB(fwprintf(stderr, L"CefInitialize: Ok\n\nCache Directory: %s\n", memCache ? L"Memory" : cachePath)); - signal = new ChefSignals(mIRC_Window); + signal = new ChefSignals(mIRC_Window, L"mIRC3"); bCefInit = true; } else { Modified: trunk/src/mChef/Chef.h =================================================================== --- trunk/src/mChef/Chef.h 2009-07-22 00:16:12 UTC (rev 219) +++ trunk/src/mChef/Chef.h 2009-07-23 21:20:17 UTC (rev 220) @@ -27,19 +27,19 @@ /* Changing any of the macros below will only be waisting your time.*/ /* Number of times that the project has been built */ -#define VERSION_BUILD 894 +#define VERSION_BUILD 933 /* Current mChef Version */ -#define MCHEF_VERSION_STR "1.0.894" -#define MCHEF_VERSION_STRWC L"1.0.894" +#define MCHEF_VERSION_STR "1.0.933" +#define MCHEF_VERSION_STRWC L"1.0.933" -#define VERSION_FULL "1.0.894" -#define VERSION_WFULL L"1.0.894" +#define VERSION_FULL "1.0.933" +#define VERSION_WFULL L"1.0.933" -#define VERSION_FILE 1,0,0,894 -#define VERSION_PRODUCT 1,0,0,894 -#define VERSION_FSTR "1, 0, 0, 894" -#define VERSION_PSTR "1, 0, 0, 894" +#define VERSION_FILE 1,0,0,933 +#define VERSION_PRODUCT 1,0,0,933 +#define VERSION_FSTR "1, 0, 0, 933" +#define VERSION_PSTR "1, 0, 0, 933" #endif Modified: trunk/src/mChef/ChefBaseStruct.cpp =================================================================== --- trunk/src/mChef/ChefBaseStruct.cpp 2009-07-22 00:16:12 UTC (rev 219) +++ trunk/src/mChef/ChefBaseStruct.cpp 2009-07-23 21:20:17 UTC (rev 220) @@ -99,13 +99,9 @@ { lpBases base = BaseFind(t); - if (base) { - CF_DB(iBaseCount++;); - CF_DB(printf("[%s] Called %s. Reference count is at %u\n", - BaseIdentifyString(base), __FUNCTION__, base->iReferenceCount+1)); + if (base) return InterlockedIncrement(&base->iReferenceCount); - } - + return 1; // safety net but this is a nasty error to have occur } @@ -121,12 +117,9 @@ CF_DB_START lpBases base = BaseFind(t); - if (base) { + if (base) return base->iReferenceCount; - } - - CF_DB(printf("%s(Line %i): %s failed. No Base Structure Found\n", __FILE__, __LINE__, __FUNCTION__)); - + CF_DB_END return 1; // safety net but this is a nasty error to have occur } @@ -143,12 +136,9 @@ lpBases base = BaseFind(t); if (base) { - CF_DB(iBaseCount--;printf("iBaseCount is now at: %i\n", iBaseCount);); - CF_DB(printf("[%s] Called %s. Reference count is at %u\n", - BaseIdentifyString(base), __FUNCTION__, base->iReferenceCount-1)); - if (base->iReferenceCount-1 == 0) { - CF_DB(fprintf(stderr,"Auto-BasePoping, references == 0\n")); + CF_DB(printf("[%s] Auto-BasePoping, references == 0\n", + BaseIdentifyString(base))); BasePop(base->base); return 0; } @@ -269,7 +259,7 @@ } } - CF_DB(fprintf(stderr, "%s(Line %i): %s failed. Remove Base Structure Failed\n", __FILE__, __LINE__, __FUNCTION__)); + CF_DB(printf("%s(Line %i): %s failed. Remove Base Structure Failed\n", __FILE__, __LINE__, __FUNCTION__)); CF_DB_END return false; } Modified: trunk/src/mChef/ChefExtern.h =================================================================== --- trunk/src/mChef/ChefExtern.h 2009-07-22 00:16:12 UTC (rev 219) +++ trunk/src/mChef/ChefExtern.h 2009-07-23 21:20:17 UTC (rev 220) @@ -18,16 +18,14 @@ #ifndef __CHEFEXTERN_H_ # define __CHEFEXTERN_H_ -/* The following are external declarations. */ +/* The following are external scope declarations. */ +extern inline void ChefInsert(lpChef curChef); + extern HWND mIRC_Window; -extern std::vector<lpChef> ChefWindows; -extern std::vector<lpBases> vBases; - extern void BasePopThemAll(); extern void *ChefCalloc(size_t numOfElements, size_t Size); -extern void ChefInsert(lpChef curChef); extern void ChefDelete(lpChef curChef); extern void ChefPanic(); extern void ChefPop(lpChef curChef); @@ -35,8 +33,8 @@ extern void ChefSend(lpChef curChef, const char *curSignal, char *fmt, ...); extern void *ChefMalloc(size_t size); extern void ChefPrint(lpChef curChef, ImageType m_Type, bool bFullView); -extern void SmartCreateBrowser(HWND hwParent, char *name, char *alias, char *url, long flags, HWND hwResizeTarget); extern void CreateBrowser(HWND hwParent, char *name, char *alias, char *url = NULL, long flags = NULL, HWND hwResizeTarget = NULL); +extern void SmartCreateBrowser(HWND hwParent, char *name, char *alias, char *url, long flags, HWND hwResizeTarget); extern lpChef ChefCreate(const HWND m_hWnd, const char *m_WindowName, char *cCallbackAlias, HWND hwResizeTarget = NULL); extern lpChef ChefFind(const HWND m_hWnd); @@ -76,16 +74,6 @@ extern wchar_t *cachePath; extern wchar_t *wBuildPath(wchar_t *wPtr, const wchar_t *wDir); -#if defined(CHEF_DEBUG) -extern FILE *m_fdOut; -extern FILE *m_fdIn; -extern bool bConsole; - -extern void ChefOpenConsole(); -extern void ChefCloseConsole(); -extern void ChefGetLastError(); -#endif - extern unsigned int ChefCount; #endif Modified: trunk/src/mChef/ChefGlobal.cpp =================================================================== --- trunk/src/mChef/ChefGlobal.cpp 2009-07-22 00:16:12 UTC (rev 219) +++ trunk/src/mChef/ChefGlobal.cpp 2009-07-23 21:20:17 UTC (rev 220) @@ -51,24 +51,6 @@ */ ChefSignals *signal = NULL; -#if defined(CHEF_DEBUG) -/** - * m_fdOut. Output Stream. - */ -FILE *m_fdOut = NULL; - -/** - * m_fdIn. Input Stream. - */ -FILE *m_fdIn = NULL; - -/** - * bConsole. Is the Debug console open? - */ -bool bConsole = FALSE; - -#endif - /* EOF */ Modified: trunk/src/mChef/ChefMacros.h =================================================================== --- trunk/src/mChef/ChefMacros.h 2009-07-22 00:16:12 UTC (rev 219) +++ trunk/src/mChef/ChefMacros.h 2009-07-23 21:20:17 UTC (rev 220) @@ -30,14 +30,6 @@ * General Purpose Chef Macros. */ #define CHEF_MAXPARAMS 10 - -/** - * General Purpose mIRC Macros. - */ -#define WM_MCOMMAND WM_USER + 200 -#define WM_MEVALUATE WM_USER + 201 -#define MIRC_COMMAND SendMessage(mIRC_Window,WM_MCOMMAND,1,3) -#define MIRC_EVALUATE SendMessage(mIRC_Window,WM_MEVALUATE,0,3) /** * mIRC Signal's Defined @@ -62,16 +54,12 @@ * General Purpose Debugging Macros. */ #ifdef CHEF_DEBUG -# define CF_DB(x) do{\ - x;\ - } while(0); - -# define CF_DB_START \ - clock_t m_tStart = clock(); - -# define CF_DB_END \ - printf("%s:%s executed in %f\n", __FILE__, __FUNCTION__, \ - (double) (clock() - m_tStart)/CLOCKS_PER_SEC); +# define CF_DB(x) x +# define CF_DB_START \ + clock_t m_tStart = clock(); +# define CF_DB_END \ + printf("[Speed Demon] %s:%s executed in %f\n", __FILE__, __FUNCTION__, \ + (double) (clock() - m_tStart)/CLOCKS_PER_SEC); #else # define CF_DB(x) # define CF_DB_START @@ -83,9 +71,9 @@ * Use this to free pointers created via the "new" keyword. */ #define MyFree(x) \ - do { \ - if ((x)) \ - delete ((x));\ + do { \ + if ((x)) \ + delete ((x)); \ } while(0); /** @@ -93,8 +81,8 @@ * Use this to free pointers created via the "new []" keyword. */ #define MyFreeEx(x) \ - do { \ - if ((x)) \ + do { \ + if ((x)) \ delete [] ((x));\ } while(0); @@ -102,10 +90,10 @@ * Free * Use this to free pointers created via the "new []" keyword. */ -#define Free(x) \ - do { \ - if ((x)) \ - free((x));\ +#define Free(x) \ + do { \ + if ((x)) \ + free((x)); \ } while(0); /** Modified: trunk/src/mChef/ChefMisc.cpp =================================================================== --- trunk/src/mChef/ChefMisc.cpp 2009-07-22 00:16:12 UTC (rev 219) +++ trunk/src/mChef/ChefMisc.cpp 2009-07-23 21:20:17 UTC (rev 220) @@ -195,55 +195,5 @@ CF_DB_END } -#ifdef CHEF_DEBUG - -/** - * OpenConsole. Used to open a Console window. - */ -void ChefOpenConsole() -{ - if (!AllocConsole()) { - CF_DB(fprintf(stderr, "Error Opening Console: %d\n", GetLastError())); - return; - } - bConsole = true; - - HANDLE m_StdHandle = GetStdHandle(STD_OUTPUT_HANDLE); - int m_StreamHandle =_open_osfhandle((intptr_t)m_StdHandle, _O_TEXT); - m_fdOut =_fdopen(m_StreamHandle, "w"); - - m_StdHandle = GetStdHandle(STD_INPUT_HANDLE); - m_StreamHandle =_open_osfhandle((intptr_t)m_StdHandle, _O_TEXT); - m_fdIn =_fdopen(m_StreamHandle, "r"); - setvbuf(m_fdIn, NULL, _IONBF, 1); - setvbuf(m_fdOut, NULL, _IONBF, 1); - - /* Inject our pointers if everything above was done correctly :') */ - *stdin = *m_fdIn; - *stdout = *m_fdOut; - - printf("mChef mDebug mConsole.\n\n"); -} - -/** - * CloseConsole. Used to close a Console window. - */ -void ChefCloseConsole() -{ - if (m_fdOut) - fclose(m_fdOut); - - if (m_fdIn) - fclose(m_fdIn); - - if (!FreeConsole()) { - CF_DB(fprintf(stderr, "Error Closing Console: %d\n", GetLastError())); - } - else - bConsole = false; -} - -#endif - /* EOF */ Modified: trunk/src/mChef/ChefSignals.cpp =================================================================== --- trunk/src/mChef/ChefSignals.cpp 2009-07-22 00:16:12 UTC (rev 219) +++ trunk/src/mChef/ChefSignals.cpp 2009-07-23 21:20:17 UTC (rev 220) @@ -18,114 +18,42 @@ #include "StdAfx.h" #include "h.h" -/** - * ChefSignals. Constructor. - * - * @param mWnd Handle to the window. - */ -ChefSignals::ChefSignals(HWND mWnd) +ChefSignals::ChefSignals(HWND whWnd, LPWSTR wMapName) + : m_hWnd(whWnd), m_MapName(wMapName) { - _mWnd = mWnd; - _CHEFSSERT(_fHandle = CreateFileMapping(INVALID_HANDLE_VALUE,0,PAGE_READWRITE,0,0x4000,L"mIRC3")); + SetMooHandle(m_hWnd); + OpenMap(m_MapName); } -/** - * ~CefSignals. Destructor. - */ ChefSignals::~ChefSignals() { - CloseHandle(_fHandle); -} -/** - * OpenFileMapping. Opens a file map with mIRC. - */ -void ChefSignals::OpenFileMapping() -{ - _CHEFSSERT(_mData =(LPSTR)MapViewOfFile(_fHandle,FILE_MAP_ALL_ACCESS,0,0,0)); } -/** - * CloseFileMapping. Closes a a file map. - */ -void ChefSignals::CloseFileMapping() -{ - _CHEFSSERT(UnmapViewOfFile(_mData)); -} - -/** - * GetEvaluatedData. Returns the evaluated data. - * - * @return _mReturn - */ char *ChefSignals::GetEvaluatedData() { - return _mReturn; + return m_MsgBuffer; } -/** - * GetEvaluatedDataCopy. Returns the evaluated data. - * This function will allocate memory for a new pointer, - * copy the evaluated data to that pointer, and returns - * the new pointer. - * - * @return data - */ char *ChefSignals::GetEvaluatedDataCopy() { - char *data = new char[512]; - strncpy(data,_mReturn,512); + char *data = ChefStrDup(m_MsgBuffer); + return data; } -/** - * CustomNotify. The name says it all. - * - * @param chef Pointer to the Chef structure. - * @param signal The signal that we are sending. - * @param data The data that we are sending along with the signal. - * - * @return true If we succeeded. - * @return false If we failed. - */ bool ChefSignals::CustomNotify(const lpChef chef, const char *signal, const char *data = NULL) { - OpenFileMapping(); - - sprintf(_mData,"/%s %s %s %s", chef->callbackAlias, chef->m_WindowName, signal, data ? data : ""); - CF_DB(fprintf(stderr, "%s:%s\n", __FUNCTION__, _mData)); - - int iSuccess = MIRC_COMMAND; - CloseFileMapping(); - - if (iSuccess == 1) - return true; - - return false; + return Cmd("/%s %s %s %s", chef->callbackAlias, chef->m_WindowName, signal, data ? data : "") == 1 ? true : false; } -/** - * CustomEvaluate. The name says it all. - * - * @param chef Pointer to the Chef structure. - * @param signal Signal that we are sending. - * @param data Data that we are sending along. - * - * @return true If we succeeded. - * @return false If we failed. - */ bool ChefSignals::CustomEvaluate(const lpChef chef, const char *signal, const char *data = NULL) { - OpenFileMapping(); + if (Eval(m_MsgBuffer, MaxReturnBuff, "$%s(%s, %s, %s)", + chef->callbackAlias, chef->m_WindowName, signal, data ? data : "") != 1) + return false; - sprintf(_mData,"$%s(%s, %s, %s)", chef->callbackAlias, chef->m_WindowName, signal, data ? data : ""); - CF_DB(fprintf(stderr, "%s:%s\n", __FUNCTION__, _mData)); - - int iSuccess = MIRC_EVALUATE; - sprintf(_mReturn,_mData); - CloseFileMapping(); - - if (iSuccess == 1 && _mReturn[0] != 0) + if (m_MsgBuffer[0] != 0) return true; return false; @@ -142,20 +70,17 @@ */ bool ChefSignals::JSSignal(char *script, bool bEvaluate) { - OpenFileMapping(); - strcpy(_mData,script); - int iSuccess = bEvaluate ? MIRC_EVALUATE : MIRC_COMMAND; + bool bRet = true; + if (bEvaluate) { + if (Eval(m_MsgBuffer, MaxReturnBuff, "%s", script) != 1 || m_MsgBuffer[0] == '\0') + bRet = false; + } + else + bRet = Cmd("%s", script) == 1 ? true : false; - if (bEvaluate) - sprintf(_mReturn,_mData); - - CloseFileMapping(); - - if (iSuccess == 1) - return true; - - return false; + return bRet; } + /** * TitleBarChanged. Signal for when the title bar has changed. * @@ -168,7 +93,7 @@ bool ChefSignals::TitleBarChanged(const lpChef chef,const char *title) { CF_DB(fprintf(stderr, "%s:%s\n", __FUNCTION__, title)); - return CustomEvaluate(chef,SIGNAL_TITLECHANGED,title); + return CustomEvaluate(chef, SIGNAL_TITLECHANGED, title); } /** @@ -184,12 +109,12 @@ */ bool ChefSignals::NavigateBegin(const lpChef chef, const cef_handler_navtype_t navtype, const int isRedirect, const char *url) { - char *cNav = ChefNavTypeLookup(navtype); char cData[1024]; - sprintf(cData,"%s, %i, %s",cNav,isRedirect,url); + ZeroMemory(cData, 1024); + sprintf(cData, "%s, %i, %s", ChefNavTypeLookup(navtype),isRedirect, url); - return CustomEvaluate(chef,SIGNAL_NAVBEGIN,cData); + return CustomEvaluate(chef, SIGNAL_NAVBEGIN, cData); } /** * JSBind. Signal to notify JS is binding, if C_CANCEL is returned it will not bind the javascript object @@ -201,7 +126,7 @@ * @return false If CustomEvaluate failed. */ bool ChefSignals::JSBind(const lpChef chef, const char *url) { - return CustomEvaluate(chef,SIGNAL_JSBIND,url); + return CustomEvaluate(chef, SIGNAL_JSBIND, url); } /** @@ -218,6 +143,7 @@ { char cErrorString[512]; + ZeroMemory(cErrorString, 512); sprintf(cErrorString,"%i, %s, %s",(int)error,ChefErrorLookup(error),failedURL); return CustomEvaluate(chef,SIGNAL_LOADERROR,cErrorString); @@ -247,7 +173,7 @@ */ bool ChefSignals::LoadEnd(const lpChef chef) { - return CustomNotify(chef,SIGNAL_ENDLOAD); + return CustomNotify(chef, SIGNAL_ENDLOAD); } /** @@ -282,9 +208,10 @@ { char pBuf[1024]; - sprintf_s(pBuf, 1024, "%s %s %s", sFile, bSuccess ? "Done" : "Fail", - sPath); + ZeroMemory(pBuf, 1024); + sprintf_s(pBuf, 1024, "%s %s %s", sFile, bSuccess ? "Done" : "Fail", sPath); + return CustomNotify(curChef, SIGNAL_CHEFPRINTER, pBuf); } Modified: trunk/src/mChef/ChefSignals.h =================================================================== --- trunk/src/mChef/ChefSignals.h 2009-07-22 00:16:12 UTC (rev 219) +++ trunk/src/mChef/ChefSignals.h 2009-07-23 21:20:17 UTC (rev 220) @@ -18,31 +18,73 @@ #ifndef __CHEF_SIGNALS_H__ # define __CHEF_SIGNALS_H__ +#define MaxReturnBuff 512 + /** * ChefSignals. * Used to marshall data communication * B/T The dll and MIRC */ -class ChefSignals +class ChefSignals : public Gen::CGenMap { private: - HWND _mWnd; - HANDLE _fHandle; - char *_mData; - char _mReturn[512]; // used to store return information for user + HWND m_hWnd; // mIRC's handle. + LPWSTR m_MapName; // Map Name; + char m_MsgBuffer[MaxReturnBuff]; // Storage for user return information. - void OpenFileMapping(); - void CloseFileMapping(); + public: - ChefSignals(HWND mWnd); + /** + * ChefSignals. Constructor. + * + * @param mWnd Handle to the window. + */ + ChefSignals(HWND hWnd, LPWSTR wMapName); + + /** + * ~CefSignals. Destructor. + */ ~ChefSignals(); - // Support - char *GetEvaluatedData(); // returns a pto to the built in managed copy of the data, no deletion necessary, but it will change on the next evaluation - char *GetEvaluatedDataCopy(); // returns a ptr to a allocated char string of the evaluated data + /** + * GetEvaluatedData. Returns the evaluated data. + * + * @return _mReturn + */ + char *GetEvaluatedData(); - // Custom Stuff + /** + * GetEvaluatedDataCopy. Returns the evaluated data. + * This function will allocate memory for a new pointer, + * copy the evaluated data to that pointer, and returns + * the new pointer. + * + * @return data + */ + char *GetEvaluatedDataCopy(); + + /** + * CustomNotify. The name says it all. + * + * @param chef Pointer to the Chef structure. + * @param signal The signal that we are sending. + * @param data The data that we are sending along with the signal. + * + * @return true If we succeeded. + * @return false If we failed. + */ bool CustomNotify(const lpChef ,const char *,const char *); + + /** + * CustomEvaluate. The name says it all. + * + * @param chef Pointer to the Chef structure. + * @param signal Signal that we are sending. + * @param data Data that we are sending along. + * + * @return true If we succeeded. + * @return false If we failed. + */ bool CustomEvaluate(const lpChef ,const char *,const char *); // JS Functions Modified: trunk/src/mChef/ChefString.cpp =================================================================== --- trunk/src/mChef/ChefString.cpp 2009-07-22 00:16:12 UTC (rev 219) +++ trunk/src/mChef/ChefString.cpp 2009-07-23 21:20:17 UTC (rev 220) @@ -18,29 +18,6 @@ #include "StdAfx.h" #include "h.h" -#if defined(CHEF_DEBUG) -void ChefGetLastError() -{ - - CF_DB_START - DWORD lastError = GetLastError(); - - if (lastError == ERROR_INSUFFICIENT_BUFFER) - fprintf(stderr, "Caugh: ERROR_INSUFFICIENT_BUFFER\n"); - else if (lastError == ERROR_INVALID_FLAGS) - fprintf(stderr, "Caugh: ERROR_INVALID_FLAGS\n"); - else if (lastError == ERROR_INVALID_PARAMETER) - fprintf(stderr, "Caugh:ERROR_INVALID_PARAMETER\n"); - else if (lastError == ERROR_NO_UNICODE_TRANSLATION) - fprintf(stderr, "Caugh: ERROR_NO_UNICODE_TRANSLATION\n"); - else - fprintf(stderr, "Caugh: UNKNOWN_ERROR\n"); - - fflush(stderr); - CF_DB_END - -} -#endif /** * CEF_String. Constructor #1 */ @@ -143,12 +120,17 @@ * decode one. */ if (WideCharToMultiByte(CP_UTF8,0,(WCHAR*)this->_cstData, curLen+1,data,newLen+1, NULL,NULL) == 0) { - CF_DB(fprintf(stderr, "%s Error Converting \"%s\" to MultiByte," - "Error Code: \n", __FUNCTION__, this->_cstData)); - CF_DB(ChefGetLastError()); +#ifdef CHEF_DEBUG + DWORD dwError = GetLastError(); + LPSTR lpErrorMsg = Gen::GetLastErrorMessage(dwError); + + printf("Error Converting \"%s\" to MultiByte. Error Code: %d, Error Message: %s\n", + this->_cstData, lpErrorMsg); + LocalFree(lpErrorMsg); +#endif } } else { - CF_DB(fprintf(stderr, "%s: Unable to get the size needed for new string!\n")); + CF_DB(printf("Unable to get the size needed for new string!\n")); } Modified: trunk/src/mChef/ChefStruct.h =================================================================== --- trunk/src/mChef/ChefStruct.h 2009-07-22 00:16:12 UTC (rev 219) +++ trunk/src/mChef/ChefStruct.h 2009-07-23 21:20:17 UTC (rev 220) @@ -39,16 +39,6 @@ }; /** - * LOADINFO Structure. See mIRC's help file for more info. - */ -typedef struct -{ - DWORD mVersion; /* mIRC's Version */ - HWND mHwnd; /* mIRC's Handle */ - BOOL mKeep; /* Keep Loaded? */ -} LOADINFO; - -/** * Chef Structure. */ typedef struct chef_t Modified: trunk/src/mChef/Main.cpp =================================================================== --- trunk/src/mChef/Main.cpp 2009-07-22 00:16:12 UTC (rev 219) +++ trunk/src/mChef/Main.cpp 2009-07-23 21:20:17 UTC (rev 220) @@ -21,6 +21,10 @@ #include "h.h" #include "Chef.h" +using namespace Gen; + +CF_DB(CGenConsole *m_Console = NULL); + /** * Parse. Parses the data from mIRC. * @@ -70,11 +74,11 @@ * * @param pLoadInfo mIRC LOADINFO Structure. */ -void __stdcall LoadDll(LOADINFO *pLoadInfo) +void __stdcall LoadDll(Gen::LoadInfo *pLoadInfo) { CF_DB_START - CF_DB(ChefOpenConsole()); + CF_DB(m_Console = new CGenConsole(); m_Console->OpenConsole();); OleInitialize(NULL); CF_DB(freopen("stderr.txt", "wt", stderr)); @@ -142,8 +146,8 @@ CF_DB( fclose(stderr); - if (bConsole) - ChefCloseConsole(); + if (m_Console) + delete m_Console; ); Modified: trunk/src/mChef/StdAfx.h =================================================================== --- trunk/src/mChef/StdAfx.h 2009-07-22 00:16:12 UTC (rev 219) +++ trunk/src/mChef/StdAfx.h 2009-07-23 21:20:17 UTC (rev 220) @@ -20,7 +20,9 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <time.h> - #include <vector> +/* */ +#include "Gen/Gen.hpp" + /* EOF */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-07-22 00:16:14
|
Revision: 219 http://mchef.svn.sourceforge.net/mchef/?rev=219&view=rev Author: tux316 Date: 2009-07-22 00:16:12 +0000 (Wed, 22 Jul 2009) Log Message: ----------- - Renamed CHEF/LPCHEF to Chef/lpChef. - Renamed BASES/LPBASES to Bases/lpBases. - Changed the iteration method for ChefFindBrowser a little. We try and catch std::out_of_range now. If we catch it and we are running in Debug mode, we will trigger a debug break point. - Changed the Base popper method. It should be safe now regardless if elements are being added or popped at the same time. - Added a safety check in handle_jsbinding. Some times the frame->get_url call fails, so we check against that and fall back if it does. Modified Paths: -------------- trunk/src/mChef/Chef.cpp trunk/src/mChef/Chef.h trunk/src/mChef/ChefBaseStruct.cpp trunk/src/mChef/ChefExtern.h trunk/src/mChef/ChefHandler.cpp trunk/src/mChef/ChefMisc.cpp trunk/src/mChef/ChefPrinter.cpp trunk/src/mChef/ChefPrinter.h trunk/src/mChef/ChefSignals.cpp trunk/src/mChef/ChefSignals.h trunk/src/mChef/ChefStruct.h trunk/src/mChef/Main.cpp trunk/src/mChef/SubClass.cpp trunk/src/mChef/V8Splash.cpp Modified: trunk/src/mChef/Chef.cpp =================================================================== --- trunk/src/mChef/Chef.cpp 2009-07-21 21:55:38 UTC (rev 218) +++ trunk/src/mChef/Chef.cpp 2009-07-22 00:16:12 UTC (rev 219) @@ -22,10 +22,10 @@ /** * ChefWindows. Vector. - * When we attach to a window, we will create an LPCHEF pointer + * When we attach to a window, we will create an lpChef pointer * and store them within this vector. */ -static vector<LPCHEF> ChefWindows; +static vector<lpChef> ChefWindows; /** * ChefCount. Integer variable used to keep an accurate count of how many @@ -38,7 +38,7 @@ * * @param curChef Chef Pointer */ -void ChefInsert(LPCHEF curChef) +void ChefInsert(lpChef curChef) { CF_DB_START ChefWindows.push_back(curChef); @@ -50,21 +50,27 @@ * * @param m_browser_hWnd Browser's handle * - * @return LPCHEF Chef Pointer + * @return lpChef Chef Pointer * @return NULL If nothing was found */ -LPCHEF ChefFindBrowser(const HWND m_BrowserHwnd) +lpChef ChefFindBrowser(const HWND m_BrowserHwnd) { CF_DB_START if (!m_BrowserHwnd) return NULL; - for (vector<LPCHEF>::iterator it = ChefWindows.begin(); it != ChefWindows.end(); it++) { - if ((*it)->m_BrowserHwnd == m_BrowserHwnd) { - CF_DB_END - return (*it); + try { + for (vector<lpChef>::iterator it = ChefWindows.begin(); it != ChefWindows.end(); it++) { + if ((*it)->m_BrowserHwnd == m_BrowserHwnd) { + CF_DB_END + return (*it); + } } } + catch (std::out_of_range) { + printf ("VECTOR OUT OF RANGE!!!!!!!!!!!!!!!!!!\n"); + CF_DB(__debugbreak()); + } CF_DB_END return NULL; @@ -75,15 +81,15 @@ * * @param m_hWnd Window Handle. * - * @return LPCHEF Chef Pointer + * @return lpChef Chef Pointer * @return NULL Nothing was found */ -LPCHEF ChefFind(const HWND m_hWnd) +lpChef ChefFind(const HWND m_hWnd) { if (!m_hWnd) return NULL; - for (vector<LPCHEF>::iterator it = ChefWindows.begin(); it != ChefWindows.end(); it++) { + for (vector<lpChef>::iterator it = ChefWindows.begin(); it != ChefWindows.end(); it++) { if ((*it)->m_hWnd == m_hWnd) { return (*it); } @@ -97,16 +103,16 @@ * * @param m_WindowName Window Name * - * @return LPCHEF Chef Pointer + * @return lpChef Chef Pointer * @return NULL Nothing was found */ -LPCHEF ChefFind(const char *m_WindowName) +lpChef ChefFind(const char *m_WindowName) { if (!*m_WindowName) { return NULL; } - for (vector<LPCHEF>::iterator it = ChefWindows.begin(); it != ChefWindows.end(); it++) { + for (vector<lpChef>::iterator it = ChefWindows.begin(); it != ChefWindows.end(); it++) { if (_stricmp((*it)->m_WindowName, m_WindowName) == 0) { return (*it); } @@ -119,14 +125,14 @@ * * @param iCount Count * - * @return LPCHEF Chef Pointer + * @return lpChef Chef Pointer * @return NULL Nothing was found */ -LPCHEF ChefFindCount(const int iCount) +lpChef ChefFindCount(const int iCount) { int c = 0; - for (vector<LPCHEF>::iterator it = ChefWindows.begin(); it != ChefWindows.end(); it++) { + for (vector<lpChef>::iterator it = ChefWindows.begin(); it != ChefWindows.end(); it++) { if (c++ == (iCount-1)) return (*it); } @@ -139,14 +145,14 @@ * * @param m_hWnd Resize Target Window Handle. * -* @return LPCHEF Chef Pointer +* @return lpChef Chef Pointer * @return NULL Nothing was found or m_hWnd was NULL */ -LPCHEF ChefFindByResize(const HWND m_hWnd) +lpChef ChefFindByResize(const HWND m_hWnd) { CF_DB_START if (m_hWnd) { - for (vector<LPCHEF>::iterator it = ChefWindows.begin(); it != ChefWindows.end(); it++) { + for (vector<lpChef>::iterator it = ChefWindows.begin(); it != ChefWindows.end(); it++) { if ((*it)->m_ResizeTarget == m_hWnd) { CF_DB_END return (*it); @@ -162,12 +168,12 @@ * * @param ptr Pointer to the string that contains the handle or window name. * - * @return LPCHEF + * @return lpChef */ -LPCHEF ChefFindEx(char *ptr) +lpChef ChefFindEx(char *ptr) { CF_DB_START - LPCHEF curChef = NULL; + lpChef curChef = NULL; if (IsAllNum(ptr)) curChef = ChefFind((HWND)atol(ptr)); @@ -183,7 +189,7 @@ * * @param curChef Pointer of Chef to be deleted. */ -void ChefDelete(LPCHEF curChef) +void ChefDelete(lpChef curChef) { CF_DB_START @@ -214,6 +220,7 @@ Free(curChef); ChefCount--; + printf("ChefCount: %i\n", ChefCount); CF_DB_END } @@ -223,13 +230,12 @@ * * @param curChef Pointer to the chef to be deleted. */ -void ChefPop(LPCHEF curChef) +void ChefPop(lpChef curChef) { CF_DB_START - for (vector<LPCHEF>::iterator it = ChefWindows.begin(); it != ChefWindows.end(); it++ ) + for (vector<lpChef>::iterator it = ChefWindows.begin(); it != ChefWindows.end(); it++ ) { - if ((*it)->m_hWnd == curChef->m_hWnd) - { + if ((*it)->m_hWnd == curChef->m_hWnd) { ChefWindows.erase(it); ChefDelete(curChef); CF_DB_END @@ -247,10 +253,9 @@ void ChefPopThemAll() { CF_DB_START - LPCHEF curChef = NULL; + lpChef curChef = NULL; - while (!ChefWindows.empty()) - { + while (!ChefWindows.empty()) { curChef = ChefWindows.front(); ChefWindows.erase(ChefWindows.begin()); ChefDelete(curChef); @@ -266,14 +271,14 @@ * @param m_WindowName Window Name * @param cCallbackAlias Alias to call back to from handler * @param hwResizeTarget HWND to resize the browser too, this allows us to either default to the entire parent window, or use a target - * @return LPCHEF Pointer to the new Chef + * @return lpChef Pointer to the new Chef */ -LPCHEF ChefCreate(const HWND m_hWnd, const char *m_WindowName, char *cCallbackAlias, HWND hwResizeTarget) +lpChef ChefCreate(const HWND m_hWnd, const char *m_WindowName, char *cCallbackAlias, HWND hwResizeTarget) { CF_DB_START - LPCHEF curChef = (LPCHEF)ChefMalloc(sizeof(CHEF)); - memset(curChef,0,sizeof(CHEF)); + lpChef curChef = (lpChef)ChefMalloc(sizeof(Chef)); + memset(curChef,0,sizeof(Chef)); curChef->mBrowser = NULL; curChef->flags = NULL; Modified: trunk/src/mChef/Chef.h =================================================================== --- trunk/src/mChef/Chef.h 2009-07-21 21:55:38 UTC (rev 218) +++ trunk/src/mChef/Chef.h 2009-07-22 00:16:12 UTC (rev 219) @@ -27,19 +27,19 @@ /* Changing any of the macros below will only be waisting your time.*/ /* Number of times that the project has been built */ -#define VERSION_BUILD 862 +#define VERSION_BUILD 894 /* Current mChef Version */ -#define MCHEF_VERSION_STR "1.0.862" -#define MCHEF_VERSION_STRWC L"1.0.862" +#define MCHEF_VERSION_STR "1.0.894" +#define MCHEF_VERSION_STRWC L"1.0.894" -#define VERSION_FULL "1.0.862" -#define VERSION_WFULL L"1.0.862" +#define VERSION_FULL "1.0.894" +#define VERSION_WFULL L"1.0.894" -#define VERSION_FILE 1,0,0,862 -#define VERSION_PRODUCT 1,0,0,862 -#define VERSION_FSTR "1, 0, 0, 862" -#define VERSION_PSTR "1, 0, 0, 862" +#define VERSION_FILE 1,0,0,894 +#define VERSION_PRODUCT 1,0,0,894 +#define VERSION_FSTR "1, 0, 0, 894" +#define VERSION_PSTR "1, 0, 0, 894" #endif Modified: trunk/src/mChef/ChefBaseStruct.cpp =================================================================== --- trunk/src/mChef/ChefBaseStruct.cpp 2009-07-21 21:55:38 UTC (rev 218) +++ trunk/src/mChef/ChefBaseStruct.cpp 2009-07-22 00:16:12 UTC (rev 219) @@ -23,8 +23,8 @@ static int iBaseCount = 0; #endif -/* Vector for our LPBASES */ -static std::vector<LPBASES> vBases; +/* Vector for our lpBases */ +static std::vector<lpBases> vBases; /** * Since we are going to be checking the size of the bases quite a bit, @@ -42,9 +42,12 @@ * * @param lpbase Base that we want to identify. */ -BaseType BaseIdentify(LPBASES lpbase) +BaseType BaseIdentify(lpBases lpbase) { - if (lpbase->base->size == SizeOfCefBase) + + if (!lpbase || !lpbase->base) + return BaseUnknown; + else if (lpbase->base->size == SizeOfCefBase) return BaseCef; else if (lpbase->base->size == SizeOfCefBrowser) return BaseCefBrowser; @@ -66,9 +69,11 @@ * * @return String */ -const char *BaseIdentifyString(LPBASES lpbase) +const char *BaseIdentifyString(lpBases lpbase) { - if (lpbase->base->size == SizeOfCefBase) + if (!lpbase || !lpbase->base) + return "UnknownItsOverNineThousand"; + else if (lpbase->base->size == SizeOfCefBase) return "BaseCef"; else if (lpbase->base->size == SizeOfCefBrowser) return "BaseCefBrowser"; @@ -92,13 +97,12 @@ */ int CEF_CALLBACK add_ref(struct _cef_base_t *t) { - LPBASES base = BaseFind(t); + lpBases base = BaseFind(t); if (base) { - CF_DB( - iBaseCount++; - printf("[Bases] add_ref called for %s, incrementing to %d\n", - BaseIdentifyString(base), base->iReferenceCount + 1)); + CF_DB(iBaseCount++;); + CF_DB(printf("[%s] Called %s. Reference count is at %u\n", + BaseIdentifyString(base), __FUNCTION__, base->iReferenceCount+1)); return InterlockedIncrement(&base->iReferenceCount); } @@ -115,11 +119,9 @@ int CEF_CALLBACK get_refct(struct _cef_base_t *t) { CF_DB_START - LPBASES base = BaseFind(t); + lpBases base = BaseFind(t); if (base) { - CF_DB(printf("[Bases] get_refct called for %s, count is at to %d\n", - BaseIdentifyString(base), base->iReferenceCount)); return base->iReferenceCount; } @@ -138,14 +140,12 @@ */ int CEF_CALLBACK release(struct _cef_base_t *t) { - LPBASES base = BaseFind(t); + lpBases base = BaseFind(t); if (base) { - CF_DB(printf("[Bases] release called for %s, decrementing to %d\n", - BaseIdentifyString(base), base->iReferenceCount - 1); - iBaseCount--; - printf("iBaseCount is now at: %i\n", iBaseCount); - ); + CF_DB(iBaseCount--;printf("iBaseCount is now at: %i\n", iBaseCount);); + CF_DB(printf("[%s] Called %s. Reference count is at %u\n", + BaseIdentifyString(base), __FUNCTION__, base->iReferenceCount-1)); if (base->iReferenceCount-1 == 0) { CF_DB(fprintf(stderr,"Auto-BasePoping, references == 0\n")); @@ -172,7 +172,7 @@ base->release = release; base->size = 0; - LPBASES lpBase = (LPBASES)ChefMalloc(sizeof(BASES)); + lpBases lpBase = (lpBases)ChefMalloc(sizeof(Bases)); lpBase->base = base; lpBase->iReferenceCount = 0; @@ -186,7 +186,7 @@ * * @param base the base to delete */ -void BaseFree(LPBASES lpbase) +void BaseFree(lpBases lpbase) { BaseType curBaseType = BaseIdentify(lpbase); @@ -221,11 +221,11 @@ * * @param base base pointer * - * @return reference to a LPBASES Struct containing your base + * @return reference to a lpBases Struct containing your base */ -LPBASES BaseFind(cef_base_t *base) +lpBases BaseFind(cef_base_t *base) { - for (std::vector<LPBASES>::iterator it = vBases.begin(); it != vBases.end(); it++ ) + for (std::vector<lpBases>::iterator it = vBases.begin(); it != vBases.end(); it++ ) if ((*it)->base == base) return (*it); @@ -238,11 +238,14 @@ void BasePopThemAll() { CF_DB_START + lpBases curBase = NULL; - for (std::vector<LPBASES>::iterator it = vBases.begin(); it != vBases.end(); it++ ) - BaseFree(*it); + while (!vBases.empty()) { + curBase = vBases.front(); + BaseFree(curBase); + } - vBases.erase(vBases.begin(),vBases.end()); // were not responsible for our memory of the bases so all we have to do is free each struct and erase away + vBases.clear(); // were not responsible for our memory of the bases so all we have to do is free each struct and erase away CF_DB_END } @@ -258,7 +261,7 @@ { CF_DB_START - for (std::vector<LPBASES>::iterator it = vBases.begin(); it != vBases.end(); it++ ) { + for (std::vector<lpBases>::iterator it = vBases.begin(); it != vBases.end(); it++ ) { if ((*it)->base == base) { BaseFree(*it); vBases.erase(it); Modified: trunk/src/mChef/ChefExtern.h =================================================================== --- trunk/src/mChef/ChefExtern.h 2009-07-21 21:55:38 UTC (rev 218) +++ trunk/src/mChef/ChefExtern.h 2009-07-22 00:16:12 UTC (rev 219) @@ -22,36 +22,36 @@ extern HWND mIRC_Window; -extern std::vector<LPCHEF> ChefWindows; -extern std::vector<LPBASES> vBases; +extern std::vector<lpChef> ChefWindows; +extern std::vector<lpBases> vBases; extern void BasePopThemAll(); extern void *ChefCalloc(size_t numOfElements, size_t Size); -extern void ChefInsert(LPCHEF curChef); -extern void ChefDelete(LPCHEF curChef); +extern void ChefInsert(lpChef curChef); +extern void ChefDelete(lpChef curChef); extern void ChefPanic(); -extern void ChefPop(LPCHEF curChef); +extern void ChefPop(lpChef curChef); extern void ChefPopThemAll(); -extern void ChefSend(LPCHEF curChef, const char *curSignal, char *fmt, ...); +extern void ChefSend(lpChef curChef, const char *curSignal, char *fmt, ...); extern void *ChefMalloc(size_t size); -extern void ChefPrint(LPCHEF curChef, ImageType m_Type, bool bFullView); +extern void ChefPrint(lpChef curChef, ImageType m_Type, bool bFullView); extern void SmartCreateBrowser(HWND hwParent, char *name, char *alias, char *url, long flags, HWND hwResizeTarget); extern void CreateBrowser(HWND hwParent, char *name, char *alias, char *url = NULL, long flags = NULL, HWND hwResizeTarget = NULL); -extern LPCHEF ChefCreate(const HWND m_hWnd, const char *m_WindowName, char *cCallbackAlias, HWND hwResizeTarget = NULL); -extern LPCHEF ChefFind(const HWND m_hWnd); -extern LPCHEF ChefFind(const char *m_WindowName); -extern LPCHEF ChefFindEx(char *ptr); -extern LPCHEF ChefFindBrowser(const HWND m_BrowserHwnd); -extern LPCHEF ChefFindCount(const int iCount); -extern LPCHEF ChefFindByResize(const HWND m_hWnd); +extern lpChef ChefCreate(const HWND m_hWnd, const char *m_WindowName, char *cCallbackAlias, HWND hwResizeTarget = NULL); +extern lpChef ChefFind(const HWND m_hWnd); +extern lpChef ChefFind(const char *m_WindowName); +extern lpChef ChefFindEx(char *ptr); +extern lpChef ChefFindBrowser(const HWND m_BrowserHwnd); +extern lpChef ChefFindCount(const int iCount); +extern lpChef ChefFindByResize(const HWND m_hWnd); extern char *ChefErrorLookup(cef_handler_errorcode_t error); extern char *ChefNavTypeLookup(cef_handler_navtype_t nav); extern char *ChefStrDup(const char *_string); extern char *BuildPath(char *Ptr, const char *Dir); -extern LPBASES BaseFind(cef_base_t *); +extern lpBases BaseFind(cef_base_t *); extern ChefSignals *signal; @@ -71,7 +71,7 @@ extern LRESULT CALLBACK SubWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); extern LRESULT CALLBACK ResizeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); -extern cef_v8value_t *InitializeMIRCJSLink(LPCHEF); +extern cef_v8value_t *InitializeMIRCJSLink(lpChef); extern wchar_t *cachePath; extern wchar_t *wBuildPath(wchar_t *wPtr, const wchar_t *wDir); Modified: trunk/src/mChef/ChefHandler.cpp =================================================================== --- trunk/src/mChef/ChefHandler.cpp 2009-07-21 21:55:38 UTC (rev 218) +++ trunk/src/mChef/ChefHandler.cpp 2009-07-22 00:16:12 UTC (rev 219) @@ -60,7 +60,7 @@ if (m_BrowserHwnd) { if ((m_hWnd = GetParent(m_BrowserHwnd))) { - LPCHEF curChef = ChefFind(m_hWnd); + lpChef curChef = ChefFind(m_hWnd); if (curChef) { CF_DB(printf("Browser: %d, Parent: %d\n", m_BrowserHwnd, m_hWnd)); curChef->m_BrowserHwnd = m_BrowserHwnd; @@ -100,7 +100,7 @@ { CF_DB_START - LPCHEF curChef = ChefFindBrowser(browser->get_window_handle(browser)); + lpChef curChef = ChefFindBrowser(browser->get_window_handle(browser)); if (curChef) signal->AddressBarChanged(curChef,CEF_String(url).ToMultiByte()); @@ -131,7 +131,7 @@ { CF_DB_START - LPCHEF curChef = ChefFindBrowser(browser->get_window_handle(browser)); + lpChef curChef = ChefFindBrowser(browser->get_window_handle(browser)); if (curChef && signal->TitleBarChanged(curChef,CEF_String(title).ToMultiByte())) SetWindowTextA(curChef->m_hWnd,signal->GetEvaluatedData()); // ease of use force ansi string one so we dont have to convert back to multi char @@ -166,7 +166,7 @@ { CF_DB_START - LPCHEF curChef = ChefFindBrowser(browser->get_window_handle(browser)); + lpChef curChef = ChefFindBrowser(browser->get_window_handle(browser)); if (curChef) { bool bSuccess = signal->NavigateBegin(curChef, navType,isRedirect,CEF_String(request->get_url(request)).ToMultiByte()); @@ -207,7 +207,7 @@ { CF_DB_START - LPCHEF curChef = ChefFindBrowser(browser->get_window_handle(browser)); + lpChef curChef = ChefFindBrowser(browser->get_window_handle(browser)); if (curChef) { if (frame) { @@ -242,7 +242,7 @@ { CF_DB_START - LPCHEF curChef = ChefFindBrowser(browser->get_window_handle(browser)); + lpChef curChef = ChefFindBrowser(browser->get_window_handle(browser)); if (curChef) { if (frame) { @@ -282,7 +282,7 @@ { CF_DB_START - LPCHEF curChef = ChefFindBrowser(browser->get_window_handle(browser)); + lpChef curChef = ChefFindBrowser(browser->get_window_handle(browser)); if (curChef && signal->LoadError(curChef,errorCode,CEF_String(failedUrl).ToMultiByte())) { cef_string_t eText = CEF_String(signal->GetEvaluatedData()).ToCefString(); errorText = &eText; @@ -518,7 +518,7 @@ CF_DB_START HWND m_hWnd = browser->get_window_handle(browser); - LPCHEF curChef = ChefFindBrowser(browser->get_window_handle(browser)); + lpChef curChef = ChefFindBrowser(browser->get_window_handle(browser)); /* The following is a small little hack. It appears that the Window is not * completely destroyed by CEF, and if we attempt to destroy it ourselfs, @@ -575,7 +575,7 @@ { CF_DB_START - LPCHEF curChef = ChefFindBrowser(browser->get_window_handle(browser)); + lpChef curChef = ChefFindBrowser(browser->get_window_handle(browser)); BaseRelease(browser); if (curChef) { @@ -610,11 +610,14 @@ { CF_DB_START - LPCHEF curChef = ChefFindBrowser(browser->get_window_handle(browser)); + lpChef curChef = ChefFindBrowser(browser->get_window_handle(browser)); - if (curChef) // basically if they dont return C_CANCEL and they do handle the JSBind event - if (signal->JSBind(curChef,CEF_String(frame->get_url(frame)).ToMultiByte()) && _strcmpi(signal->GetEvaluatedData(),"C_CANCEL")) + if (curChef) { + // basically if they dont return C_CANCEL and they do handle the JSBind event + if (frame->get_url(frame) && signal->JSBind(curChef,CEF_String(frame->get_url(frame)).ToMultiByte()) && + _strcmpi(signal->GetEvaluatedData(),"C_CANCEL")) object->set_value_bykey(object,L"mCHEF",InitializeMIRCJSLink(curChef)); + } else{ CF_DB(fprintf(stderr, "\t%s called on non-mChef window. Handle: %d, Popup: %i.\n", __FUNCTION__, browser->get_window_handle(browser), browser->is_popup(browser))); Modified: trunk/src/mChef/ChefMisc.cpp =================================================================== --- trunk/src/mChef/ChefMisc.cpp 2009-07-21 21:55:38 UTC (rev 218) +++ trunk/src/mChef/ChefMisc.cpp 2009-07-22 00:16:12 UTC (rev 219) @@ -155,7 +155,7 @@ CF_DB_START _CHEFSSERT(flags); - LPCHEF curChef = ChefCreate(hwParent, name, alias , hwResizeTarget); + lpChef curChef = ChefCreate(hwParent, name, alias , hwResizeTarget); curChef->flags = flags; // moved up top because I needed it if (IsListBox(curChef) || IsDialog(curChef)) // this will copy the resize targets left and top (for example in case its a listbox) Modified: trunk/src/mChef/ChefPrinter.cpp =================================================================== --- trunk/src/mChef/ChefPrinter.cpp 2009-07-21 21:55:38 UTC (rev 218) +++ trunk/src/mChef/ChefPrinter.cpp 2009-07-22 00:16:12 UTC (rev 219) @@ -22,7 +22,7 @@ #include "BMGLibPNG.h" #include "ChefPrinter.h" -ChefPrinter::ChefPrinter(LPCHEF curChef, ImageType iType, bool bView) +ChefPrinter::ChefPrinter(lpChef curChef, ImageType iType, bool bView) : m_curChef(curChef), m_ImageOutputFormat(iType), bFullView(bView) { CF_DB_START @@ -246,7 +246,7 @@ /** * ChefPrint. Threads ChefPrintThread. */ -void ChefPrint(LPCHEF curChef, ImageType m_Type, bool bFullView) +void ChefPrint(lpChef curChef, ImageType m_Type, bool bFullView) { LPPrinterThread curPrint = (LPPrinterThread)ChefMalloc(sizeof(PrinterThread)); Modified: trunk/src/mChef/ChefPrinter.h =================================================================== --- trunk/src/mChef/ChefPrinter.h 2009-07-21 21:55:38 UTC (rev 218) +++ trunk/src/mChef/ChefPrinter.h 2009-07-22 00:16:12 UTC (rev 219) @@ -29,7 +29,7 @@ char *m_SavePath; /* Path that we should save the image to */ char m_ImageName[MAX_PATH]; /* The name of the image. */ char m_FullImagePath[MAX_PATH]; /* Full path to the image (filename included) */ - LPCHEF m_curChef; /* We will only keep this as a reference. */ + lpChef m_curChef; /* We will only keep this as a reference. */ HDC m_ChefDC; /* Device Context */ HBITMAP hBitmap; /* Bitmap */ BITMAPINFO b_Info; /* Bitmap Info */ @@ -44,7 +44,7 @@ * @param curChef Chef window that we are going to print. * @param ImageType What type of format should we print to? */ - ChefPrinter(LPCHEF curChef, ImageType iType, bool bView); + ChefPrinter(lpChef curChef, ImageType iType, bool bView); /** * ~ChefPrinter Deconstructor. Modified: trunk/src/mChef/ChefSignals.cpp =================================================================== --- trunk/src/mChef/ChefSignals.cpp 2009-07-21 21:55:38 UTC (rev 218) +++ trunk/src/mChef/ChefSignals.cpp 2009-07-22 00:16:12 UTC (rev 219) @@ -88,7 +88,7 @@ * @return true If we succeeded. * @return false If we failed. */ -bool ChefSignals::CustomNotify(const LPCHEF chef, const char *signal, const char *data = NULL) +bool ChefSignals::CustomNotify(const lpChef chef, const char *signal, const char *data = NULL) { OpenFileMapping(); @@ -114,7 +114,7 @@ * @return true If we succeeded. * @return false If we failed. */ -bool ChefSignals::CustomEvaluate(const LPCHEF chef, const char *signal, const char *data = NULL) +bool ChefSignals::CustomEvaluate(const lpChef chef, const char *signal, const char *data = NULL) { OpenFileMapping(); @@ -165,7 +165,7 @@ * @return true If CustomEvaluate succeeded. * @return false If CustomEvaluate failed. */ -bool ChefSignals::TitleBarChanged(const LPCHEF chef,const char *title) +bool ChefSignals::TitleBarChanged(const lpChef chef,const char *title) { CF_DB(fprintf(stderr, "%s:%s\n", __FUNCTION__, title)); return CustomEvaluate(chef,SIGNAL_TITLECHANGED,title); @@ -182,7 +182,7 @@ * @return true If CustomEvaluate succeeded. * @return false If CustomEvaluate failed. */ -bool ChefSignals::NavigateBegin(const LPCHEF chef, const cef_handler_navtype_t navtype, const int isRedirect, const char *url) +bool ChefSignals::NavigateBegin(const lpChef chef, const cef_handler_navtype_t navtype, const int isRedirect, const char *url) { char *cNav = ChefNavTypeLookup(navtype); char cData[1024]; @@ -200,7 +200,7 @@ * @return true If CustomEvaluate succeeded. * @return false If CustomEvaluate failed. */ -bool ChefSignals::JSBind(const LPCHEF chef, const char *url) { +bool ChefSignals::JSBind(const lpChef chef, const char *url) { return CustomEvaluate(chef,SIGNAL_JSBIND,url); } @@ -214,7 +214,7 @@ * @return true If CustomEvaluate succeeded. * @return false If CustomEvaluate failed. */ -bool ChefSignals::LoadError(const LPCHEF chef,const cef_handler_errorcode_t error, const char *failedURL) +bool ChefSignals::LoadError(const lpChef chef,const cef_handler_errorcode_t error, const char *failedURL) { char cErrorString[512]; @@ -231,7 +231,7 @@ * @return true If CustomEvaluate succeeded. * @return false If CustomEvaluate failed. */ -bool ChefSignals::LoadStart(const LPCHEF chef) +bool ChefSignals::LoadStart(const lpChef chef) { return CustomNotify(chef, SIGNAL_STARTLOAD); } @@ -245,7 +245,7 @@ * @return true If CustomEvaluate succeeded. * @return false If CustomEvaluate failed. */ -bool ChefSignals::LoadEnd(const LPCHEF chef) +bool ChefSignals::LoadEnd(const lpChef chef) { return CustomNotify(chef,SIGNAL_ENDLOAD); } @@ -259,7 +259,7 @@ * @return true If CustomEvaluate succeeded. * @return false If CustomEvaluate failed. */ -bool ChefSignals::AddressBarChanged(const LPCHEF chef, const char *address) +bool ChefSignals::AddressBarChanged(const lpChef chef, const char *address) { CF_DB(fprintf(stderr, "%s:%s\n", __FUNCTION__, address)); @@ -277,7 +277,7 @@ * @return true * @return false */ -bool ChefSignals::PrinterSend(const LPCHEF curChef, const char *sFile, +bool ChefSignals::PrinterSend(const lpChef curChef, const char *sFile, const char *sPath, bool bSuccess) { char pBuf[1024]; Modified: trunk/src/mChef/ChefSignals.h =================================================================== --- trunk/src/mChef/ChefSignals.h 2009-07-21 21:55:38 UTC (rev 218) +++ trunk/src/mChef/ChefSignals.h 2009-07-22 00:16:12 UTC (rev 219) @@ -42,23 +42,23 @@ char *GetEvaluatedDataCopy(); // returns a ptr to a allocated char string of the evaluated data // Custom Stuff - bool CustomNotify(const LPCHEF ,const char *,const char *); - bool CustomEvaluate(const LPCHEF ,const char *,const char *); + bool CustomNotify(const lpChef ,const char *,const char *); + bool CustomEvaluate(const lpChef ,const char *,const char *); // JS Functions bool JSSignal(char *script, bool bEvaluate); // Evaluated Functions - bool TitleBarChanged(const LPCHEF ,const char*); - bool LoadError(const LPCHEF,const cef_handler_errorcode_t , const char*); - bool NavigateBegin(const LPCHEF, const cef_handler_navtype_t, const int, const char *); - bool JSBind(const LPCHEF, const char*); + bool TitleBarChanged(const lpChef ,const char*); + bool LoadError(const lpChef,const cef_handler_errorcode_t , const char*); + bool NavigateBegin(const lpChef, const cef_handler_navtype_t, const int, const char *); + bool JSBind(const lpChef, const char*); // Notify Functions - bool LoadStart(const LPCHEF); - bool LoadEnd(const LPCHEF); - bool AddressBarChanged(const LPCHEF,const char*); - bool PrinterSend(const LPCHEF curChef, const char *sFile, const char *sPath, bool bSuccess); + bool LoadStart(const lpChef); + bool LoadEnd(const lpChef); + bool AddressBarChanged(const lpChef,const char*); + bool PrinterSend(const lpChef curChef, const char *sFile, const char *sPath, bool bSuccess); }; #endif Modified: trunk/src/mChef/ChefStruct.h =================================================================== --- trunk/src/mChef/ChefStruct.h 2009-07-21 21:55:38 UTC (rev 218) +++ trunk/src/mChef/ChefStruct.h 2009-07-22 00:16:12 UTC (rev 219) @@ -74,7 +74,7 @@ bool bIsLoading; /* Are we currently loading? */ bool bCanGoBack; /* Can we go back */ bool bCanGoForward; /* Can we go forward? */ -} CHEF, *LPCHEF; +} Chef, *lpChef; /** * BrowserThread. This structure is used when threading the creation of a browser. @@ -99,7 +99,7 @@ */ typedef struct tagPrinterThread { - LPCHEF curChef; //Chef instance that we are going to "print." + lpChef curChef; //Chef instance that we are going to "print." ImageType m_Type; //What type of image are we going to print? bool bFullView; //Are we printing the entire thing, or just our current view of it? @@ -108,11 +108,11 @@ /** * Internal Base Structure */ -typedef struct tagBASES +typedef struct tagBases { volatile LONG iReferenceCount; /* Amount of times that it is being referenced */ cef_base_t *base; /* The base pointer */ -}BASES, *LPBASES; +} Bases, *lpBases; #endif Modified: trunk/src/mChef/Main.cpp =================================================================== --- trunk/src/mChef/Main.cpp 2009-07-21 21:55:38 UTC (rev 218) +++ trunk/src/mChef/Main.cpp 2009-07-22 00:16:12 UTC (rev 219) @@ -239,7 +239,7 @@ CF_DB_END; return 3; } - LPCHEF curChef = NULL; + lpChef curChef = NULL; if (!(curChef = ChefFindEx(parv[0])) || !curChef->mBrowser) { sprintf(data, "C_ERR Detach NoSuchBrowser :The HWND or Window Name you specified does not exist."); CF_DB_END; @@ -271,7 +271,7 @@ return 3; } - LPCHEF curChef = NULL; + lpChef curChef = NULL; if (!(curChef = ChefFindEx(parv[0])) || !curChef->mBrowser) { sprintf(data, "C_ERR NoBrowser"); CF_DB_END; @@ -312,7 +312,7 @@ return 3; } - LPCHEF curChef = NULL; + lpChef curChef = NULL; if (!(curChef = ChefFindEx(parv[0])) || !curChef->mBrowser) { sprintf(data, "C_ERR %s", parv[0]); //No browser @ NAME|HWND CF_DB_END; @@ -346,7 +346,7 @@ if (IsAllNum(parv[0])) { hwWindow = (HWND)atol(parv[0]); } else { - LPCHEF curChef = ChefFind(parv[0]); + lpChef curChef = ChefFind(parv[0]); hwWindow = curChef ? curChef->m_hWnd : NULL; } CheckWindowByHandle(hwWindow); @@ -378,7 +378,7 @@ return 3; } - LPCHEF curChef = NULL; + lpChef curChef = NULL; if (!(curChef = ChefFindEx(parv[0])) || !curChef->mBrowser) { sprintf(data, "C_ERR NoBrowser"); CF_DB_END; @@ -457,7 +457,7 @@ return 3; } - LPCHEF curChef = NULL; + lpChef curChef = NULL; if (!(curChef = ChefFindEx(parv[0]))) { sprintf(data, "C_ERR NoBrowser"); CF_DB_END; @@ -510,7 +510,7 @@ return 3; } - LPCHEF curChef = NULL; + lpChef curChef = NULL; if (!(curChef = ChefFindEx(parv[0])) || !curChef->mBrowser) { sprintf(data, "C_ERR NoBrowser"); } else if (parc == 1) { @@ -544,7 +544,7 @@ return 3; } - LPCHEF curChef = NULL; + lpChef curChef = NULL; if (!(curChef = ChefFindEx(parv[0])) || !curChef->mBrowser) { sprintf(data, "C_ERR NoBrowser"); } else { @@ -582,7 +582,7 @@ } int iRequest = atoi(parv[0]); - LPCHEF m_curChef = NULL; + lpChef m_curChef = NULL; if ((iRequest <= 0) || !(m_curChef = ChefFindCount(iRequest))) { sprintf(data, "%i", ChefCount); @@ -594,7 +594,7 @@ CF_DB_END return 3; } - static LPCHEF curChef = NULL; + static lpChef curChef = NULL; if (!parv[1] || curChef == NULL && !(curChef = ChefFindEx(parv[0])) || (_stricmp(curChef->m_WindowName, parv[0])!=0 && Modified: trunk/src/mChef/SubClass.cpp =================================================================== --- trunk/src/mChef/SubClass.cpp 2009-07-21 21:55:38 UTC (rev 218) +++ trunk/src/mChef/SubClass.cpp 2009-07-22 00:16:12 UTC (rev 219) @@ -32,7 +32,7 @@ */ LRESULT CALLBACK SubWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - LPCHEF curChef = ChefFind(hWnd); + lpChef curChef = ChefFind(hWnd); if (!curChef) { CF_DB(fprintf(stderr,"ERROR: WndProc called on a Window (HWND: %d) that we are not attached to!\n", hWnd)); @@ -90,7 +90,7 @@ LRESULT CALLBACK ResizeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - LPCHEF curChef = ChefFindByResize(hWnd); + lpChef curChef = ChefFindByResize(hWnd); if (!curChef) { CF_DB(fprintf(stderr,"ERROR: ResizeWndProc called on a Window (HWND: %d) that we are not attached to!\n", hWnd)); Modified: trunk/src/mChef/V8Splash.cpp =================================================================== --- trunk/src/mChef/V8Splash.cpp 2009-07-21 21:55:38 UTC (rev 218) +++ trunk/src/mChef/V8Splash.cpp 2009-07-22 00:16:12 UTC (rev 219) @@ -68,7 +68,7 @@ @return cef_v8value_t containing a built mIRCLink object */ -cef_v8value_t *InitializeMIRCJSLink(LPCHEF chef) +cef_v8value_t *InitializeMIRCJSLink(lpChef chef) { cef_base_t *base = (cef_base_t *)ChefMalloc(sizeof(cef_base_t)); InitBaseStruct(base); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-07-21 21:55:42
|
Revision: 218 http://mchef.svn.sourceforge.net/mchef/?rev=218&view=rev Author: tux316 Date: 2009-07-21 21:55:38 +0000 (Tue, 21 Jul 2009) Log Message: ----------- ChefBrowser definition. Modified Paths: -------------- trunk/src/mChef/Misc/mChef.def Modified: trunk/src/mChef/Misc/mChef.def =================================================================== --- trunk/src/mChef/Misc/mChef.def 2009-07-21 21:53:32 UTC (rev 217) +++ trunk/src/mChef/Misc/mChef.def 2009-07-21 21:55:38 UTC (rev 218) @@ -2,6 +2,7 @@ EXPORTS Attach + ChefBrowser ClearCache Detach ExecScript This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-07-21 21:53:37
|
Revision: 217 http://mchef.svn.sourceforge.net/mchef/?rev=217&view=rev Author: tux316 Date: 2009-07-21 21:53:32 +0000 (Tue, 21 Jul 2009) Log Message: ----------- Introduced mIRC Function ChefBrowser: - This function is still extremely experimental. Optimized ChefBaseStruct.cpp: - Implemented static declarations that contain the size of each of CEF's structures (that we use). This will prevent us from calling sizeof() every time we need to identify which type of base we are dealing with. - Introduced BaseIdentify - Finds out what type of base we are dealing with and returns BaseType enumerator. - Introduced BaseIdentifyString - Same as above, but returns string containing the info in question (useful for debugging). General mChef: - Started phasing out the stderr.txt little by little. We will output our info in a nice little console for the time being. - Fixed a couple of CEF Unload crashes caused by forced destruction of CefBrowser window handles. Modified Paths: -------------- trunk/src/mChef/Chef.cpp trunk/src/mChef/Chef.h trunk/src/mChef/ChefBaseStruct.cpp trunk/src/mChef/ChefExtern.h trunk/src/mChef/ChefHandler.cpp trunk/src/mChef/ChefMisc.cpp trunk/src/mChef/ChefStruct.h trunk/src/mChef/Main.cpp Modified: trunk/src/mChef/Chef.cpp =================================================================== --- trunk/src/mChef/Chef.cpp 2009-07-21 02:06:49 UTC (rev 216) +++ trunk/src/mChef/Chef.cpp 2009-07-21 21:53:32 UTC (rev 217) @@ -25,9 +25,15 @@ * When we attach to a window, we will create an LPCHEF pointer * and store them within this vector. */ -vector<LPCHEF> ChefWindows; +static vector<LPCHEF> ChefWindows; /** + * ChefCount. Integer variable used to keep an accurate count of how many + * Chef instances we have attached. + */ +unsigned int ChefCount = 0; + +/** * ChefInsert. Inserts a Chef into our vector. * * @param curChef Chef Pointer @@ -87,6 +93,48 @@ } /** + * ChefFind. Finds a Chef by Window Name. + * + * @param m_WindowName Window Name + * + * @return LPCHEF Chef Pointer + * @return NULL Nothing was found + */ +LPCHEF ChefFind(const char *m_WindowName) +{ + if (!*m_WindowName) { + return NULL; + } + + for (vector<LPCHEF>::iterator it = ChefWindows.begin(); it != ChefWindows.end(); it++) { + if (_stricmp((*it)->m_WindowName, m_WindowName) == 0) { + return (*it); + } + } + return NULL; +} + +/** + * ChefFindCount. Finds a Chef by count. + * + * @param iCount Count + * + * @return LPCHEF Chef Pointer + * @return NULL Nothing was found + */ +LPCHEF ChefFindCount(const int iCount) +{ + int c = 0; + + for (vector<LPCHEF>::iterator it = ChefWindows.begin(); it != ChefWindows.end(); it++) { + if (c++ == (iCount-1)) + return (*it); + } + + return NULL; +} + +/** * ChefFindByResize. Finds a Chef by Resize Target * * @param m_hWnd Resize Target Window Handle. @@ -110,28 +158,6 @@ } /** -* ChefFind. Finds a Chef by Window Name. -* -* @param m_WindowName Window Name -* -* @return LPCHEF Chef Pointer -* @return NULL Nothing was found -*/ -LPCHEF ChefFind(const char *m_WindowName) -{ - if (!*m_WindowName) { - return NULL; - } - - for (vector<LPCHEF>::iterator it = ChefWindows.begin(); it != ChefWindows.end(); it++) { - if (_stricmp((*it)->m_WindowName, m_WindowName) == 0) { - return (*it); - } - } - return NULL; -} - -/** * ChefFindEx. Finds a Chef by either Window Name or Handle. * * @param ptr Pointer to the string that contains the handle or window name. @@ -172,8 +198,8 @@ SetWindowLongPtr(curChef->m_ResizeTarget, GWL_WNDPROC, (LONG_PTR)curChef->wpResizeTarget); /* Sanity Check - Tell CEF that destroy if it already has not. */ - if (IsWindow(curChef->m_BrowserHwnd)) - SendMessage(curChef->m_BrowserHwnd, WM_DESTROY, 0, 0); + //if (IsWindow(curChef->m_BrowserHwnd)) + // SendMessage(curChef->m_BrowserHwnd, WM_DESTROY, 0, 0); BaseRelease(curChef->mBrowser); BaseRelease(curChef->mHandler); @@ -187,6 +213,8 @@ Free(curChef->m_WindowName); Free(curChef); + ChefCount--; + CF_DB_END } @@ -280,6 +308,7 @@ curChef->bCanGoBack = curChef->bCanGoForward = curChef->bIsLoading = false; ChefInsert(curChef); + ChefCount++; CF_DB_END return curChef; Modified: trunk/src/mChef/Chef.h =================================================================== --- trunk/src/mChef/Chef.h 2009-07-21 02:06:49 UTC (rev 216) +++ trunk/src/mChef/Chef.h 2009-07-21 21:53:32 UTC (rev 217) @@ -27,19 +27,19 @@ /* Changing any of the macros below will only be waisting your time.*/ /* Number of times that the project has been built */ -#define VERSION_BUILD 804 +#define VERSION_BUILD 862 /* Current mChef Version */ -#define MCHEF_VERSION_STR "1.0.804" -#define MCHEF_VERSION_STRWC L"1.0.804" +#define MCHEF_VERSION_STR "1.0.862" +#define MCHEF_VERSION_STRWC L"1.0.862" -#define VERSION_FULL "1.0.804" -#define VERSION_WFULL L"1.0.804" +#define VERSION_FULL "1.0.862" +#define VERSION_WFULL L"1.0.862" -#define VERSION_FILE 1,0,0,804 -#define VERSION_PRODUCT 1,0,0,804 -#define VERSION_FSTR "1, 0, 0, 804" -#define VERSION_PSTR "1, 0, 0, 804" +#define VERSION_FILE 1,0,0,862 +#define VERSION_PRODUCT 1,0,0,862 +#define VERSION_FSTR "1, 0, 0, 862" +#define VERSION_PSTR "1, 0, 0, 862" #endif Modified: trunk/src/mChef/ChefBaseStruct.cpp =================================================================== --- trunk/src/mChef/ChefBaseStruct.cpp 2009-07-21 02:06:49 UTC (rev 216) +++ trunk/src/mChef/ChefBaseStruct.cpp 2009-07-21 21:53:32 UTC (rev 217) @@ -18,10 +18,72 @@ #include "StdAfx.h" #include "h.h" +#ifdef CHEF_DEBUG + //Keep an accurate count of how many bases we have thus far. + static int iBaseCount = 0; +#endif + /* Vector for our LPBASES */ -std::vector<LPBASES> vBases; +static std::vector<LPBASES> vBases; /** + * Since we are going to be checking the size of the bases quite a bit, + * I think it only makes sense that we store them instead of checking them + * every time that we need to find out what's what. + */ +size_t SizeOfCefBase = sizeof(cef_base_t); +static size_t SizeOfCefBrowser = sizeof(cef_browser_t); +static size_t SizeOfCefHandler = sizeof(cef_handler_t); +static size_t SizeOfV8Handler = sizeof(cef_v8handler_t); +static size_t SizeOfV8Value = sizeof(cef_v8value_t); + +/** + * BaseIdentify. Identifies a base by size. + * + * @param lpbase Base that we want to identify. + */ +BaseType BaseIdentify(LPBASES lpbase) +{ + if (lpbase->base->size == SizeOfCefBase) + return BaseCef; + else if (lpbase->base->size == SizeOfCefBrowser) + return BaseCefBrowser; + else if (lpbase->base->size == SizeOfCefHandler) + return BaseCefHandler; + else if (lpbase->base->size == SizeOfV8Handler) + return BaseV8Handler; + else if (lpbase->base->size == SizeOfV8Value) + return BaseV8Value; + + /* This should never be reached. */ + return BaseUnknown; +} + +/** + * BaseIdentifyString. Identifies a base by size. + * + * @param lpbase Base that we want to identify. + * + * @return String + */ +const char *BaseIdentifyString(LPBASES lpbase) +{ + if (lpbase->base->size == SizeOfCefBase) + return "BaseCef"; + else if (lpbase->base->size == SizeOfCefBrowser) + return "BaseCefBrowser"; + else if (lpbase->base->size == SizeOfCefHandler) + return "BaseCefHandler"; + else if (lpbase->base->size == SizeOfV8Handler) + return "BaseV8Handler"; + else if (lpbase->base->size == SizeOfV8Value) + return "BaseV8Value"; + + /* This should never be reached. */ + return "BaseUnknown"; +} + +/** * add_ref. Increases the reference count to an object * * @param t base object @@ -32,8 +94,13 @@ { LPBASES base = BaseFind(t); - if (base) + if (base) { + CF_DB( + iBaseCount++; + printf("[Bases] add_ref called for %s, incrementing to %d\n", + BaseIdentifyString(base), base->iReferenceCount + 1)); return InterlockedIncrement(&base->iReferenceCount); + } return 1; // safety net but this is a nasty error to have occur } @@ -50,10 +117,13 @@ CF_DB_START LPBASES base = BaseFind(t); - if (base) + if (base) { + CF_DB(printf("[Bases] get_refct called for %s, count is at to %d\n", + BaseIdentifyString(base), base->iReferenceCount)); return base->iReferenceCount; + } - CF_DB(fprintf(stderr, "%s(Line %i): %s failed. No Base Structure Found\n", __FILE__, __LINE__, __FUNCTION__)); + CF_DB(printf("%s(Line %i): %s failed. No Base Structure Found\n", __FILE__, __LINE__, __FUNCTION__)); CF_DB_END return 1; // safety net but this is a nasty error to have occur @@ -71,6 +141,12 @@ LPBASES base = BaseFind(t); if (base) { + CF_DB(printf("[Bases] release called for %s, decrementing to %d\n", + BaseIdentifyString(base), base->iReferenceCount - 1); + iBaseCount--; + printf("iBaseCount is now at: %i\n", iBaseCount); + ); + if (base->iReferenceCount-1 == 0) { CF_DB(fprintf(stderr,"Auto-BasePoping, references == 0\n")); BasePop(base->base); @@ -91,10 +167,10 @@ */ cef_base_t *InitBaseStruct(cef_base_t *base) { - base->add_ref = add_ref; - base->get_refct = get_refct; - base->release = release; - base->size = 0; + base->add_ref = add_ref; + base->get_refct = get_refct; + base->release = release; + base->size = 0; LPBASES lpBase = (LPBASES)ChefMalloc(sizeof(BASES)); @@ -112,27 +188,28 @@ */ void BaseFree(LPBASES lpbase) { - /* for right now the only thing we have using our custom logic is the handler, ultimately the v8 stuff will need it as well */ - if (lpbase->base->size == sizeof(cef_handler_t)) { - CF_DB(printf("Freeing cef_handler_t\n")); - Free((cef_handler_t*)lpbase->base); + BaseType curBaseType = BaseIdentify(lpbase); + + CF_DB(printf("Freeing %s\n", BaseIdentifyString(lpbase))); + + /* for right now the only thing we have using our custom logic is the handler, + * ultimately the v8 stuff will need it as well */ + if (curBaseType == BaseCef) { + Free((cef_base_t *)lpbase->base); } - else if (lpbase->base->size == sizeof(cef_v8handler_t)) { - CF_DB(printf("Freeing cef_v8handler_t\n")); - Free((cef_v8handler_t*)lpbase->base); + else if (curBaseType == BaseCefHandler) { + Free((cef_handler_t *)lpbase->base); } - else if (lpbase->base->size == sizeof(cef_v8value_t)) { - CF_DB(printf("Freeing cef_v8value_t\n")); + else if (curBaseType == BaseCefBrowser) { + Free((cef_browser_t *)lpbase->base); + } + else if (curBaseType == BaseV8Handler) { + Free((cef_v8handler_t *)lpbase->base); + } + else if (curBaseType == BaseV8Value) { Free((cef_v8value_t *)lpbase->base); } - else if (lpbase->base->size == sizeof(cef_base_t)) { - CF_DB(printf("Freeing cef_base_t\n")); - Free((cef_base_t *)lpbase->base); - } - else if (lpbase->base->size == sizeof(cef_browser_t)) { - CF_DB(printf("Freeing cef_browser_t\n")); - Free((cef_browser_t *)lpbase->base); - } else { + else { CF_DB(printf("UH OH UH OH UH OH UH OH!! BaseFree called for unknown base with size: %u\n", lpbase->base->size)); } @@ -154,6 +231,7 @@ return NULL; } + /** * BasePop Removes all bases and frees memory */ Modified: trunk/src/mChef/ChefExtern.h =================================================================== --- trunk/src/mChef/ChefExtern.h 2009-07-21 02:06:49 UTC (rev 216) +++ trunk/src/mChef/ChefExtern.h 2009-07-21 21:53:32 UTC (rev 217) @@ -43,6 +43,7 @@ extern LPCHEF ChefFind(const char *m_WindowName); extern LPCHEF ChefFindEx(char *ptr); extern LPCHEF ChefFindBrowser(const HWND m_BrowserHwnd); +extern LPCHEF ChefFindCount(const int iCount); extern LPCHEF ChefFindByResize(const HWND m_hWnd); extern char *ChefErrorLookup(cef_handler_errorcode_t error); @@ -85,6 +86,8 @@ extern void ChefGetLastError(); #endif +extern unsigned int ChefCount; + #endif /* EOF */ Modified: trunk/src/mChef/ChefHandler.cpp =================================================================== --- trunk/src/mChef/ChefHandler.cpp 2009-07-21 02:06:49 UTC (rev 216) +++ trunk/src/mChef/ChefHandler.cpp 2009-07-21 21:53:32 UTC (rev 217) @@ -528,8 +528,9 @@ if (curChef) { CF_DB(printf("Chef %s [%08X] was closed.\n", curChef->m_WindowName, curChef->m_hWnd)); + + ChefPop(curChef); BaseRelease(browser); - ChefPop(curChef); return RV_CONTINUE; } Modified: trunk/src/mChef/ChefMisc.cpp =================================================================== --- trunk/src/mChef/ChefMisc.cpp 2009-07-21 02:06:49 UTC (rev 216) +++ trunk/src/mChef/ChefMisc.cpp 2009-07-21 21:53:32 UTC (rev 217) @@ -156,7 +156,7 @@ _CHEFSSERT(flags); LPCHEF curChef = ChefCreate(hwParent, name, alias , hwResizeTarget); - curChef->flags |= flags; // moved up top because I needed it + curChef->flags = flags; // moved up top because I needed it if (IsListBox(curChef) || IsDialog(curChef)) // this will copy the resize targets left and top (for example in case its a listbox) { Modified: trunk/src/mChef/ChefStruct.h =================================================================== --- trunk/src/mChef/ChefStruct.h 2009-07-21 02:06:49 UTC (rev 216) +++ trunk/src/mChef/ChefStruct.h 2009-07-21 21:53:32 UTC (rev 217) @@ -19,6 +19,26 @@ # define __STRUCT_H__ /** + * Base Type Enumerator. + */ +enum BaseType { + BaseCef = 0, + BaseCefBrowser, + BaseCefHandler, + BaseV8Value, + BaseV8Handler, + BaseUnknown +}; + +/** + * Image Type Enumerator. + */ +enum ImageType { + IMAGE_BMP = 0, /* Bitmap Image */ + IMAGE_PNG /* PNG Image */ +}; + +/** * LOADINFO Structure. See mIRC's help file for more info. */ typedef struct @@ -28,16 +48,7 @@ BOOL mKeep; /* Keep Loaded? */ } LOADINFO; - /** - * Image Type Enumerator. - */ -enum ImageType { - IMAGE_BMP= 0, /* Bitmap Image */ - IMAGE_PNG /* PNG Image */ -}; - -/** * Chef Structure. */ typedef struct chef_t Modified: trunk/src/mChef/Main.cpp =================================================================== --- trunk/src/mChef/Main.cpp 2009-07-21 02:06:49 UTC (rev 216) +++ trunk/src/mChef/Main.cpp 2009-07-21 21:53:32 UTC (rev 217) @@ -30,8 +30,6 @@ */ void Parse(char *mIRCData, char *buffer[CHEF_MAXPARAMS], int *params) { - CF_DB_START - // Lets account for completely blank parameters if (strlen(mIRCData) == 0) { *params = 0; @@ -65,7 +63,6 @@ s.push_back(c); } *params = p; - CF_DB_END } /** @@ -560,6 +557,92 @@ } /** + * ChefBrowser. + * + * parv[0] parv[1] + * N/Name hWnd + * bWnd + * Type + * URL + * Loading + * Forward + * Back + */ +int __stdcall ChefBrowser(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause) +{ + CF_DB_START + SanityCheck(); + ParseParameters(data); + + if (parc < 2) { + if (!IsAllNum(parv[0])) { + sprintf(data, "0"); + CF_DB_END + return 3; + } + + int iRequest = atoi(parv[0]); + LPCHEF m_curChef = NULL; + + if ((iRequest <= 0) || !(m_curChef = ChefFindCount(iRequest))) { + sprintf(data, "%i", ChefCount); + CF_DB_END + return 3; + } + + sprintf(data, "%s", m_curChef->m_WindowName); + CF_DB_END + return 3; + } + static LPCHEF curChef = NULL; + + if (!parv[1] || curChef == NULL && !(curChef = ChefFindEx(parv[0])) || + (_stricmp(curChef->m_WindowName, parv[0])!=0 && + !(curChef = ChefFindEx(parv[0])))) { + sprintf(data, "CouldNotFindWindow"); + } + else if (_stricmp(parv[1], "hWnd") == 0) { + sprintf(data, "%d", curChef->m_hWnd); + } + else if (_stricmp(parv[1], "bWnd") == 0) { + sprintf(data, "%d", curChef->m_BrowserHwnd); + } + else if (_stricmp(parv[1], "Type") == 0) { + if (IsPicWin(curChef)) + sprintf(data, "1"); + else if (IsDialog(curChef)) + sprintf(data, "2"); + else + sprintf(data, "3"); + } + else if (_stricmp(parv[1], "URL") == 0) { + cef_frame_t *curFrame = curChef->mBrowser->get_main_frame(curChef->mBrowser); + if (!curFrame) { + sprintf(data, "NoURL"); + } + else { + CEF_String cs(curFrame->get_url(curFrame)); + sprintf(data, "%s", cs.ToMultiByte()); + } + } + else if (_stricmp(parv[1], "Loading") == 0) { + sprintf(data, "%i", curChef->bIsLoading ? 1 : 0); + } + else if (_stricmp(parv[1], "Forward") == 0) { + sprintf(data, "%i", curChef->bCanGoForward ? 1 : 0); + } + else if (_stricmp(parv[1], "Back") == 0) { + sprintf(data, "%i", curChef->bCanGoBack ? 1 : 0); + } + else { + sprintf(data, "UnknownProperty: %s", parv[1]); + } + + CF_DB_END + return 3; +} + +/** * ClearCache */ int __stdcall ClearCache(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-07-21 02:06:54
|
Revision: 216 http://mchef.svn.sourceforge.net/mchef/?rev=216&view=rev Author: tux316 Date: 2009-07-21 02:06:49 +0000 (Tue, 21 Jul 2009) Log Message: ----------- - We now send a signal "ChefAttached" when we have successfully attached to a window. - ChefPrinter now finds a smart filename for the picture. (Chef%i.png/bmp). Modified Paths: -------------- trunk/src/mChef/Chef.h trunk/src/mChef/ChefHandler.cpp trunk/src/mChef/ChefMacros.h trunk/src/mChef/ChefPrinter.cpp trunk/src/mChef/ChefPrinter.h Modified: trunk/src/mChef/Chef.h =================================================================== --- trunk/src/mChef/Chef.h 2009-07-21 01:38:06 UTC (rev 215) +++ trunk/src/mChef/Chef.h 2009-07-21 02:06:49 UTC (rev 216) @@ -27,19 +27,19 @@ /* Changing any of the macros below will only be waisting your time.*/ /* Number of times that the project has been built */ -#define VERSION_BUILD 800 +#define VERSION_BUILD 804 /* Current mChef Version */ -#define MCHEF_VERSION_STR "1.0.800" -#define MCHEF_VERSION_STRWC L"1.0.800" +#define MCHEF_VERSION_STR "1.0.804" +#define MCHEF_VERSION_STRWC L"1.0.804" -#define VERSION_FULL "1.0.800" -#define VERSION_WFULL L"1.0.800" +#define VERSION_FULL "1.0.804" +#define VERSION_WFULL L"1.0.804" -#define VERSION_FILE 1,0,0,800 -#define VERSION_PRODUCT 1,0,0,800 -#define VERSION_FSTR "1, 0, 0, 800" -#define VERSION_PSTR "1, 0, 0, 800" +#define VERSION_FILE 1,0,0,804 +#define VERSION_PRODUCT 1,0,0,804 +#define VERSION_FSTR "1, 0, 0, 804" +#define VERSION_PSTR "1, 0, 0, 804" #endif Modified: trunk/src/mChef/ChefHandler.cpp =================================================================== --- trunk/src/mChef/ChefHandler.cpp 2009-07-21 01:38:06 UTC (rev 215) +++ trunk/src/mChef/ChefHandler.cpp 2009-07-21 02:06:49 UTC (rev 216) @@ -66,6 +66,7 @@ curChef->m_BrowserHwnd = m_BrowserHwnd; curChef->mBrowser = browse; BaseAddRef(curChef->mBrowser); + signal->CustomNotify(curChef, SIGNAL_CHEFATTACHED, NULL); } else { CF_DB(printf("Could not find Chef for %d\n", m_hWnd)); } Modified: trunk/src/mChef/ChefMacros.h =================================================================== --- trunk/src/mChef/ChefMacros.h 2009-07-21 01:38:06 UTC (rev 215) +++ trunk/src/mChef/ChefMacros.h 2009-07-21 02:06:49 UTC (rev 216) @@ -42,6 +42,7 @@ /** * mIRC Signal's Defined */ +#define SIGNAL_CHEFATTACHED "ChefAttached" // Houston, we have attached. #define SIGNAL_ADDRESSCHANGED "AddressBarChanged" // address is given #define SIGNAL_NAVBEGIN "NavigateBegin" // params: navtype isredirect url, return: C_CANCEL to halt, or new url to chagne request, nothing causes it to continue navigation #define SIGNAL_TITLECHANGED "TitleChanged" // title is evaluated, return new title or current one will be used Modified: trunk/src/mChef/ChefPrinter.cpp =================================================================== --- trunk/src/mChef/ChefPrinter.cpp 2009-07-21 01:38:06 UTC (rev 215) +++ trunk/src/mChef/ChefPrinter.cpp 2009-07-21 02:06:49 UTC (rev 216) @@ -27,9 +27,10 @@ { CF_DB_START - m_ImageName = m_SavePath = NULL; + m_SavePath = NULL; pBuf = NULL; ZeroMemory(m_FullImagePath, MAX_PATH); + ZeroMemory(m_ImageName, MAX_PATH); m_SavePath = BuildPath(m_SavePath, "Screens\\"); CF_DB_END @@ -48,33 +49,38 @@ { CF_DB_START - MyFreeEx(m_ImageName); - MyFree(m_SavePath); + MyFreeEx(m_SavePath); Free(pBuf); DeleteObject(hBitmap); - memset(m_FullImagePath, 0, MAX_PATH); CF_DB_END } -void ChefPrinter::BuildImageName() +bool ChefPrinter::BuildImageName() { CF_DB_START - m_ImageName = new char[MAX_PATH]; + char ext[4]; - if (m_ImageOutputFormat == IMAGE_BMP) { - sprintf_s(m_ImageName, MAX_PATH, "Chef%d.bmp", time(NULL)); - } else { - sprintf_s(m_ImageName, MAX_PATH, "Chef%d.png", time(NULL)); - } + ZeroMemory(ext, 4); - sprintf_s(m_FullImagePath, MAX_PATH, "%s%s", m_SavePath, m_ImageName); + if (m_ImageOutputFormat == IMAGE_PNG) + strncpy(ext, "png", 3); + else + strncpy(ext, "bmp", 3); - CF_DB(fprintf(stderr, "%s:%s\n", __FUNCTION__, m_FullImagePath)); - + bool bGoodToGo = false; + for (int i = 0; i < 250; i++) { + sprintf_s(m_ImageName, MAX_PATH, "Chef%i.%s", i, ext); + sprintf_s(m_FullImagePath, MAX_PATH, "%s%s", m_SavePath, m_ImageName); + if (!PathFileExistsA(m_FullImagePath)) { + bGoodToGo = true; + break; + } + } CF_DB_END + return bGoodToGo; } void ChefPrinter::BuildBitmap() @@ -200,7 +206,9 @@ CF_DB(fprintf(stderr, "Beginning print for %s\n", m_curChef->m_WindowName)); if (CheckPath()) { - BuildImageName(); + if (!BuildImageName()) { + //FIXME: Send a signal here indicating that the "SavePath" does NOT exist. + } BuildBitmap(); BuildBitmapHeaders(); Modified: trunk/src/mChef/ChefPrinter.h =================================================================== --- trunk/src/mChef/ChefPrinter.h 2009-07-21 01:38:06 UTC (rev 215) +++ trunk/src/mChef/ChefPrinter.h 2009-07-21 02:06:49 UTC (rev 216) @@ -27,7 +27,7 @@ private: ImageType m_ImageOutputFormat; /* Image Output format */ char *m_SavePath; /* Path that we should save the image to */ - char *m_ImageName; /* The name of the image. */ + char m_ImageName[MAX_PATH]; /* The name of the image. */ char m_FullImagePath[MAX_PATH]; /* Full path to the image (filename included) */ LPCHEF m_curChef; /* We will only keep this as a reference. */ HDC m_ChefDC; /* Device Context */ @@ -58,8 +58,11 @@ /** * BuildImageName. Will fill m_ImageName accordingly. + * + * @return true If we could build an image name. + * @return false If we failed. */ - void BuildImageName(); + bool BuildImageName(); /** * BuildBitmapHeaders. Builds the Bitmap headers. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |