本文整理汇总了C++中rb_warning函数的典型用法代码示例。如果您正苦于以下问题:C++ rb_warning函数的具体用法?C++ rb_warning怎么用?C++ rb_warning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rb_warning函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ossl_pem_passwd_cb
int
ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd)
{
int len, status = 0;
VALUE rflag, pass;
if (pwd || !rb_block_given_p())
return PEM_def_callback(buf, max_len, flag, pwd);
while (1) {
/*
* when the flag is nonzero, this passphrase
* will be used to perform encryption; otherwise it will
* be used to perform decryption.
*/
rflag = flag ? Qtrue : Qfalse;
pass = rb_protect(ossl_pem_passwd_cb0, rflag, &status);
if (status) return -1; /* exception was raised. */
len = RSTRING_LEN(pass);
if (len < 4) { /* 4 is OpenSSL hardcoded limit */
rb_warning("password must be longer than 4 bytes");
continue;
}
if (len > max_len) {
rb_warning("password must be shorter then %d bytes", max_len-1);
continue;
}
memcpy(buf, RSTRING_PTR(pass), len);
break;
}
return len;
}
开发者ID:genki,项目名称:ruby,代码行数:32,代码来源:ossl.c
示例2: nurat_to_f
static VALUE
nurat_to_f(VALUE self)
{
VALUE num, den;
int minus = 0;
long nl, dl, ml, ne, de;
int e;
double f;
{
get_dat1(self);
if (f_zero_p(dat->num))
return rb_float_new(0.0);
num = dat->num;
den = dat->den;
}
if (f_negative_p(num)) {
num = f_negate(num);
minus = 1;
}
nl = i_ilog2(num);
dl = i_ilog2(den);
ml = (long)(log(DBL_MAX) / log(2.0) - 1); /* should be a static */
ne = 0;
if (nl > ml) {
ne = nl - ml;
num = f_rshift(num, LONG2NUM(ne));
}
de = 0;
if (dl > ml) {
de = dl - ml;
den = f_rshift(den, LONG2NUM(de));
}
e = (int)(ne - de);
if ((e > DBL_MAX_EXP) || (e < DBL_MIN_EXP)) {
rb_warning("%s out of Float range", rb_obj_classname(self));
return rb_float_new(e > 0 ? HUGE_VAL : 0.0);
}
f = NUM2DBL(num) / NUM2DBL(den);
if (minus)
f = -f;
f = ldexp(f, e);
if (isinf(f) || isnan(f))
rb_warning("%s out of Float range", rb_obj_classname(self));
return rb_float_new(f);
}
开发者ID:Sophrinix,项目名称:iphone-macruby,代码行数:57,代码来源:rational.c
示例3: rb_rsvg_handle_initialize
static VALUE
rb_rsvg_handle_initialize(int argc, VALUE *argv, VALUE self)
{
RsvgHandle *handle;
VALUE gz;
rb_scan_args(argc, argv, "01", &gz);
#if LIBRSVG_CHECK_VERSION(2, 11, 0)
handle = rsvg_handle_new();
#else
if (RVAL2CBOOL(gz)) {
# ifdef HAVE_LIBRSVG_RSVG_GZ_H
handle = rsvg_handle_new_gz();
# else
rb_warning("gz handling is not supported in your librsvg");
handle = rsvg_handle_new();
# endif
} else {
handle = rsvg_handle_new();
}
#endif
#ifdef RSVG_TYPE_HANDLE
G_INITIALIZE(self, handle);
#else
DATA_PTR(self) = handle;
#endif
rb_ivar_set(self, id_closed, Qfalse);
return Qnil;
}
开发者ID:benolee,项目名称:ruby-gnome2,代码行数:31,代码来源:rbrsvg.c
示例4: ossl_engine_s_load
static VALUE
ossl_engine_s_load(int argc, VALUE *argv, VALUE klass)
{
#if !defined(HAVE_ENGINE_LOAD_BUILTIN_ENGINES)
return Qnil;
#else
VALUE name;
rb_scan_args(argc, argv, "01", &name);
if(NIL_P(name)){
ENGINE_load_builtin_engines();
return Qtrue;
}
StringValue(name);
#ifndef OPENSSL_NO_STATIC_ENGINE
OSSL_ENGINE_LOAD_IF_MATCH(dynamic);
OSSL_ENGINE_LOAD_IF_MATCH(cswift);
OSSL_ENGINE_LOAD_IF_MATCH(chil);
OSSL_ENGINE_LOAD_IF_MATCH(atalla);
OSSL_ENGINE_LOAD_IF_MATCH(nuron);
OSSL_ENGINE_LOAD_IF_MATCH(ubsec);
OSSL_ENGINE_LOAD_IF_MATCH(aep);
OSSL_ENGINE_LOAD_IF_MATCH(sureware);
OSSL_ENGINE_LOAD_IF_MATCH(4758cca);
#endif
#ifdef HAVE_ENGINE_LOAD_OPENBSD_DEV_CRYPTO
OSSL_ENGINE_LOAD_IF_MATCH(openbsd_dev_crypto);
#endif
OSSL_ENGINE_LOAD_IF_MATCH(openssl);
rb_warning("no such builtin loader for `%s'", RSTRING_PTR(name));
return Qnil;
#endif /* HAVE_ENGINE_LOAD_BUILTIN_ENGINES */
}
开发者ID:Sophrinix,项目名称:iphone-macruby,代码行数:33,代码来源:ossl_engine.c
示例5: initialize_loader
/* Image Data in Memory */
static VALUE
initialize_loader(int argc, VALUE *argv, VALUE self)
{
GdkPixbufLoader* loader;
GError* error = NULL;
VALUE arg1, is_mime_type;
rb_scan_args(argc, argv, "02", &arg1, &is_mime_type);
if (NIL_P(arg1)) {
loader = gdk_pixbuf_loader_new();
} else {
if (is_mime_type == Qtrue) {
#if RBGDK_PIXBUF_CHECK_VERSION(2,4,0)
loader = gdk_pixbuf_loader_new_with_mime_type(RVAL2CSTR(arg1), &error);
#else
rb_warning("Not supported GTK+-2.0/2.2.");
loader = gdk_pixbuf_loader_new();
#endif
} else {
/* Default behavior */
loader = gdk_pixbuf_loader_new_with_type(RVAL2CSTR(arg1), &error);
}
if(error) RAISE_GERROR(error);
}
G_INITIALIZE(self, loader);
return Qnil;
}
开发者ID:benolee,项目名称:ruby-gnome2,代码行数:30,代码来源:rbgdk-pixbuf-loader.c
示例6: rb_rsvg_handle_get_pixbuf
static VALUE
rb_rsvg_handle_get_pixbuf(int argc, VALUE *argv, VALUE self)
{
VALUE id;
VALUE rb_pixbuf;
GdkPixbuf *pixbuf = NULL;
rb_scan_args(argc, argv, "01", &id);
if (NIL_P(id)) {
pixbuf = rsvg_handle_get_pixbuf(_SELF(self));
} else {
#ifdef HAVE_RSVG_HANDLE_GET_PIXBUF_SUB
pixbuf = rsvg_handle_get_pixbuf_sub(_SELF(self),
(const char *)RVAL2CSTR(id));
#else
rb_warning("rsvg_handle_get_pixbuf_sub isn't "
"supported in your librsvg");
#endif
}
rb_pixbuf = GOBJ2RVAL(pixbuf);
if (pixbuf)
g_object_unref(pixbuf);
return rb_pixbuf;
}
开发者ID:benolee,项目名称:ruby-gnome2,代码行数:25,代码来源:rbrsvg.c
示例7: grpc_rb_completion_queue_shutdown_drain
/* Shuts down and drains the completion queue if necessary.
*
* This is done when the ruby completion queue object is about to be GCed.
*/
static void grpc_rb_completion_queue_shutdown_drain(grpc_completion_queue *cq) {
next_call_stack next_call;
grpc_completion_type type;
int drained = 0;
MEMZERO(&next_call, next_call_stack, 1);
grpc_completion_queue_shutdown(cq);
next_call.cq = cq;
next_call.event.type = GRPC_QUEUE_TIMEOUT;
/* TODO: the timeout should be a module level constant that defaults
* to gpr_inf_future(GPR_CLOCK_REALTIME).
*
* - at the moment this does not work, it stalls. Using a small timeout like
* this one works, and leads to fast test run times; a longer timeout was
* causing unnecessary delays in the test runs.
*
* - investigate further, this is probably another example of C-level cleanup
* not working consistently in all cases.
*/
next_call.timeout = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_micros(5e3, GPR_TIMESPAN));
do {
rb_thread_call_without_gvl(grpc_rb_completion_queue_next_no_gil,
(void *)&next_call, NULL, NULL);
type = next_call.event.type;
if (type == GRPC_QUEUE_TIMEOUT) break;
if (type != GRPC_QUEUE_SHUTDOWN) {
++drained;
rb_warning("completion queue shutdown: %d undrained events", drained);
}
} while (type != GRPC_QUEUE_SHUTDOWN);
}
开发者ID:201528013359030,项目名称:grpc,代码行数:36,代码来源:rb_completion_queue.c
示例8: rbglib_m_utf8_validate
static VALUE
rbglib_m_utf8_validate(G_GNUC_UNUSED VALUE self, VALUE str)
{
rb_warning("GLib.utf8_validate is deprecated. Use GLib::UTF8.validate instead.");
StringValue(str);
return CBOOL2RVAL(g_utf8_validate(RSTRING_PTR(str), RSTRING_LEN(str), NULL));
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:7,代码来源:rbglib_convert.c
示例9: ossl_sslctx_get_ciphers
/*
* call-seq:
* ctx.ciphers => [[name, version, bits, alg_bits], ...]
*/
static VALUE
ossl_sslctx_get_ciphers(VALUE self)
{
SSL_CTX *ctx;
STACK_OF(SSL_CIPHER) *ciphers;
SSL_CIPHER *cipher;
VALUE ary;
int i, num;
Data_Get_Struct(self, SSL_CTX, ctx);
if(!ctx){
rb_warning("SSL_CTX is not initialized.");
return Qnil;
}
ciphers = ctx->cipher_list;
if (!ciphers)
return rb_ary_new();
num = sk_SSL_CIPHER_num(ciphers);
ary = rb_ary_new2(num);
for(i = 0; i < num; i++){
cipher = sk_SSL_CIPHER_value(ciphers, i);
rb_ary_push(ary, ossl_ssl_cipher_to_ary(cipher));
}
return ary;
}
开发者ID:2220142,项目名称:ruby,代码行数:31,代码来源:ossl_ssl.c
示例10: exec_tmpl
static VALUE exec_tmpl(VALUE module, VALUE self, VALUE output)
{
writer_functype writer;
struct tmplpro_param* proparam;
setup_internal(self);
proparam = process_tmplpro_options(self);
switch (TYPE(output)) {
case T_STRING:
writer = &write_chars_to_string;
break;
case T_FILE:
writer = &write_chars_to_file;
break;
default:
rb_warning("bad file descriptor. Use output=stdout\n");
writer = &write_chars_to_file;
output = rb_stdout;
}
tmplpro_set_option_WriterFuncPtr(proparam, writer);
tmplpro_set_option_ext_writer_state(proparam, (ABSTRACT_WRITER *)output);
int retval = tmplpro_exec_tmpl(proparam);
release_tmplpro_options(proparam);
return INT2FIX(retval);
}
开发者ID:tom-lpsd,项目名称:ruby-html-template-pro,代码行数:25,代码来源:internal.c
示例11: ossl_ssl_get_peer_cert_chain
/*
* call-seq:
* ssl.peer_cert_chain => [cert, ...] or nil
*/
static VALUE
ossl_ssl_get_peer_cert_chain(VALUE self)
{
SSL *ssl;
STACK_OF(X509) *chain;
X509 *cert;
VALUE ary;
int i, num;
Data_Get_Struct(self, SSL, ssl);
if(!ssl){
rb_warning("SSL session is not started yet.");
return Qnil;
}
chain = SSL_get_peer_cert_chain(ssl);
if(!chain) return Qnil;
num = sk_X509_num(chain);
ary = rb_ary_new2(num);
for (i = 0; i < num; i++){
cert = sk_X509_value(chain, i);
rb_ary_push(ary, ossl_x509_new(cert));
}
return ary;
}
开发者ID:2220142,项目名称:ruby,代码行数:29,代码来源:ossl_ssl.c
示例12: load_lock
static char *
load_lock(const char *ftptr)
{
st_data_t data;
st_table *loading_tbl = get_loading_table();
if (!st_lookup(loading_tbl, (st_data_t)ftptr, &data)) {
/* partial state */
ftptr = ruby_strdup(ftptr);
data = (st_data_t)rb_thread_shield_new();
st_insert(loading_tbl, (st_data_t)ftptr, data);
return (char *)ftptr;
}
else if (RB_TYPE_P((VALUE)data, T_IMEMO) && imemo_type((VALUE)data) == imemo_memo) {
struct MEMO *memo = MEMO_CAST(data);
void (*init)(void) = (void (*)(void))memo->u3.func;
data = (st_data_t)rb_thread_shield_new();
st_insert(loading_tbl, (st_data_t)ftptr, data);
(*init)();
return (char *)"";
}
if (RTEST(ruby_verbose)) {
rb_warning("loading in progress, circular require considered harmful - %s", ftptr);
rb_backtrace_print_to(rb_stderr);
}
switch (rb_thread_shield_wait((VALUE)data)) {
case Qfalse:
data = (st_data_t)ftptr;
st_insert(loading_tbl, data, (st_data_t)rb_thread_shield_new());
return 0;
case Qnil:
return 0;
}
return (char *)ftptr;
}
开发者ID:scorpion007,项目名称:ruby,代码行数:35,代码来源:load.c
示例13: handle_exception
/*
* Static: handle_exception
* Purpose: called when rm_check_exception determines that we need
* to either issue a warning message or raise an exception.
* This function allocates a bunch of stack so we don't call
* it unless we have to.
*/
static void
handle_exception(ExceptionInfo *exception, Image *imglist, ErrorRetention retention)
{
char reason[500];
char desc[500];
char msg[sizeof(reason)+sizeof(desc)+20];
memset(msg, 0, sizeof(msg));
// Handle simple warning
if (exception->severity < ErrorException)
{
#if defined(HAVE_SNPRINTF)
snprintf(msg, sizeof(msg)-1, "RMagick: %s%s%s",
#else
sprintf(msg, "RMagick: %.500s%s%.500s",
#endif
GetLocaleExceptionMessage(exception->severity, exception->reason),
exception->description ? ": " : "",
exception->description ? GetLocaleExceptionMessage(exception->severity, exception->description) : "");
msg[sizeof(msg)-1] = '\0';
rb_warning(msg);
// Caller deletes ExceptionInfo...
return;
}
开发者ID:r-project,项目名称:BS,代码行数:36,代码来源:rmutil.c
示例14: set_default_internal
/*
* call-seq:
* Encoding.default_internal = enc or nil
*
* Sets default internal encoding.
* Or removes default internal encoding when passed nil.
*/
static VALUE
set_default_internal(VALUE klass, VALUE encoding)
{
rb_warning("setting Encoding.default_internal");
rb_enc_set_default_internal(encoding);
return encoding;
}
开发者ID:217,项目名称:ruby,代码行数:14,代码来源:encoding.c
示例15: ImageList_map
/**
* Call MapImages.
*
* Ruby usage:
* - @verbatim ImageList#map(reference) @endverbatim
* - @verbatim ImageList#map(reference, dither) @endverbatim
*
* Notes:
* - Default dither is false
* - Sets \@scene to self.scene
*
* @param argc number of input arguments
* @param argv array of input arguments
* @param self this object
* @return a new ImageList with mapped images.
*/
VALUE
ImageList_map(int argc, VALUE *argv, VALUE self)
{
Image *images, *new_images = NULL;
Image *map;
unsigned int dither = MagickFalse;
VALUE scene, new_imagelist, t;
ExceptionInfo *exception;
#if defined(HAVE_REMAPIMAGES)
QuantizeInfo quantize_info;
rb_warning("ImageList#map is deprecated. Use ImageList#remap instead.");
#endif
switch (argc)
{
case 2:
dither = RTEST(argv[1]);
case 1:
t = rm_cur_image(argv[0]);
map = rm_check_destroyed(t);
break;
default:
rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
break;
}
// Convert image array to image sequence, clone image sequence.
exception = AcquireExceptionInfo();
images = images_from_imagelist(self);
new_images = CloneImageList(images, exception);
rm_split(images);
rm_check_exception(exception, new_images, DestroyOnError);
(void) DestroyExceptionInfo(exception);
rm_ensure_result(new_images);
// Call ImageMagick
#if defined(HAVE_REMAPIMAGES)
GetQuantizeInfo(&quantize_info);
quantize_info.dither = dither;
(void) RemapImages(&quantize_info, new_images, map);
#else
(void) MapImages(new_images, map, dither);
#endif
rm_check_image_exception(new_images, DestroyOnError);
// Set @scene in new ImageList object to same value as in self.
new_imagelist = rm_imagelist_from_images(new_images);
scene = rb_iv_get(self, "@scene");
(void) imagelist_scene_eq(new_imagelist, scene);
RB_GC_GUARD(scene);
RB_GC_GUARD(new_imagelist);
RB_GC_GUARD(t);
return new_imagelist;
}
开发者ID:ABaumgaertner,项目名称:rmagick,代码行数:76,代码来源:rmilist.c
示例16: ossl_ssl_read
/*
* call-seq:
* ssl.sysread(length) => string
* ssl.sysread(length, buffer) => buffer
*
* === Parameters
* * +length+ is a positive integer.
* * +buffer+ is a string used to store the result.
*/
static VALUE
ossl_ssl_read(int argc, VALUE *argv, VALUE self)
{
SSL *ssl;
int ilen, nread = 0;
VALUE len, str;
rb_scan_args(argc, argv, "11", &len, &str);
ilen = NUM2INT(len);
if(NIL_P(str)) {
str = rb_str_new(0, ilen);
} else {
StringValue(str);
rb_str_modify(str);
rb_str_resize(str, ilen);
}
if(ilen == 0) return str;
Data_Get_Struct(self, SSL, ssl);
int fd = rb_io_fd(ossl_ssl_get_io(self));
if (ssl) {
if(SSL_pending(ssl) <= 0)
rb_thread_wait_fd(fd);
for (;;) {
nread = SSL_read(ssl, RSTRING_PTR(str), RSTRING_LEN(str));
switch(ssl_get_error(ssl, nread)) {
case SSL_ERROR_NONE:
goto end;
case SSL_ERROR_ZERO_RETURN:
rb_eof_error();
case SSL_ERROR_WANT_WRITE:
rb_io_wait_writable(fd);
continue;
case SSL_ERROR_WANT_READ:
rb_io_wait_readable(fd);
continue;
case SSL_ERROR_SYSCALL:
if(ERR_peek_error() == 0 && nread == 0) rb_eof_error();
rb_sys_fail(0);
default:
ossl_raise(eSSLError, "SSL_read:");
}
}
}
else {
ID id_sysread = rb_intern("sysread");
rb_warning("SSL session is not started yet.");
return rb_funcall(ossl_ssl_get_io(self), id_sysread, 2, len, str);
}
end:
rb_str_set_len(str, nread);
OBJ_TAINT(str);
return str;
}
开发者ID:FunkyFortune,项目名称:rubinius,代码行数:68,代码来源:ossl_ssl.c
示例17: ossl_cipher_update_deprecated
static VALUE
ossl_cipher_update_deprecated(VALUE self, VALUE data)
{
char *cname;
cname = rb_class2name(rb_obj_class(self));
rb_warning("%s#<< is deprecated; use %s#update instead", cname, cname);
return ossl_cipher_update(self, data);
}
开发者ID:FooBarWidget,项目名称:rubyenterpriseedition,代码行数:9,代码来源:ossl_cipher.c
示例18: prenderer_set_stipple
static VALUE
prenderer_set_stipple(G_GNUC_UNUSED VALUE self,
G_GNUC_UNUSED VALUE part,
G_GNUC_UNUSED VALUE stipple)
{
rb_warning("Gdk::PangoRender#set_tipple is not supported (Require pango-1.8.1 or later");
return self;
}
开发者ID:masaakiaoyagi,项目名称:ruby-gnome2,代码行数:9,代码来源:rbgdkpangorenderer.c
示例19: prenderer_set_override_color
static VALUE
prenderer_set_override_color(G_GNUC_UNUSED VALUE self,
G_GNUC_UNUSED VALUE part,
G_GNUC_UNUSED VALUE color)
{
rb_warning("Gdk::PangoRender#set_override_color is not supported (Require pango-1.8.1 or later");
return self;
}
开发者ID:masaakiaoyagi,项目名称:ruby-gnome2,代码行数:9,代码来源:rbgdkpangorenderer.c
示例20: ossl_cipher_update_deprecated
/*
* call-seq:
* cipher << data -> string
*
* === Parameters
* +data+ is a nonempty string.
*
* This method is deprecated and not available in 1.9.x or later.
*/
static VALUE
ossl_cipher_update_deprecated(VALUE self, VALUE data)
{
const char *cname;
cname = rb_class2name(rb_obj_class(self));
rb_warning("%s#<< is deprecated; use %s#update instead", cname, cname);
return rb_funcall(self, rb_intern("update"), 1, data);
}
开发者ID:mamute,项目名称:rubyenterpriseedition187-248,代码行数:18,代码来源:ossl_cipher.c
注:本文中的rb_warning函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论