Bug 783840 - Fix build warnings in js r=luke

This commit is contained in:
David Zbarsky 2012-08-20 12:32:56 -04:00
parent 2c84955ead
commit b5c2ae0b3e
9 changed files with 22 additions and 18 deletions

View File

@ -254,16 +254,16 @@ frontend::CompileFunctionBody(JSContext *cx, HandleFunction fun, CompileOptions
const AutoNameVector &formals, const jschar *chars, size_t length)
{
if (!CheckLength(cx, length))
return NULL;
return false;
ScriptSource *ss = cx->new_<ScriptSource>();
if (!ss)
return NULL;
return false;
ScriptSourceHolder ssh(cx->runtime, ss);
SourceCompressionToken sct(cx);
JS_ASSERT(options.sourcePolicy != CompileOptions::LAZY_SOURCE);
if (options.sourcePolicy == CompileOptions::SAVE_SOURCE) {
if (!ss->setSourceCopy(cx, chars, length, true, &sct))
return NULL;
return false;
}
options.setCompileAndGo(false);

View File

@ -5720,7 +5720,7 @@ JS::Evaluate(JSContext *cx, HandleObject obj, CompileOptions options,
else
chars = InflateString(cx, bytes, &length);
if (!chars)
return NULL;
return false;
bool ok = Evaluate(cx, obj, options, chars, length, rval);
cx->free_(chars);
@ -5735,7 +5735,7 @@ JS::Evaluate(JSContext *cx, HandleObject obj, CompileOptions options,
{
AutoFile file;
if (!file.open(cx, filename) || !file.readAll(cx, buffer))
return NULL;
return false;
}
options = options.setFileAndLine(filename, 1);

View File

@ -1305,10 +1305,12 @@ Function(JSContext *cx, unsigned argc, Value *vp)
}
}
#ifdef DEBUG
for (unsigned i = 0; i < formals.length(); ++i) {
JSString *str = formals[i];
JS_ASSERT(str->asAtom().asPropertyName() == formals[i]);
}
#endif
JS::Anchor<JSString *> strAnchor(NULL);
const jschar *chars;

View File

@ -5887,10 +5887,10 @@ bool
ExpressionDecompiler::decompilePC(jsbytecode *pc)
{
JS_ASSERT(script->code <= pc && pc < script->code + script->length);
PCStack pcstack(cx);
if (!pcstack.init(cx, script, pc))
return NULL;
return false;
JSOp op = (JSOp)*pc;

View File

@ -1595,10 +1595,10 @@ NodeBuilder::xmlPI(Value target, Value contents, TokenPos *pos, Value *dst)
class ASTSerializer
{
JSContext *cx;
Parser *parser;
NodeBuilder builder;
uint32_t lineno;
JSContext *cx;
Parser *parser;
NodeBuilder builder;
DebugOnly<uint32_t> lineno;
Value atomContents(JSAtom *atom) {
return StringValue(atom ? atom : cx->runtime->atomState.emptyAtom);
@ -1681,8 +1681,12 @@ class ASTSerializer
public:
ASTSerializer(JSContext *c, bool l, char const *src, uint32_t ln)
: cx(c), builder(c, l, src), lineno(ln) {
}
: cx(c)
, builder(c, l, src)
#ifdef DEBUG
, lineno(ln)
#endif
{}
bool init(JSObject *userobj) {
return builder.init(userobj);

View File

@ -520,7 +520,7 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
if (scriptBits & (1 << OwnSource)) {
ss = cx->new_<ScriptSource>();
if (!ss)
return NULL;
return false;
} else {
JS_ASSERT(enclosingScript);
ss = enclosingScript->scriptSource();

View File

@ -1055,7 +1055,6 @@ class SourceCompressorThread
// Set by finish() to tell the compression thread to exit.
SHUTDOWN
} state;
JSRuntime *rt;
SourceCompressionToken *tok;
PRThread *thread;
// Protects |state| and |tok| when it's non-NULL.
@ -1075,7 +1074,6 @@ class SourceCompressorThread
public:
explicit SourceCompressorThread(JSRuntime *rt)
: state(IDLE),
rt(rt),
tok(NULL),
thread(NULL),
lock(NULL),

View File

@ -139,7 +139,7 @@ WeakMap_has_impl(JSContext *cx, CallArgs args)
return false;
if (ObjectValueMap *map = GetObjectMap(&args.thisv().toObject())) {
if (ObjectValueMap::Ptr ptr = map->lookup(key)) {
if (map->has(key)) {
args.rval().setBoolean(true);
return true;
}

View File

@ -374,7 +374,7 @@ ConvertQNameToString(JSContext *cx, JSObject *obj)
size_t length = str->length();
jschar *chars = (jschar *) cx->malloc_((length + 2) * sizeof(jschar));
if (!chars)
return JS_FALSE;
return NULL;
*chars = '@';
const jschar *strChars = str->getChars(cx);
if (!strChars) {