JS style: consistent use of space around for/while/if conditions. NFC. (#13669)

This commit is contained in:
Sam Clegg 2021-03-16 08:09:43 -07:00 коммит произвёл GitHub
Родитель 6bfb7f15d2
Коммит cbc974264e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
34 изменённых файлов: 136 добавлений и 141 удалений

Просмотреть файл

@ -300,7 +300,7 @@ function fetchXHR(fetch, onsuccess, onerror, onprogress, onreadystatechange) {
xhr.overrideMimeType(overriddenMimeTypeStr);
}
if (requestHeaders) {
for(;;) {
for (;;) {
var key = HEAPU32[requestHeaders >> 2];
if (!key) break;
var value = HEAPU32[requestHeaders + 4 >> 2];

Просмотреть файл

@ -162,7 +162,7 @@ var emscriptenCpuProfiler = {
accumulatedFrameTimeInsideMainLoop: function(startX, numSamples) {
var total = 0;
numSamples = Math.min(numSamples, this.frametimesInsideMainLoop.length);
for(var i = 0; i < numSamples; ++i) {
for (var i = 0; i < numSamples; ++i) {
var x = (startX + i) % this.frametimesInsideMainLoop.length;
if (this.frametimesInsideMainLoop[x]) total += this.frametimesInsideMainLoop[x];
}
@ -171,7 +171,7 @@ var emscriptenCpuProfiler = {
accumulatedFrameTimeOutsideMainLoop: function(startX, numSamples) {
var total = 0;
numSamples = Math.min(numSamples, this.frametimesInsideMainLoop.length);
for(var i = 0; i < numSamples; ++i) {
for (var i = 0; i < numSamples; ++i) {
var x = (startX + i) % this.frametimesInsideMainLoop.length;
if (this.frametimesOutsideMainLoop[x]) total += this.frametimesOutsideMainLoop[x];
}
@ -201,7 +201,7 @@ var emscriptenCpuProfiler = {
if (sect.traceable && timeInSection > this.logWebGLCallsSlowerThan) {
var funcs = new Error().stack.toString().split('\n');
var cs = '';
for(var i = 2; i < 5 && i < funcs.length; ++i) {
for (var i = 2; i < 5 && i < funcs.length; ++i) {
if (i != 2) cs += ' <- ';
var fn = funcs[i];
var at = fn.indexOf('@');
@ -232,7 +232,7 @@ var emscriptenCpuProfiler = {
if (this.insideMainLoopRecursionCounter != 0) return;
// Aggregate total times spent in each section to memory store to wait until the next stats UI redraw period.
for(var i = 0; i < this.sections.length; ++i) {
for (var i = 0; i < this.sections.length; ++i) {
var sect = this.sections[i];
if (!sect) continue;
sect.frametimesInsideMainLoop[this.currentHistogramX] = sect.accumulatedTimeInsideMainLoop;
@ -417,7 +417,7 @@ var emscriptenCpuProfiler = {
drawBar: function drawBar(x) {
var timeSpentInSectionsInsideMainLoop = 0;
for(var i = 0; i < this.sections.length; ++i) {
for (var i = 0; i < this.sections.length; ++i) {
var sect = this.sections[i];
if (!sect) continue;
timeSpentInSectionsInsideMainLoop += sect.frametimesInsideMainLoop[x];
@ -428,7 +428,7 @@ var emscriptenCpuProfiler = {
y -= h;
this.drawContext.fillStyle = this.colorCpuTimeSpentInUserCode;
this.drawContext.fillRect(x, y, 1, h);
for(var i = 0; i < this.sections.length; ++i) {
for (var i = 0; i < this.sections.length; ++i) {
var sect = this.sections[i];
if (!sect) continue;
h = (sect.frametimesInsideMainLoop[x] + sect.frametimesOutsideMainLoop[x]) * scale;
@ -566,7 +566,7 @@ var emscriptenCpuProfiler = {
this.hookedWebGLContexts.splice(this.hookedWebGLContexts.indexOf(glCtx), 1);
document.getElementById("toggle_webgl_profile").style.background = '#E1E1E1';
for(var f in glCtx) {
for (var f in glCtx) {
if (typeof glCtx[f] !== 'function' || f.indexOf('real_') == 0) continue;
var realf = 'real_' + f;
glCtx[f] = glCtx[realf];
@ -581,7 +581,7 @@ var emscriptenCpuProfiler = {
glCtx[realf] = glCtx[f];
var numArgs = this_.webGLFunctionLength(f); // On Firefox & Chrome, could do "glCtx[realf].length", but that doesn't work on Edge, which always reports 0.
// Accessing 'arguments' is super slow, so to avoid overhead, statically reason the number of arguments.
switch(numArgs) {
switch (numArgs) {
case 0: glCtx[f] = function webgl_0() { this_.enterSection(section); var ret = glCtx[realf](); this_.endSection(section); return ret; }; break;
case 1: glCtx[f] = function webgl_1(a1) { this_.enterSection(section); var ret = glCtx[realf](a1); this_.endSection(section); return ret; }; break;
case 2: glCtx[f] = function webgl_2(a1, a2) { this_.enterSection(section); var ret = glCtx[realf](a1, a2); this_.endSection(section); return ret; }; break;
@ -616,7 +616,7 @@ var emscriptenCpuProfiler = {
// Distinguishing between these two allows pinpointing locations of troublesome GL usage that might cause performance issues.
this.createSection(0, 'Hot GL', this.colorHotGLFunction, /*traceable=*/true);
this.createSection(1, 'Cold GL', this.colorColdGLFunction, /*traceable=*/true);
for(var f in glCtx) {
for (var f in glCtx) {
if (typeof glCtx[f] !== 'function' || f.indexOf('real_') == 0) continue;
this.hookWebGLFunction(f, glCtx);
}

Просмотреть файл

@ -923,7 +923,7 @@ var LibraryEmbind = {
// TODO: Remove this completely once all function invokers are being dynamically generated.
var needsDestructorStack = false;
for(var i = 1; i < argTypes.length; ++i) { // Skip return value at index 0 - it's not deleted here.
for (var i = 1; i < argTypes.length; ++i) { // Skip return value at index 0 - it's not deleted here.
if (argTypes[i] !== null && argTypes[i].destructorFunction === undefined) { // The type does not define a destructor function - must use dynamic stack
needsDestructorStack = true;
break;
@ -983,7 +983,7 @@ var LibraryEmbind = {
#else
var argsList = "";
var argsListWired = "";
for(var i = 0; i < argCount - 2; ++i) {
for (var i = 0; i < argCount - 2; ++i) {
argsList += (i!==0?", ":"")+"arg"+i;
argsListWired += (i!==0?", ":"")+"arg"+i+"Wired";
}
@ -1016,7 +1016,7 @@ var LibraryEmbind = {
invokerFnBody += "var thisWired = classParam.toWireType("+dtorStack+", this);\n";
}
for(var i = 0; i < argCount - 2; ++i) {
for (var i = 0; i < argCount - 2; ++i) {
invokerFnBody += "var arg"+i+"Wired = argType"+i+".toWireType("+dtorStack+", arg"+i+"); // "+argTypes[i+2].name+"\n";
args1.push("argType"+i);
args2.push(argTypes[i+2]);
@ -1032,7 +1032,7 @@ var LibraryEmbind = {
if (needsDestructorStack) {
invokerFnBody += "runDestructors(destructors);\n";
} else {
for(var i = isClassMethodFunc?1:2; i < argTypes.length; ++i) { // Skip return value at index 0 - it's not deleted here. Also skip class type if not a method.
for (var i = isClassMethodFunc?1:2; i < argTypes.length; ++i) { // Skip return value at index 0 - it's not deleted here. Also skip class type if not a method.
var paramName = (i === 1 ? "thisWired" : ("arg"+(i - 2)+"Wired"));
if (argTypes[i].destructorFunction !== null) {
invokerFnBody += paramName+"_dtor("+paramName+"); // "+argTypes[i].name+"\n";

Просмотреть файл

@ -76,8 +76,7 @@ var LibraryEmVal = {
_emval_register__deps: ['$emval_free_list', '$emval_handle_array', '$init_emval'],
_emval_register: function(value) {
switch(value){
switch (value) {
case undefined :{ return 1; }
case null :{ return 2; }
case true :{ return 3; }
@ -168,14 +167,14 @@ var LibraryEmVal = {
};
#else
var argsList = "";
for(var i = 0; i < argCount; ++i) {
for (var i = 0; i < argCount; ++i) {
argsList += (i!==0?", ":"")+"arg"+i; // 'arg0, arg1, ..., argn'
}
var functionBody =
"return function emval_allocator_"+argCount+"(constructor, argTypes, args) {\n";
for(var i = 0; i < argCount; ++i) {
for (var i = 0; i < argCount; ++i) {
functionBody +=
"var argType"+i+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+i+"], \"parameter "+i+"\");\n" +
"var arg"+i+" = argType"+i+".readValueFromPointer(args);\n" +
@ -244,7 +243,7 @@ var LibraryEmVal = {
#endif
_emval_get_global__deps: ['_emval_register', '$getStringOrSymbol', '$emval_get_global'],
_emval_get_global: function(name) {
if(name===0){
if (name===0) {
return __emval_register(emval_get_global());
} else {
name = getStringOrSymbol(name);

Просмотреть файл

@ -119,7 +119,7 @@ var document = {
removeEventListener: window.removeEventListener,
callEventListeners: window.callEventListeners,
getElementById: function(id) {
switch(id) {
switch (id) {
case 'canvas': {
if (this.canvas) return this.canvas;
return this.canvas = headlessCanvas();

Просмотреть файл

@ -9,7 +9,7 @@ function headlessCanvas() {
var ret = {
headless: true,
getContext: function(which) {
switch(which) {
switch (which) {
case 'webgl':
case 'experimental-webgl': {
return {
@ -442,7 +442,7 @@ function headlessCanvas() {
bindBuffer: function(){},
bufferData: function(){},
getParameter: function(pname) {
switch(pname) {
switch (pname) {
case /* GL_VENDOR */ 0x1F00: return 'FakeShellGLVendor';
case /* GL_RENDERER */ 0x1F01: return 'FakeShellGLRenderer';
case /* GL_VERSION */ 0x1F02: return '0.0.1';
@ -470,7 +470,7 @@ function headlessCanvas() {
return id;
},
getShaderParameter: function(shader, pname) {
switch(pname) {
switch (pname) {
case /* GL_SHADER_TYPE */ 0x8B4F: return this.items[shader].type;
case /* GL_COMPILE_STATUS */ 0x8B81: return true;
default: throw 'getShaderParameter ' + pname;
@ -492,7 +492,7 @@ function headlessCanvas() {
bindAttribLocation: function(){},
linkProgram: function(){},
getProgramParameter: function(program, pname) {
switch(pname) {
switch (pname) {
case /* LINK_STATUS */ 0x8B82: return true;
case /* ACTIVE_UNIFORMS */ 0x8B86: return 4;
default: throw 'getProgramParameter ' + pname;

Просмотреть файл

@ -286,7 +286,7 @@ LibraryManager.library = {
sysconf: function(name) {
// long sysconf(int name);
// http://pubs.opengroup.org/onlinepubs/009695399/functions/sysconf.html
switch(name) {
switch (name) {
case {{{ cDefine('_SC_PAGE_SIZE') }}}: return {{{ POSIX_PAGE_SIZE }}};
case {{{ cDefine('_SC_PHYS_PAGES') }}}:
#if ALLOW_MEMORY_GROWTH
@ -558,7 +558,7 @@ LibraryManager.library = {
// Loop through potential heap size increases. If we attempt a too eager reservation that fails, cut down on the
// attempted size and reserve a smaller bump instead. (max 3 times, chosen somewhat arbitrarily)
for(var cutDown = 1; cutDown <= 4; cutDown *= 2) {
for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
#if MEMORY_GROWTH_LINEAR_STEP == -1
var overGrownHeapSize = oldSize * (1 + {{{ MEMORY_GROWTH_GEOMETRIC_STEP }}} / cutDown); // ensure geometric growth
#if MEMORY_GROWTH_GEOMETRIC_CAP
@ -1038,7 +1038,7 @@ LibraryManager.library = {
_addDays__deps: ['_isLeapYear', '_MONTH_DAYS_LEAP', '_MONTH_DAYS_REGULAR'],
_addDays: function(date, days) {
var newDate = new Date(date.getTime());
while(days > 0) {
while (days > 0) {
var leap = __isLeapYear(newDate.getFullYear());
var currentMonth = newDate.getMonth();
var daysInCurrentMonth = (leap ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR)[currentMonth];
@ -2201,8 +2201,8 @@ LibraryManager.library = {
if (parts[5] === 0) {
str = "::";
//special case IPv6 addresses
if(v4part === "0.0.0.0") v4part = ""; // any/unspecified address
if(v4part === "0.0.0.1") v4part = "1";// loopback address
if (v4part === "0.0.0.0") v4part = ""; // any/unspecified address
if (v4part === "0.0.0.1") v4part = "1";// loopback address
str += v4part;
return str;
}
@ -3757,7 +3757,7 @@ LibraryManager.library = {
},
$callRuntimeCallbacks: function(callbacks) {
while(callbacks.length > 0) {
while (callbacks.length > 0) {
var callback = callbacks.shift();
if (typeof callback == 'function') {
callback(Module); // Pass the module as the first argument.

Просмотреть файл

@ -514,7 +514,7 @@ var LibraryBrowser = {
},
getUserMedia: function(func) {
if(!window.getUserMedia) {
if (!window.getUserMedia) {
window.getUserMedia = navigator['getUserMedia'] ||
navigator['mozGetUserMedia'];
}
@ -558,7 +558,7 @@ var LibraryBrowser = {
break;
case 'wheel':
delta = event.deltaY
switch(event.deltaMode) {
switch (event.deltaMode) {
case 0:
// DOM_DELTA_PIXEL: 100 pixels make up a step
delta /= 100;

Просмотреть файл

@ -46,7 +46,7 @@ var LibraryEGL = {
if (attribList) {
// read attribList if it is non-null
for(;;) {
for (;;) {
var param = {{{ makeGetValue('attribList', '0', 'i32') }}};
if (param == 0x3021 /*EGL_ALPHA_SIZE*/) {
var alphaSize = {{{ makeGetValue('attribList', '4', 'i32') }}};
@ -176,7 +176,7 @@ var LibraryEGL = {
return 0;
}
EGL.setErrorCode(0x3000 /* EGL_SUCCESS */);
switch(attribute) {
switch (attribute) {
case 0x3020: // EGL_BUFFER_SIZE
{{{ makeSetValue('value', '0', 'EGL.contextAttributes.alpha ? 32 : 24' /* 8 bits for each R,G,B. 8 bits for alpha if enabled*/, 'i32') }}};
return 1;
@ -333,7 +333,7 @@ var LibraryEGL = {
// EGL 1.4 spec says default EGL_CONTEXT_CLIENT_VERSION is GLES1, but this is not supported by Emscripten.
// So user must pass EGL_CONTEXT_CLIENT_VERSION == 2 to initialize EGL.
var glesContextVersion = 1;
for(;;) {
for (;;) {
var param = {{{ makeGetValue('contextAttribs', '0', 'i32') }}};
if (param == 0x3098 /*EGL_CONTEXT_CLIENT_VERSION*/) {
glesContextVersion = {{{ makeGetValue('contextAttribs', '4', 'i32') }}};
@ -424,7 +424,7 @@ var LibraryEGL = {
return 0;
}
EGL.setErrorCode(0x3000 /* EGL_SUCCESS */);
switch(attribute) {
switch (attribute) {
case 0x3028: // EGL_CONFIG_ID
{{{ makeSetValue('value', '0', '62002' /* A magic value for the only EGLConfig configuration ID supported by Emscripten. */, 'i32') }}};
return 1;
@ -493,7 +493,7 @@ var LibraryEGL = {
}
EGL.setErrorCode(0x3000 /* EGL_SUCCESS */);
switch(attribute) {
switch (attribute) {
case 0x3028: // EGL_CONFIG_ID
{{{ makeSetValue('value', '0', '62002' /* A magic value for the only EGLConfig configuration ID supported by Emscripten. */, 'i32') }}};
return 1;
@ -536,7 +536,7 @@ var LibraryEGL = {
EGL.setErrorCode(0x3000 /* EGL_SUCCESS */);
if (EGL.stringCache[name]) return EGL.stringCache[name];
var ret;
switch(name) {
switch (name) {
case 0x3053 /* EGL_VENDOR */: ret = allocateUTF8("Emscripten"); break;
case 0x3054 /* EGL_VERSION */: ret = allocateUTF8("1.4 Emscripten EGL"); break;
case 0x3055 /* EGL_EXTENSIONS */: ret = allocateUTF8(""); break; // Currently not supporting any EGL extensions.

Просмотреть файл

@ -100,7 +100,7 @@ mergeInto(LibraryManager.library, {
var ret = [];
var curr, next, currArg;
while(1) {
while (1) {
var startTextIndex = textIndex;
curr = {{{ makeGetValue(0, 'textIndex', 'i8') }}};
if (curr === 0) break;
@ -165,7 +165,7 @@ mergeInto(LibraryManager.library, {
precision = getNextArg('i32');
textIndex++;
} else {
while(1) {
while (1) {
var precisionChr = {{{ makeGetValue(0, 'textIndex+1', 'i8') }}};
if (precisionChr < {{{ charCode('0') }}} ||
precisionChr > {{{ charCode('9') }}}) break;

Просмотреть файл

@ -1759,7 +1759,7 @@ FS.staticInit();` +
Object.defineProperties(lazyArray, {
length: {
get: /** @this{Object} */ function() {
if(!this.lengthKnown) {
if (!this.lengthKnown) {
this.cacheLength();
}
return this._length;
@ -1767,7 +1767,7 @@ FS.staticInit();` +
},
chunkSize: {
get: /** @this{Object} */ function() {
if(!this.lengthKnown) {
if (!this.lengthKnown) {
this.cacheLength();
}
return this._chunkSize;

Просмотреть файл

@ -285,7 +285,7 @@ var LibraryGLEmulation = {
var glGetString = _glGetString;
_glGetString = _emscripten_glGetString = function _glGetString(name_) {
if (GL.stringCache[name_]) return GL.stringCache[name_];
switch(name_) {
switch (name_) {
case 0x1F03 /* GL_EXTENSIONS */: // Add various extensions that we can support
var ret = stringToNewUTF8((GLctx.getSupportedExtensions() || []).join(' ') +
' GL_EXT_texture_env_combine GL_ARB_texture_env_crossbar GL_ATI_texture_env_combine3 GL_NV_texture_env_combine4 GL_EXT_texture_env_dot3 GL_ARB_multitexture GL_ARB_vertex_buffer_object GL_EXT_framebuffer_object GL_ARB_vertex_program GL_ARB_fragment_program GL_ARB_shading_language_100 GL_ARB_shader_objects GL_ARB_vertex_shader GL_ARB_fragment_shader GL_ARB_texture_cube_map GL_EXT_draw_range_elements' +
@ -688,7 +688,7 @@ var LibraryGLEmulation = {
glGetPointerv: function(name, p) {
var attribute;
switch(name) {
switch (name) {
case 0x808E: // GL_VERTEX_ARRAY_POINTER
attribute = GLImmediate.clientAttributes[GLImmediate.VERTEX]; break;
case 0x8090: // GL_COLOR_ARRAY_POINTER
@ -1171,7 +1171,7 @@ var LibraryGLEmulation = {
var load;
// As an optimization, merge duplicate identical texture loads to one var.
while(load = texLoadRegex.exec(lines)) {
while (load = texLoadRegex.exec(lines)) {
var texLoadExpr = load[1];
var secondOccurrence = lines.slice(load.index+1).indexOf(texLoadExpr);
if (secondOccurrence != -1) { // And also has a second occurrence of same load expression..
@ -3006,7 +3006,7 @@ var LibraryGLEmulation = {
},
glFogf: function(pname, param) { // partial support, TODO
switch(pname) {
switch (pname) {
case 0xB63: // GL_FOG_START
GLEmulation.fogStart = param; break;
case 0xB64: // GL_FOG_END
@ -3038,7 +3038,7 @@ var LibraryGLEmulation = {
},
glFogfv__deps: ['glFogf'],
glFogfv: function(pname, param) { // partial support, TODO
switch(pname) {
switch (pname) {
case 0xB66: // GL_FOG_COLOR
GLEmulation.fogColor[0] = {{{ makeGetValue('param', '0', 'float') }}};
GLEmulation.fogColor[1] = {{{ makeGetValue('param', '4', 'float') }}};
@ -3052,7 +3052,7 @@ var LibraryGLEmulation = {
},
glFogiv__deps: ['glFogf'],
glFogiv: function(pname, param) {
switch(pname) {
switch (pname) {
case 0xB66: // GL_FOG_COLOR
GLEmulation.fogColor[0] = ({{{ makeGetValue('param', '0', 'i32') }}}/2147483647)/2.0+0.5;
GLEmulation.fogColor[1] = ({{{ makeGetValue('param', '4', 'i32') }}}/2147483647)/2.0+0.5;

Просмотреть файл

@ -840,9 +840,9 @@ var LibraryGLFW = {
var win = GLFW.WindowFromId(winid);
if (!win) return;
switch(mode) {
switch (mode) {
case 0x00033001: { // GLFW_CURSOR
switch(value) {
switch (value) {
case 0x00034001: { // GLFW_CURSOR_NORMAL
win.inputModes[mode] = value;
Module['canvas'].removeEventListener('click', GLFW.onClickRequestPointerLock, true);

Просмотреть файл

@ -164,16 +164,14 @@ var LibraryGLUT = {
if (GLUT.specialFunc || GLUT.keyboardFunc) {
var key = GLUT.getSpecialKey(event['keyCode']);
if (key !== null) {
if( GLUT.specialFunc ) {
if (GLUT.specialFunc) {
event.preventDefault();
GLUT.saveModifiers(event);
{{{ makeDynCall('viii', 'GLUT.specialFunc') }}}(key, Browser.mouseX, Browser.mouseY);
}
}
else
{
} else {
key = GLUT.getASCIIKey(event);
if( key !== null && GLUT.keyboardFunc ) {
if (key !== null && GLUT.keyboardFunc) {
event.preventDefault();
GLUT.saveModifiers(event);
{{{ makeDynCall('viii', 'GLUT.keyboardFunc') }}}(key, Browser.mouseX, Browser.mouseY);
@ -186,16 +184,14 @@ var LibraryGLUT = {
if (GLUT.specialUpFunc || GLUT.keyboardUpFunc) {
var key = GLUT.getSpecialKey(event['keyCode']);
if (key !== null) {
if(GLUT.specialUpFunc) {
if (GLUT.specialUpFunc) {
event.preventDefault ();
GLUT.saveModifiers(event);
{{{ makeDynCall('viii', 'GLUT.specialUpFunc') }}}(key, Browser.mouseX, Browser.mouseY);
}
}
else
{
} else {
key = GLUT.getASCIIKey(event);
if( key !== null && GLUT.keyboardUpFunc ) {
if (key !== null && GLUT.keyboardUpFunc) {
event.preventDefault ();
GLUT.saveModifiers(event);
{{{ makeDynCall('viii', 'GLUT.keyboardUpFunc') }}}(key, Browser.mouseX, Browser.mouseY);
@ -213,7 +209,7 @@ var LibraryGLUT = {
main = touches[0],
type = "";
switch(event.type) {
switch (event.type) {
case "touchstart": type = "mousedown"; break;
case "touchmove": type = "mousemove"; break;
case "touchend": type = "mouseup"; break;
@ -500,7 +496,7 @@ var LibraryGLUT = {
glutSetCursor__sig: 'vi',
glutSetCursor: function(cursor) {
var cursorStyle = 'auto';
switch(cursor) {
switch (cursor) {
case 0x0000: /* GLUT_CURSOR_RIGHT_ARROW */
// No equivalent css cursor style, fallback to 'auto'
break;

Просмотреть файл

@ -49,7 +49,7 @@ var LibraryJSEvents = {
inEventHandler: 0,
removeAllEventListeners: function() {
for(var i = JSEvents.eventHandlers.length-1; i >= 0; --i) {
for (var i = JSEvents.eventHandlers.length-1; i >= 0; --i) {
JSEvents._removeHandler(i);
}
JSEvents.eventHandlers = [];
@ -79,13 +79,13 @@ var LibraryJSEvents = {
function arraysHaveEqualContent(arrA, arrB) {
if (arrA.length != arrB.length) return false;
for(var i in arrA) {
for (var i in arrA) {
if (arrA[i] != arrB[i]) return false;
}
return true;
}
// Test if the given call was already queued, and if so, don't add it again.
for(var i in JSEvents.deferredCalls) {
for (var i in JSEvents.deferredCalls) {
var call = JSEvents.deferredCalls[i];
if (call.targetFunction == targetFunction && arraysHaveEqualContent(call.argsList, argsList)) {
return;
@ -102,7 +102,7 @@ var LibraryJSEvents = {
// Erases all deferred calls to the given target function from the queue list.
removeDeferredCalls: function(targetFunction) {
for(var i = 0; i < JSEvents.deferredCalls.length; ++i) {
for (var i = 0; i < JSEvents.deferredCalls.length; ++i) {
if (JSEvents.deferredCalls[i].targetFunction == targetFunction) {
JSEvents.deferredCalls.splice(i, 1);
--i;
@ -118,7 +118,7 @@ var LibraryJSEvents = {
if (!JSEvents.canPerformEventHandlerRequests()) {
return;
}
for(var i = 0; i < JSEvents.deferredCalls.length; ++i) {
for (var i = 0; i < JSEvents.deferredCalls.length; ++i) {
var call = JSEvents.deferredCalls[i];
JSEvents.deferredCalls.splice(i, 1);
--i;
@ -136,7 +136,7 @@ var LibraryJSEvents = {
// Removes all event handlers on the given DOM element of the given type. Pass in eventTypeString == undefined/null to remove all event handlers regardless of the type.
removeAllHandlersOnTarget: function(target, eventTypeString) {
for(var i = 0; i < JSEvents.eventHandlers.length; ++i) {
for (var i = 0; i < JSEvents.eventHandlers.length; ++i) {
if (JSEvents.eventHandlers[i].target == target &&
(!eventTypeString || eventTypeString == JSEvents.eventHandlers[i].eventTypeString)) {
JSEvents._removeHandler(i--);
@ -177,7 +177,7 @@ var LibraryJSEvents = {
JSEvents.registerRemoveEventListeners();
#endif
} else {
for(var i = 0; i < JSEvents.eventHandlers.length; ++i) {
for (var i = 0; i < JSEvents.eventHandlers.length; ++i) {
if (JSEvents.eventHandlers[i].target == eventHandler.target
&& JSEvents.eventHandlers[i].eventTypeString == eventHandler.eventTypeString) {
JSEvents._removeHandler(i--);
@ -200,7 +200,7 @@ var LibraryJSEvents = {
#if USE_PTHREADS
getTargetThreadForEventCallback: function(targetThread) {
switch(targetThread) {
switch (targetThread) {
case {{{ cDefine('EM_CALLBACK_THREAD_CONTEXT_MAIN_BROWSER_THREAD') }}}: return 0; // The event callback for the current event should be called on the main browser thread. (0 == don't proxy)
case {{{ cDefine('EM_CALLBACK_THREAD_CONTEXT_CALLING_THREAD') }}}: return PThread.currentProxiedOperationCallerThread; // The event callback for the current event should be backproxied to the thread that is registering the event.
default: return targetThread; // The event callback for the current event should be proxied to the given specific thread.
@ -1958,7 +1958,7 @@ var LibraryJSEvents = {
if (!navigator.vibrate) return {{{ cDefine('EMSCRIPTEN_RESULT_NOT_SUPPORTED') }}};
var vibrateList = [];
for(var i = 0; i < numEntries; ++i) {
for (var i = 0; i < numEntries; ++i) {
var msecs = {{{ makeGetValue('msecsArray', 'i*4', 'i32') }}};
vibrateList.push(msecs);
}
@ -2050,7 +2050,7 @@ var LibraryJSEvents = {
#endif
var touches = {};
var et = e.touches;
for(var i = 0; i < et.length; ++i) {
for (var i = 0; i < et.length; ++i) {
var touch = et[i];
#if ASSERTIONS
// Verify that browser does not recycle touch objects with old stale data, but reports new ones each time.
@ -2060,7 +2060,7 @@ var LibraryJSEvents = {
touches[touch.identifier] = touch;
}
et = e.changedTouches;
for(var i = 0; i < et.length; ++i) {
for (var i = 0; i < et.length; ++i) {
var touch = et[i];
#if ASSERTIONS
// Verify that browser does not recycle touch objects with old stale data, but reports new ones each time.
@ -2070,7 +2070,7 @@ var LibraryJSEvents = {
touches[touch.identifier] = touch;
}
et = e.targetTouches;
for(var i = 0; i < et.length; ++i) {
for (var i = 0; i < et.length; ++i) {
touches[et[i].identifier].onTarget = 1;
}
@ -2090,7 +2090,7 @@ var LibraryJSEvents = {
#endif
var targetRect = getBoundingClientRect(target);
var numTouches = 0;
for(var i in touches) {
for (var i in touches) {
var t = touches[i];
HEAP32[idx + {{{ C_STRUCTS.EmscriptenTouchPoint.identifier / 4}}}] = t.identifier;
HEAP32[idx + {{{ C_STRUCTS.EmscriptenTouchPoint.screenX / 4}}}] = t.screenX;
@ -2170,17 +2170,17 @@ var LibraryJSEvents = {
$fillGamepadEventData: function(eventStruct, e) {
{{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenGamepadEvent.timestamp, 'e.timestamp', 'double') }}};
for(var i = 0; i < e.axes.length; ++i) {
for (var i = 0; i < e.axes.length; ++i) {
{{{ makeSetValue('eventStruct+i*8', C_STRUCTS.EmscriptenGamepadEvent.axis, 'e.axes[i]', 'double') }}};
}
for(var i = 0; i < e.buttons.length; ++i) {
for (var i = 0; i < e.buttons.length; ++i) {
if (typeof(e.buttons[i]) === 'object') {
{{{ makeSetValue('eventStruct+i*8', C_STRUCTS.EmscriptenGamepadEvent.analogButton, 'e.buttons[i].value', 'double') }}};
} else {
{{{ makeSetValue('eventStruct+i*8', C_STRUCTS.EmscriptenGamepadEvent.analogButton, 'e.buttons[i]', 'double') }}};
}
}
for(var i = 0; i < e.buttons.length; ++i) {
for (var i = 0; i < e.buttons.length; ++i) {
if (typeof(e.buttons[i]) === 'object') {
{{{ makeSetValue('eventStruct+i*4', C_STRUCTS.EmscriptenGamepadEvent.digitalButton, 'e.buttons[i].pressed', 'i32') }}};
} else {
@ -2691,7 +2691,7 @@ var LibraryJSEvents = {
'}\n' +
'clearImmediate = /**@type{function(number=)}*/(function(id) {\n' +
'var index = id - __setImmediate_id_counter;\n' +
'if (index >= 0 && index < __setImmediate_queue.length) __setImmediate_queue[index] = function(){};\n' + // must preserve the order and count of elements in the queue, so replace the pending callback with an empty function
'if (index >= 0 && index < __setImmediate_queue.length) __setImmediate_queue[index] = function() {};\n' + // must preserve the order and count of elements in the queue, so replace the pending callback with an empty function
'})\n' +
'}',

Просмотреть файл

@ -14,7 +14,7 @@ var LibraryHtml5WebGL = {
var len = arr.length;
var writeLength = dstLength < len ? dstLength : len;
var heap = heapType ? HEAPF32 : HEAP32;
for(var i = 0; i < writeLength; ++i) {
for (var i = 0; i < writeLength; ++i) {
heap[(dst >> 2) + i] = arr[i];
}
return len;
@ -26,7 +26,7 @@ var LibraryHtml5WebGL = {
assert(attributes);
#endif
var a = attributes >> 2;
for(var i = 0; i < ({{{ C_STRUCTS.EmscriptenWebGLContextAttributes.__size__ }}}>>2); ++i) {
for (var i = 0; i < ({{{ C_STRUCTS.EmscriptenWebGLContextAttributes.__size__ }}}>>2); ++i) {
HEAP32[a+i] = 0;
}
@ -560,7 +560,7 @@ function handleWebGLProxying(funcs) {
function listOfNFunctionArgs(func) {
var args = [];
for(var i = 0; i < func.length; ++i) {
for (var i = 0; i < func.length; ++i) {
args.push('p' + i);
}
return args;
@ -574,7 +574,7 @@ function handleWebGLProxying(funcs) {
targetingOffscreenFramebuffer = true;
#endif
for(var i in funcs) {
for (var i in funcs) {
// Is this a function that takes GL context handle as first argument?
var proxyContextHandle = funcs[i + '__proxy'] == 'sync_on_webgl_context_handle_thread';

Просмотреть файл

@ -67,7 +67,7 @@ mergeInto(LibraryManager.library, {
},
emscripten_math_hypot: function(count, varargs) {
var args = [];
for(var i = 0; i < count; ++i) args.push(HEAPF64[(varargs>>3) + i]);
for (var i = 0; i < count; ++i) args.push(HEAPF64[(varargs>>3) + i]);
return Math.hypot.apply(null, args);
},
emscripten_math_sin: function(x) {

Просмотреть файл

@ -1577,7 +1577,7 @@ var LibraryOpenAL = {
var err = c.mediaStreamError;
if (err) {
#if OPENAL_DEBUG
switch(err.name) {
switch (err.name) {
case 'PermissionDeniedError':
console.error(funcname+'() but the user denied access to the device');
break;
@ -1773,7 +1773,7 @@ var LibraryOpenAL = {
newCapture.mediaStream = mediaStream;
var inputChannelCount = 1;
switch(newCapture.mediaStreamSourceNode.channelCountMode) {
switch (newCapture.mediaStreamSourceNode.channelCountMode) {
case 'max':
inputChannelCount = outputChannelCount;
break;
@ -2011,7 +2011,7 @@ var LibraryOpenAL = {
var setSample;
switch(c.requestedSampleType) {
switch (c.requestedSampleType) {
case 'f32': setSample = setF32Sample; break;
case 'i16': setSample = setI16Sample; break;
case 'u8' : setSample = setU8Sample ; break;
@ -2346,7 +2346,7 @@ var LibraryOpenAL = {
}
name = UTF8ToString(pEnumName);
// See alGetEnumValue(), but basically behave the same as OpenAL-Soft
switch(name) {
switch (name) {
case 'ALC_NO_ERROR': return 0;
case 'ALC_INVALID_DEVICE': return 0xA001;
case 'ALC_INVALID_CONTEXT': return 0xA002;
@ -2480,7 +2480,7 @@ var LibraryOpenAL = {
return;
}
switch(param) {
switch (param) {
case 0x1000 /* ALC_MAJOR_VERSION */:
{{{ makeSetValue('pValues', '0', '1', 'i32') }}};
break;
@ -2951,7 +2951,7 @@ var LibraryOpenAL = {
}
name = UTF8ToString(pEnumName);
switch(name) {
switch (name) {
// Spec doesn't clearly state that alGetEnumValue() is required to
// support _only_ extension tokens.
// We should probably follow OpenAL-Soft's example and support all

Просмотреть файл

@ -31,7 +31,7 @@ var LibraryPThread = {
#if PTHREAD_POOL_SIZE
var pthreadPoolSize = {{{ PTHREAD_POOL_SIZE }}};
// Start loading up the Worker pool, if requested.
for(var i = 0; i < pthreadPoolSize; ++i) {
for (var i = 0; i < pthreadPoolSize; ++i) {
PThread.allocateUnusedWorker();
}
#endif
@ -144,7 +144,7 @@ var LibraryPThread = {
},
threadStatusToString: function(threadStatus) {
switch(threadStatus) {
switch (threadStatus) {
case 0: return "not yet started";
case 1: return "running";
case 2: return "sleeping";
@ -495,7 +495,7 @@ var LibraryPThread = {
busySpinWait: function(msecs) {
var t = performance.now() + msecs;
while(performance.now() < t) {
while (performance.now() < t) {
;
}
}

Просмотреть файл

@ -560,7 +560,7 @@ var LibrarySDL = {
});
}
};
switch(event.type) {
switch (event.type) {
case 'touchstart': case 'touchmove': {
event.preventDefault();
@ -585,7 +585,7 @@ var LibrarySDL = {
SDL.DOMButtons[0] = 1;
}
var mouseEventType;
switch(event.type) {
switch (event.type) {
case 'touchstart': mouseEventType = 'mousedown'; break;
case 'touchmove': mouseEventType = 'mousemove'; break;
}
@ -612,7 +612,7 @@ var LibrarySDL = {
// Remove the entry in the SDL.downFingers hash
// because the finger is no longer down.
for(var i = 0; i < event.changedTouches.length; i++) {
for (var i = 0; i < event.changedTouches.length; i++) {
var touch = event.changedTouches[i];
if (SDL.downFingers[touch.identifier] === true) {
delete SDL.downFingers[touch.identifier];
@ -1190,22 +1190,22 @@ var LibrarySDL = {
// so perform a buffer conversion for the data.
var audio = SDL_audio();
var numChannels = audio.channels;
for(var c = 0; c < numChannels; ++c) {
for (var c = 0; c < numChannels; ++c) {
var channelData = dstAudioBuffer['getChannelData'](c);
if (channelData.length != sizeSamplesPerChannel) {
throw 'Web Audio output buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + sizeSamplesPerChannel + ' samples!';
}
if (audio.format == 0x8010 /*AUDIO_S16LSB*/) {
for(var j = 0; j < sizeSamplesPerChannel; ++j) {
for (var j = 0; j < sizeSamplesPerChannel; ++j) {
channelData[j] = ({{{ makeGetValue('heapPtr', '(j*numChannels + c)*2', 'i16', 0, 0) }}}) / 0x8000;
}
} else if (audio.format == 0x0008 /*AUDIO_U8*/) {
for(var j = 0; j < sizeSamplesPerChannel; ++j) {
for (var j = 0; j < sizeSamplesPerChannel; ++j) {
var v = ({{{ makeGetValue('heapPtr', 'j*numChannels + c', 'i8', 0, 0) }}});
channelData[j] = ((v >= 0) ? v-128 : v+128) /128;
}
} else if (audio.format == 0x8120 /*AUDIO_F32*/) {
for(var j = 0; j < sizeSamplesPerChannel; ++j) {
for (var j = 0; j < sizeSamplesPerChannel; ++j) {
channelData[j] = ({{{ makeGetValue('heapPtr', '(j*numChannels + c)*4', 'float', 0, 0) }}});
}
} else {
@ -2077,7 +2077,7 @@ var LibrarySDL = {
SDL_PeepEvents__proxy: 'sync',
SDL_PeepEvents__sig: 'iiiiii',
SDL_PeepEvents: function(events, requestedEventCount, action, from, to) {
switch(action) {
switch (action) {
case 2: { // SDL_GETEVENT
// We only handle 1 event right now
assert(requestedEventCount == 1);
@ -2495,7 +2495,7 @@ var LibrarySDL = {
SDL.audio.queueNewAudioData = function SDL_queueNewAudioData() {
if (!SDL.audio) return;
for(var i = 0; i < SDL.audio.numSimultaneouslyQueuedBuffers; ++i) {
for (var i = 0; i < SDL.audio.numSimultaneouslyQueuedBuffers; ++i) {
// Only queue new data if we don't have enough audio data already in queue. Otherwise skip this time slot
// and wait to queue more in the next time the callback is run.
var secsUntilNextPlayStart = SDL.audio.nextPlayTime - SDL.audioContext['currentTime'];

Просмотреть файл

@ -472,7 +472,7 @@ var LibraryGL = {
// Validates that user obeys GL spec #6.4: http://www.khronos.org/registry/webgl/specs/latest/1.0/#6.4
validateVertexAttribPointer: function(dimension, dataType, stride, offset) {
var sizeBytes = 1;
switch(dataType) {
switch (dataType) {
case 0x1400 /* GL_BYTE */:
case 0x1401 /* GL_UNSIGNED_BYTE */:
sizeBytes = 1;
@ -531,7 +531,7 @@ var LibraryGL = {
var contextHandle = glCtx.canvas.GLctxObject.handle;
var threadId = (typeof _pthread_self !== 'undefined') ? _pthread_self : function() { return 1; };
// Accessing 'arguments' is super slow, so to avoid overhead, statically reason the number of arguments.
switch(numArgs) {
switch (numArgs) {
case 0: glCtx[f] = function webgl_0() { var ret = glCtx[realf](); console.error('[Thread ' + threadId() + ', GL ctx: ' + contextHandle + ']: ' + f + '() -> ' + ret); return ret; }; break;
case 1: glCtx[f] = function webgl_1(a1) { var ret = glCtx[realf](a1); console.error('[Thread ' + threadId() + ', GL ctx: ' + contextHandle + ']: ' + f + '('+a1+') -> ' + ret); return ret; }; break;
case 2: glCtx[f] = function webgl_2(a1, a2) { var ret = glCtx[realf](a1, a2); console.error('[Thread ' + threadId() + ', GL ctx: ' + contextHandle + ']: ' + f + '('+a1+', ' + a2 +') -> ' + ret); return ret; }; break;
@ -561,7 +561,7 @@ var LibraryGL = {
// Hot GL functions are ones that you'd expect to find during render loops (render calls, dynamic resource uploads), cold GL functions are load time functions (shader compilation, texture/mesh creation)
// Distinguishing between these two allows pinpointing locations of troublesome GL usage that might cause performance issues.
for(var f in glCtx) {
for (var f in glCtx) {
if (typeof glCtx[f] !== 'function' || f.indexOf('real_') == 0) continue;
this.hookWebGLFunction(f, glCtx);
}
@ -1167,7 +1167,7 @@ var LibraryGL = {
glGetString: function(name_) {
if (GL.stringCache[name_]) return GL.stringCache[name_];
var ret;
switch(name_) {
switch (name_) {
case 0x1F03 /* GL_EXTENSIONS */:
var exts = GLctx.getSupportedExtensions() || []; // .getSupportedExtensions() can return null if context is lost, so coerce to empty array.
#if GL_EXTENSIONS_IN_PREFIXED_FORMAT
@ -1243,7 +1243,7 @@ var LibraryGL = {
return;
}
var ret = undefined;
switch(name_) { // Handle a few trivial GLES values
switch (name_) { // Handle a few trivial GLES values
case 0x8DFA: // GL_SHADER_COMPILER
ret = 1;
break;
@ -1317,7 +1317,7 @@ var LibraryGL = {
if (result === null) {
// null is a valid result for some (e.g., which buffer is bound - perhaps nothing is bound), but otherwise
// can mean an invalid name_, which we need to report as an error
switch(name_) {
switch (name_) {
case 0x8894: // ARRAY_BUFFER_BINDING
case 0x8B8D: // CURRENT_PROGRAM
case 0x8895: // ELEMENT_ARRAY_BUFFER_BINDING
@ -1821,7 +1821,7 @@ var LibraryGL = {
#if GL_ASSERTIONS
err('GL_INVALID_OPERATION in glGenQueriesEXT: GLctx.disjointTimerQueryExt.createQueryEXT returned null - most likely GL context is lost!');
#endif
while(i < n) {{{ makeSetValue('ids', 'i++*4', 0, 'i32') }}};
while (i < n) {{{ makeSetValue('ids', 'i++*4', 0, 'i32') }}};
return;
}
var id = GL.getNewId(GL.timerQueriesEXT);
@ -3679,7 +3679,7 @@ var LibraryGL = {
// but without targeting WebGL 2, so this FULL_ES3 block is in library_webgl.js instead of library_webgl2.js
#if FULL_ES3
$emscriptenWebGLGetBufferBinding: function(target) {
switch(target) {
switch (target) {
case 0x8892 /*GL_ARRAY_BUFFER*/: target = 0x8894 /*GL_ARRAY_BUFFER_BINDING*/; break;
case 0x8893 /*GL_ELEMENT_ARRAY_BUFFER*/: target = 0x8895 /*GL_ELEMENT_ARRAY_BUFFER_BINDING*/; break;
case 0x88EB /*GL_PIXEL_PACK_BUFFER*/: target = 0x88ED /*GL_PIXEL_PACK_BUFFER_BINDING*/; break;

Просмотреть файл

@ -23,7 +23,7 @@ var LibraryWebGL2 = {
}
return stringiCache[index];
}
switch(name) {
switch (name) {
case 0x1F03 /* GL_EXTENSIONS */:
var exts = GLctx.getSupportedExtensions() || []; // .getSupportedExtensions() can return null if context is lost, so coerce to empty array.
#if GL_EXTENSIONS_IN_PREFIXED_FORMAT
@ -594,7 +594,7 @@ var LibraryWebGL2 = {
#endif
program = GL.programs[program];
switch(pname) {
switch (pname) {
case 0x8A41: /* GL_UNIFORM_BLOCK_NAME_LENGTH */
var name = GLctx['getActiveUniformBlockName'](program, uniformBlockIndex);
{{{ makeSetValue('params', 0, 'name.length+1', 'i32') }}};

Просмотреть файл

@ -263,9 +263,9 @@ var LibraryWebSocket = {
HEAP8.set(new Uint8Array(e.data), buf);
#if WEBSOCKET_DEBUG
var s = 'WebSocket onmessage, received data: ' + len + ' bytes of binary:';
for(var i = 0; i < Math.min(len, 256); ++i) s += ' ' + HEAPU8[buf+i].toString(16);
for (var i = 0; i < Math.min(len, 256); ++i) s += ' ' + HEAPU8[buf+i].toString(16);
s += ', "';
for(var i = 0; i < Math.min(len, 256); ++i) s += (HEAPU8[buf+i] >= 32 && HEAPU8[buf+i] <= 127) ? String.fromCharCode(HEAPU8[buf+i]) : '\uFFFD';
for (var i = 0; i < Math.min(len, 256); ++i) s += (HEAPU8[buf+i] >= 32 && HEAPU8[buf+i] <= 127) ? String.fromCharCode(HEAPU8[buf+i]) : '\uFFFD';
s += '"';
if (len > 256) s + ' ... (' + (len - 256) + ' more bytes)';
@ -355,9 +355,9 @@ var LibraryWebSocket = {
#if WEBSOCKET_DEBUG
var s = 'data: ' + dataLength + ' bytes of binary:';
for(var i = 0; i < Math.min(dataLength, 256); ++i) s += ' '+ HEAPU8[binaryData+i].toString(16);
for (var i = 0; i < Math.min(dataLength, 256); ++i) s += ' '+ HEAPU8[binaryData+i].toString(16);
s += ', "';
for(var i = 0; i < Math.min(dataLength, 256); ++i) s += (HEAPU8[binaryData+i] >= 32 && HEAPU8[binaryData+i] <= 127) ? String.fromCharCode(HEAPU8[binaryData+i]) : '\uFFFD';
for (var i = 0; i < Math.min(dataLength, 256); ++i) s += (HEAPU8[binaryData+i] >= 32 && HEAPU8[binaryData+i] <= 127) ? String.fromCharCode(HEAPU8[binaryData+i]) : '\uFFFD';
s += '"';
if (dataLength > 256) s + ' ... (' + (dataLength - 256) + ' more bytes)';
@ -434,7 +434,7 @@ var LibraryWebSocket = {
#if WEBSOCKET_DEBUG
console.error('emscripten_websocket_deinitialize()');
#endif
for(var i in WS.sockets) {
for (var i in WS.sockets) {
var socket = WS.sockets[i];
if (socket) {
socket.close();

Просмотреть файл

@ -104,7 +104,7 @@ var emscriptenMemoryProfiler = {
var q = v * (1 - f*s);
var t = v * (1 - (1 - f) * s);
var r, g, b;
switch(h_i) {
switch (h_i) {
case 0: r = v; g = t; b = p; break;
case 1: r = q; g = v; b = p; break;
case 2: r = p; g = v; b = t; break;
@ -437,7 +437,7 @@ var emscriptenMemoryProfiler = {
printHeapResizeLog: function(heapResizes) {
var demangler = typeof demangleAll !== 'undefined' ? demangleAll : function(x) { return x; };
var html = '';
for(var i = 0; i < heapResizes.length; ++i) {
for (var i = 0; i < heapResizes.length; ++i) {
var j = i+1;
while(j < heapResizes.length) {
if ((heapResizes[j].filteredStack || heapResizes[j].stack) == (heapResizes[i].filteredStack || heapResizes[i].stack)) {
@ -546,7 +546,7 @@ var emscriptenMemoryProfiler = {
if (document.getElementById('showHeapResizes').checked) {
// Print heap resize traces.
for(var i in self.resizeMemorySources) {
for (var i in self.resizeMemorySources) {
var resize = self.resizeMemorySources[i];
self.drawContext.fillStyle = resize.color;
self.fillRect(resize.begin, resize.end, 0.5);
@ -555,7 +555,7 @@ var emscriptenMemoryProfiler = {
// Print sbrk() traces.
var uniqueSources = {};
var filterWords = document.getElementById('sbrkFilter').value.split(',');
for(var i in self.sbrkSources) {
for (var i in self.sbrkSources) {
var sbrk = self.sbrkSources[i];
var stack = sbrk.stack;
for (var j in filterWords) {

Просмотреть файл

@ -33,7 +33,7 @@ var Types = {
// Constructs an array ['a0', 'a1', 'a2', ..., 'a(n-1)']
function genArgSequence(n) {
var args = [];
for(var i = 0; i < n; ++i) {
for (var i = 0; i < n; ++i) {
args.push('a'+i);
}
return args;

Просмотреть файл

@ -135,7 +135,7 @@ window.close = function window_close() {
window.alert = function(text) {
err('alert forever: ' + text);
while (1){};
while (1) {};
};
window.scrollX = window.scrollY = 0; // TODO: proxy these
@ -165,7 +165,7 @@ var webGLWorker = new WebGLWorker();
var document = new EventListener();
document.createElement = function document_createElement(what) {
switch(what) {
switch (what) {
case 'canvas': {
var canvas = new EventListener();
canvas.ensureData = function canvas_ensureData() {

Просмотреть файл

@ -19,7 +19,7 @@
function abortFnPtrError(ptr, sig) {
#if ASSERTIONS >= 2
var possibleSig = '';
for(var x in debug_tables) {
for (var x in debug_tables) {
var tbl = debug_tables[x];
if (tbl[ptr]) {
possibleSig += 'as sig "' + x + '" pointing to function ' + tbl[ptr] + ', ';

Просмотреть файл

@ -24,7 +24,7 @@ function prettyPrint(arg) {
var i8buf = new Int8Array(buf);
var i16buf = new Int16Array(buf);
var f32buf = new Float32Array(buf);
switch(arg.toString()) {
switch (arg.toString()) {
case '[object Uint8Array]':
i8buf.set(arg.subarray(0, 32));
break;

Просмотреть файл

@ -17,7 +17,7 @@ function setValue(ptr, value, type, noSafe) {
if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit
#if SAFE_HEAP
if (noSafe) {
switch(type) {
switch (type) {
case 'i1': {{{ makeSetValue('ptr', '0', 'value', 'i1', undefined, undefined, undefined, '1') }}}; break;
case 'i8': {{{ makeSetValue('ptr', '0', 'value', 'i8', undefined, undefined, undefined, '1') }}}; break;
case 'i16': {{{ makeSetValue('ptr', '0', 'value', 'i16', undefined, undefined, undefined, '1') }}}; break;
@ -29,7 +29,7 @@ function setValue(ptr, value, type, noSafe) {
}
} else {
#endif
switch(type) {
switch (type) {
case 'i1': {{{ makeSetValue('ptr', '0', 'value', 'i1') }}}; break;
case 'i8': {{{ makeSetValue('ptr', '0', 'value', 'i8') }}}; break;
case 'i16': {{{ makeSetValue('ptr', '0', 'value', 'i16') }}}; break;
@ -52,7 +52,7 @@ function getValue(ptr, type, noSafe) {
if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit
#if SAFE_HEAP
if (noSafe) {
switch(type) {
switch (type) {
case 'i1': return {{{ makeGetValue('ptr', '0', 'i1', undefined, undefined, undefined, undefined, '1') }}};
case 'i8': return {{{ makeGetValue('ptr', '0', 'i8', undefined, undefined, undefined, undefined, '1') }}};
case 'i16': return {{{ makeGetValue('ptr', '0', 'i16', undefined, undefined, undefined, undefined, '1') }}};
@ -64,7 +64,7 @@ function getValue(ptr, type, noSafe) {
}
} else {
#endif
switch(type) {
switch (type) {
case 'i1': return {{{ makeGetValue('ptr', '0', 'i1') }}};
case 'i8': return {{{ makeGetValue('ptr', '0', 'i8') }}};
case 'i16': return {{{ makeGetValue('ptr', '0', 'i16') }}};

Просмотреть файл

@ -111,7 +111,7 @@ function UTF8ToString(ptr, maxBytesToRead) {
#if TEXTDECODER == 2
if (!ptr) return '';
var maxPtr = ptr + maxBytesToRead;
for(var end = ptr; !(end >= maxPtr) && HEAPU8[end];) ++end;
for (var end = ptr; !(end >= maxPtr) && HEAPU8[end];) ++end;
return UTF8Decoder.decode(HEAPU8.subarray(ptr, end));
#else
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : '';

Просмотреть файл

@ -664,7 +664,7 @@ var io = ('undefined' === typeof module ? {} : module.exports);
"use strict";
// use native JSON if it's available
if (nativeJSON && nativeJSON.parse){
if (nativeJSON && nativeJSON.parse) {
return exports.JSON = {
parse: nativeJSON.parse
, stringify: nativeJSON.stringify
@ -1732,7 +1732,7 @@ var io = ('undefined' === typeof module ? {} : module.exports);
while (remaining.length > 0 && remaining.splice(0,1)[0] !=
self.transport.name) {}
if (remaining.length){
if (remaining.length) {
connect(remaining);
} else {
self.publish('connect_failed');
@ -2256,7 +2256,7 @@ var io = ('undefined' === typeof module ? {} : module.exports);
break;
case 'error':
if (packet.advice){
if (packet.advice) {
this.socket.onError(packet);
} else {
if (packet.reason == 'unauthorized') {
@ -3146,7 +3146,7 @@ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="Sho
this.onreadystatechange = empty;
self.posting = false;
if (this.status == 200){
if (this.status == 200) {
self.socket.setBuffer(false);
} else {
self.onClose();
@ -3361,7 +3361,7 @@ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="Sho
*/
HTMLFile.prototype.destroy = function () {
if (this.iframe){
if (this.iframe) {
try {
this.iframe.src = 'about:blank';
} catch(e){}
@ -3395,7 +3395,7 @@ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="Sho
*/
HTMLFile.check = function (socket) {
if (typeof window != "undefined" && (['Active'].concat('Object').join('X')) in window){
if (typeof window != "undefined" && (['Active'].concat('Object').join('X')) in window) {
try {
var a = new window[(['Active'].concat('Object').join('X'))]('htmlfile');
return a && io.Transport.XHR.check(socket);

Просмотреть файл

@ -304,7 +304,7 @@ function WebGLClient() {
this.onmessage = function(msg) {
//dump('client GL got ' + JSON.stringify(msg) + '\n');
switch(msg.op) {
switch (msg.op) {
case 'render': {
if (commandBuffers.length === 0) {
// requestion a new frame, we will clear the buffers after rendering them

Просмотреть файл

@ -484,7 +484,7 @@ function WebGLWorker() {
enabledState: {} // Stores whether various GL state via glEnable/glDisable/glIsEnabled/getParameter are enabled.
};
var stateDisabledByDefault = [this.BLEND, this.CULL_FACE, this.DEPTH_TEST, this.DITHER, this.POLYGON_OFFSET_FILL, this.SAMPLE_ALPHA_TO_COVERAGE, this.SAMPLE_COVERAGE, this.SCISSOR_TEST, this.STENCIL_TEST];
for(var i in stateDisabledByDefault) {
for (var i in stateDisabledByDefault) {
bindings.enabledState[stateDisabledByDefault[i]] = false; // It will be important to distinguish between false and undefined (undefined meaning the state cap enum is unknown/unsupported).
}
@ -498,7 +498,7 @@ function WebGLWorker() {
this.onmessage = function(msg) {
//dump('worker GL got ' + JSON.stringify(msg) + '\n');
switch(msg.op) {
switch (msg.op) {
case 'setPrefetched': {
WebGLWorker.prototype.prefetchedParameters = msg.parameters;
WebGLWorker.prototype.prefetchedExtensions = msg.extensions;

Просмотреть файл

@ -285,7 +285,7 @@ THE SOFTWARE.
var that = this;
var type = message['type'];
switch(type) {
switch (type) {
case 'ice':
var candidate = JSON.parse(message['candidate']);
if(candidate)