[INFER] Fix another Windows build break.
authorBrian Hackett <bhackett1024@gmail.com>
Fri, 29 Oct 2010 11:44:30 -0700
changeset 74601 1185c7f42e5d2a80796c69ace2faabace099f4e5
parent 74600 53c04cf898f4eb6496b0e65fa3e812a748e13479
child 74602 a2e6ee94f4bfa85ac6e30d7f9f828483bcb0bc14
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
milestone2.0b8pre
[INFER] Fix another Windows build break.
js/src/jsapi.cpp
js/src/jsinfer.cpp
js/src/jsinferinlines.h
js/src/jsobj.cpp
js/src/jsobj.h
js/src/jsscript.cpp
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -4479,17 +4479,17 @@ JS_DefineFunctionsWithPrefix(JSContext *
             if (!ctor) {
                 ctor = JS_GetConstructor(cx, obj);
                 if (!ctor)
                     return JS_FALSE;
             }
 
             size_t genericLen = strlen(namePrefix) + strlen(fs->name) + 12;
             char *genericName = (char*) alloca(genericLen);
-            snprintf(genericName, genericLen, "%s.generic.%s", namePrefix, fs->name);
+            JS_snprintf(genericName, genericLen, "%s.generic.%s", namePrefix, fs->name);
 
             flags &= ~JSFUN_GENERIC_NATIVE;
             fun = JS_DefineFunctionWithType(cx, ctor, fs->name,
                                             Jsvalify(js_generic_native_method_dispatcher),
                                             fs->nargs + 1,
                                             flags & ~JSFUN_TRCINFO,
                                             fs->handler,
                                             genericName);
@@ -4509,17 +4509,17 @@ JS_DefineFunctionsWithPrefix(JSContext *
             if (!js_SetReservedSlot(cx, FUN_OBJECT(fun), 0, priv))
                 return JS_FALSE;
         }
 
 #ifdef JS_TYPE_INFERENCE
         JS_ASSERT(namePrefix);
         size_t fullLen = strlen(namePrefix) + strlen(fs->name) + 2;
         char *fullName = (char*) alloca(fullLen);
-        snprintf(fullName, fullLen, "%s.%s", namePrefix, fs->name);
+        JS_snprintf(fullName, fullLen, "%s.%s", namePrefix, fs->name);
 #else
         char *fullName = NULL;
 #endif
 
         fun = JS_DefineFunctionWithType(cx, obj, fs->name, fs->call, fs->nargs, flags,
                                         fs->handler, fullName);
         if (!fun)
             return JS_FALSE;
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -1016,17 +1016,17 @@ TypeCompartment::init()
     JS_InitArenaPool(&pool, "typeinfer", 512, 8, NULL);
 
     /*
     char buf[50];
     char prefix[10];
     prefix[0] = 0;
     strcpy(prefix, ".XXXXXX");
     mktemp(prefix);
-    snprintf(buf, sizeof(buf), "infer%s.txt", prefix);
+    JS_snprintf(buf, sizeof(buf), "infer%s.txt", prefix);
     out = fopen(buf, "w");
     */
 
     static FILE *file = NULL;
     if (!file)
         file = fopen("infer.txt", "w");
     out = file;
 
@@ -1348,17 +1348,17 @@ TypeFunction::fillProperties(JSContext *
      * transitively from Object.prototype.
      */
     TypeObject *funcProto = cx->getFixedTypeObject(TYPE_OBJECT_FUNCTION_PROTOTYPE);
     funcProto->addPropagate(cx, this);
 
     const char *baseName = cx->getTypeId(name);
     unsigned len = strlen(baseName) + 15;
     char *prototypeName = (char *)alloca(len);
-    snprintf(prototypeName, len, "%s:prototype", baseName);
+    JS_snprintf(prototypeName, len, "%s:prototype", baseName);
     prototypeObject = cx->getTypeObject(prototypeName, false);
 
     TypeSet *prototypeTypes = propertySet.getVariable(cx, id_prototype(cx));
     prototypeTypes->addType(cx, (jstype) prototypeObject);
 
     /* The prototype inherits properties from Object.prototype. */
     TypeObject *objectProto = cx->getFixedTypeObject(TYPE_OBJECT_OBJECT_PROTOTYPE);
     objectProto->addPropagate(cx, prototypeObject);
@@ -2727,30 +2727,30 @@ Script::analyzeTypes(JSContext *cx, Byte
          * This bytecode uses the value at the top of the stack, though this is
          * not specified in the opcode table.
          */
         JS_ASSERT(code->inStack);
         TypeSet *value = &code->inStack->group()->types;
 
         /* Model sharp values as local variables. */
         char name[24];
-        snprintf(name, sizeof(name), "#%d:%d",
-                 GET_UINT16(pc), GET_UINT16(pc + UINT16_LEN));
+        JS_snprintf(name, sizeof(name), "#%d:%d",
+                    GET_UINT16(pc), GET_UINT16(pc + UINT16_LEN));
         JSAtom *atom = js_Atomize(cx, name, strlen(name), ATOM_PINNED);
         jsid id = ATOM_TO_JSID(atom);
 
         TypeSet *types = evalParent()->localTypes.getVariable(cx, id);
         value->addSubset(cx, pool, types);
         break;
       }
 
       case JSOP_USESHARP: {
         char name[24];
-        snprintf(name, sizeof(name), "#%d:%d",
-                 GET_UINT16(pc), GET_UINT16(pc + UINT16_LEN));
+        JS_snprintf(name, sizeof(name), "#%d:%d",
+                    GET_UINT16(pc), GET_UINT16(pc + UINT16_LEN));
         JSAtom *atom = js_Atomize(cx, name, strlen(name), ATOM_PINNED);
         jsid id = ATOM_TO_JSID(atom);
 
         TypeSet *types = evalParent()->localTypes.getVariable(cx, id);
         MergePushed(cx, evalParent()->pool, code, 0, types);
         break;
       }
 
--- a/js/src/jsinferinlines.h
+++ b/js/src/jsinferinlines.h
@@ -37,16 +37,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 // inline members for javascript type inference.
 
 #include "jsanalyze.h"
 #include "jscompartment.h"
 #include "jsinfer.h"
+#include "jsprf.h"
 
 #ifndef jsinferinlines_h___
 #define jsinferinlines_h___
 
 /////////////////////////////////////////////////////////////////////
 // Types
 /////////////////////////////////////////////////////////////////////
 
@@ -217,17 +218,17 @@ JSContext::getTypeId(jsid id)
 #endif
 }
 
 inline void
 JSContext::setTypeFunctionScript(JSFunction *fun, JSScript *script)
 {
 #ifdef JS_TYPE_INFERENCE
     char name[8];
-    snprintf(name, 16, "#%u", script->analysis->id);
+    JS_snprintf(name, 16, "#%u", script->analysis->id);
 
     js::types::TypeFunction *typeFun =
         compartment->types.getTypeObject(this, script->analysis, name, true)->asFunction();
 
     /* We should not be attaching multiple scripts to the same function. */
     if (typeFun->script) {
         JS_ASSERT(typeFun->script == script);
         fun->typeObject = typeFun;
@@ -685,17 +686,17 @@ Bytecode::setFixed(JSContext *cx, unsign
     pushed(num)->addType(cx, type);
 }
 
 inline types::TypeObject *
 Bytecode::getInitObject(JSContext *cx, bool isArray)
 {
     if (!initObject) {
         char name[32];
-        snprintf(name, 32, "#%u:%u", script->id, offset);
+        JS_snprintf(name, 32, "#%u:%u", script->id, offset);
         initObject = cx->compartment->types.getTypeObject(cx, script, name, false);
         initObject->isInitObject = true;
     }
 
     /*
      * Add the propagation even if there was already an object, as Object/Array
      * could *both* be invoked for this value.
      */
@@ -1252,17 +1253,17 @@ TypeFunction::getNewObject(JSContext *cx
 {
     if (newObject)
         return newObject;
 
     const char *baseName = cx->getTypeId(name);
 
     unsigned len = strlen(baseName) + 10;
     char *newName = (char *) alloca(len);
-    snprintf(newName, len, "%s:new", baseName);
+    JS_snprintf(newName, len, "%s:new", baseName);
     newObject = cx->compartment->types.getTypeObject(cx, script ? script->analysis : NULL,
                                                      newName, false);
 
     properties(cx);
     JS_ASSERT_IF(!prototypeObject, isBuiltin);
 
     /*
      * Propagate properties from the prototype of this script to any objects
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -3626,17 +3626,17 @@ js_InitClass(JSContext *cx, JSObject *ob
         return NULL;
     }
 
     /* Create type information for the prototype object. */
     TypeObject *protoType = NULL;
 #ifdef JS_TYPE_INFERENCE
     size_t protoLen = strlen(clasp->name) + 15;
     char *protoName = (char*) alloca(protoLen);
-    snprintf(protoName, protoLen, "%s:prototype", clasp->name);
+    JS_snprintf(protoName, protoLen, "%s:prototype", clasp->name);
     if (clasp == &js_FunctionClass)
         protoType = cx->getTypeFunctionHandler(protoName, JS_TypeHandlerVoid);
     else
         protoType = cx->getTypeObject(protoName, false);
 #endif
 
     /*
      * Create a prototype object for this class.
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -58,17 +58,17 @@
 #include "jscell.h"
 
 namespace js {
 
 class JSProxyHandler;
 class AutoPropDescArrayRooter;
 
 namespace mjit { class Compiler; }
-namespace types { class TypeObject; }
+namespace types { struct TypeObject; }
 
 static inline PropertyOp
 CastAsPropertyOp(JSObject *object)
 {
     return JS_DATA_TO_FUNC_PTR(PropertyOp, object);
 }
 
 static inline JSPropertyOp
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -1789,16 +1789,16 @@ JSScript::makeAnalysis(JSContext *cx)
 
 #ifdef JS_TYPE_INFERENCE
     analysis->id = ++cx->compartment->types.scriptCount;
     analysis->localTypes.pool = &analysis->pool;
     analysis->thisTypes.setPool(&analysis->pool);
 
 #ifdef JS_TYPES_DEBUG_SPEW
     char name[40];
-    snprintf(name, sizeof(name), "#%u:locals", analysis->id);
+    JS_snprintf(name, sizeof(name), "#%u:locals", analysis->id);
     analysis->localTypes.name = ATOM_TO_JSID(js_Atomize(cx, name, strlen(name), 0));
     fprintf(cx->typeOut(), "newScript: %s\n", name);
 #endif
 #endif /* JS_TYPE_INFERENCE */
 
     return analysis;
 }