本文整理汇总了C++中RETURN_STRINGL函数的典型用法代码示例。如果您正苦于以下问题:C++ RETURN_STRINGL函数的具体用法?C++ RETURN_STRINGL怎么用?C++ RETURN_STRINGL使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RETURN_STRINGL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: php_hash_do_hash
static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_bool raw_output_default) /* {{{ */
{
char *algo, *data, *digest;
int algo_len, data_len;
zend_bool raw_output = raw_output_default;
const php_hash_ops *ops;
void *context;
php_stream *stream = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|b", &algo, &algo_len, &data, &data_len, &raw_output) == FAILURE) {
return;
}
ops = php_hash_fetch_ops(algo, algo_len);
if (!ops) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown hashing algorithm: %s", algo);
RETURN_FALSE;
}
if (isfilename) {
if (CHECK_NULL_PATH(data, data_len)) {
RETURN_FALSE;
}
stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS, NULL, DEFAULT_CONTEXT);
if (!stream) {
/* Stream will report errors opening file */
RETURN_FALSE;
}
}
context = emalloc(ops->context_size);
ops->hash_init(context);
if (isfilename) {
char buf[1024];
int n;
while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
ops->hash_update(context, (unsigned char *) buf, n);
}
php_stream_close(stream);
} else {
ops->hash_update(context, (unsigned char *) data, data_len);
}
digest = emalloc(ops->digest_size + 1);
ops->hash_final((unsigned char *) digest, context);
efree(context);
if (raw_output) {
digest[ops->digest_size] = 0;
RETURN_STRINGL(digest, ops->digest_size, 0);
} else {
char *hex_digest = safe_emalloc(ops->digest_size, 2, 1);
php_hash_bin2hex(hex_digest, (unsigned char *) digest, ops->digest_size);
hex_digest[2 * ops->digest_size] = 0;
efree(digest);
RETURN_STRINGL(hex_digest, 2 * ops->digest_size, 0);
}
}
示例2: ZEND_METHOD
/* ArchiveReader::getCurrentEntryData {{{
*
*/
ZEND_METHOD(ArchiveReader, getCurrentEntryData)
{
zval *this = getThis();
archive_file_t *arch;
int result, error_num;
size_t len;
off_t offset;
const char *error_string;
char *buf;
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, ce_ArchiveException, &error_handling TSRMLS_CC);
if (!_archive_get_fd(this, &arch TSRMLS_CC)) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
if (arch->current_entry == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Current archive entry is not available");
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
if (arch->current_entry->data) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
RETURN_STRINGL(arch->current_entry->data, arch->current_entry->data_len, 1);
}
while ((result = archive_read_data_block(arch->arch, (const void **)&buf, &len, &offset)) == ARCHIVE_OK) {
arch->current_entry->data = erealloc(arch->current_entry->data, arch->current_entry->data_len + len + 1);
memcpy(arch->current_entry->data + arch->current_entry->data_len, buf, len);
arch->current_entry->data_len += len;
}
if (result && result != ARCHIVE_EOF) {
error_num = archive_errno(arch->arch);
error_string = archive_error_string(arch->arch);
if (error_num && error_string) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to read entry data: error #%d, %s", error_num, error_string);
}
else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to read entry data: unknown error %d", result);
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
RETURN_STRINGL(arch->current_entry->data, arch->current_entry->data_len, 1);
}
示例3: PHP_FUNCTION
/* {{{ proto string zlib_get_coding_type(void)
Returns the coding type used for output compression */
static PHP_FUNCTION(zlib_get_coding_type)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}
switch (ZLIBG(compression_coding)) {
case PHP_ZLIB_ENCODING_GZIP:
RETURN_STRINGL("gzip", sizeof("gzip") - 1);
case PHP_ZLIB_ENCODING_DEFLATE:
RETURN_STRINGL("deflate", sizeof("deflate") - 1);
default:
RETURN_FALSE;
}
}
示例4: PHP_FUNCTION
U_CFUNC PHP_FUNCTION(rbbi_get_binary_rules)
{
BREAKITER_METHOD_INIT_VARS;
object = getThis();
if (zend_parse_parameters_none() == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"rbbi_get_binary_rules: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
}
BREAKITER_METHOD_FETCH_OBJECT;
uint32_t rules_len;
const uint8_t *rules = fetch_rbbi(bio)->getBinaryRules(rules_len);
if (rules_len > INT_MAX - 1) {
intl_errors_set(BREAKITER_ERROR_P(bio), BREAKITER_ERROR_CODE(bio),
"rbbi_get_binary_rules: the rules are too large",
0 TSRMLS_CC);
RETURN_FALSE;
}
char *ret_rules = static_cast<char*>(emalloc(rules_len + 1));
memcpy(ret_rules, rules, rules_len);
ret_rules[rules_len] = '\0';
RETURN_STRINGL(ret_rules, rules_len, 0);
}
示例5: PHP_METHOD
PHP_METHOD(MTF, change_flag) {
char *loginname = NULL;
int loginname_len;
char *flag = NULL;
int flag_len;
char *strg;
int len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &loginname, &loginname_len, &flag, &flag_len) == FAILURE) {
return;
}
zval *attrs, *obj;
obj = getThis();
attrs = zend_read_property(Z_OBJCE_P(obj), obj, "session", strlen("session"), 0 TSRMLS_CC);
//php_var_dump(&attrs, 1 TSRMLS_CC);
char *session = Z_STRVAL_P(attrs);
char *xml = NULL;
if(session){
char *xmlpro = protocol_flag(session, loginname, flag);
char *url;
asprintf(&url, "%s/change_member_flag.ucs", INI_STR("mtf.url"));
xml = conn(url, xmlpro);
char *debug = NULL;
asprintf(&debug, "%s?%s",url, xmlpro);
zend_update_property_string(object, getThis(), "debug", strlen("debug"), debug TSRMLS_CC);
}
len = spprintf(&strg, 0, "%s", xml);
RETURN_STRINGL(strg, len, 0);
}
示例6: ONPHP_METHOD
ONPHP_METHOD(Ternary, toString)
{
zval *trinity = ONPHP_READ_PROPERTY(getThis(), "trinity");
if (Z_TYPE_P(trinity) == IS_BOOL) {
if (zval_is_true(trinity)) {
RETURN_STRINGL("true", 4, 1);
} else {
RETURN_STRINGL("false", 5, 1);
}
} else if (Z_TYPE_P(trinity) == IS_NULL) {
RETURN_STRINGL("null", 4, 1);
}
ONPHP_THROW(WrongStateException, NULL);
}
示例7: PHP_FUNCTION
U_CFUNC PHP_FUNCTION(intltz_get_id)
{
TIMEZONE_METHOD_INIT_VARS;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O",
&object, TimeZone_ce_ptr) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intltz_get_id: bad arguments", 0 TSRMLS_CC);
RETURN_FALSE;
}
TIMEZONE_METHOD_FETCH_OBJECT;
UnicodeString id_us;
to->utimezone->getID(id_us);
char *id = NULL;
int id_len = 0;
intl_convert_utf16_to_utf8(&id, &id_len,
id_us.getBuffer(), id_us.length(), TIMEZONE_ERROR_CODE_P(to));
INTL_METHOD_CHECK_STATUS(to, "intltz_get_id: Could not convert id to UTF-8");
RETURN_STRINGL(id, id_len, 0);
}
示例8: PHP_FUNCTION
U_CFUNC PHP_FUNCTION(intltz_get_region)
{
char *str_id;
size_t str_id_len;
char outbuf[3];
intl_error_reset(NULL);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&str_id, &str_id_len) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intltz_get_region: bad arguments", 0);
RETURN_FALSE;
}
UErrorCode status = UErrorCode();
UnicodeString id;
if (intl_stringFromChar(id, str_id, str_id_len, &status) == FAILURE) {
intl_error_set(NULL, status,
"intltz_get_region: could not convert time zone id to UTF-16", 0);
RETURN_FALSE;
}
int32_t region_len = TimeZone::getRegion(id, outbuf, sizeof(outbuf), status);
INTL_CHECK_STATUS(status, "intltz_get_region: Error obtaining region");
RETURN_STRINGL(outbuf, region_len);
}
示例9: phalcon_raw_url_encode
void phalcon_raw_url_encode(zval *return_value, zval *url) {
zval copy;
char *escaped;
int use_copy = 0, length;
if (Z_TYPE_P(url) == IS_STRING) {
zend_make_printable_zval(url, ©, &use_copy);
if (use_copy) {
url = ©
}
}
escaped = php_raw_url_encode(Z_STRVAL_P(url), Z_STRLEN_P(url), &length);
if (use_copy) {
zval_dtor(url);
}
if (escaped) {
RETURN_STRINGL(escaped, length, 0);
} else {
RETURN_NULL();
}
}
示例10: PHP_METHOD
/* {{{ proto string MarkdownDocument::getToc() */
PHP_METHOD(markdowndoc, getToc)
{
discount_object *dobj;
char *data = NULL;
int status;
if (zend_parse_parameters_none() == FAILURE) {
RETURN_FALSE;
}
if ((dobj = markdowndoc_get_object(getThis(), 1 TSRMLS_CC)) == NULL) {
RETURN_FALSE;
}
status = mkd_toc(dobj->markdoc, &data);
if (status < 0) {
/* no doc->ctx, shouldn't happen */
zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC,
"Call to library function mkd_toc() failed (should not happen!)");
RETURN_FALSE;
}
/* status == 0 can indicate either empty string or no MKD_TOC, we
* must use data to disambiguate */
if (data == NULL) {
RETURN_FALSE; /* no MKD_TOC */
}
/* empty string included in general case */
RETURN_STRINGL(data, status, 0);
}
示例11: PHP_METHOD
static PHP_METHOD(php_midgard_reflection_method, getDocComment)
{
reflection_object *intern;
zend_function *fptr;
RETVAL_FALSE;
if (zend_parse_parameters_none() == FAILURE)
return;
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
#if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3
RETURN_FALSE;
#endif
if (fptr->op_array.doc_comment) {
RETURN_STRINGL(fptr->op_array.doc_comment, fptr->op_array.doc_comment_len, 1);
} else {
RETURN_FALSE;
}
} else {
zval *ref_class = zend_read_property(php_midgard_reflection_class_class, getThis(), "class", sizeof("class")-1, 0 TSRMLS_CC); \
zval *ref_method = zend_read_property(php_midgard_reflection_class_class, getThis(), "name", sizeof("name")-1, 0 TSRMLS_CC); \
if (!ref_class || !ref_method)
RETURN_FALSE;
const char *comment = php_midgard_docs_get_method_comment((const gchar *) Z_STRVAL_P(ref_class), (const gchar *) Z_STRVAL_P(ref_method));
RETURN_STRING ((char *)comment, 1);
}
}
示例12: ONPHP_METHOD
ONPHP_METHOD(ExtractPart, toDialectString)
{
zval *dialect, *what, *from, *whatString, *fromString;
smart_str string = {0};
ONPHP_GET_ARGS("O", &dialect, onphp_ce_Dialect);
what = ONPHP_READ_PROPERTY(getThis(), "what");
from = ONPHP_READ_PROPERTY(getThis(), "from");
ONPHP_CALL_METHOD_0(what, "tostring", &whatString);
ONPHP_CALL_METHOD_1_NORET(from, "todialectstring", &fromString, dialect);
if (EG(exception)) {
ZVAL_FREE(whatString);
return;
}
smart_str_appendl(&string, "EXTRACT(", 8);
onphp_append_zval_to_smart_string(&string, whatString);
smart_str_appendl(&string, " FROM ", 6);
onphp_append_zval_to_smart_string(&string, fromString);
smart_str_appendc(&string, ')');
smart_str_0(&string);
zval_ptr_dtor(&whatString);
zval_ptr_dtor(&fromString);
RETURN_STRINGL(string.c, string.len, 0);
}
示例13: CLASS_METHOD
/** public function ION\HTTP\Message::getProtocolVersion() : string */
CLASS_METHOD(ION_HTTP_Message, getProtocolVersion) {
ion_http_message * message = ION_THIS_OBJECT(ion_http_message);
if(message->version) {
RETURN_STR(zend_string_copy(message->version));
} else {
RETURN_STRINGL(ION_HTTP_VERSION_DEFAULT, sizeof(ION_HTTP_VERSION_DEFAULT) - 1);
}
}
示例14: PHP_METHOD
/* {{{ Cassandra\Blob::toBinaryString() */
PHP_METHOD(Blob, toBinaryString)
{
cassandra_blob* blob = (cassandra_blob*) zend_object_store_get_object(getThis() TSRMLS_CC);
char* bytes = (char *) emalloc(sizeof(char) * (blob->size + 1));
memcpy(bytes, blob->data, blob->size);
bytes[blob->size] = '\0';
RETURN_STRINGL(bytes, blob->size, 0);
}
示例15: PHP_METHOD
/* {{{ Cassandra\Blob::bytes() */
PHP_METHOD(CassandraBlob, bytes)
{
cassandra_blob* blob = (cassandra_blob*) zend_object_store_get_object(getThis() TSRMLS_CC);
char* hex;
int hex_len;
php_cassandra_bytes_to_hex((const char *) blob->data, blob->size, &hex, &hex_len);
RETURN_STRINGL(hex, hex_len, 0);
}