Merge branch 'release/1.10.x'

This commit is contained in:
rdb 2024-03-12 15:39:16 +01:00
commit af27a9523c
8 changed files with 69 additions and 35 deletions

View File

@ -2317,7 +2317,9 @@ touch() const {
perror(os_specific.c_str());
return false;
}
close(fd);
if (close(fd) < 0) {
perror(os_specific.c_str());
}
return true;
}
perror(os_specific.c_str());
@ -2766,7 +2768,9 @@ atomic_compare_and_exchange_contents(string &orig_contents,
if (flock(fd, LOCK_EX) != 0) {
#endif
perror(os_specific.c_str());
close(fd);
if (close(fd) < 0) {
perror(os_specific.c_str());
}
return false;
}
@ -2778,7 +2782,9 @@ atomic_compare_and_exchange_contents(string &orig_contents,
if (bytes_read < 0) {
perror(os_specific.c_str());
close(fd);
if (close(fd) < 0) {
perror(os_specific.c_str());
}
return false;
}
@ -2789,7 +2795,9 @@ atomic_compare_and_exchange_contents(string &orig_contents,
ssize_t bytes_written = write(fd, new_contents.data(), new_contents.size());
if (bytes_written < 0) {
perror(os_specific.c_str());
close(fd);
if (close(fd) < 0) {
perror(os_specific.c_str());
}
return false;
}
}
@ -2882,7 +2890,9 @@ atomic_read_contents(string &contents) const {
if (flock(fd, LOCK_EX) != 0) {
#endif
perror(os_specific.c_str());
close(fd);
if (close(fd) < 0) {
perror(os_specific.c_str());
}
return false;
}
@ -2894,11 +2904,15 @@ atomic_read_contents(string &contents) const {
if (bytes_read < 0) {
perror(os_specific.c_str());
close(fd);
if (close(fd) < 0) {
perror(os_specific.c_str());
}
return false;
}
close(fd);
if (close(fd) < 0) {
perror(os_specific.c_str());
}
return true;
#endif // _WIN32
}

View File

@ -267,7 +267,15 @@ close() {
_handle = nullptr;
#else
if (_fd != -1) {
::close(_fd);
if (::close(_fd) < 0) {
#ifdef NDEBUG
perror("close");
#else
char *str = (char *)alloca(_filename.size() + 32);
sprintf(str, "close(%d \"%s\")", _fd, _filename.c_str());
perror(str);
#endif
}
}
_fd = -1;
#endif // _WIN32

View File

@ -3915,7 +3915,7 @@ write_function_for_name(ostream &out, Object *obj,
// None of the remaps take any keyword arguments, so let's check that
// we take none. This saves some checks later on.
indent(out, 4) << "if (kwds == nullptr || PyDict_GET_SIZE(kwds) == 0) {\n";
if (min_args == 1 && min_args == 1) {
if (min_args == 1 && max_args == 1) {
indent(out, 4) << " PyObject *arg = PyTuple_GET_ITEM(args, 0);\n";
always_returns = write_function_forset(out, mii->second, min_args,
max_args, expected_params, 6,

View File

@ -65,23 +65,21 @@ init_libpandagl() {
*/
int
get_pipe_type_pandagl() {
#ifdef HAVE_WGL
#if defined(HAVE_WGL)
return wglGraphicsPipe::get_class_type().get_index();
#endif
#ifdef HAVE_COCOA
#elif defined(HAVE_COCOA)
return CocoaGLGraphicsPipe::get_class_type().get_index();
#endif
#ifdef HAVE_GLX
#elif defined(HAVE_GLX)
return glxGraphicsPipe::get_class_type().get_index();
#endif
#ifdef HAVE_EGL
#elif defined(HAVE_EGL)
return eglGraphicsPipe::get_class_type().get_index();
#endif
#else
return 0;
#endif
}
#if defined(HAVE_EGL) && !defined(USE_X11)

View File

@ -2083,6 +2083,8 @@ fetch_specified_texture(Shader::ShaderTexSpec &spec, SamplerState &sampler,
const LightAttrib *target_light;
_target_rs->get_attrib_def(target_light);
PT(Texture) tex;
// We don't count ambient lights, which would be pretty silly to handle
// via this mechanism.
size_t num_lights = target_light->get_num_non_ambient_lights();
@ -2092,28 +2094,21 @@ fetch_specified_texture(Shader::ShaderTexSpec &spec, SamplerState &sampler,
Light *light_obj = light.node()->as_light();
nassertr(light_obj != nullptr, nullptr);
PT(Texture) tex;
LightLensNode *lln = DCAST(LightLensNode, light.node());
if (lln != nullptr && lln->_shadow_caster) {
tex = get_shadow_map(light);
} else {
tex = get_dummy_shadow_map((Texture::TextureType)spec._desired_type);
}
if (tex != nullptr) {
sampler = tex->get_default_sampler();
}
return tex;
} else {
// There is no such light assigned. Bind a dummy shadow map.
PT(Texture) tex = get_dummy_shadow_map((Texture::TextureType)spec._desired_type);
if (tex != nullptr) {
sampler = tex->get_default_sampler();
}
return tex;
tex = get_dummy_shadow_map((Texture::TextureType)spec._desired_type);
}
if (tex != nullptr) {
sampler = tex->get_default_sampler();
}
return tex;
}
break;
case Shader::STO_ff_stage_i:
{
@ -2181,7 +2176,6 @@ fetch_specified_texture(Shader::ShaderTexSpec &spec, SamplerState &sampler,
}
return default_add_tex;
}
break;
case Shader::STO_stage_normal_i:
{
@ -2211,7 +2205,6 @@ fetch_specified_texture(Shader::ShaderTexSpec &spec, SamplerState &sampler,
}
return default_normal_height_tex;
}
break;
case Shader::STO_stage_gloss_i:
{
@ -2264,7 +2257,6 @@ fetch_specified_texture(Shader::ShaderTexSpec &spec, SamplerState &sampler,
}
return default_normal_height_tex;
}
break;
case Shader::STO_stage_selector_i:
{

View File

@ -81,7 +81,11 @@ private:
inline bool Socket_IP::
ErrorClose() {
if (Active()) {
DO_CLOSE(_socket);
if (DO_CLOSE(_socket) != 0) {
#ifndef _WIN32
perror("Socket_IP::ErrorClose");
#endif
}
}
_socket = BAD_SOCKET;
@ -126,7 +130,11 @@ inline Socket_IP::
inline void Socket_IP::
Close() {
if (Active()) {
DO_CLOSE(_socket);
if (DO_CLOSE(_socket) != 0) {
#ifndef _WIN32
perror("Socket_IP::ErrorClose");
#endif
}
}
_socket = BAD_SOCKET;

View File

@ -134,6 +134,17 @@ PUBLISHED:
INLINE bool has_nonzero_shear() const;
INLINE bool has_mat() const;
#ifdef CPPPARSER
// Force interrogate to make a copy as a temporary solution for #1625.
LPoint3 get_pos() const;
LVecBase3 get_hpr() const;
LQuaternion get_quat() const;
LQuaternion get_norm_quat() const;
LVecBase3 get_scale() const;
PN_stdfloat get_uniform_scale() const;
LVecBase3 get_shear() const;
LMatrix4 get_mat() const;
#else
INLINE const LPoint3 &get_pos() const;
INLINE const LVecBase3 &get_hpr() const;
INLINE const LQuaternion &get_quat() const;
@ -142,6 +153,7 @@ PUBLISHED:
INLINE PN_stdfloat get_uniform_scale() const;
INLINE const LVecBase3 &get_shear() const;
INLINE const LMatrix4 &get_mat() const;
#endif
INLINE const LMatrix4 *get_inverse_mat() const;
INLINE LVecBase2 get_pos2d() const;

View File

@ -321,7 +321,9 @@ static int setup_logging(const char *path, int append) {
dup2(fd, 1);
dup2(fd, 2);
close(fd);
if (close(fd) < 0) {
perror("setup_logging: close");
}
return 1;
#endif
}