From 28ad032210ed21dd171ab1b007d04f75966bf9b7 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 8 Feb 2021 19:41:46 +0100 Subject: [PATCH 1/6] collide: Fix CollisionHandlerGravity docstrings [skip ci] --- panda/src/collide/collisionHandlerGravity.I | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/panda/src/collide/collisionHandlerGravity.I b/panda/src/collide/collisionHandlerGravity.I index 48c172959f..da449937cd 100644 --- a/panda/src/collide/collisionHandlerGravity.I +++ b/panda/src/collide/collisionHandlerGravity.I @@ -52,8 +52,6 @@ get_reach() const { * * The object might not necessarily be at rest. Use is_on_ground() if you * want to know whether the object is on the ground and at rest. - * - * See Also: is_in_outer_space() */ INLINE PN_stdfloat CollisionHandlerGravity:: get_airborne_height() const { @@ -73,7 +71,7 @@ is_on_ground() const { /** * How hard did the object hit the ground. This value is set on impact with - * the ground. You may want to watch (poll) on is_on_groun() and when that is + * the ground. You may want to watch (poll) on is_on_ground() and when that is * true, call get_impact_velocity(). Normally I avoid polling, but we are * calling is_on_ground() frequently anyway. */ From 59ab828098c51c3ca371f622643c78965ac3c67b Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 11 Feb 2021 03:27:44 +0100 Subject: [PATCH 2/6] linmath: Fix typo in Mat4 isub docstring Fixes panda3d/panda3d-docs#96 --- panda/src/linmath/lmatrix4_src.I | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/linmath/lmatrix4_src.I b/panda/src/linmath/lmatrix4_src.I index 99d930bd0b..e1040444f2 100644 --- a/panda/src/linmath/lmatrix4_src.I +++ b/panda/src/linmath/lmatrix4_src.I @@ -1045,7 +1045,7 @@ operator += (const FLOATNAME(LMatrix4) &other) { } /** - * Performs a memberwise addition between two matrices. + * Performs a memberwise subtraction between two matrices. */ INLINE_LINMATH FLOATNAME(LMatrix4) &FLOATNAME(LMatrix4):: operator -= (const FLOATNAME(LMatrix4) &other) { From 4e27264cac8d841e7004698753c06b325eef3f98 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 11 Feb 2021 03:28:43 +0100 Subject: [PATCH 3/6] downloader: Add properties to HTTPCookie --- panda/src/downloader/httpCookie.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/panda/src/downloader/httpCookie.h b/panda/src/downloader/httpCookie.h index dfbc507215..9d8763cf4d 100644 --- a/panda/src/downloader/httpCookie.h +++ b/panda/src/downloader/httpCookie.h @@ -66,6 +66,14 @@ PUBLISHED: void output(std::ostream &out) const; +PUBLISHED: + MAKE_PROPERTY(name, get_name, set_name); + MAKE_PROPERTY(value, get_value, set_value); + MAKE_PROPERTY(domain, get_domain, set_domain); + MAKE_PROPERTY(path, get_path, set_path); + MAKE_PROPERTY2(expires, has_expires, get_expires, set_expires, clear_expires); + MAKE_PROPERTY(secure, get_secure, set_secure); + private: bool parse_cookie_param(const std::string ¶m, bool first_param); From 4dfe65113315463021e923e53e2e8647a4da7a5c Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 15 Feb 2021 11:13:33 +0100 Subject: [PATCH 4/6] prc: Fix istream/ostream/iostream properties of StreamWrapper --- dtool/src/prc/streamWrapper.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dtool/src/prc/streamWrapper.h b/dtool/src/prc/streamWrapper.h index a837540129..56074eac3f 100644 --- a/dtool/src/prc/streamWrapper.h +++ b/dtool/src/prc/streamWrapper.h @@ -64,7 +64,7 @@ PUBLISHED: ~IStreamWrapper(); INLINE std::istream *get_istream() const; - MAKE_PROPERTY(std::istream, get_istream); + MAKE_PROPERTY(istream, get_istream); public: void read(char *buffer, std::streamsize num_bytes); @@ -91,7 +91,7 @@ PUBLISHED: ~OStreamWrapper(); INLINE std::ostream *get_ostream() const; - MAKE_PROPERTY(std::ostream, get_ostream); + MAKE_PROPERTY(ostream, get_ostream); public: void write(const char *buffer, std::streamsize num_bytes); @@ -127,7 +127,7 @@ PUBLISHED: ~StreamWrapper(); INLINE std::iostream *get_iostream() const; - MAKE_PROPERTY(std::iostream, get_iostream); + MAKE_PROPERTY(iostream, get_iostream); private: std::iostream *_iostream; From 20bdd32765ffcfc43a718e514973232f0d06ca42 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 15 Feb 2021 11:13:57 +0100 Subject: [PATCH 5/6] downloader: Fix an uninitialized member --- panda/src/downloader/httpChannel.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/panda/src/downloader/httpChannel.cxx b/panda/src/downloader/httpChannel.cxx index 679cb6f6de..c83abf4e97 100644 --- a/panda/src/downloader/httpChannel.cxx +++ b/panda/src/downloader/httpChannel.cxx @@ -117,6 +117,7 @@ HTTPChannel(HTTPClient *client) : _cipher_list = _client->get_cipher_list(); _last_status_code = 0; _last_run_time = 0.0f; + _download_dest = DD_none; _download_to_ramfile = nullptr; _download_to_stream = nullptr; } From 84c2a18d003c183507afea7f042ca9f90240734b Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 15 Feb 2021 11:18:13 +0100 Subject: [PATCH 6/6] downloader: Implement VirtualFileHTTP::read_file() --- panda/src/downloader/virtualFileHTTP.cxx | 20 ++++++++++++++++++++ panda/src/downloader/virtualFileHTTP.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/panda/src/downloader/virtualFileHTTP.cxx b/panda/src/downloader/virtualFileHTTP.cxx index 527e9c619b..dcb9036d87 100644 --- a/panda/src/downloader/virtualFileHTTP.cxx +++ b/panda/src/downloader/virtualFileHTTP.cxx @@ -140,6 +140,26 @@ open_read_file(bool auto_unwrap) const { return return_file(strstream, auto_unwrap); } +/** + * Fills up the indicated pvector with the contents of the file, if it is a + * regular file. Returns true on success, false otherwise. + */ +bool VirtualFileHTTP:: +read_file(vector_uchar &result, bool auto_unwrap) const { + if (_status_only) { + return false; + } + + Ramfile ramfile; + if (!_channel->download_to_ram(&ramfile, false)) { + return false; + } + + const string &data = ramfile.get_data(); + std::copy(data.begin(), data.end(), std::back_inserter(result)); + return true; +} + /** * Downloads the entire file from the web server into the indicated iostream. * Returns true on success, false on failure. diff --git a/panda/src/downloader/virtualFileHTTP.h b/panda/src/downloader/virtualFileHTTP.h index eaf63f0465..219390f4aa 100644 --- a/panda/src/downloader/virtualFileHTTP.h +++ b/panda/src/downloader/virtualFileHTTP.h @@ -51,6 +51,8 @@ public: virtual std::streamsize get_file_size() const; virtual time_t get_timestamp() const; + virtual bool read_file(vector_uchar &result, bool auto_unwrap) const; + private: bool fetch_file(std::ostream *buffer_stream) const; std::istream *return_file(std::istream *buffer_stream, bool auto_unwrap) const;