mirror of https://github.com/nodejs/node.git
Fix a few compiler warnings...
parent
a6017660d8
commit
fe74283e1d
|
@ -258,12 +258,12 @@ Handle<Value> Buffer::Base64Slice(const Arguments &args) {
|
|||
|
||||
c = bitbuf[0] >> 2;
|
||||
assert(c < 64);
|
||||
out[j++] = base64_table[c];
|
||||
out[j++] = base64_table[(int)c];
|
||||
assert(j < out_len);
|
||||
|
||||
c = ((bitbuf[0] & 0x03) << 4) | (bitbuf[1] >> 4);
|
||||
assert(c < 64);
|
||||
out[j++] = base64_table[c];
|
||||
out[j++] = base64_table[(int)c];
|
||||
assert(j < out_len);
|
||||
|
||||
if (b1_oob) {
|
||||
|
@ -271,7 +271,7 @@ Handle<Value> Buffer::Base64Slice(const Arguments &args) {
|
|||
} else {
|
||||
c = ((bitbuf[1] & 0x0F) << 2) | (bitbuf[2] >> 6);
|
||||
assert(c < 64);
|
||||
out[j++] = base64_table[c];
|
||||
out[j++] = base64_table[(int)c];
|
||||
}
|
||||
assert(j < out_len);
|
||||
|
||||
|
@ -280,7 +280,7 @@ Handle<Value> Buffer::Base64Slice(const Arguments &args) {
|
|||
} else {
|
||||
c = bitbuf[2] & 0x3F;
|
||||
assert(c < 64);
|
||||
out[j++] = base64_table[c];
|
||||
out[j++] = base64_table[(int)c];
|
||||
}
|
||||
assert(j <= out_len);
|
||||
}
|
||||
|
@ -426,12 +426,12 @@ Handle<Value> Buffer::AsciiWrite(const Arguments &args) {
|
|||
Handle<Value> Buffer::Base64Write(const Arguments &args) {
|
||||
HandleScope scope;
|
||||
|
||||
assert(unbase64_table['/'] == 63);
|
||||
assert(unbase64_table['+'] == 62);
|
||||
assert(unbase64_table['T'] == 19);
|
||||
assert(unbase64_table['Z'] == 25);
|
||||
assert(unbase64_table['t'] == 45);
|
||||
assert(unbase64_table['z'] == 51);
|
||||
assert(unbase64_table[(int)'/'] == 63);
|
||||
assert(unbase64_table[(int)'+'] == 62);
|
||||
assert(unbase64_table[(int)'T'] == 19);
|
||||
assert(unbase64_table[(int)'Z'] == 25);
|
||||
assert(unbase64_table[(int)'t'] == 45);
|
||||
assert(unbase64_table[(int)'z'] == 51);
|
||||
|
||||
Buffer *buffer = ObjectWrap::Unwrap<Buffer>(args.This());
|
||||
|
||||
|
@ -468,18 +468,18 @@ Handle<Value> Buffer::Base64Write(const Arguments &args) {
|
|||
while (src < srcEnd) {
|
||||
const int remaining = srcEnd - src;
|
||||
if (remaining == 0 || *src == '=') break;
|
||||
a = unbase64_table[*src++];
|
||||
a = unbase64_table[(int)*src++];
|
||||
|
||||
if (remaining == 1 || *src == '=') break;
|
||||
b = unbase64_table[*src++];
|
||||
b = unbase64_table[(int)*src++];
|
||||
*dst++ = (a << 2) | ((b & 0x30) >> 4);
|
||||
|
||||
if (remaining == 2 || *src == '=') break;
|
||||
c = unbase64_table[*src++];
|
||||
c = unbase64_table[(int)*src++];
|
||||
*dst++ = ((b & 0x0F) << 4) | ((c & 0x3C) >> 2);
|
||||
|
||||
if (remaining == 3 || *src == '=') break;
|
||||
d = unbase64_table[*src++];
|
||||
d = unbase64_table[(int)*src++];
|
||||
*dst++ = ((c & 0x03) << 6) | (d & 0x3F);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ static Persistent<String> version_symbol;
|
|||
|
||||
|
||||
static int verify_callback(int ok, X509_STORE_CTX *ctx) {
|
||||
assert(ok);
|
||||
return(1); // Ignore errors by now. VerifyPeer will catch them by using SSL_get_verify_result.
|
||||
}
|
||||
|
||||
|
@ -693,7 +694,8 @@ void base64(unsigned char *input, int length, char** buf64, int* buf64_len) {
|
|||
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
|
||||
len = BIO_write(b64, input, length);
|
||||
assert(len == length);
|
||||
BIO_flush(b64);
|
||||
int r = BIO_flush(b64);
|
||||
assert(r == 1);
|
||||
BIO_get_mem_ptr(b64, &bptr);
|
||||
|
||||
*buf64_len = bptr->length;
|
||||
|
@ -804,7 +806,7 @@ int local_EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx,
|
|||
return(0);
|
||||
}
|
||||
|
||||
if (b > (sizeof(ctx->final) / sizeof(ctx->final[0]))) {
|
||||
if (b > (int)(sizeof(ctx->final) / sizeof(ctx->final[0]))) {
|
||||
EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_BAD_DECRYPT);
|
||||
return(0);
|
||||
}
|
||||
|
@ -961,6 +963,10 @@ class Cipher : public ObjectWrap {
|
|||
|
||||
delete [] key_buf;
|
||||
|
||||
if (!r) {
|
||||
return ThrowException(Exception::Error(String::New("CipherInit error")));
|
||||
}
|
||||
|
||||
return args.This();
|
||||
}
|
||||
|
||||
|
@ -1005,6 +1011,10 @@ class Cipher : public ObjectWrap {
|
|||
delete [] key_buf;
|
||||
delete [] iv_buf;
|
||||
|
||||
if (!r) {
|
||||
return ThrowException(Exception::Error(String::New("CipherInitIv error")));
|
||||
}
|
||||
|
||||
return args.This();
|
||||
}
|
||||
|
||||
|
@ -1023,21 +1033,27 @@ class Cipher : public ObjectWrap {
|
|||
}
|
||||
|
||||
unsigned char *out=0;
|
||||
int out_len=0;
|
||||
int out_len=0, r;
|
||||
if (Buffer::HasInstance(args[0])) {
|
||||
Local<Object> buffer_obj = args[0]->ToObject();
|
||||
char *buffer_data = Buffer::Data(buffer_obj);
|
||||
size_t buffer_length = Buffer::Length(buffer_obj);
|
||||
|
||||
int r = cipher->CipherUpdate(buffer_data, buffer_length, &out, &out_len);
|
||||
r = cipher->CipherUpdate(buffer_data, buffer_length, &out, &out_len);
|
||||
} else {
|
||||
char* buf = new char[len];
|
||||
ssize_t written = DecodeWrite(buf, len, args[0], enc);
|
||||
assert(written == len);
|
||||
int r = cipher->CipherUpdate(buf, len,&out,&out_len);
|
||||
r = cipher->CipherUpdate(buf, len,&out,&out_len);
|
||||
delete [] buf;
|
||||
}
|
||||
|
||||
if (!r) {
|
||||
delete [] out;
|
||||
Local<Value> exception = Exception::TypeError(String::New("DecipherUpdate fail"));
|
||||
return ThrowException(exception);
|
||||
}
|
||||
|
||||
Local<Value> outString;
|
||||
if (out_len==0) {
|
||||
outString=String::New("");
|
||||
|
@ -1308,6 +1324,10 @@ class Decipher : public ObjectWrap {
|
|||
|
||||
delete [] key_buf;
|
||||
|
||||
if (!r) {
|
||||
return ThrowException(Exception::Error(String::New("DecipherInit error")));
|
||||
}
|
||||
|
||||
return args.This();
|
||||
}
|
||||
|
||||
|
@ -1353,6 +1373,10 @@ class Decipher : public ObjectWrap {
|
|||
delete [] key_buf;
|
||||
delete [] iv_buf;
|
||||
|
||||
if (!r) {
|
||||
return ThrowException(Exception::Error(String::New("DecipherInitIv error")));
|
||||
}
|
||||
|
||||
return args.This();
|
||||
}
|
||||
|
||||
|
@ -1443,6 +1467,12 @@ class Decipher : public ObjectWrap {
|
|||
int out_len=0;
|
||||
int r = cipher->DecipherUpdate(buf, len, &out, &out_len);
|
||||
|
||||
if (!r) {
|
||||
delete [] out;
|
||||
Local<Value> exception = Exception::TypeError(String::New("DecipherUpdate fail"));
|
||||
return ThrowException(exception);
|
||||
}
|
||||
|
||||
Local<Value> outString;
|
||||
if (out_len==0) {
|
||||
outString=String::New("");
|
||||
|
@ -1491,9 +1521,7 @@ class Decipher : public ObjectWrap {
|
|||
|
||||
unsigned char* out_value;
|
||||
int out_len;
|
||||
char* out_hexdigest;
|
||||
int out_hex_len;
|
||||
Local<Value> outString ;
|
||||
Local<Value> outString;
|
||||
|
||||
int r = cipher->DecipherFinal(&out_value, &out_len, false);
|
||||
|
||||
|
@ -1536,8 +1564,6 @@ class Decipher : public ObjectWrap {
|
|||
|
||||
unsigned char* out_value;
|
||||
int out_len;
|
||||
char* out_hexdigest;
|
||||
int out_hex_len;
|
||||
Local<Value> outString ;
|
||||
|
||||
int r = cipher->DecipherFinal(&out_value, &out_len, true);
|
||||
|
@ -1677,6 +1703,10 @@ class Hmac : public ObjectWrap {
|
|||
|
||||
delete [] buf;
|
||||
|
||||
if (!r) {
|
||||
return ThrowException(Exception::Error(String::New("hmac error")));
|
||||
}
|
||||
|
||||
return args.This();
|
||||
}
|
||||
|
||||
|
@ -1692,21 +1722,28 @@ class Hmac : public ObjectWrap {
|
|||
Local<Value> exception = Exception::TypeError(String::New("Bad argument"));
|
||||
return ThrowException(exception);
|
||||
}
|
||||
|
||||
int r;
|
||||
|
||||
if( Buffer::HasInstance(args[0])) {
|
||||
Local<Object> buffer_obj = args[0]->ToObject();
|
||||
char *buffer_data = Buffer::Data(buffer_obj);
|
||||
size_t buffer_length = Buffer::Length(buffer_obj);
|
||||
|
||||
int r = hmac->HmacUpdate(buffer_data, buffer_length);
|
||||
r = hmac->HmacUpdate(buffer_data, buffer_length);
|
||||
} else {
|
||||
char* buf = new char[len];
|
||||
ssize_t written = DecodeWrite(buf, len, args[0], enc);
|
||||
assert(written == len);
|
||||
int r = hmac->HmacUpdate(buf, len);
|
||||
r = hmac->HmacUpdate(buf, len);
|
||||
delete [] buf;
|
||||
}
|
||||
|
||||
if (!r) {
|
||||
Local<Value> exception = Exception::TypeError(String::New("HmacUpdate fail"));
|
||||
return ThrowException(exception);
|
||||
}
|
||||
|
||||
return args.This();
|
||||
}
|
||||
|
||||
|
@ -1842,21 +1879,26 @@ class Hash : public ObjectWrap {
|
|||
return ThrowException(exception);
|
||||
}
|
||||
|
||||
int r;
|
||||
|
||||
if (Buffer::HasInstance(args[0])) {
|
||||
Local<Object> buffer_obj = args[0]->ToObject();
|
||||
char *buffer_data = Buffer::Data(buffer_obj);
|
||||
size_t buffer_length = Buffer::Length(buffer_obj);
|
||||
|
||||
int r = hash->HashUpdate(buffer_data, buffer_length);
|
||||
r = hash->HashUpdate(buffer_data, buffer_length);
|
||||
} else {
|
||||
char* buf = new char[len];
|
||||
ssize_t written = DecodeWrite(buf, len, args[0], enc);
|
||||
assert(written == len);
|
||||
int r = hash->HashUpdate(buf, len);
|
||||
r = hash->HashUpdate(buf, len);
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
if (!r) {
|
||||
Local<Value> exception = Exception::TypeError(String::New("HashUpdate fail"));
|
||||
return ThrowException(exception);
|
||||
}
|
||||
|
||||
return args.This();
|
||||
}
|
||||
|
||||
|
@ -2000,6 +2042,10 @@ class Sign : public ObjectWrap {
|
|||
|
||||
bool r = sign->SignInit(*signType);
|
||||
|
||||
if (!r) {
|
||||
return ThrowException(Exception::Error(String::New("SignInit error")));
|
||||
}
|
||||
|
||||
return args.This();
|
||||
}
|
||||
|
||||
|
@ -2016,20 +2062,27 @@ class Sign : public ObjectWrap {
|
|||
return ThrowException(exception);
|
||||
}
|
||||
|
||||
int r;
|
||||
|
||||
if (Buffer::HasInstance(args[0])) {
|
||||
Local<Object> buffer_obj = args[0]->ToObject();
|
||||
char *buffer_data = Buffer::Data(buffer_obj);
|
||||
size_t buffer_length = Buffer::Length(buffer_obj);
|
||||
|
||||
int r = sign->SignUpdate(buffer_data, buffer_length);
|
||||
r = sign->SignUpdate(buffer_data, buffer_length);
|
||||
} else {
|
||||
char* buf = new char[len];
|
||||
ssize_t written = DecodeWrite(buf, len, args[0], enc);
|
||||
assert(written == len);
|
||||
int r = sign->SignUpdate(buf, len);
|
||||
r = sign->SignUpdate(buf, len);
|
||||
delete [] buf;
|
||||
}
|
||||
|
||||
if (!r) {
|
||||
Local<Value> exception = Exception::TypeError(String::New("SignUpdate fail"));
|
||||
return ThrowException(exception);
|
||||
}
|
||||
|
||||
return args.This();
|
||||
}
|
||||
|
||||
|
@ -2201,6 +2254,10 @@ class Verify : public ObjectWrap {
|
|||
|
||||
bool r = verify->VerifyInit(*verifyType);
|
||||
|
||||
if (!r) {
|
||||
return ThrowException(Exception::Error(String::New("VerifyInit error")));
|
||||
}
|
||||
|
||||
return args.This();
|
||||
}
|
||||
|
||||
|
@ -2218,20 +2275,27 @@ class Verify : public ObjectWrap {
|
|||
return ThrowException(exception);
|
||||
}
|
||||
|
||||
int r;
|
||||
|
||||
if(Buffer::HasInstance(args[0])) {
|
||||
Local<Object> buffer_obj = args[0]->ToObject();
|
||||
char *buffer_data = Buffer::Data(buffer_obj);
|
||||
size_t buffer_length = Buffer::Length(buffer_obj);
|
||||
|
||||
int r = verify->VerifyUpdate(buffer_data, buffer_length);
|
||||
r = verify->VerifyUpdate(buffer_data, buffer_length);
|
||||
} else {
|
||||
char* buf = new char[len];
|
||||
ssize_t written = DecodeWrite(buf, len, args[0], enc);
|
||||
assert(written == len);
|
||||
int r = verify->VerifyUpdate(buf, len);
|
||||
r = verify->VerifyUpdate(buf, len);
|
||||
delete [] buf;
|
||||
}
|
||||
|
||||
if (!r) {
|
||||
Local<Value> exception = Exception::TypeError(String::New("VerifyUpdate fail"));
|
||||
return ThrowException(exception);
|
||||
}
|
||||
|
||||
return args.This();
|
||||
}
|
||||
|
||||
|
|
|
@ -564,7 +564,7 @@ static Handle<Value> ReadDir(const Arguments& args) {
|
|||
char *name;
|
||||
int i = 0;
|
||||
|
||||
while (ent = readdir(dir)) {
|
||||
while ((ent = readdir(dir))) {
|
||||
name = ent->d_name;
|
||||
|
||||
if (name[0] != '.' || (name[1] && (name[1] != '.' || name[2]))) {
|
||||
|
|
|
@ -107,7 +107,7 @@ Handle<Value> node::Script::CreateContext (const Arguments& args) {
|
|||
Local<Object> sandbox = args[0]->ToObject();
|
||||
Local<Array> keys = sandbox->GetPropertyNames();
|
||||
|
||||
for (int i = 0; i < keys->Length(); i++) {
|
||||
for (uint32_t i = 0; i < keys->Length(); i++) {
|
||||
Handle<String> key = keys->Get(Integer::New(i))->ToString();
|
||||
Handle<Value> value = sandbox->Get(key);
|
||||
context->Set(key, value);
|
||||
|
|
|
@ -30,6 +30,7 @@ void SignalWatcher::Callback(EV_P_ ev_signal *watcher, int revents) {
|
|||
SignalWatcher *w = static_cast<SignalWatcher*>(watcher->data);
|
||||
|
||||
assert(watcher == &w->watcher_);
|
||||
assert(revents == EV_SIGNAL);
|
||||
|
||||
HandleScope scope;
|
||||
|
||||
|
|
1
wscript
1
wscript
|
@ -271,6 +271,7 @@ def configure(conf):
|
|||
# LFS
|
||||
conf.env.append_value('CPPFLAGS', '-D_LARGEFILE_SOURCE')
|
||||
conf.env.append_value('CPPFLAGS', '-D_FILE_OFFSET_BITS=64')
|
||||
conf.env.append_value('CPPFLAGS', '-DEV_MULTIPLICITY=0')
|
||||
|
||||
## needed for node_file.cc fdatasync
|
||||
## Strangely on OSX 10.6 the g++ doesn't see fdatasync but gcc does?
|
||||
|
|
Loading…
Reference in New Issue