00001 // Filename: patcher.cxx 00002 // Created by: mike (09Jan97) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "pandabase.h" 00016 00017 #ifdef HAVE_OPENSSL 00018 00019 #include "config_downloader.h" 00020 #include "patcher.h" 00021 #include "filename.h" 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Function: Patcher::Constructor 00025 // Access: Public 00026 // Description: 00027 //////////////////////////////////////////////////////////////////// 00028 Patcher:: 00029 Patcher() { 00030 PT(Buffer) buffer = new Buffer(patcher_buffer_size); 00031 init(buffer); 00032 } 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Function: Patcher::Constructor 00036 // Access: Public 00037 // Description: 00038 //////////////////////////////////////////////////////////////////// 00039 Patcher:: 00040 Patcher(PT(Buffer) buffer) { 00041 init(buffer); 00042 } 00043 00044 //////////////////////////////////////////////////////////////////// 00045 // Function: Patcher::Constructor 00046 // Access: Private 00047 // Description: 00048 //////////////////////////////////////////////////////////////////// 00049 void Patcher:: 00050 init(PT(Buffer) buffer) { 00051 nassertv(!buffer.is_null()); 00052 _buffer = buffer; 00053 00054 _patchfile = NULL; 00055 _patchfile = new Patchfile(_buffer); 00056 } 00057 00058 //////////////////////////////////////////////////////////////////// 00059 // Function: Patcher::Destructor 00060 // Access: Public 00061 // Description: 00062 //////////////////////////////////////////////////////////////////// 00063 Patcher:: 00064 ~Patcher() { 00065 delete _patchfile; 00066 } 00067 00068 //////////////////////////////////////////////////////////////////// 00069 // Function: Patcher::initiate 00070 // Access: Public 00071 // Description: 00072 //////////////////////////////////////////////////////////////////// 00073 int Patcher:: 00074 initiate(Filename &patch, Filename &infile) { 00075 return _patchfile->initiate(patch, infile); 00076 } 00077 00078 //////////////////////////////////////////////////////////////////// 00079 // Function: Patcher::run 00080 // Access: Public 00081 // Description: 00082 //////////////////////////////////////////////////////////////////// 00083 int Patcher:: 00084 run() { 00085 return _patchfile->run(); 00086 } 00087 00088 #endif // HAVE_OPENSSL