From 7026854cc2c118e238fed1bfa2e1f01f6a75e969 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 5 Jul 2015 16:07:08 +0200 Subject: [PATCH] Fixes to get the C binding generator to work --- dtool/src/cppparser/cppArrayType.cxx | 11 ++-- dtool/src/cppparser/cppBison.yxx | 10 ++-- dtool/src/cppparser/cppType.cxx | 6 +++ dtool/src/cppparser/cppTypedefType.cxx | 2 +- dtool/src/interrogate/functionRemap.cxx | 50 +++++++++++++++---- dtool/src/interrogate/functionRemap.h | 4 +- dtool/src/interrogate/interfaceMaker.cxx | 8 +-- dtool/src/interrogate/interfaceMakerC.cxx | 18 +++++-- .../interfaceMakerPythonNative.cxx | 19 +++---- dtool/src/interrogate/interrogateBuilder.cxx | 6 +++ .../parameterRemapBasicStringPtrToString.cxx | 16 +++++- .../parameterRemapBasicStringRefToString.cxx | 16 +++++- .../parameterRemapBasicStringToString.cxx | 18 +++++-- .../parameterRemapBasicStringToString.h | 2 +- .../interrogate/parameterRemapToString.cxx | 2 +- dtool/src/parser-inc/iostream | 6 ++- dtool/src/parser-inc/stdint.h | 2 +- dtool/src/parser-inc/stdtypedefs.h | 4 +- panda/src/downloader/httpClient.h | 3 +- panda/src/downloader/stringStream.h | 2 + panda/src/egg/eggGroup.I | 2 +- panda/src/pgraph/geomNode.h | 2 +- 22 files changed, 153 insertions(+), 56 deletions(-) diff --git a/dtool/src/cppparser/cppArrayType.cxx b/dtool/src/cppparser/cppArrayType.cxx index 4b044fb766..fa23f26e0f 100644 --- a/dtool/src/cppparser/cppArrayType.cxx +++ b/dtool/src/cppparser/cppArrayType.cxx @@ -217,11 +217,11 @@ is_equal(const CPPDeclaration *other) const { if (*_bounds != *ot->_bounds) { return false; } - } else if (_bounds == NULL || ot->_bounds == NULL) { + } else if ((_bounds == NULL) != (ot->_bounds == NULL)) { return false; } - return _element_type == ot->_element_type; + return *_element_type == *ot->_element_type; } @@ -241,10 +241,13 @@ is_less(const CPPDeclaration *other) const { if (*_bounds != *ot->_bounds) { return *_bounds < *ot->_bounds; } - } else if (_bounds == NULL || ot->_bounds == NULL) { + } else if ((_bounds == NULL) != (ot->_bounds == NULL)) { return _bounds < ot->_bounds; } - return _element_type < ot->_element_type; + if (*_element_type != *ot->_element_type) { + return *_element_type < *ot->_element_type; + } + return false; } diff --git a/dtool/src/cppparser/cppBison.yxx b/dtool/src/cppparser/cppBison.yxx index 87c4f5cd17..644fcac1de 100644 --- a/dtool/src/cppparser/cppBison.yxx +++ b/dtool/src/cppparser/cppBison.yxx @@ -724,7 +724,7 @@ typedef_declaration: inst->_storage_class |= (current_storage_class | $1); current_scope->add_declaration(inst, global_scope, current_lexer, @2); CPPTypedefType *typedef_type = new CPPTypedefType(inst->_type, inst->_ident, current_scope); - current_scope->add_declaration(typedef_type, global_scope, current_lexer, @2); + current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, @2); } } } @@ -735,13 +735,13 @@ typedef_instance_identifiers: { CPPType *target_type = current_type; CPPTypedefType *typedef_type = new CPPTypedefType(target_type, $1, current_scope, @1.file); - current_scope->add_declaration(typedef_type, global_scope, current_lexer, @1); + current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, @1); } | instance_identifier maybe_initialize ',' typedef_instance_identifiers { CPPType *target_type = current_type; CPPTypedefType *typedef_type = new CPPTypedefType(target_type, $1, current_scope, @1.file); - current_scope->add_declaration(typedef_type, global_scope, current_lexer, @1); + current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, @1); } ; @@ -751,14 +751,14 @@ typedef_const_instance_identifiers: $1->add_modifier(IIT_const); CPPType *target_type = current_type; CPPTypedefType *typedef_type = new CPPTypedefType(target_type, $1, current_scope, @1.file); - current_scope->add_declaration(typedef_type, global_scope, current_lexer, @1); + current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, @1); } | instance_identifier maybe_initialize ',' typedef_const_instance_identifiers { $1->add_modifier(IIT_const); CPPType *target_type = current_type; CPPTypedefType *typedef_type = new CPPTypedefType(target_type, $1, current_scope, @1.file); - current_scope->add_declaration(typedef_type, global_scope, current_lexer, @1); + current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, @1); } ; diff --git a/dtool/src/cppparser/cppType.cxx b/dtool/src/cppparser/cppType.cxx index daceeb1d26..c94cfbd759 100644 --- a/dtool/src/cppparser/cppType.cxx +++ b/dtool/src/cppparser/cppType.cxx @@ -323,6 +323,12 @@ new_type(CPPType *type) { return type; } + // If this triggers, we probably messed up by defining is_less() + // incorrectly; they provide a relative ordering even though they + // are equal to each other. Or, we provided an is_equal() that + // gives false negatives. + assert(**result.first == *type); + // The insertion has not taken place; thus, there was previously // another equivalent type declared. if (*result.first != type) { diff --git a/dtool/src/cppparser/cppTypedefType.cxx b/dtool/src/cppparser/cppTypedefType.cxx index 89924b3cc1..1cc31e4b4e 100644 --- a/dtool/src/cppparser/cppTypedefType.cxx +++ b/dtool/src/cppparser/cppTypedefType.cxx @@ -381,7 +381,7 @@ is_equal(const CPPDeclaration *other) const { const CPPTypedefType *ot = ((CPPDeclaration *)other)->as_typedef_type(); assert(ot != NULL); - return (_type == ot->_type) && (*_ident == *ot->_ident); + return (*_type == *ot->_type) && (*_ident == *ot->_ident); } //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogate/functionRemap.cxx b/dtool/src/interrogate/functionRemap.cxx index 25a2848112..4206931d13 100644 --- a/dtool/src/interrogate/functionRemap.cxx +++ b/dtool/src/interrogate/functionRemap.cxx @@ -94,9 +94,29 @@ get_parameter_name(int n) const { // Access: Public // Description: Writes a sequence of commands to the given output // stream to call the wrapped function. The parameter -// values are taken from pexprs, if it is nonempty, or -// are assumed to be simply the names of the parameters, -// if it is empty. +// values are assumed to be simply the names of the +// parameters. +// +// The return value is the expression to return, if we +// are returning a value, or the empty string if we +// return nothing. +//////////////////////////////////////////////////////////////////// +string FunctionRemap:: +call_function(ostream &out, int indent_level, bool convert_result, + const string &container) const { + vector_string pexprs; + for (int i = 0; i < _parameters.size(); ++i) { + pexprs.push_back(get_parameter_name(i)); + } + return call_function(out, indent_level, convert_result, container, pexprs); +} + +//////////////////////////////////////////////////////////////////// +// Function: FunctionRemap::call_function +// Access: Public +// Description: Writes a sequence of commands to the given output +// stream to call the wrapped function. The parameter +// values are taken from pexprs. // // The return value is the expression to return, if we // are returning a value, or the empty string if we @@ -219,7 +239,7 @@ call_function(ostream &out, int indent_level, bool convert_result, string call = get_call_str(container, pexprs); if (!convert_result) { - return_expr = get_call_str(container, pexprs); + return_expr = call; } else { //if (_return_type->return_value_should_be_simple()) { @@ -371,23 +391,35 @@ get_call_str(const string &container, const vector_string &pexprs) const { // Getters and setters are a special case. if (_type == T_getter) { - if (!container.empty()) { + if (_has_this && !container.empty()) { call << "(" << container << ")->" << _expression; } else { call << _expression; } } else if (_type == T_setter) { - if (!container.empty()) { - call << "(" << container << ")->" << _expression; + string expr; + if (_has_this && !container.empty()) { + expr = "(" + container + ")->" + _expression; } else { - call << _expression; + expr = _expression; + } + + // It's not possible to assign arrays in C++, we have to copy them. + CPPArrayType *array_type = _parameters[_first_true_parameter]._remap->get_orig_type()->as_array_type(); + if (array_type != NULL) { + call << "std::copy(" << expr << ", " << expr << " + " << *array_type->_bounds << ", "; + } else { + call << expr << " = "; } - call << " = "; _parameters[_first_true_parameter]._remap->pass_parameter(call, get_parameter_expr(_first_true_parameter, pexprs)); + if (array_type != NULL) { + call << ')'; + } + } else { const char *separator = ""; diff --git a/dtool/src/interrogate/functionRemap.h b/dtool/src/interrogate/functionRemap.h index 969aa3b969..6a4477ba56 100644 --- a/dtool/src/interrogate/functionRemap.h +++ b/dtool/src/interrogate/functionRemap.h @@ -52,9 +52,11 @@ public: ~FunctionRemap(); string get_parameter_name(int n) const; + string call_function(ostream &out, int indent_level, + bool convert_result, const string &container) const; string call_function(ostream &out, int indent_level, bool convert_result, const string &container, - const vector_string &pexprs = vector_string()) const; + const vector_string &pexprs) const; void write_orig_prototype(ostream &out, int indent_level, bool local=false, int num_default_args=0) const; diff --git a/dtool/src/interrogate/interfaceMaker.cxx b/dtool/src/interrogate/interfaceMaker.cxx index 03398895b8..b8ec0c7c7f 100644 --- a/dtool/src/interrogate/interfaceMaker.cxx +++ b/dtool/src/interrogate/interfaceMaker.cxx @@ -442,8 +442,8 @@ remap_parameter(CPPType *struct_type, CPPType *param_type) { return new ParameterRemapEnumToInt(param_type); */ - } else if (TypeManager::is_const_simple(param_type)) { - return new ParameterRemapConstToNonConst(param_type); + //} else if (TypeManager::is_const_simple(param_type)) { + // return new ParameterRemapConstToNonConst(param_type); } else if (TypeManager::is_const_ref_to_simple(param_type)) { return new ParameterRemapReferenceToConcrete(param_type); @@ -833,9 +833,9 @@ manage_return_value(ostream &out, int indent_level, indent(out, indent_level) << "if (" << return_expr << " != (" - << remap->_return_type->get_new_type()->get_local_name(&parser) << ")0) {\n"; + << remap->_return_type->get_new_type()->get_local_name(&parser) << ")NULL) {\n"; indent(out, indent_level + 2) - << return_expr << "->ref();\n"; + << "(" << return_expr << ")->ref();\n"; indent(out, indent_level) << "}\n"; output_ref(out, indent_level, remap, "refcount"); diff --git a/dtool/src/interrogate/interfaceMakerC.cxx b/dtool/src/interrogate/interfaceMakerC.cxx index a1019241ed..c693bf7689 100644 --- a/dtool/src/interrogate/interfaceMakerC.cxx +++ b/dtool/src/interrogate/interfaceMakerC.cxx @@ -173,13 +173,17 @@ write_function_for(ostream &out, InterfaceMaker::Function *func) { void InterfaceMakerC:: write_function_instance(ostream &out, InterfaceMaker::Function *func, FunctionRemap *remap) { + if (remap->_extension || (remap->_flags & FunctionRemap::F_explicit_self)) { + return; + } + out << "/*\n" << " * C wrapper for\n" << " * "; remap->write_orig_prototype(out, 0); out << "\n" << " */\n"; - + if (!output_function_names) { // If we're not saving the function names, don't export it from // the library. @@ -192,17 +196,17 @@ write_function_instance(ostream &out, InterfaceMaker::Function *func, if (generate_spam) { write_spam_message(out, remap); } - - string return_expr = + + string return_expr = remap->call_function(out, 2, true, "param0"); return_expr = manage_return_value(out, 2, remap, return_expr); if (!return_expr.empty()) { out << " return " << return_expr << ";\n"; } - + out << "}\n\n"; } - + //////////////////////////////////////////////////////////////////// // Function: InterfaceMakerC::write_function_header // Access: Private @@ -212,6 +216,10 @@ write_function_instance(ostream &out, InterfaceMaker::Function *func, void InterfaceMakerC:: write_function_header(ostream &out, InterfaceMaker::Function *func, FunctionRemap *remap, bool newline) { + if (remap->_extension || (remap->_flags & FunctionRemap::F_explicit_self)) { + return; + } + if (remap->_void_return) { out << "void"; } else { diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index 9bae13353f..f0990dd0d8 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -4748,8 +4748,7 @@ write_function_instance(ostream &out, FunctionRemap *remap, << "PyUnicode_AsWideChar(" << param_name << ", " << param_name << "_str, " << param_name << "_len);\n" << "#endif\n"; - pexpr_string = "std::wstring(" + - param_name + "_str, " + param_name + "_len)"; + pexpr_string = param_name + "_str, " + param_name + "_len"; extra_cleanup << "#if PY_VERSION_HEX >= 0x03030000\n" @@ -4774,8 +4773,7 @@ write_function_instance(ostream &out, FunctionRemap *remap, << "PyUnicode_AsWideChar(" << param_name << ", " << param_name << "_str, " << param_name << "_len);\n" << "#endif\n"; - pexpr_string = "&std::wstring(" + - param_name + "_str, " + param_name + "_len)"; + pexpr_string = param_name + "_str, " + param_name + "_len"; extra_cleanup << "#if PY_VERSION_HEX >= 0x03030000\n" @@ -4822,13 +4820,12 @@ write_function_instance(ostream &out, FunctionRemap *remap, + "_str, &" + param_name + "_len"; } - if (TypeManager::is_const_ptr_to_basic_string_char(orig_type)) { - pexpr_string = "&std::string(" + - param_name + "_str, " + param_name + "_len)"; - } else { - pexpr_string = "std::string(" + - param_name + "_str, " + param_name + "_len)"; - } +// if (TypeManager::is_const_ptr_to_basic_string_char(orig_type)) { +// pexpr_string = "&std::string(" + +// param_name + "_str, " + param_name + "_len)"; +// } else { + pexpr_string = param_name + "_str, " + param_name + "_len"; +// } expected_params += "str"; } // Remember to clear the TypeError that any of the above methods raise. diff --git a/dtool/src/interrogate/interrogateBuilder.cxx b/dtool/src/interrogate/interrogateBuilder.cxx index 6563132bf4..e6babb17f7 100644 --- a/dtool/src/interrogate/interrogateBuilder.cxx +++ b/dtool/src/interrogate/interrogateBuilder.cxx @@ -1537,6 +1537,12 @@ get_getter(CPPType *expr_type, string expression, assert(expr_type != (CPPType *)NULL); } + // We can't return an array from a function, but we can decay it + // into a pointer. + while (expr_type->get_subtype() == CPPDeclaration::ST_array) { + expr_type = CPPType::new_type(new CPPPointerType(expr_type->as_array_type()->_element_type)); + } + // Make up a CPPFunctionType. CPPParameterList *params = new CPPParameterList; CPPFunctionType *ftype = new CPPFunctionType(expr_type, params, 0); diff --git a/dtool/src/interrogate/parameterRemapBasicStringPtrToString.cxx b/dtool/src/interrogate/parameterRemapBasicStringPtrToString.cxx index bb111935b2..42ae0ecd5e 100644 --- a/dtool/src/interrogate/parameterRemapBasicStringPtrToString.cxx +++ b/dtool/src/interrogate/parameterRemapBasicStringPtrToString.cxx @@ -23,6 +23,12 @@ ParameterRemapBasicStringPtrToString:: ParameterRemapBasicStringPtrToString(CPPType *orig_type) : ParameterRemapToString(orig_type) { + static CPPType *const_char_star_type = (CPPType *)NULL; + if (const_char_star_type == (CPPType *)NULL) { + const_char_star_type = parser.parse_type("const char *"); + } + + _new_type = const_char_star_type; } //////////////////////////////////////////////////////////////////// @@ -34,7 +40,7 @@ ParameterRemapBasicStringPtrToString(CPPType *orig_type) : //////////////////////////////////////////////////////////////////// void ParameterRemapBasicStringPtrToString:: pass_parameter(ostream &out, const string &variable_name) { - out << "&" << variable_name; + out << "&std::string(" << variable_name << ")"; } //////////////////////////////////////////////////////////////////// @@ -58,6 +64,12 @@ ParameterRemapBasicWStringPtrToWString:: ParameterRemapBasicWStringPtrToWString(CPPType *orig_type) : ParameterRemapToWString(orig_type) { + static CPPType *const_wchar_star_type = (CPPType *)NULL; + if (const_wchar_star_type == (CPPType *)NULL) { + const_wchar_star_type = parser.parse_type("const wchar_t *"); + } + + _new_type = const_wchar_star_type; } //////////////////////////////////////////////////////////////////// @@ -69,7 +81,7 @@ ParameterRemapBasicWStringPtrToWString(CPPType *orig_type) : //////////////////////////////////////////////////////////////////// void ParameterRemapBasicWStringPtrToWString:: pass_parameter(ostream &out, const string &variable_name) { - out << "&" << variable_name; + out << "&std::wstring(" << variable_name << ")"; } //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogate/parameterRemapBasicStringRefToString.cxx b/dtool/src/interrogate/parameterRemapBasicStringRefToString.cxx index 6025d395c6..4e264c45d3 100644 --- a/dtool/src/interrogate/parameterRemapBasicStringRefToString.cxx +++ b/dtool/src/interrogate/parameterRemapBasicStringRefToString.cxx @@ -23,6 +23,12 @@ ParameterRemapBasicStringRefToString:: ParameterRemapBasicStringRefToString(CPPType *orig_type) : ParameterRemapToString(orig_type) { + static CPPType *const_char_star_type = (CPPType *)NULL; + if (const_char_star_type == (CPPType *)NULL) { + const_char_star_type = parser.parse_type("const char *"); + } + + _new_type = const_char_star_type; } //////////////////////////////////////////////////////////////////// @@ -34,7 +40,7 @@ ParameterRemapBasicStringRefToString(CPPType *orig_type) : //////////////////////////////////////////////////////////////////// void ParameterRemapBasicStringRefToString:: pass_parameter(ostream &out, const string &variable_name) { - out << variable_name; + out << "std::string(" << variable_name << ")"; } //////////////////////////////////////////////////////////////////// @@ -58,6 +64,12 @@ ParameterRemapBasicWStringRefToWString:: ParameterRemapBasicWStringRefToWString(CPPType *orig_type) : ParameterRemapToWString(orig_type) { + static CPPType *const_wchar_star_type = (CPPType *)NULL; + if (const_wchar_star_type == (CPPType *)NULL) { + const_wchar_star_type = parser.parse_type("const wchar_t *"); + } + + _new_type = const_wchar_star_type; } //////////////////////////////////////////////////////////////////// @@ -69,7 +81,7 @@ ParameterRemapBasicWStringRefToWString(CPPType *orig_type) : //////////////////////////////////////////////////////////////////// void ParameterRemapBasicWStringRefToWString:: pass_parameter(ostream &out, const string &variable_name) { - out << variable_name; + out << "std::wstring(" << variable_name << ")"; } //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogate/parameterRemapBasicStringToString.cxx b/dtool/src/interrogate/parameterRemapBasicStringToString.cxx index 3fdcc44042..3cd22933a9 100644 --- a/dtool/src/interrogate/parameterRemapBasicStringToString.cxx +++ b/dtool/src/interrogate/parameterRemapBasicStringToString.cxx @@ -24,6 +24,12 @@ ParameterRemapBasicStringToString:: ParameterRemapBasicStringToString(CPPType *orig_type) : ParameterRemapToString(orig_type) { + static CPPType *const_char_star_type = (CPPType *)NULL; + if (const_char_star_type == (CPPType *)NULL) { + const_char_star_type = parser.parse_type("const char *"); + } + + _new_type = const_char_star_type; } //////////////////////////////////////////////////////////////////// @@ -35,7 +41,7 @@ ParameterRemapBasicStringToString(CPPType *orig_type) : //////////////////////////////////////////////////////////////////// void ParameterRemapBasicStringToString:: pass_parameter(ostream &out, const string &variable_name) { - out << variable_name; + out << "std::string(" << variable_name << ")"; } //////////////////////////////////////////////////////////////////// @@ -73,8 +79,14 @@ get_return_expr(const string &expression) { //////////////////////////////////////////////////////////////////// ParameterRemapBasicWStringToWString:: ParameterRemapBasicWStringToWString(CPPType *orig_type) : - ParameterRemapToString(orig_type) + ParameterRemapToWString(orig_type) { + static CPPType *const_wchar_star_type = (CPPType *)NULL; + if (const_wchar_star_type == (CPPType *)NULL) { + const_wchar_star_type = parser.parse_type("const wchar_t *"); + } + + _new_type = const_wchar_star_type; } //////////////////////////////////////////////////////////////////// @@ -86,7 +98,7 @@ ParameterRemapBasicWStringToWString(CPPType *orig_type) : //////////////////////////////////////////////////////////////////// void ParameterRemapBasicWStringToWString:: pass_parameter(ostream &out, const string &variable_name) { - out << variable_name; + out << "std::wstring(" << variable_name << ")"; } //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogate/parameterRemapBasicStringToString.h b/dtool/src/interrogate/parameterRemapBasicStringToString.h index 877ebad035..63678a8354 100644 --- a/dtool/src/interrogate/parameterRemapBasicStringToString.h +++ b/dtool/src/interrogate/parameterRemapBasicStringToString.h @@ -39,7 +39,7 @@ public: // Description : Maps a concrete basic_string to an atomic // string. //////////////////////////////////////////////////////////////////// -class ParameterRemapBasicWStringToWString : public ParameterRemapToString { +class ParameterRemapBasicWStringToWString : public ParameterRemapToWString { public: ParameterRemapBasicWStringToWString(CPPType *orig_type); diff --git a/dtool/src/interrogate/parameterRemapToString.cxx b/dtool/src/interrogate/parameterRemapToString.cxx index 362cd89691..fd41c9bbe3 100644 --- a/dtool/src/interrogate/parameterRemapToString.cxx +++ b/dtool/src/interrogate/parameterRemapToString.cxx @@ -35,7 +35,7 @@ ParameterRemapToString(CPPType *orig_type) : const_char_star_type = parser.parse_type("const char *"); } - if (TypeManager::is_const(orig_type)) { + if (TypeManager::is_const_char_pointer(orig_type) || TypeManager::is_string(orig_type)) { _new_type = const_char_star_type; } else { _new_type = char_star_type; diff --git a/dtool/src/parser-inc/iostream b/dtool/src/parser-inc/iostream index 5cd485d04d..5da002182a 100644 --- a/dtool/src/parser-inc/iostream +++ b/dtool/src/parser-inc/iostream @@ -59,6 +59,10 @@ __published: bool bad() const; void clear(); }; + +// We actually want to wrap streampos as streamoff. +#define streampos streamoff + class ostream : virtual public ios { __published: void put(char c); @@ -104,6 +108,6 @@ extern istream cin; extern ostream cout; extern ostream cerr; -typedef int streampos; +typedef long streamoff; #endif diff --git a/dtool/src/parser-inc/stdint.h b/dtool/src/parser-inc/stdint.h index 060dbf82e7..11fba7a776 100644 --- a/dtool/src/parser-inc/stdint.h +++ b/dtool/src/parser-inc/stdint.h @@ -15,7 +15,7 @@ #ifndef _STDINT_H #define _STDINT_H -#ifdef _LP64 +#if defined(_LP64) || defined(_WIN64) #define __WORDSIZE 64 #else #define __WORDSIZE 32 diff --git a/dtool/src/parser-inc/stdtypedefs.h b/dtool/src/parser-inc/stdtypedefs.h index 56d95508f7..345eda1fd0 100644 --- a/dtool/src/parser-inc/stdtypedefs.h +++ b/dtool/src/parser-inc/stdtypedefs.h @@ -20,8 +20,8 @@ #ifndef STDTYPEDEFS_H #define STDTYPEDEFS_H #ifndef __APPLE__ -typedef unsigned int size_t; -typedef int ssize_t; +typedef unsigned long size_t; +typedef long ssize_t; typedef int off_t; typedef unsigned int time_t; typedef int clock_t; diff --git a/panda/src/downloader/httpClient.h b/panda/src/downloader/httpClient.h index 5d6b0c8aea..cabc03c924 100644 --- a/panda/src/downloader/httpClient.h +++ b/panda/src/downloader/httpClient.h @@ -77,7 +77,6 @@ PUBLISHED: void clear_direct_host(); void add_direct_host(const string &hostname); - void get_proxies_for_url(const URLSpec &url, pvector &proxies) const; string get_proxies_for_url(const URLSpec &url) const; void set_username(const string &server, const string &realm, const string &username); @@ -134,6 +133,8 @@ PUBLISHED: static HTTPClient *get_global_ptr(); public: + void get_proxies_for_url(const URLSpec &url, pvector &proxies) const; + SSL_CTX *get_ssl_ctx(); private: diff --git a/panda/src/downloader/stringStream.h b/panda/src/downloader/stringStream.h index 366f0d1394..d90314c46e 100644 --- a/panda/src/downloader/stringStream.h +++ b/panda/src/downloader/stringStream.h @@ -34,6 +34,8 @@ PUBLISHED: INLINE string get_data(); INLINE void set_data(const string &data); + +public: INLINE void swap_data(pvector &data); private: diff --git a/panda/src/egg/eggGroup.I b/panda/src/egg/eggGroup.I index 64bc0c843d..f88d7c40c0 100644 --- a/panda/src/egg/eggGroup.I +++ b/panda/src/egg/eggGroup.I @@ -1018,7 +1018,7 @@ tag_end() const { //////////////////////////////////////////////////////////////////// // Function: EggGroup::tag_size -// Access: Published +// Access: Public // Description: Returns the number of elements between tag_begin() // and tag_end(). // diff --git a/panda/src/pgraph/geomNode.h b/panda/src/pgraph/geomNode.h index 285783df99..cfdbd85e2c 100644 --- a/panda/src/pgraph/geomNode.h +++ b/panda/src/pgraph/geomNode.h @@ -36,7 +36,7 @@ class GraphicsStateGuardianBase; //////////////////////////////////////////////////////////////////// class EXPCL_PANDA_PGRAPH GeomNode : public PandaNode { PUBLISHED: - GeomNode(const string &name); + explicit GeomNode(const string &name); protected: GeomNode(const GeomNode ©);