fastuidraw::c_array<uint8_t> fastuidraw::GlyphRenderDataCoverage:: coverage_values(void) { GlyphDataPrivate *d; d = reinterpret_cast<GlyphDataPrivate*>(m_d); return make_c_array(d->m_texels); }
static void fetch_resources(const T &src, std::vector<reference_counted_ptr<const resource_base> > *dst) { dst->resize(src.number_resources()); src.save_resources(make_c_array(*dst)); }
void initialize(const T &st, PackedValuePoolBase::Slot slot, PackedValuePoolBase *p) { this->initialize_common(slot, p); m_data.resize(st.data_size()); st.pack_data(make_c_array(m_data)); ResourceType::fetch_resources(st, &m_resources); BindImageType::fetch_bind_images(st, &m_bind_images); m_copy.copy_value(st); }
fastuidraw::c_array<const fastuidraw::ColorStop> fastuidraw::ColorStopSequence:: values(void) const { ColorStopSequencePrivate *d; d = static_cast<ColorStopSequencePrivate*>(m_d); if (d->m_dirty) { d->m_dirty = false; std::stable_sort(d->m_values.begin(), d->m_values.end()); } return make_c_array(d->m_values); }
enum fastuidraw::return_code fastuidraw::GlyphRenderDataCoverage:: upload_to_atlas(const GlyphAtlas::handle &atlas, GlyphLocation &atlas_location, GlyphLocation &secondary_atlas_location, int &geometry_offset, int &geometry_length) const { GlyphDataPrivate *d; d = reinterpret_cast<GlyphDataPrivate*>(m_d); atlas_location = atlas->allocate(d->m_resolution, make_c_array(d->m_texels)); secondary_atlas_location = GlyphLocation(); geometry_offset = -1; geometry_length = 0; return atlas_location.valid() ? routine_success : routine_fail; }
void compiler::compiler_main(const string& cpp_path, const string& out_path, const vector<string>& params) { /* Remove .so file to avoid overwriting, which causes problems when unloading servlets. Reason: before unloading a servlet the destroy methon needs to be called. If the servlet gets overwritten, then call'ing it's method causes a SEGV Don't check the return value. The file may not exist - this is not an error. In case of other errors - they will be reported later (presumably by the compiler, when trying to overwrite) */ unlink(out_path.c_str()); static const char* static_argv[] = { "/usr/bin/g++", "-shared", "-fPIC", "-o" }; static const size_t static_argv_size = 4; vector<string> args; args.reserve( sizeof(static_argv) + 2 + 2*includes_.size() + params.size() ); for(unsigned i=0; i<static_argv_size;++i) args.push_back(static_argv[i]); args.push_back(out_path); args.push_back(cpp_path); for(unsigned i=0; i<includes_.size(); ++i) { args.push_back("-I"); args.push_back(includes_[i]); } for(unsigned i=0; i<default_flags_.size(); ++i) args.push_back(default_flags_[i]); for(unsigned i=0; i<params.size(); ++i) args.push_back(params[i]); ofstream err("/tmp/cxxsp.log"); err << "\nThe full command is:\n\t"; for(unsigned i=1; i<args.size(); ++i) err << args[i] << ' '; err << endl; err.close(); /* Note: No need for memory management. In a momemt this process will exit and all the memory will be freed */ char** argv = make_c_array(args); if(execv(static_argv[0], argv) == -1) { perror("Failed to execute the compiler"); cerr << "\nThe full command is:\n\t"; for(unsigned i=1; i<args.size(); ++i) cerr << args[i] << ' '; cerr << endl; exit(111); } exit(222); }
/* **| method: object search ( mapping params ); **| This is the preferred way of calling this method. ** **| alt: object search ( string filter ); **| alt: object search ( string filter, array attrs ); **| alt: object search ( string filter, array attrs, int attrsonly ); **| alt: object search ( string filter, array attrs, int attrsonly, int timeout ); ** **| general: search the LDAP directory for the specified entry **| (entries). The first form is the preferred one as it **| encompasses all the current and future parameters as expected **| by the underlying API. The following fields are read from the **| mapping:@nl **| **| @list **| * base - the base DN to use in this search. Overrides the **| default base DN (as set with set_base_dn) **| * scope - the search scope for this search. Overrides the **| default scope (as set with set_scope) **| * filter - the search filter. The BNF for the filter is as **| follows: **| @pre **| <filter> ::= `(' <filtercomp> `)' **| <filtercomp> ::= <and> | <or> | <not> | <simple> **| <and> ::= `&' <filterlist> **| <or> ::= `|' <filterlist> **| <not> ::= `!' <filter> **| <filterlist> ::= <filter> | <filter> <filterlist> **| <simple> ::= <attributetype> <filtertype> <attributevalue> **| <filtertype> ::= `=' | `~=' | `<=' | `>=' **| @pre_end **| * attrs - search attributes. An array of attribute types to **| return in the result. If absent, all types will be returned. **| * attrsonly - if != then the result will contain attribute **| types only - no values shall be returned. **| * timeout - the timeout, in seconds, after which the call **| should return if the search isn't finished. **| @list_end */ static void f_ldap_search(INT32 args) { char *filter; int scope; struct pike_string *base; char **attrs; int attrsonly; struct timeval *timeout; LDAPMessage *res; int ret; struct object *obj; if (!THIS->bound) Pike_error("OpenLDAP.Client: attempting operation on an unbound connection\n"); if (!args) Pike_error("OpenLDAP.Client->search() requires at least one argument\n"); if (args == 1) { switch(ARG(1).type) { case T_MAPPING: { /* the new style case */ struct svalue *val; struct mapping *m = ARG(1).u.mapping; /* * m->base */ val = low_mapping_string_lookup(m, base_str); if (!val || val->type != T_STRING) base = THIS->basedn; else base = val->u.string; /* * m->scope */ val = low_mapping_string_lookup(m, scope_str); if (!val || val->type != T_INT) scope = THIS->scope; else scope = val->u.integer; /* * m->filter */ val = low_mapping_string_lookup(m, filter_str); if (!val || val->type != T_STRING) filter = OL_DEF_FILTER; else filter = val->u.string->str; /* * m->attrs */ val = low_mapping_string_lookup(m, attrs_str); if (!val || val->type != T_ARRAY) attrs = NULL; else attrs = make_c_array(val); /* * m->attrsonly */ val = low_mapping_string_lookup(m, attrsonly_str); if (!val || val->type != T_INT) attrsonly = 0; else attrsonly = val->u.integer != 0; /* * m->timeout */ val = low_mapping_string_lookup(m, timeout_str); if (!val || val->type != T_INT) timeout = NULL; else timeout = make_timeout(val->u.integer); /*TEMPORARY*/ break; } case T_STRING: /* the old style case */ base = THIS->basedn; scope = THIS->scope; filter = ARG(1).u.string->str; attrs = NULL; attrsonly = 0; timeout = NULL; break; default: Pike_error("OpenLDAP.Client->search() with single argument requires either a mapping or a string\n"); break; } } else switch(args) { case 4: /* timeout */ if (ARG(4).type != T_INT) Pike_error("OpenLDAP.Client->search(): argument 4 must be an integer\n"); else timeout = make_timeout(ARG(4).u.integer); /* fall through */ case 3: /* attrsonly */ if (ARG(3).type != T_INT) Pike_error("OpenLDAP.Client->search(): argument 3 must be an integer\n"); else attrsonly = ARG(3).u.integer != 0; /* fall through */ case 2: /* attrs */ if (ARG(2).type != T_ARRAY) Pike_error("OpenLDAP.Client->search(): argument 2 must be an array\n"); else attrs = make_c_array(&ARG(2)); base = THIS->basedn; scope = THIS->scope; filter = ARG(1).u.string->str; attrsonly = 0; timeout = NULL; break; default: Pike_error("OpenLDAP.Client->search(): incorrect number of arguments\n"); break; } ret = timeout ? ldap_search_st(THIS->conn, base->str, scope, filter, attrs, attrsonly, timeout, &res) : ldap_search_s(THIS->conn, base->str, scope, filter, attrs, attrsonly, &res); if (ret) Pike_error("OpenLDAP.Client->search(): %s\n", ldap_err2string(ret)); pop_n_elems(args); THIS->data = res; obj = clone_object(result_program, 0); push_object(obj); if (attrs) free(attrs); }