Permalink
Browse files

Fixed clang warning compiling C-exts.

  • Loading branch information...
1 parent 55774b4 commit 5b0e570b0b2fb6f83df09a8570c3a245135a70eb @brixen brixen committed Aug 24, 2012
@@ -2017,7 +2017,7 @@ BigDecimal_power(int argc, VALUE*argv, VALUE self)
if (VpIsNaN(x)) {
y = VpCreateRbObject(n, "0#");
- RB_GC_GUARD(y->obj);
+ RB_GC_GUARD(y->obj) = y->obj;
VpSetNaN(y);
return ToValue(y);
}
@@ -2074,7 +2074,7 @@ BigDecimal_power(int argc, VALUE*argv, VALUE self)
if (VpIsZero(x)) {
if (is_negative(vexp)) {
y = VpCreateRbObject(n, "#0");
- RB_GC_GUARD(y->obj);
+ RB_GC_GUARD(y->obj) = y->obj;
if (VpGetSign(x) < 0) {
if (is_integer(vexp)) {
if (is_even(vexp)) {
@@ -2468,22 +2468,22 @@ BigMath_s_exp(VALUE klass, VALUE x, VALUE vprec)
else {
Real* vy;
vy = VpCreateRbObject(prec, "#0");
- RB_GC_GUARD(vy->obj);
+ RB_GC_GUARD(vy->obj) = vy->obj;
VpSetInf(vy, VP_SIGN_POSITIVE_INFINITE);
return ToValue(vy);
}
}
else if (nan) {
Real* vy;
vy = VpCreateRbObject(prec, "#0");
- RB_GC_GUARD(vy->obj);
+ RB_GC_GUARD(vy->obj) = vy->obj;
VpSetNaN(vy);
return ToValue(vy);
}
else if (vx == NULL) {
cannot_be_coerced_into_BigDecimal(rb_eArgError, x);
}
- RB_GC_GUARD(vx->obj);
+ RB_GC_GUARD(vx->obj) = vx->obj;
n = prec + rmpd_double_figures();
negative = VpGetSign(vx) < 0;
@@ -2620,14 +2620,14 @@ BigMath_s_log(VALUE klass, VALUE x, VALUE vprec)
if (infinite && !negative) {
Real* vy;
vy = VpCreateRbObject(prec, "#0");
- RB_GC_GUARD(vy->obj);
+ RB_GC_GUARD(vy->obj) = vy->obj;
VpSetInf(vy, VP_SIGN_POSITIVE_INFINITE);
return ToValue(vy);
}
else if (nan) {
Real* vy;
vy = VpCreateRbObject(prec, "#0");
- RB_GC_GUARD(vy->obj);
+ RB_GC_GUARD(vy->obj) = vy->obj;
VpSetNaN(vy);
return ToValue(vy);
}
@@ -92,7 +92,7 @@ static void fbuffer_append_str(FBuffer *fb, VALUE str)
const char *newstr = StringValuePtr(str);
unsigned long len = RSTRING_LEN(str);
- RB_GC_GUARD(str);
+ RB_GC_GUARD(str) = str;
fbuffer_append(fb, newstr, len);
}
@@ -974,7 +974,7 @@ ossl_sslctx_flush_sessions(int argc, VALUE *argv, VALUE self)
static void
ossl_ssl_shutdown(SSL *ssl)
{
- int i, rc;
+ int i;
if (ssl) {
/* 4 is from SSL_smart_shutdown() of mod_ssl.c (v2.2.19) */
@@ -984,7 +984,7 @@ ossl_ssl_shutdown(SSL *ssl)
* Ignore the case SSL_shutdown returns -1. Empty handshake_func
* must not happen.
*/
- if (rc = SSL_shutdown(ssl))
+ if (SSL_shutdown(ssl) == -1)
break;
}
ERR_clear_error();
@@ -99,7 +99,7 @@ static VALUE transcode_string(VALUE src, int * parser_encoding)
}
src = rb_str_export_to_enc(src, rb_utf8_encoding());
- RB_GC_GUARD(src);
+ RB_GC_GUARD(src) = src;
*parser_encoding = YAML_UTF8_ENCODING;
return src;
View
@@ -44,6 +44,24 @@
#include <unistd.h>
#endif
+#ifdef HAVE_OPENPTY
+/* Normally, the following header would be used:
+ * #include <util.h>
+ *
+ * but MRI has an include file "util.h" which may be picked up depending on the
+ * order of include directories. Rather than futz with that, we just add the
+ * prototype.
+ */
+#include <sys/termios.h>
+
+int openpty(int *amaster, int *aslave, char *name, struct termios *termp,
+ struct winsize *winp);
+#endif
+
+#ifdef TIOCSCTTY
+#include <sys/ioctl.h>
+#endif
+
#define DEVICELEN 16
#if !defined(HAVE_OPENPTY)
View
@@ -518,7 +518,7 @@ syck_default_error_handler( SyckParser *p, const char *msg )
{
printf( "Error at [Line %d, Col %d]: %s\n",
p->linect,
- p->cursor - p->lineptr,
+ (int)(p->cursor - p->lineptr),
msg );
}
View
@@ -736,7 +736,7 @@ zstream_append_input(struct zstream *z, const Bytef *src, long len)
}
#define zstream_append_input2(z,v)\
- RB_GC_GUARD(v),\
+ RB_GC_GUARD(v) = v,\
zstream_append_input((z), (Bytef*)RSTRING_PTR(v), RSTRING_LEN(v))
static void
@@ -850,7 +850,7 @@ zstream_run(struct zstream *z, Bytef *src, long len, int flush)
for (;;) {
/* VC allocates err and guard to same address. accessing err and guard
in same scope prevents it. */
- RB_GC_GUARD(guard);
+ RB_GC_GUARD(guard) = guard;
n = z->stream.avail_out;
err = z->func->run(&z->stream, flush);
z->buf_filled += n - z->stream.avail_out;
@@ -1928,9 +1928,6 @@ static VALUE cGzError, cNoFooter, cCRCError, cLengthError;
/*-------- gzfile internal APIs --------*/
-/* TODO: Encodings */
-typedef void rb_econv_t;
-
struct gzfile {
struct zstream z;
VALUE io;
@@ -9696,10 +9696,10 @@ yylex(void *yylval_v, void *vstate)
}
else {
term = nextc();
- if (ISALNUM(term) || ismbchar(term)) {
+ if (ISALNUM(term) /* || ismbchar(term) */) {
cur = tmpstr;
*cur++ = c;
- while(ISALNUM(term) || ismbchar(term)) {
+ while(ISALNUM(term) /* || ismbchar(term) */) {
*cur++ = term;
term = nextc();
}
@@ -4505,10 +4505,10 @@ yylex(void *yylval_v, void *vstate)
}
else {
term = nextc();
- if (ISALNUM(term) || ismbchar(term)) {
+ if (ISALNUM(term) /* || ismbchar(term) */) {
cur = tmpstr;
*cur++ = c;
- while(ISALNUM(term) || ismbchar(term)) {
+ while(ISALNUM(term) /* || ismbchar(term) */) {
*cur++ = term;
term = nextc();
}

0 comments on commit 5b0e570

Please sign in to comment.