diff options
Diffstat (limited to 'indra/newview')
249 files changed, 1317 insertions, 1359 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 498b14e211..ecfef112a4 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12687,7 +12687,7 @@ <key>Persist</key> <integer>1</integer> <key>Type</key> - <string>S32</string> + <string>U32</string> <key>Value</key> <integer>8</integer> </map> diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index 8627ab1852..d7d98477c0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file blurLightF.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2007, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -42,16 +42,16 @@ in vec2 vary_fragcoord; vec4 getPosition(vec2 pos_screen); vec4 getNorm(vec2 pos_screen); -void main() +void main() { vec2 tc = vary_fragcoord.xy; vec4 norm = getNorm(tc); vec3 pos = getPosition(tc).xyz; vec4 ccol = texture(lightMap, tc).rgba; - + vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); dlt /= max(-pos.z*dist_factor, 1.0); - + vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free' vec4 col = defined_weight.xyxx * ccol; @@ -75,15 +75,15 @@ void main() k[1] = (k[0]+k[2])*0.5f; k[3] = (k[2]+k[4])*0.5f; k[5] = (k[4]+k[6])*0.5f; - + for (int i = 1; i < 7; i++) { vec2 samptc = tc + k[i].z*dlt*2.0; samptc /= screen_res; - vec3 samppos = getPosition(samptc).xyz; + vec3 samppos = getPosition(samptc).xyz; float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane - + if (d*d <= pointplanedist_tolerance_pow2) { col += texture(lightMap, samptc)*k[i].xyxx; @@ -95,10 +95,10 @@ void main() { vec2 samptc = tc - k[i].z*dlt*2.0; samptc /= screen_res; - vec3 samppos = getPosition(samptc).xyz; + vec3 samppos = getPosition(samptc).xyz; float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane - + if (d*d <= pointplanedist_tolerance_pow2) { col += texture(lightMap, samptc)*k[i].xyxx; @@ -108,7 +108,7 @@ void main() col /= defined_weight.xyxx; //col.y *= col.y; - + frag_color = max(col, vec4(0)); #ifdef IS_AMD_CARD diff --git a/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl b/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl index eff7221ae7..67890032df 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl @@ -1,28 +1,28 @@ -/** +/** * @file exposureF.glsl * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - + /*[EXTRA_CODE_HERE]*/ out vec4 frag_color; @@ -43,7 +43,7 @@ float lum(vec3 col) return dot(l, col); } -void main() +void main() { vec2 tc = vec2(0.5,0.5); @@ -53,13 +53,13 @@ void main() L /= max_L; L = pow(L, 2.0); float s = mix(dynamic_exposure_params.z, dynamic_exposure_params.y, L); - + #ifdef USE_LAST_EXPOSURE float prev = texture(exposureMap, vec2(0.5,0.5)).r; s = mix(prev, s, min(dt*2.0*abs(prev-s), 0.04)); #endif - + frag_color = max(vec4(s, s, s, dt), vec4(0.0)); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 52dfed06ae..2b9cc6ae5a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -1,28 +1,28 @@ -/** +/** * @file deferred/fullbrightF.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2007, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - + /*[EXTRA_CODE_HERE]*/ out vec4 frag_color; @@ -52,7 +52,7 @@ vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color); void mirrorClip(vec3 pos); -void main() +void main() { mirrorClip(vary_position); #ifdef IS_ALPHA @@ -90,7 +90,7 @@ void main() calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten); color.rgb = applySkyAndWaterFog(pos, additive, atten, color).rgb; - + #endif #endif diff --git a/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl b/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl index 7e3e7d9271..a1b7a4b11f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class1/deferred/globalF.glsl * * $LicenseInfo:firstyear=2024&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2024, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl index 95b2f80e06..3432bf07ef 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl @@ -1,32 +1,32 @@ -/** +/** * @file luminanceF.glsl * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - + /*[EXTRA_CODE_HERE]*/ -// take a luminance sample of diffuseRect and emissiveRect +// take a luminance sample of diffuseRect and emissiveRect out vec4 frag_color; @@ -43,12 +43,12 @@ float lum(vec3 col) return dot(l, col); } -void main() +void main() { vec2 tc = vary_fragcoord*0.6+0.2; tc.y -= 0.1; // HACK - nudge exposure sample down a little bit to favor ground over sky vec3 c = texture(diffuseRect, tc).rgb; - + vec4 norm = texture(normalMap, tc); if (!GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_HDRI) && diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl index 6ef556d7e8..585de99e1d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl @@ -1,28 +1,28 @@ -/** +/** * @file class1\deferred\moonF.glsl * * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2005, 2020 Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - + /*[EXTRA_CODE_HERE]*/ out vec4 frag_data[4]; @@ -34,7 +34,7 @@ uniform sampler2D diffuseMap; in vec2 vary_texcoord0; -void main() +void main() { // Restore Pre-EEP alpha fade moon near horizon float fade = 1.0; diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskF.glsl index 35b7602569..07a2218db2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file pbrShadowAlphaMaskF.glsl * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -33,7 +33,7 @@ in vec4 vertex_color; in vec2 vary_texcoord0; uniform float minimum_alpha; -void main() +void main() { float alpha = texture(diffuseMap,vary_texcoord0.xy).a * vertex_color.a; diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl index 380d493636..b521081af9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file pbropaqueF.glsl * * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2022, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -28,7 +28,7 @@ #ifndef IS_HUD -// deferred opaque implementation +// deferred opaque implementation uniform sampler2D diffuseMap; //always in sRGB space @@ -85,7 +85,7 @@ void main() float sign = vary_sign; vec3 vN = vary_normal; vec3 vT = vary_tangent.xyz; - + vec3 vB = sign * cross(vN, vT); vec3 tnorm = normalize( vNt.x * vT + vNt.y * vB + vNt.z * vN ); @@ -95,7 +95,7 @@ void main() // roughness 0.0 // metal 0.0 vec3 spec = texture(specularMap, metallic_roughness_texcoord.xy).rgb; - + spec.g *= roughnessFactor; spec.b *= metallicFactor; diff --git a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl index 6791fe44d9..e77e972873 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl @@ -25,7 +25,7 @@ // debug stub -float random (vec2 uv) +float random (vec2 uv) { return 0.f; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl index 785c748234..41e42b5173 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class1/deferred/skyF.glsl * * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2005, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -99,9 +99,9 @@ void main() else #endif { - // Potential Fill-rate optimization. Add cloud calculation - // back in and output alpha of 0 (so that alpha culling kills - // the fragment) if the sky wouldn't show up because the clouds + // Potential Fill-rate optimization. Add cloud calculation + // back in and output alpha of 0 (so that alpha culling kills + // the fragment) if the sky wouldn't show up because the clouds // are fully opaque. color = vary_HazeColor; diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl index 24d2db2183..ea00d240df 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl @@ -102,7 +102,7 @@ void main() // Initialize temp variables vec3 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color * 0.7; //magic 0.7 to match legacy color - + // Sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes vec3 light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y); @@ -152,7 +152,7 @@ void main() sunlight *= max(0.0, (1. - cloud_shadow)); // Haze color below cloud - vec3 add_below_cloud = (blue_horizon * blue_weight * (sunlight + ambient) + vec3 add_below_cloud = (blue_horizon * blue_weight * (sunlight + ambient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + ambient)); // Attenuate cloud color by atmosphere diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl index b4ab7cd169..7fc0e98513 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class1\environment\terrainV.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2007, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -44,15 +44,15 @@ uniform vec4 object_plane_t; vec2 texgen_object(vec4 vpos, mat4 mat, vec4 tp0, vec4 tp1) { vec4 tcoord; - + tcoord.x = dot(vpos, tp0); tcoord.y = dot(vpos, tp1); tcoord.z = 0; tcoord.w = 1; - tcoord = mat * tcoord; - - return tcoord.xy; + tcoord = mat * tcoord; + + return tcoord.xy; } void main() @@ -65,12 +65,12 @@ void main() pos = (modelview_matrix*pre_pos).xyz; vary_normal = normalize(normal_matrix * normal); - + // Transform and pass tex coords vary_texcoord0.xy = texgen_object(vec4(position, 1.0), texture_matrix0, object_plane_s, object_plane_t); - + vec4 t = vec4(texcoord1,0,1); - + vary_texcoord0.zw = t.xy; vary_texcoord1.xy = t.xy-vec2(2.0, 0.0); vary_texcoord1.zw = t.xy-vec2(1.0, 0.0); diff --git a/indra/newview/app_settings/shaders/class1/interface/normaldebugG.glsl b/indra/newview/app_settings/shaders/class1/interface/normaldebugG.glsl index 51d05cd507..50737d4742 100644 --- a/indra/newview/app_settings/shaders/class1/interface/normaldebugG.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/normaldebugG.glsl @@ -1,24 +1,24 @@ -/** +/** * @file normaldebugG.glsl * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl index d077670c96..55daa83750 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl @@ -57,9 +57,9 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou vec3 rel_pos_norm = normalize(rel_pos); float rel_pos_len = length(rel_pos); - + vec3 sunlight = (sun_up_factor == 1) ? sunlight_color: moonlight_color; - + // sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes vec3 light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y); @@ -119,7 +119,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou additive = (blue_horizon.rgb * blue_weight.rgb) * (cs + tmpAmbient.rgb) + (haze_horizon * haze_weight.rgb) * (cs * haze_glow + tmpAmbient.rgb); // brightness of surface both sunlight and ambient - + sunlit = sunlight.rgb; amblit = tmpAmbient; @@ -128,7 +128,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou vec3 srgb_to_linear(vec3 col); -// provide a touch of lighting in the opposite direction of the sun light +// provide a touch of lighting in the opposite direction of the sun light // so areas in shadow don't lose all detail float ambientLighting(vec3 norm, vec3 light_dir) { @@ -150,7 +150,7 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, ou // (allows for mixing of light sources other than sunlight e.g. reflection probes) sunlit *= sky_sunlight_scale; amblit *= sky_ambient_scale; - + amblit = srgb_to_linear(amblit); amblit *= ambientLighting(norm, light_dir); } diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index 1bd5f5a718..f6c75e6a9c 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file sunLightF.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2007, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -41,7 +41,7 @@ vec4 getPosition(vec2 pos_screen); float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); float sampleSpotShadow(vec3 pos, vec3 norm, int index, vec2 pos_screen); -void main() +void main() { vec2 pos_screen = vary_fragcoord.xy; vec4 pos = getPosition(pos_screen); @@ -50,7 +50,7 @@ void main() vec4 col; col.r = sampleDirectionalShadow(pos.xyz, norm.xyz, pos_screen); col.g = 1.0f; - col.b = sampleSpotShadow(pos.xyz, norm.xyz, 0, pos_screen); + col.b = sampleSpotShadow(pos.xyz, norm.xyz, 0, pos_screen); col.a = sampleSpotShadow(pos.xyz, norm.xyz, 1, pos_screen); frag_color = clamp(col, vec4(0), vec4(1)); diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl index e0333b6044..3437ed4b4c 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl @@ -1,27 +1,27 @@ -/** +/** * @file class2/deferred/sunLightSSAOF.glsl * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2007, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - + /*[EXTRA_CODE_HERE]*/ out vec4 frag_color; @@ -38,7 +38,7 @@ float sampleDirectionalShadow(vec3 shadow_pos, vec3 norm, vec2 pos_screen); float sampleSpotShadow(vec3 shadow_pos, vec3 norm, int index, vec2 pos_screen); float calcAmbientOcclusion(vec4 pos, vec3 norm, vec2 pos_screen); -void main() +void main() { vec2 pos_screen = vary_fragcoord.xy; vec4 pos = getPosition(pos_screen); diff --git a/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl index 4af57e3b80..87977eb28c 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl @@ -67,16 +67,16 @@ void main() calcAtmosphericVarsLinear(pos.xyz, norm.xyz, light_dir, sunlit, amblit, additive, atten); vec3 sunlit_linear = srgb_to_linear(sunlit); - + // mask off atmospherics below water (when camera is under water) bool do_atmospherics = false; - + if (dot(vec3(0), waterPlane.xyz) + waterPlane.w > 0.0 || dot(pos.xyz, waterPlane.xyz) + waterPlane.w > 0.0) { do_atmospherics = true; } - + vec3 irradiance = vec3(0); vec3 radiance = vec3(0); @@ -101,5 +101,5 @@ void main() } frag_color = max(vec4(color.rgb, alpha), vec4(0)); //output linear since local lights will be added to this shader's results - + } diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl index edfd6cbced..ac3fec23f6 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl @@ -56,8 +56,8 @@ vec3 srgb_to_linear(vec3 c); // Util vec3 hue_to_rgb(float hue); -vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, - float perceptualRoughness, +vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, + float perceptualRoughness, float metallic, vec3 n, // normal vec3 v, // surface point to camera @@ -91,7 +91,7 @@ void main() float metallic = orm.b; vec3 f0 = vec3(0.04); vec3 baseColor = diffuse.rgb; - + vec3 diffuseColor = baseColor.rgb*(vec3(1.0)-f0); diffuseColor *= 1.0 - metallic; diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl index 60be9f4407..e419525bd5 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl @@ -1,28 +1,28 @@ -/** +/** * @file class3\deferred\pointLightF.glsl * * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2022, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - + /*[EXTRA_CODE_HERE]*/ out vec4 frag_color; @@ -59,8 +59,8 @@ vec2 getScreenCoord(vec4 clip); vec3 srgb_to_linear(vec3 c); float getDepth(vec2 tc); -vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, - float perceptualRoughness, +vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, + float perceptualRoughness, float metallic, vec3 n, // normal vec3 v, // surface point to camera @@ -93,13 +93,13 @@ void main() if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) { - vec3 colorEmissive = texture(emissiveRect, tc).rgb; + vec3 colorEmissive = texture(emissiveRect, tc).rgb; vec3 orm = spec.rgb; float perceptualRoughness = orm.g; float metallic = orm.b; vec3 f0 = vec3(0.04); vec3 baseColor = diffuse.rgb; - + vec3 diffuseColor = baseColor.rgb*(vec3(1.0)-f0); diffuseColor *= 1.0 - metallic; @@ -136,7 +136,7 @@ void main() final_color += lit*scol*color.rgb*spec.rgb; } } - + if (dot(final_color, final_color) <= 0.0) { discard; diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index 90c84cc428..5dfa196cf6 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -51,7 +51,7 @@ layout (std140) uniform ReflectionProbes mat4 heroBox; // list of bounding spheres for reflection probes sorted by distance to camera (closest first) vec4 refSphere[MAX_REFMAP_COUNT]; - // extra parameters + // extra parameters // x - irradiance scale // y - radiance scale // z - fade in @@ -102,7 +102,7 @@ bool shouldSampleProbe(int i, vec3 pos) if (refIndex[i].w < 0) { vec4 v = refBox[i] * vec4(pos, 1.0); - if (abs(v.x) > 1 || + if (abs(v.x) > 1 || abs(v.y) > 1 || abs(v.z) > 1) { @@ -229,7 +229,7 @@ void preProbeSample(vec3 pos) } } count++; - + ++neighborIdx; } @@ -251,56 +251,56 @@ void preProbeSample(vec3 pos) // original reference implementation: /* -bool intersect(const Ray &ray) const -{ - float t0, t1; // solutions for t if the ray intersects -#if 0 +bool intersect(const Ray &ray) const +{ + float t0, t1; // solutions for t if the ray intersects +#if 0 // geometric solution - Vec3f L = center - orig; - float tca = L.dotProduct(dir); + Vec3f L = center - orig; + float tca = L.dotProduct(dir); // if (tca < 0) return false; - float d2 = L.dotProduct(L) - tca * tca; - if (d2 > radius2) return false; - float thc = sqrt(radius2 - d2); - t0 = tca - thc; - t1 = tca + thc; -#else + float d2 = L.dotProduct(L) - tca * tca; + if (d2 > radius2) return false; + float thc = sqrt(radius2 - d2); + t0 = tca - thc; + t1 = tca + thc; +#else // analytic solution - Vec3f L = orig - center; - float a = dir.dotProduct(dir); - float b = 2 * dir.dotProduct(L); - float c = L.dotProduct(L) - radius2; - if (!solveQuadratic(a, b, c, t0, t1)) return false; -#endif - if (t0 > t1) std::swap(t0, t1); - - if (t0 < 0) { - t0 = t1; // if t0 is negative, let's use t1 instead - if (t0 < 0) return false; // both t0 and t1 are negative - } - - t = t0; - - return true; + Vec3f L = orig - center; + float a = dir.dotProduct(dir); + float b = 2 * dir.dotProduct(L); + float c = L.dotProduct(L) - radius2; + if (!solveQuadratic(a, b, c, t0, t1)) return false; +#endif + if (t0 > t1) std::swap(t0, t1); + + if (t0 < 0) { + t0 = t1; // if t0 is negative, let's use t1 instead + if (t0 < 0) return false; // both t0 and t1 are negative + } + + t = t0; + + return true; } */ // adapted -- assume that origin is inside sphere, return intersection of ray with edge of sphere vec3 sphereIntersect(vec3 origin, vec3 dir, vec3 center, float radius2) -{ - float t0, t1; // solutions for t if the ray intersects +{ + float t0, t1; // solutions for t if the ray intersects - vec3 L = center - origin; + vec3 L = center - origin; float tca = dot(L,dir); - float d2 = dot(L,L) - tca * tca; + float d2 = dot(L,L) - tca * tca; + + float thc = sqrt(radius2 - d2); + t0 = tca - thc; + t1 = tca + thc; - float thc = sqrt(radius2 - d2); - t0 = tca - thc; - t1 = tca + thc; - vec3 v = origin + dir * t1; - return v; -} + return v; +} void swap(inout float a, inout float b) { @@ -312,17 +312,17 @@ void swap(inout float a, inout float b) // debug implementation, make no assumptions about origin void sphereIntersectDebug(vec3 origin, vec3 dir, vec3 center, float radius2, float depth, inout vec4 col) { - float t[2]; // solutions for t if the ray intersects + float t[2]; // solutions for t if the ray intersects // geometric solution - vec3 L = center - origin; + vec3 L = center - origin; float tca = dot(L, dir); // if (tca < 0) return false; - float d2 = dot(L, L) - tca * tca; - if (d2 > radius2) return; - float thc = sqrt(radius2 - d2); - t[0] = tca - thc; - t[1] = tca + thc; + float d2 = dot(L, L) - tca * tca; + if (d2 > radius2) return; + float thc = sqrt(radius2 - d2); + t[0] = tca - thc; + t[1] = tca + thc; for (int i = 0; i < 2; ++i) { @@ -411,8 +411,8 @@ void debugBoxCol(vec3 ro, vec3 rd, float t, vec3 p, inout vec4 col) bool behind = dot(v,v) > dot(pos,pos); float w = 0.25; - - if (behind) + + if (behind) { w *= 0.5; w /= (length(v)-length(pos))*0.5+1.0; @@ -426,7 +426,7 @@ void debugBoxCol(vec3 ro, vec3 rd, float t, vec3 p, inout vec4 col) // cribbed from https://iquilezles.org/articles/intersectors/ // axis aligned box centered at the origin, with size boxSize -void boxIntersectionDebug( in vec3 ro, in vec3 p, vec3 boxSize, inout vec4 col) +void boxIntersectionDebug( in vec3 ro, in vec3 p, vec3 boxSize, inout vec4 col) { vec3 rd = normalize(p-ro); @@ -453,7 +453,7 @@ void boxIntersectionDebug( in vec3 ro, in vec3 p, vec3 boxSize, inout vec4 col) void boxIntersectDebug(vec3 origin, vec3 pos, mat4 i, inout vec4 col) { mat4 clipToLocal = i; - + // transform into unit cube space origin = (clipToLocal * vec4(origin, 1.0)).xyz; pos = (clipToLocal * vec4(pos, 1.0)).xyz; @@ -471,7 +471,7 @@ void boxIntersectDebug(vec3 origin, vec3 pos, mat4 i, inout vec4 col) // dw - distance weight float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, vec4 i, out float dw) { - float r1 = r * 0.5; // 50% of radius (outer sphere to start interpolating down) + float r1 = r * 0.5; // 50% of radius (outer sphere to start interpolating down) vec3 delta = pos.xyz - origin; float d2 = max(length(delta), 0.001); @@ -495,7 +495,7 @@ float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, vec4 i, out float d // lod - which mip to sample (lower is higher res, sharper reflections) // c - center of probe // r2 - radius of probe squared -// i - index of probe +// i - index of probe vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c, int i) { // parallax adjustment @@ -514,7 +514,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c, float rr = r * r; - v = sphereIntersect(pos, dir, c, + v = sphereIntersect(pos, dir, c, refIndex[i].w < 1 ? 4096.0*4096.0 : // <== effectively disable parallax correction for automatically placed probes to keep from bombing the world with obvious spheres rr); @@ -525,7 +525,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c, vec3 d = normalize(v); v = env_mat * v; - + vec4 ret = textureLod(reflectionProbes, vec4(v.xyz, refIndex[i].x), lod) * refParams[i].y; return ret.rgb; @@ -536,7 +536,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c, // dir - pixel normal // w - weight of sample (distance and angular attenuation) // dw - weight of sample (distance only) -// i - index of probe +// i - index of probe vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int i, vec3 amblit) { // parallax adjustment @@ -554,7 +554,7 @@ vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int // pad sphere for manual probe extending into automatic probe space float rr = r * r; - v = sphereIntersect(pos, dir, c, + v = sphereIntersect(pos, dir, c, refIndex[i].w < 1 ? 4096.0*4096.0 : // <== effectively disable parallax correction for automatically placed probes to keep from bombing the world with obvious spheres rr); @@ -563,7 +563,7 @@ vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int v -= c; v = env_mat * v; - + vec3 col = textureLod(irradianceProbes, vec4(v.xyz, refIndex[i].x), 0).rgb * refParams[i].x; col = mix(amblit, col, min(refParams[i].x, 1.0)); @@ -625,7 +625,7 @@ vec3 sampleProbes(vec3 pos, vec3 dir, float lod) col[1] *= 1.0/wsum[1]; col[0] = vec3(0); } - + return col[1]+col[0]; } @@ -654,7 +654,7 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir, vec3 amblit) { continue; } - + { float w = 0; float dw = 0; @@ -684,7 +684,7 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir, vec3 amblit) col[1] *= 1.0/wsum[1]; col[0] = vec3(0); } - + return col[1]+col[0]; } @@ -704,13 +704,13 @@ void tapHeroProbe(inout vec3 glossenv, vec3 pos, vec3 norm, float glossiness) { float d = 0; boxIntersect(pos, norm, heroBox, d, 1.0); - + w = max(d, 0); } else { float r = heroSphere.w; - + w = sphereWeight(pos, refnormpersp, heroSphere.xyz, r, vec4(1), dw); } @@ -851,9 +851,9 @@ void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout { float lod = (1.0-glossiness)*reflection_lods; glossenv = sampleProbes(pos, normalize(refnormpersp), lod); - + } - + if (envIntensity > 0.0) { legacyenv = sampleProbes(pos, normalize(refnormpersp), 0.0); diff --git a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl index deb276ef9d..9ac389f926 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl @@ -52,7 +52,7 @@ float random (vec2 uv); float tapScreenSpaceReflection(int totalSamples, vec2 tc, vec3 viewPos, vec3 n, inout vec4 collectedColor, sampler2D source, float glossiness); -void main() +void main() { vec2 tc = vary_fragcoord.xy; float depth = linearDepth01(getDepth(tc), zNear, zFar); @@ -60,13 +60,13 @@ void main() vec3 pos = getPositionWithDepth(tc, getDepth(tc)).xyz; vec4 spec = texture(specularRect, tc); vec2 hitpixel; - + vec4 diffuse = texture(diffuseRect, tc); vec3 specCol = spec.rgb; vec4 fcol = texture(diffuseMap, tc); - if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) + if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) { vec3 orm = specCol.rgb; float perceptualRoughness = orm.g; diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 96c32734e4..529d1cba6b 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -105,8 +105,8 @@ vec3 pbrBaseLight(vec3 diffuseColor, vec3 additive, vec3 atten); -vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, - float perceptualRoughness, +vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, + float perceptualRoughness, float metallic, vec3 n, // normal vec3 v, // surface point to camera @@ -169,15 +169,15 @@ void main() if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) { - vec3 orm = spec.rgb; + vec3 orm = spec.rgb; float perceptualRoughness = orm.g; float metallic = orm.b; float ao = orm.r; - + // PBR IBL float gloss = 1.0 - perceptualRoughness; - + sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, norm.xyz, gloss, false, amblit_linear); adjustIrradiance(irradiance, ambocc); @@ -205,7 +205,7 @@ void main() { // legacy shaders are still writng sRGB to gbuffer baseColor.rgb = srgb_to_linear(baseColor.rgb); - + spec.rgb = srgb_to_linear(spec.rgb); float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0); @@ -224,7 +224,7 @@ void main() vec3 sun_contrib = min(da, scol) * sunlit_linear; color.rgb += sun_contrib; color.rgb *= baseColor.rgb; - + vec3 refnormpersp = reflect(pos.xyz, norm.xyz); if (spec.a > 0.0) @@ -254,7 +254,7 @@ void main() } color.rgb = mix(color.rgb, baseColor.rgb, baseColor.a); - + if (envIntensity > 0.0) { // add environment map applyLegacyEnv(color, legacyenv, spec, pos.xyz, norm.xyz, envIntensity); diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl index 319fa86148..092b0c3c08 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl @@ -1,28 +1,28 @@ -/** +/** * @file class3\deferred\spotLightF.glsl * * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2022, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - + /*[EXTRA_CODE_HERE]*/ out vec4 frag_color; @@ -83,8 +83,8 @@ vec4 getPosition(vec2 pos_screen); const float M_PI = 3.14159265; -vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, - float perceptualRoughness, +vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, + float perceptualRoughness, float metallic, vec3 n, // normal vec3 v, // surface point to camera @@ -112,13 +112,13 @@ void main() } float shadow = 1.0; - + if (proj_shadow_idx >= 0) { vec4 shd = texture(lightMap, tc); shadow = (proj_shadow_idx==0)?shd.b:shd.a; shadow += shadow_fade; - shadow = clamp(shadow, 0.0, 1.0); + shadow = clamp(shadow, 0.0, 1.0); } vec4 norm = getNorm(tc); @@ -149,7 +149,7 @@ void main() float metallic = orm.b; vec3 f0 = vec3(0.04); vec3 baseColor = diffuse.rgb; - + vec3 diffuseColor = baseColor.rgb*(vec3(1.0)-f0); diffuseColor *= 1.0 - metallic; @@ -167,7 +167,7 @@ void main() if (nl > 0.0) { amb_da += (nl*0.5 + 0.5) * proj_ambiance; - + dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy ); vec3 intensity = dist_atten * dlit * 3.25 * shadow; // Legacy attenuation, magic number to balance with legacy materials @@ -205,11 +205,11 @@ void main() // unshadowed for consistency between forward and deferred? amb_da += (nl*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance; } - + amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, 1.0, proj_tc.xy ); final_color += diffuse.rgb * amb_rgb * max(dot(-normalize(lv), n), 0.0); } - + if (spec.a > 0.0) { dlit *= min(nl*6.0, 1.0) * dist_atten; @@ -218,7 +218,7 @@ void main() float gtdenom = 2 * nh; float gt = max(0, min(gtdenom * nv / vh, gtdenom * nl / vh)); - + if (nh > 0.0) { float scol = fres*texture(lightFunc, vec2(nh, spec.a)).r*gt/(nh*nl); @@ -226,26 +226,26 @@ void main() speccol = clamp(speccol, vec3(0), vec3(1)); final_color += speccol; } - } + } if (envIntensity > 0.0) { vec3 ref = reflect(normalize(pos), n); - + //project from point pos in direction ref to plane proj_p, proj_n vec3 pdelta = proj_p-pos; float ds = dot(ref, proj_n); - + if (ds < 0.0) { vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; - + vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); if (stc.z > 0.0) { stc /= stc.w; - + if (stc.x < 1.0 && stc.y < 1.0 && stc.x > 0.0 && diff --git a/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl index f6bef1e498..a5a37d80dd 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl @@ -43,7 +43,7 @@ void main() float depth = getDepth(tc.xy); if (above_water > 0) - { + { // we want to depth test when the camera is above water, but some GPUs have a hard time // with depth testing against render targets that are bound for sampling in the same shader // so we do it manually here @@ -60,5 +60,5 @@ void main() vec4 fogged = getWaterFogView(pos.xyz); frag_color = max(fogged, vec4(0)); //output linear since local lights will be added to this shader's results - + } diff --git a/indra/newview/gltf/accessor.cpp b/indra/newview/gltf/accessor.cpp index 9f1cb0c1cd..2ef9237f2d 100644 --- a/indra/newview/gltf/accessor.cpp +++ b/indra/newview/gltf/accessor.cpp @@ -108,7 +108,8 @@ void Buffer::erase(Asset& asset, S32 offset, S32 length) mData.erase(mData.begin() + offset, mData.begin() + offset + length); - mByteLength = mData.size(); + llassert(mData.size() <= size_t(INT_MAX)); + mByteLength = S32(mData.size()); for (BufferView& view : asset.mBufferViews) { @@ -141,7 +142,7 @@ bool Buffer::prep(Asset& asset) } mData.resize(mByteLength); - if (!file.read((U8*)mData.data(), mData.size())) + if (!file.read((U8*)mData.data(), mByteLength)) { LL_WARNS("GLTF") << "Failed to load buffer data from asset: " << id << LL_ENDL; return false; diff --git a/indra/newview/gltf/animation.cpp b/indra/newview/gltf/animation.cpp index 45e9e1ddef..8b85eba3e5 100644 --- a/indra/newview/gltf/animation.cpp +++ b/indra/newview/gltf/animation.cpp @@ -189,17 +189,16 @@ void Animation::Sampler::getFrameInfo(Asset& asset, F32 time, U32& frameIndex, F if (mFrameTimes.size() > 1) { + llassert(mFrameTimes.size() <= size_t(U32_MAX)); + frameIndex = U32(mFrameTimes.size()) - 2; + t = 1.f; + if (time > mMaxTime) { - frameIndex = mFrameTimes.size() - 2; - t = 1.0f; return; } - frameIndex = mFrameTimes.size() - 2; - t = 1.f; - - for (U32 i = 0; i < mFrameTimes.size() - 1; i++) + for (U32 i = 0; i < (U32)mFrameTimes.size() - 1; i++) { if (time >= mFrameTimes[i] && time < mFrameTimes[i + 1]) { @@ -382,7 +381,7 @@ void Skin::uploadMatrixPalette(Asset& asset) glGenBuffers(1, &mUBO); } - U32 joint_count = llmin(max_joints, mJoints.size()); + size_t joint_count = llmin<size_t>(max_joints, mJoints.size()); std::vector<mat4> t_mp; diff --git a/indra/newview/gltf/primitive.cpp b/indra/newview/gltf/primitive.cpp index 4cff0622b3..dd37b5b4d0 100644 --- a/indra/newview/gltf/primitive.cpp +++ b/indra/newview/gltf/primitive.cpp @@ -56,7 +56,7 @@ struct MikktMesh bool copy(const Primitive* prim) { bool indexed = !prim->mIndexArray.empty(); - U32 vert_count = indexed ? prim->mIndexArray.size() : prim->mPositions.size(); + auto vert_count = indexed ? prim->mIndexArray.size() : prim->mPositions.size(); U32 triangle_count = 0; @@ -171,8 +171,8 @@ struct MikktMesh void genNormals() { - U32 tri_count = p.size() / 3; - for (U32 i = 0; i < tri_count; ++i) + size_t tri_count = p.size() / 3; + for (size_t i = 0; i < tri_count; ++i) { LLVector3 v0 = p[i * 3]; LLVector3 v1 = p[i * 3 + 1]; @@ -240,7 +240,7 @@ struct MikktMesh { prim->mTexCoords1.resize(vert_count); } - + prim->mIndexArray.resize(remap.size()); for (int i = 0; i < remap.size(); ++i) @@ -511,7 +511,10 @@ bool Primitive::prep(Asset& asset) } mVertexBuffer = new LLVertexBuffer(mask); - mVertexBuffer->allocateBuffer(mPositions.size(), mIndexArray.size() * 2); // double the size of the index buffer for 32-bit indices + // we store these buffer sizes as S32 elsewhere + llassert(mPositions.size() <= size_t(S32_MAX)); + llassert(mIndexArray.size() <= size_t(S32_MAX / 2)); + mVertexBuffer->allocateBuffer(U32(mPositions.size()), U32(mIndexArray.size() * 2)); // double the size of the index buffer for 32-bit indices mVertexBuffer->setBuffer(); mVertexBuffer->setPositionData(mPositions.data()); @@ -544,7 +547,7 @@ bool Primitive::prep(Asset& asset) mVertexBuffer->setTexCoord1Data(mTexCoords1.data()); vertical_flip(mTexCoords1); } - + if (!mIndexArray.empty()) { @@ -724,8 +727,8 @@ const LLVolumeTriangle* Primitive::lineSegmentIntersect(const LLVector4a& start, face.mTangents = mTangents.data(); face.mIndices = nullptr; // unreferenced - face.mNumIndices = mIndexArray.size(); - face.mNumVertices = mPositions.size(); + face.mNumIndices = S32(mIndexArray.size()); + face.mNumVertices = S32(mPositions.size()); LLOctreeTriangleRayIntersect intersect(start, dir, &face, &closest_t, intersection, tex_coord, normal, tangent_out); intersect.traverse(mOctree); diff --git a/indra/newview/gltfscenemanager.cpp b/indra/newview/gltfscenemanager.cpp index 16f362b3e4..e01aec0497 100644 --- a/indra/newview/gltfscenemanager.cpp +++ b/indra/newview/gltfscenemanager.cpp @@ -244,7 +244,8 @@ void GLTFSceneManager::uploadSelection() LLFileSystem cache(assetId, LLAssetType::AT_GLTF_BIN, LLFileSystem::WRITE); auto& data = mUploadingAsset->mBuffers[idx].mData; - cache.write((const U8*)data.data(), data.size()); + llassert(data.size() <= size_t(S32_MAX)); + cache.write((const U8 *) data.data(), S32(data.size())); } }; #if GLTF_SIM_SUPPORT @@ -399,8 +400,9 @@ void GLTFSceneManager::onGLTFLoadComplete(const LLUUID& id, LLAssetType::EType a { LLFileSystem file(id, asset_type, LLFileSystem::READ); std::string data; - data.resize(file.getSize()); - file.read((U8*)data.data(), data.size()); + S32 file_size = file.getSize(); + data.resize(file_size); + file.read((U8*)data.data(), file_size); boost::json::value json = boost::json::parse(data); @@ -479,7 +481,8 @@ void GLTFSceneManager::update() LLFileSystem cache(assetId, LLAssetType::AT_GLTF, LLFileSystem::WRITE); LL_INFOS("GLTF") << "Uploaded GLTF json: " << assetId << LL_ENDL; - cache.write((const U8 *) buffer.c_str(), buffer.size()); + llassert(buffer.size() <= size_t(S32_MAX)); + cache.write((const U8 *) buffer.c_str(), S32(buffer.size())); mUploadingAsset = nullptr; } diff --git a/indra/newview/installers/darwin/apple-notarize.sh b/indra/newview/installers/darwin/apple-notarize.sh index d90772ec0e..cc4435e614 100755 --- a/indra/newview/installers/darwin/apple-notarize.sh +++ b/indra/newview/installers/darwin/apple-notarize.sh @@ -17,7 +17,7 @@ if [[ -f "$CONFIG_FILE" ]]; then --asc-provider $ASC_PROVIDER \ --file "$zip_file" 2>&1) echo $res - + requestUUID=$(echo $res | awk '/RequestUUID/ { print $NF; }') if [[ -n $requestUUID ]]; then in_progress=1 @@ -26,7 +26,7 @@ if [[ -f "$CONFIG_FILE" ]]; then res=$(xcrun altool --notarization-info "$requestUUID" \ --username $USERNAME \ --password $PASSWORD 2>&1) - if [[ $res != *"in progress"* ]]; then + if [[ $res != *"in progress"* ]]; then in_progress=0 fi echo "." diff --git a/indra/newview/installers/darwin/fix_application_icon_position.sh b/indra/newview/installers/darwin/fix_application_icon_position.sh index 62abcdd07e..841defe96c 100755 --- a/indra/newview/installers/darwin/fix_application_icon_position.sh +++ b/indra/newview/installers/darwin/fix_application_icon_position.sh @@ -1,5 +1,5 @@ #!/bin/bash -# just run this script each time after you change the installer's name to fix the icon misalignment +# just run this script each time after you change the installer's name to fix the icon misalignment mydir="$(dirname "$0")" # If there's more than one DMG in more than one build directory, pick the most # recent one. diff --git a/indra/newview/linux_tools/register_secondlifeprotocol.sh b/indra/newview/linux_tools/register_secondlifeprotocol.sh index 16e73cb854..33c34d7a76 100755 --- a/indra/newview/linux_tools/register_secondlifeprotocol.sh +++ b/indra/newview/linux_tools/register_secondlifeprotocol.sh @@ -27,7 +27,7 @@ for LLKDECONFIG in kde-config kde4-config; do LLKDEPROTODIR=`$LLKDECONFIG --path services | cut -d ':' -f 1` if [ -d "$LLKDEPROTODIR" ]; then LLKDEPROTOFILE=${LLKDEPROTODIR}/secondlife.protocol - cat > ${LLKDEPROTOFILE} <<EOF || echo Warning: Did not register secondlife:// handler with KDE: Could not write ${LLKDEPROTOFILE} + cat > ${LLKDEPROTOFILE} <<EOF || echo Warning: Did not register secondlife:// handler with KDE: Could not write ${LLKDEPROTOFILE} [Protocol] exec=${HANDLER} '%u' protocol=secondlife diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 298ed82d92..759b73e486 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1312,7 +1312,7 @@ boost::signals2::connection LLAgent::whenPositionChanged(position_signal_t::slot //----------------------------------------------------------------------------- S32 LLAgent::getRegionsVisited() const { - return mRegionsVisited.size(); + return static_cast<S32>(mRegionsVisited.size()); } //----------------------------------------------------------------------------- @@ -3128,8 +3128,8 @@ bool LLAgent::isInGroup(const LLUUID& group_id, bool ignore_god_mode /* false */ if (!ignore_god_mode && isGodlike()) return true; - U32 count = mGroups.size(); - for(U32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3148,8 +3148,8 @@ bool LLAgent::hasPowerInGroup(const LLUUID& group_id, U64 power) const // GP_NO_POWERS can also mean no power is enough to grant an ability. if (GP_NO_POWERS == power) return false; - U32 count = mGroups.size(); - for(U32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3169,8 +3169,8 @@ U64 LLAgent::getPowerInGroup(const LLUUID& group_id) const if (isGodlike()) return GP_ALL_POWERS; - U32 count = mGroups.size(); - for(U32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3183,8 +3183,8 @@ U64 LLAgent::getPowerInGroup(const LLUUID& group_id) const bool LLAgent::getGroupData(const LLUUID& group_id, LLGroupData& data) const { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3197,8 +3197,8 @@ bool LLAgent::getGroupData(const LLUUID& group_id, LLGroupData& data) const S32 LLAgent::getGroupContribution(const LLUUID& group_id) const { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3211,8 +3211,8 @@ S32 LLAgent::getGroupContribution(const LLUUID& group_id) const bool LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution) { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { @@ -3234,8 +3234,8 @@ bool LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution) bool LLAgent::setUserGroupFlags(const LLUUID& group_id, bool accept_notices, bool list_in_profile) { - S32 count = mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = mGroups.size(); + for(size_t i = 0; i < count; ++i) { if(mGroups[i].mID == group_id) { diff --git a/indra/newview/llagentpicksinfo.cpp b/indra/newview/llagentpicksinfo.cpp index 17464dcef9..e2a2d2d8a9 100644 --- a/indra/newview/llagentpicksinfo.cpp +++ b/indra/newview/llagentpicksinfo.cpp @@ -123,5 +123,5 @@ void LLAgentPicksInfo::onServerRespond(LLAvatarData* picks) return; } - setNumberOfPicks(picks->picks_list.size()); + setNumberOfPicks(static_cast<S32>(picks->picks_list.size())); } diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 46f7d84ace..faa5d801dd 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -964,7 +964,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it { LL_INFOS() << "setWearableOutfit() start" << LL_ENDL; - S32 count = wearables.size(); + auto count = wearables.size(); llassert(items.size() == count); // Check for whether outfit already matches the one requested @@ -973,7 +973,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it S32 type_counts[arr_size]; bool update_inventory{ false }; std::fill(type_counts,type_counts+arr_size,0); - for (S32 i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) { LLViewerWearable* new_wearable = wearables[i]; LLPointer<LLInventoryItem> new_item = items[i]; @@ -1407,7 +1407,7 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array) { // Build a compound message to send all the objects that need to be rezzed. - S32 obj_count = obj_item_array.size(); + auto obj_count = obj_item_array.size(); if (obj_count > 0) { LL_DEBUGS("Avatar") << "ATT attaching multiple, total obj_count " << obj_count << LL_ENDL; diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp index 0dbd2d2ba3..ce4e8e9392 100644 --- a/indra/newview/llaisapi.cpp +++ b/indra/newview/llaisapi.cpp @@ -786,7 +786,7 @@ void AISAPI::FetchOrphans(completion_t callback) void AISAPI::EnqueueAISCommand(const std::string &procName, LLCoprocedureManager::CoProcedure_t proc) { LLCoprocedureManager &inst = LLCoprocedureManager::instance(); - S32 pending_in_pool = inst.countPending("AIS"); + auto pending_in_pool = inst.countPending("AIS"); std::string procFullName = "AIS(" + procName + ")"; if (pending_in_pool < MAX_SIMULTANEOUS_COROUTINES) { @@ -815,7 +815,7 @@ void AISAPI::onIdle(void *userdata) if (!sPostponedQuery.empty()) { LLCoprocedureManager &inst = LLCoprocedureManager::instance(); - S32 pending_in_pool = inst.countPending("AIS"); + auto pending_in_pool = inst.countPending("AIS"); while (pending_in_pool < MAX_SIMULTANEOUS_COROUTINES && !sPostponedQuery.empty()) { ais_query_item_t &item = sPostponedQuery.front(); @@ -1356,7 +1356,7 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth) uuid_int_map_t::const_iterator lookup_it = mCatDescendentsKnown.find(category_id); if (mCatDescendentsKnown.end() != lookup_it) { - S32 descendent_count = lookup_it->second; + S32 descendent_count = static_cast<S32>(lookup_it->second); LL_DEBUGS("Inventory") << "Setting descendents count to " << descendent_count << " for category " << category_id << LL_ENDL; new_cat->setDescendentCount(descendent_count); @@ -1409,7 +1409,7 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth) uuid_int_map_t::const_iterator lookup_it = mCatDescendentsKnown.find(category_id); if (mCatDescendentsKnown.end() != lookup_it) { - S32 descendent_count = lookup_it->second; + S32 descendent_count = static_cast<S32>(lookup_it->second); LL_DEBUGS("Inventory") << "Setting descendents count to " << descendent_count << " for new category " << category_id << LL_ENDL; new_cat->setDescendentCount(descendent_count); @@ -1585,7 +1585,7 @@ void AISUpdate::doUpdate() checkTimeout(); // Do version/descendant accounting. - for (std::map<LLUUID,S32>::const_iterator catit = mCatDescendentDeltas.begin(); + for (std::map<LLUUID,size_t>::const_iterator catit = mCatDescendentDeltas.begin(); catit != mCatDescendentDeltas.end(); ++catit) { LL_DEBUGS("Inventory") << "descendant accounting for " << catit->first << LL_ENDL; @@ -1609,7 +1609,7 @@ void AISUpdate::doUpdate() LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); if (cat) { - S32 descendent_delta = catit->second; + S32 descendent_delta = static_cast<S32>(catit->second); S32 old_count = cat->getDescendentCount(); LL_DEBUGS("Inventory") << "Updating descendant count for " << cat->getName() << " " << cat_id @@ -1733,7 +1733,7 @@ void AISUpdate::doUpdate() ucv_it != mCatVersionsUpdated.end(); ++ucv_it) { const LLUUID id = ucv_it->first; - S32 version = ucv_it->second; + S32 version = static_cast<S32>(ucv_it->second); LLViewerInventoryCategory *cat = gInventory.getCategory(id); LL_DEBUGS("Inventory") << "cat version update " << cat->getName() << " to version " << cat->getVersion() << LL_ENDL; if (cat->getVersion() != version) diff --git a/indra/newview/llaisapi.h b/indra/newview/llaisapi.h index 0dabd9f678..dd490c8268 100644 --- a/indra/newview/llaisapi.h +++ b/indra/newview/llaisapi.h @@ -134,7 +134,7 @@ private: // Todo: make throttle work over all fetch requests isntead of per-request const F32 AIS_EXPIRY_SECONDS = 0.008f; - typedef std::map<LLUUID,S32> uuid_int_map_t; + typedef std::map<LLUUID,size_t> uuid_int_map_t; uuid_int_map_t mCatDescendentDeltas; uuid_int_map_t mCatDescendentsKnown; uuid_int_map_t mCatVersionsUpdated; diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 6efb200ed8..9dd23a5319 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -719,7 +719,7 @@ public: bool isMostRecent(); void handleLateArrivals(); void resetTime(F32 timeout); - static S32 countActive() { return sActiveHoldingPatterns.size(); } + static S32 countActive() { return static_cast<S32>(sActiveHoldingPatterns.size()); } S32 index() { return mIndex; } private: @@ -1374,7 +1374,7 @@ static void removeDuplicateItems(LLInventoryModel::item_array_t& items) // encountered, so we actually keep the *last* of each duplicate // item. This is needed to give the right priority when adding // duplicate items to an existing outfit. - for (S32 i=items.size()-1; i>=0; i--) + for (S32 i = static_cast<S32>(items.size()) - 1; i >= 0; i--) { LLViewerInventoryItem *item = items.at(i); LLUUID item_id = item->getLinkedUUID(); @@ -2133,11 +2133,11 @@ void LLAppearanceMgr::filterWearableItems( items.clear(); for (S32 i=0; i<LLWearableType::WT_COUNT; i++) { - S32 size = items_by_type[i].size(); + auto size = items_by_type[i].size(); if (size <= 0) continue; - S32 start_index = llmax(0,size-max_per_type); - for (S32 j = start_index; j<size; j++) + auto start_index = llmax(0,size-max_per_type); + for (size_t j = start_index; j<size; j++) { items.push_back(items_by_type[i][j]); } @@ -3588,7 +3588,7 @@ struct WearablesOrderComparator LOG_CLASS(WearablesOrderComparator); WearablesOrderComparator(const LLWearableType::EType type) { - mControlSize = build_order_string(type, 0).size(); + mControlSize = static_cast<U32>(build_order_string(type, 0).size()); }; bool operator()(const LLInventoryItem* item1, const LLInventoryItem* item2) @@ -3623,7 +3623,7 @@ void LLAppearanceMgr::getWearableOrderingDescUpdates(LLInventoryModel::item_arra for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; type++) { - U32 size = items_by_type[type].size(); + U32 size = static_cast<U32>(items_by_type[type].size()); if (!size) continue; //sinking down invalid items which need reordering @@ -4577,7 +4577,7 @@ public: LLInventoryModel::item_array_t* items; gInventory.getDirectDescendentsOf(mComplete.front(), cats, items); - S32 count = items->size(); + auto count = items->size(); if(!count) { LL_WARNS() << "Nothing fetched in category " << mComplete.front() @@ -4593,7 +4593,7 @@ public: S32 version = cat ? cat->getVersion() : -2; LL_INFOS() << "stage1, category " << mComplete.front() << " got " << count << " items, version " << version << " passing to stage2 " << LL_ENDL; uuid_vec_t ids; - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { ids.push_back(items->at(i)->getUUID()); } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index e53a16fa3a..3b3345e8b2 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1664,7 +1664,7 @@ bool LLAppViewer::doFrame() S32 LLAppViewer::updateTextureThreads(F32 max_time) { - S32 work_pending = 0; + size_t work_pending = 0; { LL_PROFILE_ZONE_NAMED_CATEGORY_APP("Texture Cache"); work_pending += LLAppViewer::getTextureCache()->update(max_time); // unpauses the texture cache thread @@ -1677,7 +1677,7 @@ S32 LLAppViewer::updateTextureThreads(F32 max_time) LL_PROFILE_ZONE_NAMED_CATEGORY_APP("Image Fetch"); work_pending += LLAppViewer::getTextureFetch()->update(max_time); // unpauses the texture fetch thread } - return work_pending; + return static_cast<S32>(work_pending); } void LLAppViewer::flushLFSIO() @@ -2024,9 +2024,9 @@ bool LLAppViewer::cleanup() while(1) { S32 pending = 0; - pending += LLAppViewer::getTextureCache()->update(1); // unpauses the worker thread - pending += LLAppViewer::getImageDecodeThread()->update(1); // unpauses the image thread - pending += LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread + pending += static_cast<S32>(LLAppViewer::getTextureCache()->update(1)); // unpauses the worker thread + pending += static_cast<S32>(LLAppViewer::getImageDecodeThread()->update(1)); // unpauses the image thread + pending += static_cast<S32>(LLAppViewer::getTextureFetch()->update(1)); // unpauses the texture fetch thread pending += LLLFSThread::updateClass(0); F64 idle_time = idleTimer.getElapsedTimeF64(); if(!pending) @@ -3344,7 +3344,7 @@ LLSD LLAppViewer::getViewerInfo() const info["NET_BANDWITH"] = gSavedSettings.getF32("ThrottleBandwidthKBPS"); info["LOD_FACTOR"] = gSavedSettings.getF32("RenderVolumeLODFactor"); info["RENDER_QUALITY"] = (F32)gSavedSettings.getU32("RenderQualityPerformance"); - info["TEXTURE_MEMORY"] = gGLManager.mVRAM; + info["TEXTURE_MEMORY"] = LLSD::Integer(gGLManager.mVRAM); #if LL_DARWIN info["HIDPI"] = gHiDPISupport; @@ -3483,7 +3483,7 @@ std::string LLAppViewer::getViewerInfoString(bool default_string) const else { // array value: build KEY_0, KEY_1 etc. entries - for (LLSD::Integer n(0), size(ii->second.size()); n < size; ++n) + for (LLSD::Integer n(0), size(static_cast<LLSD::Integer>(ii->second.size())); n < size; ++n) { args[STRINGIZE(ii->first << '_' << n)] = ii->second[n].asString(); } @@ -3726,7 +3726,7 @@ void LLAppViewer::recordMarkerVersion(LLAPRFile& marker_file) } // record the viewer version in the marker file - marker_file.write(marker_version.data(), marker_version.length()); + marker_file.write(marker_version.data(), static_cast<S32>(marker_version.length())); } bool LLAppViewer::markerIsSameVersion(const std::string& marker_name) const @@ -5170,7 +5170,7 @@ void LLAppViewer::updateNameLookupUrl(const LLViewerRegion * regionp) if (have_capability) { // we have support for display names, use it - U32 url_size = name_lookup_url.size(); + auto url_size = name_lookup_url.size(); // capabilities require URLs with slashes before query params: // https://<host>:<port>/cap/<uuid>/?ids=<blah> // but the caps are granted like: diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 3d2964b930..5ae1e2f43c 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -964,7 +964,7 @@ bool LLAppViewerWin32::sendURLToOtherInstance(const std::string& url) COPYDATASTRUCT cds; const S32 SLURL_MESSAGE_TYPE = 0; cds.dwData = SLURL_MESSAGE_TYPE; - cds.cbData = url.length() + 1; + cds.cbData = static_cast<DWORD>(url.length()) + 1; cds.lpData = (void*)url.c_str(); LRESULT msg_result = SendMessage(other_window, WM_COPYDATA, NULL, (LPARAM)&cds); diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index 8f5dd0dab8..deabcd9f42 100644 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -296,7 +296,7 @@ void LLAttachmentsMgr::LLItemRequestTimes::addTime(const LLUUID& inv_item_id) void LLAttachmentsMgr::LLItemRequestTimes::removeTime(const LLUUID& inv_item_id) { LLInventoryItem *item = gInventory.getItem(inv_item_id); - S32 remove_count = (*this).erase(inv_item_id); + auto remove_count = (*this).erase(inv_item_id); if (remove_count) { LL_DEBUGS("Avatar") << "ATT " << mOpName << " removing request time " diff --git a/indra/newview/llautoreplace.cpp b/indra/newview/llautoreplace.cpp index e1d494f7c7..f200ca8e31 100644 --- a/indra/newview/llautoreplace.cpp +++ b/indra/newview/llautoreplace.cpp @@ -81,7 +81,7 @@ void LLAutoReplace::autoreplaceCallback(S32& replacement_start, S32& replacement replacement_start = word_start; replacement_length = word_end - word_start + 1; replacement_string = utf8str_to_wstring(replacement_word); - S32 size_change = replacement_string.size() - old_string.size(); + S32 size_change = static_cast<S32>(replacement_string.size() - old_string.size()); cursor_pos += size_change; } } diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index aeed29b999..f3cdd366b3 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -653,8 +653,8 @@ void LLAvatarActions::csr(const LLUUID& id, std::string name) std::string url = "http://csr.lindenlab.com/agent/"; // slow and stupid, but it's late - S32 len = name.length(); - for (S32 i = 0; i < len; i++) + auto len = name.length(); + for (size_t i = 0; i < len; i++) { if (name[i] == ' ') { @@ -829,11 +829,11 @@ namespace action_give_inventory return; } - S32 count = LLShareInfo::instance().mAvatarNames.size(); + auto count = LLShareInfo::instance().mAvatarNames.size(); bool shared = count && !inventory_selected_uuids.empty(); // iterate through avatars - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { const LLUUID& avatar_uuid = LLShareInfo::instance().mAvatarUuids[i]; diff --git a/indra/newview/llavatarrendernotifier.cpp b/indra/newview/llavatarrendernotifier.cpp index 61fc9d00f3..07a5c871ae 100644 --- a/indra/newview/llavatarrendernotifier.cpp +++ b/indra/newview/llavatarrendernotifier.cpp @@ -306,7 +306,7 @@ void LLHUDRenderNotifier::updateNotificationHUD(hud_complexity_list_t complexity } mHUDComplexityList = complexity; - mHUDsCount = mHUDComplexityList.size(); + mHUDsCount = static_cast<S32>(mHUDComplexityList.size()); static LLCachedControl<U32> show_my_complexity_changes(gSavedSettings, "ShowMyComplexityChanges", 20); if (!show_my_complexity_changes) diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp index 3821559b9e..89516a8a84 100644 --- a/indra/newview/llblocklist.cpp +++ b/indra/newview/llblocklist.cpp @@ -47,7 +47,7 @@ LLBlockList::LLBlockList(const Params& p) { LLMuteList::getInstance()->addObserver(this); - mMuteListSize = LLMuteList::getInstance()->getMutes().size(); + mMuteListSize = static_cast<U32>(LLMuteList::getInstance()->getMutes().size()); // Set up context menu. LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; @@ -92,7 +92,7 @@ void LLBlockList::createList() BlockListActionType LLBlockList::getCurrentMuteListActionType() { BlockListActionType type = NONE; - U32 curSize = LLMuteList::getInstance()->getMutes().size(); + U32 curSize = static_cast<U32>(LLMuteList::getInstance()->getMutes().size()); if( curSize > mMuteListSize) type = ADD; else if(curSize < mMuteListSize) @@ -266,7 +266,7 @@ void LLBlockList::refresh() selectItemPair(getItemPair(next_selected), true); } } - mMuteListSize = LLMuteList::getInstance()->getMutes().size(); + mMuteListSize = static_cast<U32>(LLMuteList::getInstance()->getMutes().size()); // Sort the list. sort(); diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 7fd29b297b..039164cd6e 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -26,16 +26,11 @@ #include "llviewerprecompiledheaders.h" -#if LL_WINDOWS -#pragma warning( disable : 4800 ) // performance warning in <functional> -#endif - #include "llcallingcard.h" #include <algorithm> #include "indra_constants.h" -//#include "llcachename.h" #include "llstl.h" #include "lltimer.h" #include "lluuid.h" diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index 6205b44375..4f90db17c0 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -470,7 +470,7 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) // to eat trailing spaces that might be part of a gesture. LLWStringUtil::trimHead(raw_text); - S32 length = raw_text.length(); + auto length = raw_text.length(); if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences { @@ -518,7 +518,7 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) // Select to end of line, starting from the character // after the last one the user typed. - self->mInputEditor->setSelection(length, outlength); + self->mInputEditor->setSelection(static_cast<S32>(length), outlength); } } diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 3893b21c2a..fc50691ece 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -725,8 +725,8 @@ public: mSourceType == CHAT_SOURCE_AGENT) { //if it's an avatar name with a username add formatting - S32 username_start = chat.mFromName.rfind(" ("); - S32 username_end = chat.mFromName.rfind(')'); + auto username_start = chat.mFromName.rfind(" ("); + auto username_end = chat.mFromName.rfind(')'); if (username_start != std::string::npos && username_end == (chat.mFromName.length() - 1)) diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index 313fd58624..ce8968253b 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -628,7 +628,7 @@ public: /** * Returns number of hosted chiclets. */ - S32 getChicletCount() {return mChicletList.size();}; + S32 getChicletCount() { return static_cast<S32>(mChicletList.size()); } /** * Returns index of chiclet in list. @@ -854,7 +854,7 @@ T* LLChicletPanel::createChiclet(const LLUUID& session_id, S32 index) template<class T> T* LLChicletPanel::createChiclet(const LLUUID& session_id) { - return createChiclet<T>(session_id, mChicletList.size()); + return createChiclet<T>(session_id, static_cast<S32>(mChicletList.size())); } template<class T> diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index b42d217477..47803edc73 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -618,13 +618,13 @@ void LLCOFWearables::populateClothingList(LLAppearanceMgr::wearables_by_type_t& for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; ++type) { - U32 size = clothing_by_type[type].size(); + auto size = clothing_by_type[type].size(); if (!size) continue; LLAppearanceMgr::sortItemsByActualDescription(clothing_by_type[type]); //clothing items are displayed in reverse order, from furthest ones to closest ones (relatively to the body) - for (U32 i = size; i != 0; --i) + for (size_t i = size; i != 0; --i) { LLViewerInventoryItem* item = clothing_by_type[type][i-1]; @@ -647,8 +647,8 @@ void LLCOFWearables::addClothingTypesDummies(const LLAppearanceMgr::wearables_by for (U32 type = LLWearableType::WT_SHIRT; type < LLWearableType::WT_COUNT; type++) { - U32 size = clothing_by_type[type].size(); - if (size) continue; + if (clothing_by_type[type].empty()) + continue; LLWearableType::EType w_type = static_cast<LLWearableType::EType>(type); LLPanelInventoryListItemBase* item_panel = LLPanelDummyClothingListItem::create(w_type); diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp index 5b8d8b5480..f301af9511 100644 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -378,8 +378,8 @@ bool LLCommandLineParser::parseCommandLineString(const std::string& str) if (!str.empty()) { bool add_last_c = true; - S32 last_c_pos = str.size() - 1; //don't get out of bounds on pos+1, last char will be processed separately - for (S32 pos = 0; pos < last_c_pos; ++pos) + auto last_c_pos = str.size() - 1; //don't get out of bounds on pos+1, last char will be processed separately + for (size_t pos = 0; pos < last_c_pos; ++pos) { cmd_line_string.append(&str[pos], 1); if (str[pos] == '\\') diff --git a/indra/newview/llcommunicationchannel.cpp b/indra/newview/llcommunicationchannel.cpp index 074d60d879..810b282722 100644 --- a/indra/newview/llcommunicationchannel.cpp +++ b/indra/newview/llcommunicationchannel.cpp @@ -54,7 +54,7 @@ bool LLCommunicationChannel::filterByDoNotDisturbStatus(LLNotificationPtr) S32 LLCommunicationChannel::getHistorySize() const { - return mHistory.size(); + return static_cast<S32>(mHistory.size()); } LLCommunicationChannel::history_list_t::const_iterator LLCommunicationChannel::beginHistory() const diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index bb853a3ddc..716333b217 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -424,11 +424,11 @@ void LLControlAvatar::updateDebugText() S32 total_linkset_count = 0; if (mRootVolp) { - total_linkset_count = 1 + mRootVolp->getChildren().size(); + total_linkset_count = 1 + static_cast<S32>(mRootVolp->getChildren().size()); } std::vector<LLVOVolume*> volumes; getAnimatedVolumes(volumes); - S32 animated_volume_count = volumes.size(); + S32 animated_volume_count = static_cast<S32>(volumes.size()); std::string active_string; std::string type_string; std::string lod_string; diff --git a/indra/newview/llcylinder.cpp b/indra/newview/llcylinder.cpp index 6e1fd41b87..c347d3e1be 100644 --- a/indra/newview/llcylinder.cpp +++ b/indra/newview/llcylinder.cpp @@ -48,7 +48,7 @@ void LLCone::render(S32 sides) gGL.begin(LLRender::TRIANGLE_FAN); gGL.vertex3f(0,0,0); - for (U32 i = 0; i < sides; i++) + for (S32 i = 0; i < sides; i++) { F32 a = (F32) i/sides * F_PI*2.f; F32 x = cosf(a)*0.5f; @@ -61,7 +61,7 @@ void LLCone::render(S32 sides) gGL.begin(LLRender::TRIANGLE_FAN); gGL.vertex3f(0.f, 0.f, 0.5f); - for (U32 i = 0; i < sides; i++) + for (S32 i = 0; i < sides; i++) { F32 a = (F32) i/sides * F_PI*2.f; F32 x = cosf(a)*0.5f; diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index ab7255d34e..26fdf51485 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -339,7 +339,7 @@ LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep) face = new LLFace(this, mVObjp); - face->setTEOffset(mFaces.size()); + face->setTEOffset(static_cast<S32>(mFaces.size())); face->setTexture(texturep); face->setPoolType(gPipeline.getPoolTypeFromTE(te, texturep)); @@ -361,7 +361,7 @@ LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep, LLFace *face; face = new LLFace(this, mVObjp); - face->setTEOffset(mFaces.size()); + face->setTEOffset(static_cast<S32>(mFaces.size())); face->setTexture(texturep); face->setNormalMap(normalp); face->setPoolType(gPipeline.getPoolTypeFromTE(te, texturep)); @@ -384,7 +384,7 @@ LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep, LLFace *face; face = new LLFace(this, mVObjp); - face->setTEOffset(mFaces.size()); + face->setTEOffset(static_cast<S32>(mFaces.size())); face->setTexture(texturep); face->setNormalMap(normalp); face->setSpecularMap(specularp); @@ -417,7 +417,7 @@ void LLDrawable::setNumFaces(const S32 newFaces, LLFacePool *poolp, LLViewerText else // (newFaces > mFaces.size()) { mFaces.reserve(newFaces); - for (int i = mFaces.size(); i<newFaces; i++) + for (auto i = mFaces.size(); i<newFaces; i++) { addFace(poolp, texturep); } @@ -442,7 +442,7 @@ void LLDrawable::setNumFacesFast(const S32 newFaces, LLFacePool *poolp, LLViewer else // (newFaces > mFaces.size()) { mFaces.reserve(newFaces); - for (int i = mFaces.size(); i<newFaces; i++) + for (auto i = mFaces.size(); i<newFaces; i++) { addFace(poolp, texturep); } @@ -455,10 +455,10 @@ void LLDrawable::mergeFaces(LLDrawable* src) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE - U32 face_count = mFaces.size() + src->mFaces.size(); + auto face_count = mFaces.size() + src->mFaces.size(); mFaces.reserve(face_count); - for (U32 i = 0; i < src->mFaces.size(); i++) + for (size_t i = 0; i < src->mFaces.size(); i++) { LLFace* facep = src->mFaces[i]; facep->setDrawable(this); diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index a9c15abc01..9ba4f7f300 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -315,7 +315,7 @@ void LLFacePool::addFaceReference(LLFace *facep) { if (-1 == facep->getReferenceIndex()) { - facep->setReferenceIndex(mReferences.size()); + facep->setReferenceIndex(static_cast<S32>(mReferences.size())); mReferences.push_back(facep); } } @@ -672,7 +672,7 @@ bool LLRenderPass::uploadMatrixPalette(LLVOAvatar* avatar, LLMeshSkinInfo* skinI return false; } const LLVOAvatar::MatrixPaletteCache& mpc = avatar->updateSkinInfoMatrixPalette(skinInfo); - U32 count = mpc.mMatrixPalette.size(); + U32 count = static_cast<U32>(mpc.mMatrixPalette.size()); if (count == 0) { diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 686e9aef24..93fea899f3 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -924,7 +924,7 @@ bool LLDrawPoolAlpha::uploadMatrixPalette(const LLDrawInfo& params) return false; } const LLVOAvatar::MatrixPaletteCache& mpc = params.mAvatar.get()->updateSkinInfoMatrixPalette(params.mSkinInfo); - U32 count = mpc.mMatrixPalette.size(); + U32 count = static_cast<U32>(mpc.mMatrixPalette.size()); if (count == 0) { diff --git a/indra/newview/lldrawpoolmaterials.cpp b/indra/newview/lldrawpoolmaterials.cpp index 07834c58b4..bbc93c2af9 100644 --- a/indra/newview/lldrawpoolmaterials.cpp +++ b/indra/newview/lldrawpoolmaterials.cpp @@ -250,7 +250,7 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass) if (params.mAvatar != lastAvatar) { const LLVOAvatar::MatrixPaletteCache& mpc = params.mAvatar->updateSkinInfoMatrixPalette(params.mSkinInfo); - U32 count = mpc.mMatrixPalette.size(); + U32 count = static_cast<U32>(mpc.mMatrixPalette.size()); if (count == 0) { diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 793d84652b..71b82b77eb 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -256,7 +256,7 @@ void LLDrawPoolWater::renderPostDeferred(S32 pass) if (mShaderLevel == 1) { - fog_color.mV[VW] = log(fog_density) / log(2); + fog_color.mV[VALPHA] = log(fog_density) / log(2); } F32 water_height = environment.getWaterHeight(); diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 739f85d4e6..fe6cd4e37d 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -217,8 +217,8 @@ bool LLViewerDynamicTexture::updateAllInstances() LLViewerDynamicTexture *dynamicTexture = *iter; if (dynamicTexture->needsRender()) { - llassert(dynamicTexture->getFullWidth() <= LLPipeline::MAX_BAKE_WIDTH); - llassert(dynamicTexture->getFullHeight() <= LLPipeline::MAX_BAKE_WIDTH); + llassert(dynamicTexture->getFullWidth() <= S32(LLPipeline::MAX_BAKE_WIDTH)); + llassert(dynamicTexture->getFullHeight() <= S32(LLPipeline::MAX_BAKE_WIDTH)); glClear(GL_DEPTH_BUFFER_BIT); diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index e075562e52..8884905cf0 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -757,7 +757,7 @@ namespace LLEnvironment::DayInstance::ptr_t getBaseDayInstance() const { return mBaseDayInstance; } void setBaseDayInstance(const LLEnvironment::DayInstance::ptr_t &baseday); - S32 countExperiencesActive() const { return mActiveExperiences.size(); } + S32 countExperiencesActive() const { return static_cast<S32>(mActiveExperiences.size()); } bool isOverriddenSky() const { return !mSkyExperience.isNull(); } bool isOverriddenWater() const { return !mWaterExperience.isNull(); } @@ -2512,7 +2512,7 @@ LLSettingsDay::ptr_t LLEnvironment::createDayCycleFromEnvironment(EnvSelection_t if (type == "sky") { - for (S32 idx = 1; idx < LLSettingsDay::TRACK_MAX; ++idx) + for (U32 idx = 1; idx < LLSettingsDay::TRACK_MAX; ++idx) day->clearCycleTrack(idx); day->setSettingsAtKeyframe(settings, 0.0f, 1); } diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index cda73f59ed..52062a3ad2 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1173,7 +1173,7 @@ bool LLFace::getGeometryVolume(const LLVolume& volume, if (mVertexBuffer.notNull()) { - if (num_indices + (S32) mIndicesIndex > mVertexBuffer->getNumIndices()) + if (num_indices + mIndicesIndex > mVertexBuffer->getNumIndices()) { if (gDebugGL) { @@ -1189,7 +1189,7 @@ bool LLFace::getGeometryVolume(const LLVolume& volume, return false; } - if (num_vertices + mGeomIndex > mVertexBuffer->getNumVerts()) + if (num_vertices + (U32)mGeomIndex > mVertexBuffer->getNumVerts()) { if (gDebugGL) { @@ -1248,12 +1248,16 @@ bool LLFace::getGeometryVolume(const LLVolume& volume, clearState(GLOBAL); } - LLColor4U color = tep->getColor(); + LLColor4U color{}; + if (tep) + { + color = tep->getColor(); if (tep->getGLTFRenderMaterial()) { color = tep->getGLTFRenderMaterial()->mBaseColor; } + } if (rebuild_color) { //decide if shiny goes in alpha channel of color @@ -1588,7 +1592,7 @@ bool LLFace::getGeometryVolume(const LLVolume& volume, mask.setElement<2>(); mask.setElement<3>(); - U32 count = num_vertices/2 + num_vertices%2; + S32 count = num_vertices/2 + num_vertices%2; for (S32 i = 0; i < count; i++) { @@ -2285,7 +2289,7 @@ bool LLFace::verify(const U32* indices_array) const } // First, check whether the face data fits within the pool's range. - if ((mGeomIndex + mGeomCount) > mVertexBuffer->getNumVerts()) + if ((U32)(mGeomIndex + mGeomCount) > mVertexBuffer->getNumVerts()) { ok = false; LL_INFOS() << "Face references invalid vertices!" << LL_ENDL; diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 0658d84bb8..67d55c53e4 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -249,7 +249,7 @@ bool LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) TimerBar* hover_bar = NULL; F32Seconds mouse_time_offset = ((F32)(x - mBarRect.mLeft) / (F32)mBarRect.getWidth()) * mTotalTimeDisplay; - for (int bar_index = 0, end_index = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); + for (size_t bar_index = 0, end_index = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); bar_index < end_index; ++bar_index) { @@ -706,7 +706,7 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t gGL.color3fv(base_col.mV); U32 count = 0; - U32 total_count = base_execution.size(); + U32 total_count = static_cast<U32>(base_execution.size()); last_p.clear(); @@ -728,7 +728,7 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t LLGLEnable blend(GL_BLEND); gGL.color3fv(cur_col.mV); count = 0; - total_count = cur_execution.size(); + total_count = static_cast<U32>(cur_execution.size()); for (std::vector<LLSD::Real>::iterator iter = cur_execution.begin(); iter != cur_execution.end(); ++iter) { @@ -1020,7 +1020,7 @@ void LLFastTimerView::drawLineGraph() //highlight visible range { - S32 first_frame = mRecording.getNumRecordedPeriods() - mScrollIndex; + S32 first_frame = static_cast<S32>(mRecording.getNumRecordedPeriods()) - mScrollIndex; S32 last_frame = first_frame - MAX_VISIBLE_HISTORY; F32 frame_delta = ((F32) (mGraphRect.getWidth()))/(mRecording.getNumRecordedPeriods()-1); @@ -1083,7 +1083,7 @@ void LLFastTimerView::drawLineGraph() F32 time_scale_factor = (F32)mGraphRect.getHeight() / max_time.value(); F32 hz_scale_factor = (F32) mGraphRect.getHeight() / (1.f / max_time.value()); - for (U32 j = mRecording.getNumRecordedPeriods(); + for (U32 j = static_cast<U32>(mRecording.getNumRecordedPeriods()); j > 0; j--) { @@ -1651,7 +1651,7 @@ S32 LLFastTimerView::drawBar(LLRect bar_rect, TimerBarRow& row, S32 image_width, bool children_visible = visible && !time_block->getTreeNode().mCollapsed; bar_index++; - const U32 num_bars = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); + const auto num_bars = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); if (bar_index < num_bars && row.mBars[bar_index].mFirstChild) { bool is_last = false; diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 906d04691f..377710c170 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -1250,7 +1250,7 @@ void LLFavoritesBarCtrl::fitLabelWidth(LLMenuItemCallGL* menu_item) // Check whether item name wider than menu if (menu_item->getNominalWidth() > max_width) { - S32 chars_total = item_name.length(); + S32 chars_total = static_cast<S32>(item_name.length()); S32 chars_fitted = 1; menu_item->setLabel(LLStringExplicit("")); S32 label_space = max_width - menu_item->getFont()->getWidth("...") - @@ -1375,7 +1375,7 @@ bool LLFavoritesBarCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) } void copy_slurl_to_clipboard_cb(std::string& slurl) { - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl),0,slurl.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl), 0, static_cast<S32>(slurl.size())); LLSD args; args["SLURL"] = slurl; @@ -1522,8 +1522,8 @@ bool LLFavoritesBarCtrl::isClipboardPasteable() const std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for(S32 i = 0; i < count; i++) + auto count = objects.size(); + for(size_t i = 0; i < count; i++) { const LLUUID &item_id = objects.at(i); @@ -1551,9 +1551,9 @@ void LLFavoritesBarCtrl::pasteFromClipboard() const LLInventoryItem* item = NULL; std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); + auto count = objects.size(); LLUUID parent_id(mFavoriteFolderId); - for(S32 i = 0; i < count; i++) + for(size_t i = 0; i < count; i++) { item = model->getItem(objects.at(i)); if (item) diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index ed55d00559..aa04221f4b 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -196,7 +196,7 @@ static const std::vector<std::string> sGraphicsLevelNames = boost::assign::list_ U32 LLFeatureManager::getMaxGraphicsLevel() const { - return sGraphicsLevelNames.size() - 1; + return static_cast<U32>(sGraphicsLevelNames.size()) - 1; } bool LLFeatureManager::isValidGraphicsLevel(U32 level) const diff --git a/indra/newview/llfetchedgltfmaterial.cpp b/indra/newview/llfetchedgltfmaterial.cpp index ee4f1b0fe5..c2821d56d6 100644 --- a/indra/newview/llfetchedgltfmaterial.cpp +++ b/indra/newview/llfetchedgltfmaterial.cpp @@ -46,7 +46,7 @@ LLFetchedGLTFMaterial::LLFetchedGLTFMaterial() LLFetchedGLTFMaterial::~LLFetchedGLTFMaterial() { - + } LLFetchedGLTFMaterial& LLFetchedGLTFMaterial::operator=(const LLFetchedGLTFMaterial& rhs) @@ -253,4 +253,3 @@ void LLFetchedGLTFMaterial::materialComplete(bool success) materialCompleteCallbacks.clear(); materialCompleteCallbacks.shrink_to_fit(); } - diff --git a/indra/newview/llfetchedgltfmaterial.h b/indra/newview/llfetchedgltfmaterial.h index 7550c75b45..634a4853b0 100644 --- a/indra/newview/llfetchedgltfmaterial.h +++ b/indra/newview/llfetchedgltfmaterial.h @@ -70,7 +70,7 @@ public: static LLFetchedGLTFMaterial sDefault; protected: // Lifetime management - + void materialBegin(); void materialComplete(bool success); diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index 4d82611def..367803b78a 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -72,13 +72,13 @@ LLVolumeImplFlexible::LLVolumeImplFlexible(LLViewerObject* vo, LLFlexibleObjectD mVO->mDrawable->makeActive() ; } - mInstanceIndex = sInstanceList.size(); + mInstanceIndex = static_cast<S32>(sInstanceList.size()); sInstanceList.push_back(this); }//----------------------------------------------- LLVolumeImplFlexible::~LLVolumeImplFlexible() { - S32 end_idx = sInstanceList.size()-1; + S32 end_idx = static_cast<S32>(sInstanceList.size()) - 1; if (end_idx != mInstanceIndex) { diff --git a/indra/newview/llfloater360capture.cpp b/indra/newview/llfloater360capture.cpp index 115374f94e..66796276a9 100644 --- a/indra/newview/llfloater360capture.cpp +++ b/indra/newview/llfloater360capture.cpp @@ -83,7 +83,7 @@ LLFloater360Capture::~LLFloater360Capture() // Normally LLFloater360Capture tells the Simulator send everything // and now reverts to the regular "keyhole" frustum of interest // list updates. - if (!LLApp::isExiting() && + if (!LLApp::isExiting() && gSavedSettings.getBOOL("360CaptureUseInterestListCap") && mStartILMode != gAgent.getInterestListMode()) { @@ -419,9 +419,9 @@ void LLFloater360Capture::mockSnapShot(LLImageRaw* raw) unsigned int depth = raw->getComponents(); unsigned char* pixels = raw->getData(); - for (int y = 0; y < height; y++) + for (unsigned int y = 0; y < height; y++) { - for (int x = 0; x < width; x++) + for (unsigned int x = 0; x < width; x++) { unsigned long offset = y * width * depth + x * depth; unsigned char red = x * 256 / width; @@ -582,7 +582,7 @@ void LLFloater360Capture::capture360Images() LLViewerStats::instance().getRecording().resume(); LLAppViewer::instance()->resumeMainloopTimeout(); - + // update main loop timeout state LLAppViewer::instance()->pingMainloopTimeout("LLFloater360Capture::capture360Images"); } diff --git a/indra/newview/llfloaterbulkpermission.cpp b/indra/newview/llfloaterbulkpermission.cpp index 497fe3b9ba..c09c02d32b 100644 --- a/indra/newview/llfloaterbulkpermission.cpp +++ b/indra/newview/llfloaterbulkpermission.cpp @@ -223,7 +223,7 @@ bool LLFloaterBulkPermission::start() // Go to the next object and start if found. Returns false if no objects left, true otherwise. bool LLFloaterBulkPermission::nextObject() { - S32 count; + size_t count; bool successful_start = false; do { @@ -251,7 +251,7 @@ bool LLFloaterBulkPermission::popNext() { // get the head element from the container, and attempt to get its inventory. bool rv = false; - S32 count = mObjectIDs.size(); + auto count = mObjectIDs.size(); if(mCurrentObjectID.isNull() && (count > 0)) { mCurrentObjectID = mObjectIDs.at(0); diff --git a/indra/newview/llfloatercamerapresets.h b/indra/newview/llfloatercamerapresets.h index 9b07987755..4e12617242 100644 --- a/indra/newview/llfloatercamerapresets.h +++ b/indra/newview/llfloatercamerapresets.h @@ -1,24 +1,24 @@ -/** +/** * @file llfloatercamerapresets.h * * $LicenseInfo:firstyear=2019&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2019, Linden Research, Inc. -* +* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. -* +* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. -* +* * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* +* * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/llfloaterchangeitemthumbnail.cpp b/indra/newview/llfloaterchangeitemthumbnail.cpp index 3a9612a354..3e2e7cb7a3 100644 --- a/indra/newview/llfloaterchangeitemthumbnail.cpp +++ b/indra/newview/llfloaterchangeitemthumbnail.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llfloaterchangeitemthumbnail.cpp * @brief LLFloaterChangeItemThumbnail class implementation * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -96,7 +96,7 @@ void LLThumbnailImagePicker::notify(const std::vector<std::string>& filenames) { return; } - + LLFloaterSimpleSnapshot::uploadThumbnail(file_path, mInventoryId, mTaskId, mCallback); } @@ -636,7 +636,7 @@ void LLFloaterChangeItemThumbnail::onRemove(void *userdata) LLNotificationsUtil::add("DeleteThumbnail", LLSD(), payload, boost::bind(&LLFloaterChangeItemThumbnail::onRemovalConfirmation, _1, _2, self->getHandle())); } -// static +// static void LLFloaterChangeItemThumbnail::onRemovalConfirmation(const LLSD& notification, const LLSD& response, LLHandle<LLFloater> handle) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp index d6bf410c55..837aa858f5 100644 --- a/indra/newview/llfloaterconversationpreview.cpp +++ b/indra/newview/llfloaterconversationpreview.cpp @@ -108,7 +108,7 @@ void LLFloaterConversationPreview::setPages(std::list<LLSD>* messages, const std delete mMessages; // Clean up temporary message list with "Loading..." text } mMessages = messages; - mCurrentPage = (mMessages->size() ? (mMessages->size() - 1) / mPageSize : 0); + mCurrentPage = (mMessages->size() ? (static_cast<int>(mMessages->size()) - 1) / mPageSize : 0); mPageSpinner->setEnabled(true); mPageSpinner->setMaxValue(mCurrentPage+1); diff --git a/indra/newview/llfloatereditenvironmentbase.cpp b/indra/newview/llfloatereditenvironmentbase.cpp index 07bc5701cf..bd5839ed17 100644 --- a/indra/newview/llfloatereditenvironmentbase.cpp +++ b/indra/newview/llfloatereditenvironmentbase.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llfloatereditenvironmentbase.cpp * @brief Floaters to create and edit fixed settings for sky and water. * * $LicenseInfo:firstyear=2011&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2011, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/llfloatereditenvironmentbase.h b/indra/newview/llfloatereditenvironmentbase.h index 96cb37c6ee..37fda5d33e 100644 --- a/indra/newview/llfloatereditenvironmentbase.h +++ b/indra/newview/llfloatereditenvironmentbase.h @@ -1,25 +1,25 @@ -/** +/** * @file llfloatereditenvironmentbase.h * @brief Floaters to create and edit fixed settings for sky and water. * * $LicenseInfo:firstyear=2011&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2011, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -54,7 +54,7 @@ public: virtual void onFocusReceived() override; virtual void onFocusLost() override; - + virtual LLSettingsBase::ptr_t getEditSettings() const = 0; virtual bool isDirty() const override { return getIsDirty(); } @@ -141,7 +141,7 @@ private: bool mIsDirty; bool mCanEdit; - + on_dirty_charged_sg mOnDirtyChanged; }; diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 5e3e8a7838..ebccb2214c 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -1195,7 +1195,7 @@ void LLFloaterEditExtDayCycle::updateButtons() } else { - for (S32 track = 1; track < LLSettingsDay::TRACK_MAX; ++track) + for (U32 track = 1; track < LLSettingsDay::TRACK_MAX; ++track) { if (track == mCurrentTrack) continue; @@ -1220,7 +1220,7 @@ void LLFloaterEditExtDayCycle::updateButtons() // update track buttons bool extended_env = LLEnvironment::instance().isExtendedEnvironmentEnabled(); - for (S32 track = 0; track < LLSettingsDay::TRACK_MAX; ++track) + for (U32 track = 0; track < LLSettingsDay::TRACK_MAX; ++track) { LLButton* button = getChild<LLButton>(track_tabs[track], true); button->setEnabled(extended_env); diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp index 4b3034f069..d38f53eed6 100644 --- a/indra/newview/llfloateremojipicker.cpp +++ b/indra/newview/llfloateremojipicker.cpp @@ -39,9 +39,9 @@ #include "llscrolllistctrl.h" #include "llscrolllistitem.h" #include "llsdserialize.h" -#include "lltextbox.h" +#include "lltextbox.h" #include "lltrans.h" -#include "llviewerchat.h" +#include "llviewerchat.h" namespace { // The following variables and constants are used for storing the floater state @@ -103,16 +103,16 @@ public: F32 x = 4; // padding-left F32 y = getRect().getHeight() / 2; LLFontGL::getFontSansSerif()->render( - mText, // wstr - 0, // begin_offset - x, // x - y, // y - LLColor4::white, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - mText.size()); // max_chars + mText, // wstr + 0, // begin_offset + x, // x + y, // y + LLColor4::white, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast<S32>(mText.size())); // max_chars } virtual void updatePanel(bool allow_modify) override {} @@ -235,17 +235,17 @@ protected: { std::string text = mTitle.substr(0, mBegin); font->renderUTF8( - text, // text - 0, // begin_offset - x0, // x - y, // y - color, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - text.size(), // max_chars - x1); // max_pixels + text, // text + 0, // begin_offset + x0, // x + y, // y + color, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast<S32>(text.size()), // max_chars + x1); // max_pixels F32 dx = font->getWidthF32(text); x0 += dx; x1 -= dx; @@ -254,17 +254,17 @@ protected: { std::string text = mTitle.substr(mBegin, mEnd - mBegin); font->renderUTF8( - text, // text - 0, // begin_offset - x0, // x - y, // y - LLColor4::yellow6, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - text.size(), // max_chars - x1); // max_pixels + text, // text + 0, // begin_offset + x0, // x + y, // y + LLColor4::yellow6, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast<S32>(text.size()), // max_chars + x1); // max_pixels F32 dx = font->getWidthF32(text); x0 += dx; x1 -= dx; @@ -273,17 +273,17 @@ protected: { std::string text = mEnd ? mTitle.substr(mEnd) : mTitle; font->renderUTF8( - text, // text - 0, // begin_offset - x0, // x - y, // y - color, // color - LLFontGL::LEFT, // halign - LLFontGL::VCENTER, // valign - LLFontGL::NORMAL, // style - LLFontGL::DROP_SHADOW_SOFT, // shadow - text.size(), // max_chars - x1); // max_pixels + text, // text + 0, // begin_offset + x0, // x + y, // y + color, // color + LLFontGL::LEFT, // halign + LLFontGL::VCENTER, // valign + LLFontGL::NORMAL, // style + LLFontGL::DROP_SHADOW_SOFT, // shadow + static_cast<S32>(text.size()), // max_chars + x1); // max_pixels } } @@ -413,9 +413,9 @@ void LLFloaterEmojiPicker::initialize() showPreview(true); mSelectedGroupIndex = groupIndex == ALL_EMOJIS_GROUP_INDEX ? 0 : - (1 + std::distance(mFilteredEmojiGroups.begin(), + static_cast<U32>((1 + std::distance(mFilteredEmojiGroups.begin(), std::find(mFilteredEmojiGroups.begin(), mFilteredEmojiGroups.end(), groupIndex))) % - (1 + mFilteredEmojiGroups.size()); + (1 + mFilteredEmojiGroups.size())); mGroupButtons[mSelectedGroupIndex]->setToggleState(true); mGroupButtons[mSelectedGroupIndex]->setUseFontColor(true); @@ -991,15 +991,15 @@ bool LLFloaterEmojiPicker::moveFocusedIconUp() bool LLFloaterEmojiPicker::moveFocusedIconDown() { - S32 rowCount = mEmojiGrid->getPanelList().size(); - for (S32 i = mFocusedIconRow + 1; i < rowCount; ++i) + auto rowCount = mEmojiGrid->getPanelList().size(); + for (size_t i = mFocusedIconRow + 1; i < rowCount; ++i) { LLScrollingPanel* panel = mEmojiGrid->getPanelList()[i]; LLEmojiGridRow* row = dynamic_cast<LLEmojiGridRow*>(panel); if (row && row->mList->getPanelList().size() > mFocusedIconCol) { mEmojiScroll->scrollToShowRect(row->getBoundingRect()); - mFocusedIconRow = i; + mFocusedIconRow = static_cast<S32>(i); selectFocusedIcon(); return true; } @@ -1027,7 +1027,7 @@ bool LLFloaterEmojiPicker::moveFocusedIconPrev() if (row && row->mList->getPanelList().size()) { mEmojiScroll->scrollToShowRect(row->getBoundingRect()); - mFocusedIconCol = row->mList->getPanelList().size() - 1; + mFocusedIconCol = static_cast<S32>(row->mList->getPanelList().size()) - 1; mFocusedIconRow = i; selectFocusedIcon(); return true; @@ -1044,7 +1044,7 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext() LLScrollingPanel* panel = mEmojiGrid->getPanelList()[mFocusedIconRow]; LLEmojiGridRow* row = dynamic_cast<LLEmojiGridRow*>(panel); - S32 colCount = row ? row->mList->getPanelList().size() : 0; + S32 colCount = row ? static_cast<S32>(row->mList->getPanelList().size()) : 0; if (mFocusedIconCol < colCount - 1) { mFocusedIconCol++; @@ -1052,8 +1052,8 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext() return true; } - S32 rowCount = mEmojiGrid->getPanelList().size(); - for (S32 i = mFocusedIconRow + 1; i < rowCount; ++i) + auto rowCount = mEmojiGrid->getPanelList().size(); + for (size_t i = mFocusedIconRow + 1; i < rowCount; ++i) { LLScrollingPanel* panel = mEmojiGrid->getPanelList()[i]; LLEmojiGridRow* row = dynamic_cast<LLEmojiGridRow*>(panel); @@ -1061,7 +1061,7 @@ bool LLFloaterEmojiPicker::moveFocusedIconNext() { mEmojiScroll->scrollToShowRect(row->getBoundingRect()); mFocusedIconCol = 0; - mFocusedIconRow = i; + mFocusedIconRow = static_cast<S32>(i); selectFocusedIcon(); return true; } @@ -1112,10 +1112,10 @@ bool LLFloaterEmojiPicker::handleKey(KEY key, MASK mask, bool called_from_parent switch (key) { case KEY_LEFT: - selectEmojiGroup((mSelectedGroupIndex + mFilteredEmojis.size()) % mGroupButtons.size()); + selectEmojiGroup(static_cast<U32>((mSelectedGroupIndex + mFilteredEmojis.size()) % mGroupButtons.size())); return true; case KEY_RIGHT: - selectEmojiGroup((mSelectedGroupIndex + 1) % mGroupButtons.size()); + selectEmojiGroup(static_cast<U32>((mSelectedGroupIndex + 1) % mGroupButtons.size())); return true; } } diff --git a/indra/newview/llfloaterenvironmentadjust.cpp b/indra/newview/llfloaterenvironmentadjust.cpp index 1849c4801d..32c4f6205d 100644 --- a/indra/newview/llfloaterenvironmentadjust.cpp +++ b/indra/newview/llfloaterenvironmentadjust.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llfloaterfixedenvironment.cpp * @brief Floaters to create and edit fixed settings for sky and water. * * $LicenseInfo:firstyear=2011&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2011, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -260,7 +260,7 @@ void LLFloaterEnvironmentAdjust::onButtonReset() LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); LLEnvironment::instance().updateEnvironment(); } - }); + }); } //------------------------------------------------------------------------- diff --git a/indra/newview/llfloaterenvironmentadjust.h b/indra/newview/llfloaterenvironmentadjust.h index 228771418d..c894473582 100644 --- a/indra/newview/llfloaterenvironmentadjust.h +++ b/indra/newview/llfloaterenvironmentadjust.h @@ -1,25 +1,25 @@ -/** +/** * @file llfloaterenvironmentadjust.h * @brief Floaters to create and edit fixed settings for sky and water. * * $LicenseInfo:firstyear=2011&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2011, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index 45a2efb265..6829e6b479 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llfloaterfixedenvironment.cpp * @brief Floaters to create and edit fixed settings for sky and water. * * $LicenseInfo:firstyear=2011&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2011, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -429,7 +429,7 @@ bool LLFloaterFixedEnvironmentWater::postBuild() void LLFloaterFixedEnvironmentWater::updateEditEnvironment(void) { - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, std::static_pointer_cast<LLSettingsWater>(mSettings)); } @@ -437,7 +437,7 @@ void LLFloaterFixedEnvironmentWater::onOpen(const LLSD& key) { if (!mSettings) { - // Initialize the settings, take a snapshot of the current water. + // Initialize the settings, take a snapshot of the current water. mSettings = LLEnvironment::instance().getEnvironmentFixedWater(LLEnvironment::ENV_CURRENT)->buildClone(); mSettings->setName("Snapshot water (new)"); @@ -461,7 +461,7 @@ void LLFloaterFixedEnvironmentWater::loadWaterSettingFromFile(const std::vector< LLSettingsWater::ptr_t legacywater = LLEnvironment::createWaterFromLegacyPreset(filename, messages); if (!legacywater) - { + { LLNotificationsUtil::add("WLImportFail", messages); return; } @@ -508,7 +508,7 @@ bool LLFloaterFixedEnvironmentSky::postBuild() void LLFloaterFixedEnvironmentSky::updateEditEnvironment(void) { - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, std::static_pointer_cast<LLSettingsSky>(mSettings)); } @@ -516,7 +516,7 @@ void LLFloaterFixedEnvironmentSky::onOpen(const LLSD& key) { if (!mSettings) { - // Initialize the settings, take a snapshot of the current water. + // Initialize the settings, take a snapshot of the current water. mSettings = LLEnvironment::instance().getEnvironmentFixedSky(LLEnvironment::ENV_CURRENT)->buildClone(); mSettings->setName("Snapshot sky (new)"); LLEnvironment::instance().saveBeaconsState(); @@ -548,7 +548,7 @@ void LLFloaterFixedEnvironmentSky::loadSkySettingFromFile(const std::vector<std: LLSettingsSky::ptr_t legacysky = LLEnvironment::createSkyFromLegacyPreset(filename, messages); if (!legacysky) - { + { LLNotificationsUtil::add("WLImportFail", messages); return; diff --git a/indra/newview/llfloaterforgetuser.cpp b/indra/newview/llfloaterforgetuser.cpp index be21de503e..874bb7d545 100644 --- a/indra/newview/llfloaterforgetuser.cpp +++ b/indra/newview/llfloaterforgetuser.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llfloaterforgetuser.cpp * @brief LLFloaterForgetUser class definition. * * $LicenseInfo:firstyear=2019&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2019, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -157,7 +157,7 @@ bool LLFloaterForgetUser::onConfirmForget(const LLSD& notification, const LLSD& return false; } -// static +// static bool LLFloaterForgetUser::onConfirmLogout(const LLSD& notification, const LLSD& response, const std::string &fav_id, const std::string &grid) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); diff --git a/indra/newview/llfloaterforgetuser.h b/indra/newview/llfloaterforgetuser.h index 2bbccc8192..99a724b648 100644 --- a/indra/newview/llfloaterforgetuser.h +++ b/indra/newview/llfloaterforgetuser.h @@ -1,25 +1,25 @@ -/** +/** * @file llfloaterforgetuser.h * @brief LLFloaterForgetUser class declaration. * * $LicenseInfo:firstyear=2019&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2019, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/llfloatergridstatus.cpp b/indra/newview/llfloatergridstatus.cpp index eb3d23d785..b6b844b307 100644 --- a/indra/newview/llfloatergridstatus.cpp +++ b/indra/newview/llfloatergridstatus.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llfloatergridstatus.cpp * @brief Grid status floater - uses an embedded web browser to show Grid status info * * $LicenseInfo:firstyear=2009&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2017, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/llfloatergridstatus.h b/indra/newview/llfloatergridstatus.h index 9b134f1641..570479d990 100644 --- a/indra/newview/llfloatergridstatus.h +++ b/indra/newview/llfloatergridstatus.h @@ -1,25 +1,25 @@ -/** +/** * @file llfloatergridstatus.h * @brief Grid status floater - uses an embedded web browser to show Grid status info * * $LicenseInfo:firstyear=2009&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2017, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index a02ecaf293..2fd1a482e5 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -342,13 +342,13 @@ void LLPanelGroups::onGroupList(LLUICtrl* ctrl, void* userdata) void init_group_list(LLScrollListCtrl* group_list, const LLUUID& highlight_id, U64 powers_mask) { - S32 count = gAgent.mGroups.size(); + auto count = gAgent.mGroups.size(); LLUUID id; if (!group_list) return; group_list->operateOnAll(LLCtrlListInterface::OP_DELETE); - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { id = gAgent.mGroups.at(i).mID; LLGroupData* group_datap = &gAgent.mGroups.at(i); diff --git a/indra/newview/llfloaterhowto.h b/indra/newview/llfloaterhowto.h index c6dee0099a..9d7793817a 100644 --- a/indra/newview/llfloaterhowto.h +++ b/indra/newview/llfloaterhowto.h @@ -1,25 +1,25 @@ -/** +/** * @file llfloaterhowto.h * @brief A variant of web floater meant to open guidebook * * $LicenseInfo:firstyear=2021&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2021, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 2d398de61a..add389748f 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1787,8 +1787,8 @@ void LLFloaterIMContainer::setNearbyDistances() // Get the position of the agent const LLVector3d& me_pos = gAgent.getPositionGlobal(); // For each nearby avatar, compute and update the distance - int avatar_count = positions.size(); - for (int i = 0; i < avatar_count; i++) + auto avatar_count = positions.size(); + for (size_t i = 0; i < avatar_count; i++) { F64 dist = dist_vec_squared(positions[i], me_pos); item->setDistance(avatar_ids[i],dist); diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index 36c0d0833f..e11445d779 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -212,7 +212,7 @@ public: void highlightConversationItemWidget(const LLUUID& session_id, bool is_highlighted); bool isScrolledOutOfSight(LLConversationViewSession* conversation_item_widget); boost::signals2::connection mMicroChangedSignal; - S32 getConversationListItemSize() { return mConversationsWidgets.size(); } + S32 getConversationListItemSize() { return static_cast<S32>(mConversationsWidgets.size()); } typedef std::list<LLFloater*> floater_list_t; void getDetachedConversationFloaters(floater_list_t& floaters); diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index 26b0836301..28c651f0cd 100644 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -431,7 +431,7 @@ bool LLFloaterIMNearbyChat::handleKeyHere( KEY key, MASK mask ) bool LLFloaterIMNearbyChat::matchChatTypeTrigger(const std::string& in_str, std::string* out_str) { - U32 in_len = in_str.length(); + auto in_len = in_str.length(); S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers); bool string_was_found = false; @@ -470,7 +470,7 @@ void LLFloaterIMNearbyChat::onChatBoxKeystroke() // to eat trailing spaces that might be part of a gesture. LLWStringUtil::trimHead(raw_text); - S32 length = raw_text.length(); + auto length = raw_text.length(); if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences { @@ -517,7 +517,7 @@ void LLFloaterIMNearbyChat::onChatBoxKeystroke() mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part // Select to end of line, starting from the character // after the last one the user typed. - mInputEditor->selectByCursorPosition(utf8_out_str.size()-rest_of_match.size(),utf8_out_str.size()); + mInputEditor->selectByCursorPosition(static_cast<S32>(utf8_out_str.size() - rest_of_match.size()), static_cast<S32>(utf8_out_str.size())); } } @@ -549,7 +549,7 @@ void LLFloaterIMNearbyChat::onChatBoxFocusReceived() EChatType LLFloaterIMNearbyChat::processChatTypeTriggers(EChatType type, std::string &str) { - U32 length = str.length(); + auto length = str.length(); S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers); for (S32 n = 0; n < cnt; n++) @@ -560,7 +560,7 @@ EChatType LLFloaterIMNearbyChat::processChatTypeTriggers(EChatType type, std::st if (!LLStringUtil::compareInsensitive(trigger, sChatTypeTriggers[n].name)) { - U32 trigger_length = sChatTypeTriggers[n].name.length(); + auto trigger_length = sChatTypeTriggers[n].name.length(); // It's to remove space after trigger name if (length > trigger_length && str[trigger_length] == ' ') @@ -754,8 +754,8 @@ void LLFloaterIMNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType bool LLFloaterIMNearbyChat::isWordsName(const std::string& name) { // checking to see if it's display name plus username in parentheses - S32 open_paren = name.find(" (", 0); - S32 close_paren = name.find(')', 0); + auto open_paren = name.find(" (", 0); + auto close_paren = name.find(')', 0); if (open_paren != std::string::npos && close_paren == name.length()-1) @@ -765,7 +765,7 @@ bool LLFloaterIMNearbyChat::isWordsName(const std::string& name) else { //checking for a single space - S32 pos = name.find(' ', 0); + auto pos = name.find(' ', 0); return std::string::npos != pos && name.rfind(' ', name.length()) == pos && 0 != pos && name.length()-1 != pos; } } diff --git a/indra/newview/llfloaterimnearbychat.h b/indra/newview/llfloaterimnearbychat.h index c5fca94169..abcaa13442 100644 --- a/indra/newview/llfloaterimnearbychat.h +++ b/indra/newview/llfloaterimnearbychat.h @@ -70,7 +70,7 @@ public: LLChatEntry* getChatBox() { return mInputEditor; } std::string getCurrentChat(); - S32 getMessageArchiveLength() {return mMessageArchive.size();} + S32 getMessageArchiveLength() { return static_cast<S32>(mMessageArchive.size()); } virtual bool handleKeyHere( KEY key, MASK mask ); diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index d49352ec94..9b08ecd059 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -1190,7 +1190,7 @@ bool LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids) if (is_region_exist) { - S32 count = ids.size(); + auto count = ids.size(); if( isInviteAllowed() && (count > 0) ) { @@ -1200,7 +1200,7 @@ bool LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids) LLSD data; data["params"] = LLSD::emptyArray(); - for (int i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) { data["params"].append(ids[i]); } diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index a1951bc4a8..9a794d1775 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -2512,7 +2512,7 @@ void LLPanelLandAccess::refresh() // Clear the sort order so we don't re-sort on every add. mListAccess->clearSortOrder(); mListAccess->deleteAllItems(); - S32 count = parcel->mAccessList.size(); + auto count = parcel->mAccessList.size(); getChild<LLUICtrl>("AllowedText")->setTextArg("[COUNT]", llformat("%d",count)); getChild<LLUICtrl>("AllowedText")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); @@ -2560,7 +2560,7 @@ void LLPanelLandAccess::refresh() // Clear the sort order so we don't re-sort on every add. mListBanned->clearSortOrder(); mListBanned->deleteAllItems(); - S32 count = parcel->mBanList.size(); + auto count = parcel->mBanList.size(); getChild<LLUICtrl>("BanCheck")->setTextArg("[COUNT]", llformat("%d",count)); getChild<LLUICtrl>("BanCheck")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); @@ -2760,13 +2760,13 @@ void LLPanelLandAccess::refresh_ui() getChildView("GroupCheck")->setEnabled(can_manage_allowed && can_allow_groups); } getChildView("AccessList")->setEnabled(can_manage_allowed); - S32 allowed_list_count = parcel->mAccessList.size(); + auto allowed_list_count = parcel->mAccessList.size(); getChildView("add_allowed")->setEnabled(can_manage_allowed && allowed_list_count < PARCEL_MAX_ACCESS_LIST); bool has_selected = (mListAccess && mListAccess->getSelectionInterface()->getFirstSelectedIndex() >= 0); getChildView("remove_allowed")->setEnabled(can_manage_allowed && has_selected); getChildView("BannedList")->setEnabled(can_manage_banned); - S32 banned_list_count = parcel->mBanList.size(); + auto banned_list_count = parcel->mBanList.size(); getChildView("add_banned")->setEnabled(can_manage_banned && banned_list_count < PARCEL_MAX_ACCESS_LIST); has_selected = (mListBanned && mListBanned->getSelectionInterface()->getFirstSelectedIndex() >= 0); getChildView("remove_banned")->setEnabled(can_manage_banned && has_selected); diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp index df602387b3..63c05b14f8 100644 --- a/indra/newview/llfloaterlandholdings.cpp +++ b/indra/newview/llfloaterlandholdings.cpp @@ -76,8 +76,8 @@ bool LLFloaterLandHoldings::postBuild() grant_list->sortByColumnIndex(0, true); grant_list->setDoubleClickCallback(onGrantList, this); - S32 count = gAgent.mGroups.size(); - for(S32 i = 0; i < count; ++i) + auto count = gAgent.mGroups.size(); + for(size_t i = 0; i < count; ++i) { LLUUID id(gAgent.mGroups.at(i).mID); LLUIString areastr = getString("area_string"); diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index b75012c44f..f20fea01c5 100644 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -577,7 +577,7 @@ S32 LLFloaterMarketplaceListings::getFolderCount() LLInventoryModel::item_array_t * items; gInventory.getDirectDescendentsOf(mRootFolderId, cats, items); - return (cats->size() + items->size()); + return static_cast<S32>(cats->size() + items->size()); } else { diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 3a0e6dc05b..a91cdba5c0 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1420,7 +1420,7 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides) LLModel* model = instance.mModel; const LLMeshSkinInfo *skin = &model->mSkinInfo; U32 joint_count = LLSkinningUtil::getMeshJointCount(skin); - U32 bind_count = highlight_overrides ? skin->mAlternateBindMatrix.size() : 0; // simply do not include overrides if data is not needed + U32 bind_count = highlight_overrides ? static_cast<U32>(skin->mAlternateBindMatrix.size()) : 0; // simply do not include overrides if data is not needed if (bind_count > 0 && bind_count != joint_count) { std::ostringstream out; @@ -1544,7 +1544,7 @@ void LLFloaterModelPreview::addStringToLogTab(const std::string& str, bool flash } LLWString text = utf8str_to_wstring(str); - S32 add_text_len = text.length() + 1; // newline + S32 add_text_len = static_cast<S32>(text.length()) + 1; // newline S32 editor_max_len = mUploadLogText->getMaxTextLength(); if (add_text_len > editor_max_len) { diff --git a/indra/newview/llfloatermyenvironment.cpp b/indra/newview/llfloatermyenvironment.cpp index ea3e76f377..df4526e69d 100644 --- a/indra/newview/llfloatermyenvironment.cpp +++ b/indra/newview/llfloatermyenvironment.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llfloatergesture.cpp * @brief LLFloaterMyEnvironment class implementation * * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2019, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -278,7 +278,7 @@ void LLFloaterMyEnvironment::onDoApply(const std::string &context) std::string name = itemp->getName(); U32 flags(0); - + if (!itemp->getPermissions().allowOperationBy(PERM_MODIFY, gAgent.getID())) flags |= LLSettingsBase::FLAG_NOMOD; if (!itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) @@ -317,7 +317,7 @@ bool LLFloaterMyEnvironment::canAction(const std::string &context) return false; if (context == PARAMETER_EDIT) - { + { return (selected.size() == 1) && isSettingSelected(selected.front()); } else if (context == PARAMETER_COPY) @@ -364,11 +364,11 @@ bool LLFloaterMyEnvironment::canApply(const std::string &context) return false; if (context == PARAMETER_REGION) - { + { return LLEnvironment::instance().canAgentUpdateRegionEnvironment(); } else if (context == PARAMETER_PARCEL) - { + { return LLEnvironment::instance().canAgentUpdateParcelEnvironment(); } else diff --git a/indra/newview/llfloatermyscripts.cpp b/indra/newview/llfloatermyscripts.cpp index a84f479d02..0283855f15 100644 --- a/indra/newview/llfloatermyscripts.cpp +++ b/indra/newview/llfloatermyscripts.cpp @@ -137,7 +137,7 @@ void LLFloaterMyScripts::setAttachmentDetails(LLSD content) return; } - S32 number_attachments = content["attachments"].size(); + S32 number_attachments = static_cast<S32>(content["attachments"].size()); for(int i = 0; i < number_attachments; i++) { @@ -148,7 +148,7 @@ void LLFloaterMyScripts::setAttachmentDetails(LLSD content) humanReadableLocation = LLTrans::getString(actualLocation.c_str()); } - S32 number_objects = content["attachments"][i]["objects"].size(); + S32 number_objects = static_cast<S32>(content["attachments"][i]["objects"].size()); for(int j = 0; j < number_objects; j++) { LLUUID task_id = content["attachments"][i]["objects"][j]["id"].asUUID(); diff --git a/indra/newview/llfloaternewfeaturenotification.cpp b/indra/newview/llfloaternewfeaturenotification.cpp index be347c46b0..369727ff1e 100644 --- a/indra/newview/llfloaternewfeaturenotification.cpp +++ b/indra/newview/llfloaternewfeaturenotification.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llfloaternewfeaturenotification.cpp * @brief LLFloaterNewFeatureNotification class implementation * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -46,7 +46,7 @@ bool LLFloaterNewFeatureNotification::postBuild() const std::string title_txt = "title_txt"; const std::string dsc_txt = "description_txt"; std::string feature = "_" + getKey().asString(); - + getChild<LLUICtrl>(title_txt)->setValue(getString(title_txt + feature)); getChild<LLUICtrl>(dsc_txt)->setValue(getString(dsc_txt + feature)); diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp index e0a234e3a2..848672b1fc 100644 --- a/indra/newview/llfloaterpathfindingcharacters.cpp +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -284,7 +284,7 @@ void LLFloaterPathfindingCharacters::showCapsule() const if (LLPathingLib::getInstance() != NULL) { LLPathingLib::getInstance()->createPhysicsCapsuleRep(character->getLength(), character->getRadius(), - character->isHorizontal(), character->getUUID()); + (BOOL)character->isHorizontal(), character->getUUID()); } } diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index a097a3ee31..994a5c0c02 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -30,10 +30,6 @@ #include "llfloaterpathfindingconsole.h" -#include <vector> - -#include <boost/signals2.hpp> - #include "llagent.h" #include "llbutton.h" #include "llcheckboxctrl.h" @@ -46,7 +42,6 @@ #include "llpanel.h" #include "llpathfindingnavmeshzone.h" #include "llpathfindingpathtool.h" -#include "llpathinglib.h" #include "llsliderctrl.h" #include "llsd.h" #include "lltabcontainer.h" diff --git a/indra/newview/llfloaterpathfindingobjects.cpp b/indra/newview/llfloaterpathfindingobjects.cpp index b4452d4c46..402da273c8 100644 --- a/indra/newview/llfloaterpathfindingobjects.cpp +++ b/indra/newview/llfloaterpathfindingobjects.cpp @@ -135,7 +135,7 @@ void LLFloaterPathfindingObjects::draw() std::vector<LLScrollListItem *> selectedItems = mObjectsScrollList->getAllSelected(); if (!selectedItems.empty()) { - int numSelectedItems = selectedItems.size(); + auto numSelectedItems = selectedItems.size(); S32 nameColumnIndex = getNameColumnIndex(); const LLColor4 &beaconColor = getBeaconColor(); const LLColor4 &beaconTextColor = getBeaconTextColor(); @@ -334,7 +334,7 @@ void LLFloaterPathfindingObjects::rebuildObjectsScrollList(bool update_if_needed if (!mHasObjectsToBeSelected) { std::vector<LLScrollListItem*> selectedItems = mObjectsScrollList->getAllSelected(); - int numSelectedItems = selectedItems.size(); + auto numSelectedItems = selectedItems.size(); if (numSelectedItems > 0) { mObjectsToBeSelected.reserve(selectedItems.size()); @@ -835,7 +835,7 @@ void LLFloaterPathfindingObjects::selectScrollListItemsInWorld() std::vector<LLScrollListItem *> selectedItems = mObjectsScrollList->getAllSelected(); if (!selectedItems.empty()) { - int numSelectedItems = selectedItems.size(); + auto numSelectedItems = selectedItems.size(); std::vector<LLViewerObject *>viewerObjects; viewerObjects.reserve(numSelectedItems); diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index 6b93ab2b49..3a633a7ff8 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -1,24 +1,24 @@ -/** +/** * @file llfloaterperformance.cpp * * $LicenseInfo:firstyear=2021&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2021, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -186,7 +186,7 @@ void LLFloaterPerformance::draw() { enableAutotuneWarning(); - if (mUpdateTimer->hasExpired() && + if (mUpdateTimer->hasExpired() && !LLFloaterReg::instanceVisible("save_pref_preset", PRESETS_GRAPHIC)) // give user a chance to save the graphics settings before updating them { setFPSText(); @@ -447,7 +447,7 @@ void LLFloaterPerformance::populateNearbyList() row[0]["column"] = "complex_visual"; row[0]["type"] = "bar"; LLSD& value = row[0]["value"]; - // The ratio used in the bar is the current cost, as soon as we take action this changes so we keep the + // The ratio used in the bar is the current cost, as soon as we take action this changes so we keep the // pre-tune value for the numerical column and sorting. value["ratio"] = render_av_gpu_ms / mNearbyMaxGPUTime; value["bottom"] = BAR_BOTTOM_PAD; @@ -571,7 +571,7 @@ void LLFloaterPerformance::updateMaxRenderTime() { LLAvatarComplexityControls::updateMaxRenderTime( mNearbyPanel->getChild<LLSliderCtrl>("RenderAvatarMaxART"), - mNearbyPanel->getChild<LLTextBox>("RenderAvatarMaxARTText"), + mNearbyPanel->getChild<LLTextBox>("RenderAvatarMaxARTText"), true); } @@ -684,7 +684,7 @@ bool is_ALM_available() { bool bumpshiny = LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump") && gSavedSettings.getBOOL("RenderObjectBump"); bool shaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders"); - + return LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && bumpshiny && shaders; diff --git a/indra/newview/llfloaterprofiletexture.h b/indra/newview/llfloaterprofiletexture.h index 16e2656bc6..cdb1b92ba9 100644 --- a/indra/newview/llfloaterprofiletexture.h +++ b/indra/newview/llfloaterprofiletexture.h @@ -1,25 +1,25 @@ -/** +/** * @file llfloaterprofiletexture.h * @brief LLFloaterProfileTexture class definition * * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2022, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 1c4874eae5..073cef3d73 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -1787,7 +1787,7 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) LL_DEBUGS() << "no region set" << LL_ENDL; getChild<LLUICtrl>("region_text")->setValue(LLSD("")); } - + // Update visibility of terrain swatches, etc refresh(); @@ -1920,7 +1920,7 @@ bool LLPanelRegionTerrainInfo::sendUpdate() for (S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i) { LLPointer<LLGLTFMaterial> mat_override = new LLGLTFMaterial(); - + const bool transform_controls_valid = mMaterialScaleUCtrl[i] && mMaterialScaleVCtrl[i] && mMaterialRotationCtrl[i] && mMaterialOffsetUCtrl[i] && mMaterialOffsetVCtrl[i]; if (transform_controls_valid) { @@ -4145,7 +4145,7 @@ void LLPanelEstateAccess::copyListToClipboard(std::string list_name) } } - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(list_to_copy), 0, list_to_copy.length()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(list_to_copy), 0, static_cast<S32>(list_to_copy.length())); } bool LLPanelEstateAccess::refreshFromRegion(LLViewerRegion* region) diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index 1f4e95c229..b3452a25c5 100644 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -403,7 +403,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) return; } - S32 number_parcels = content["parcels"].size(); + auto number_parcels = content["parcels"].size(); LLStringUtil::format_map_t args_parcels; args_parcels["[PARCELS]"] = llformat ("%d", number_parcels); @@ -418,10 +418,10 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) bool has_locations = false; bool has_local_ids = false; - for(S32 i = 0; i < number_parcels; i++) + for(size_t i = 0; i < number_parcels; i++) { std::string parcel_name = content["parcels"][i]["name"].asString(); - S32 number_objects = content["parcels"][i]["objects"].size(); + auto number_objects = content["parcels"][i]["objects"].size(); S32 local_id = 0; if(content["parcels"][i].has("local_id")) @@ -431,7 +431,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) local_id = content["parcels"][i]["local_id"].asInteger(); } - for(S32 j = 0; j < number_objects; j++) + for(size_t j = 0; j < number_objects; j++) { S32 size = content["parcels"][i]["objects"][j]["resources"]["memory"].asInteger() / SIZE_OF_ONE_KB; @@ -898,10 +898,10 @@ void LLPanelScriptLimitsRegionMemory::returnObjects() return; } - S32 number_parcels = mContent["parcels"].size(); + auto number_parcels = mContent["parcels"].size(); // a message per parcel containing all objects to be returned from that parcel - for(S32 i = 0; i < number_parcels; i++) + for(size_t i = 0; i < number_parcels; i++) { S32 local_id = 0; if(mContent["parcels"][i].has("local_id")) diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 2c28e80995..2a72a361d6 100755 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -966,8 +966,8 @@ void LLFloaterWorldMap::buildLandmarkIDLists() mLandmarkAssetIDList.reserve(mLandmarkAssetIDList.size() + items.size()); mLandmarkItemIDList.reserve(mLandmarkItemIDList.size() + items.size()); - S32 count = items.size(); - for(S32 i = 0; i < count; ++i) + auto count = items.size(); + for(size_t i = 0; i < count; ++i) { LLInventoryItem* item = items.at(i); @@ -1552,7 +1552,7 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) LLScrollListCtrl *list = getChild<LLScrollListCtrl>("search_results"); list->operateOnAll(LLCtrlListInterface::OP_DELETE); - S32 name_length = mCompletingRegionName.length(); + auto name_length = mCompletingRegionName.length(); LLSD match; diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index b826b12bd3..5300627cec 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -83,7 +83,7 @@ const LLUUID& get_folder_uuid(const LLUUID& parentFolderUUID, LLInventoryCollect gInventory.collectDescendentsIf(parentFolderUUID, cats, items, LLInventoryModel::EXCLUDE_TRASH, matchFunctor); - S32 cats_count = cats.size(); + auto cats_count = cats.size(); if (cats_count > 1) { @@ -244,7 +244,7 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje { LLUUID creator_id = item->getCreatorUUID(); LLViewerInventoryItem* cur_item = NULL; - for ( S32 i = items->size() - 1; i >= 0; --i ) + for (S32 i = static_cast<S32>(items->size()) - 1; i >= 0; --i) { cur_item = items->at(i); if ( creator_id == cur_item->getCreatorUUID() ) @@ -261,7 +261,7 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje // Note: UUID's of compared items also may be not equal. std::string obj_name = obj->getName(); LLViewerInventoryItem* cur_item = NULL; - for ( S32 i = items->size() - 1; i >= 0; --i ) + for (S32 i = static_cast<S32>(items->size()) - 1; i >= 0; --i) { cur_item = items->at(i); if ( obj->getType() != cur_item->getType() ) @@ -281,7 +281,7 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje // then return true. Note: UUID's of compared items also may be not equal. std::string obj_name = obj->getName(); LLViewerInventoryCategory* cur_cat = NULL; - for ( S32 i = cats->size() - 1; i >= 0; --i ) + for (S32 i = static_cast<S32>(cats->size()) - 1; i >= 0; --i) { cur_cat = cats->at(i); if ( obj->getType() != cur_cat->getType() ) diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 2ac99a2f16..8ee11cdbd2 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -671,7 +671,7 @@ bool LLGestureMgr::triggerAndReviseString(const std::string &utf8str, std::strin { // choose one at random { - S32 random = ll_rand(matching.size()); + S32 random = ll_rand(static_cast<S32>(matching.size())); gesture = matching[random]; @@ -745,7 +745,7 @@ bool LLGestureMgr::triggerGesture(KEY key, MASK mask) // choose one and play it if (matching.size() > 0) { - U32 random = ll_rand(matching.size()); + U32 random = ll_rand(static_cast<S32>(matching.size())); LLMultiGesture* gesture = matching[random]; @@ -783,7 +783,7 @@ bool LLGestureMgr::triggerGestureRelease(KEY key, MASK mask) S32 LLGestureMgr::getPlayingCount() const { - return mPlaying.size(); + return static_cast<S32>(mPlaying.size()); } @@ -1462,7 +1462,7 @@ void LLGestureMgr::notifyObservers() bool LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str) { - S32 in_len = in_str.length(); + auto in_len = in_str.length(); //return whole trigger, if received text equals to it item_map_t::iterator it; @@ -1490,7 +1490,7 @@ bool LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str) { const std::string& trigger = gesture->getTrigger(); - if (in_len > (S32)trigger.length()) + if (in_len > trigger.length()) { // too short, bail out continue; diff --git a/indra/newview/llgiveinventory.cpp b/indra/newview/llgiveinventory.cpp index c4e0e53bb5..1259b65ebe 100644 --- a/indra/newview/llgiveinventory.cpp +++ b/indra/newview/llgiveinventory.cpp @@ -242,9 +242,9 @@ bool LLGiveInventory::doGiveInventoryCategory(const LLUUID& to_agent, items, LLInventoryModel::EXCLUDE_TRASH, giveable); - S32 count = cats.size(); + auto count = cats.size(); bool complete = true; - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { if (!gInventory.isCategoryComplete(cats.at(i)->getUUID())) { @@ -446,8 +446,8 @@ bool LLGiveInventory::handleCopyProtectedCategory(const LLSD& notification, cons items, LLInventoryModel::EXCLUDE_TRASH, remove); - S32 count = items.size(); - for(S32 i = 0; i < count; ++i) + auto count = items.size(); + for(size_t i = 0; i < count; ++i) { gInventory.deleteObject(items.at(i)->getUUID()); } @@ -503,7 +503,7 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent, // MAX ITEMS is based on (sizeof(uuid)+2) * count must be < // MTUBYTES or 18 * count < 1200 => count < 1200/18 => // 66. I've cut it down a bit from there to give some pad. - S32 count = items.size() + cats.size(); + auto count = items.size() + cats.size(); if (count > MAX_ITEMS) { LLNotificationsUtil::add("TooManyItems"); @@ -520,7 +520,7 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent, LLAgentUI::buildFullname(name); LLUUID transaction_id; transaction_id.generate(); - S32 bucket_size = (sizeof(U8) + UUID_BYTES) * (count + 1); + S32 bucket_size = (sizeof(U8) + UUID_BYTES) * (static_cast<S32>(count) + 1); U8* bucket = new U8[bucket_size]; U8* pos = bucket; U8 type = (U8)cat->getType(); diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index c878c8cf63..08f8918e5d 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -939,7 +939,7 @@ public: { // takes (count, pointer) // &vector[0] gets pointer to contiguous array - LLImageGL::generateTextures(source.size(), &source[0]); + LLImageGL::generateTextures(static_cast<S32>(source.size()), &source[0]); } ~TextureHolder() @@ -950,7 +950,7 @@ public: texUnit->unbind(LLTexUnit::TT_TEXTURE); } // ensure that we delete these textures regardless of how we exit - LLImageGL::deleteTextures(source.size(), &source[0]); + LLImageGL::deleteTextures(static_cast<S32>(source.size()), &source[0]); } bool bind(U32 index) diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 133e8e8599..215f3dd3a7 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -73,7 +73,7 @@ static bool is_valid_update(const LLSD& data) ++count; } else - { + { LL_WARNS() << "Missing required parameter: object_id" << LL_ENDL; return false; } @@ -93,7 +93,7 @@ static bool is_valid_update(const LLSD& data) ++count; } else - { + { LL_WARNS() << "Missing required parameter: side" << LL_ENDL; return false; } @@ -119,7 +119,7 @@ static bool is_valid_update(const LLSD& data) } if (count < 3) - { + { LL_WARNS() << "Only specified object_id and side, update won't actually change anything and is just noise" << LL_ENDL; return false; } @@ -173,7 +173,7 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s LLSDSerialize::fromNotation(data, str, data_in.length()); const LLHost& host = msg->getSender(); - + LLViewerRegion* region = LLWorld::instance().getRegion(host); llassert(region); @@ -199,14 +199,14 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s bool has_te[MAX_TES] = { false }; if (tes.isArray()) // NOTE: if no "te" array exists, this is a malformed message (null out all overrides will come in as an empty te array) - { + { LLGLTFOverrideCacheEntry cache; cache.mLocalId = local_id; cache.mObjectId = id; cache.mRegionHandle = region->getHandle(); - U32 count = llmin(tes.size(), MAX_TES); - for (U32 i = 0; i < count; ++i) + auto count = llmin(tes.size(), MAX_TES); + for (size_t i = 0; i < count; ++i) { LLGLTFMaterial* mat = new LLGLTFMaterial(); // setTEGLTFMaterialOverride and cache will take ownership mat->applyOverrideLLSD(od[i]); @@ -252,7 +252,7 @@ void LLGLTFMaterialList::queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFM { #if 0 override_list_t& overrides = mQueuedOverrides[id]; - + if (overrides.size() < side + 1) { overrides.resize(side + 1); @@ -372,7 +372,7 @@ void LLGLTFMaterialList::queueUpdate(const LLSD& data) { sUpdates = LLSD::emptyArray(); } - + sUpdates[sUpdates.size()] = data; } @@ -380,7 +380,7 @@ void LLGLTFMaterialList::flushUpdates(void(*done_callback)(bool)) { LLSD& data = sUpdates; - S32 i = data.size(); + auto i = data.size(); for (ModifyMaterialData& e : sModifyQueue) { @@ -392,7 +392,7 @@ void LLGLTFMaterialList::flushUpdates(void(*done_callback)(bool)) data[i]["object_id"] = e.object_id; data[i]["side"] = e.side; - + if (e.has_override) { data[i]["gltf_json"] = e.override_data.asJSON(); @@ -491,7 +491,7 @@ void LLGLTFMaterialList::onAssetLoadComplete(const LLUUID& id, LLAssetType::ETyp } buffer.resize(size); - file.read((U8*)&buffer[0], buffer.size()); + file.read((U8*)&buffer[0], static_cast<S32>(buffer.size())); } { @@ -500,7 +500,7 @@ void LLGLTFMaterialList::onAssetLoadComplete(const LLUUID& id, LLAssetType::ETyp LLSD asset; // read file into buffer - std::istrstream str(&buffer[0], buffer.size()); + std::istrstream str(&buffer[0], static_cast<S32>(buffer.size())); if (LLSDSerialize::deserialize(asset, str, buffer.size())) { @@ -517,7 +517,7 @@ void LLGLTFMaterialList::onAssetLoadComplete(const LLUUID& id, LLAssetType::ETyp LL_PROFILE_ZONE_SCOPED; tinygltf::TinyGLTF gltf; - if (!gltf.LoadASCIIFromString(&asset_data->mModelIn, &error_msg, &warn_msg, data.c_str(), data.length(), "")) + if (!gltf.LoadASCIIFromString(&asset_data->mModelIn, &error_msg, &warn_msg, data.c_str(), static_cast<U32>(data.length()), "")) { LL_WARNS("GLTF") << "Failed to decode material asset: " << LL_NEWLINE @@ -578,7 +578,7 @@ LLFetchedGLTFMaterial* LLGLTFMaterialList::getMaterial(const LLUUID& id) gAssetStorage->getAssetData(id, LLAssetType::AT_MATERIAL, onAssetLoadComplete, (void*)user_data); } - + return mat; } diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 6eab86ff0a..982538f106 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -79,14 +79,14 @@ public: static void flushUpdates(void(*done_callback)(bool) = nullptr); static void addSelectionUpdateCallback(void(*update_callback)(const LLUUID& object_id, S32 side)); - + // Queue an explicit LLSD ModifyMaterialParams update apply given override data // overrides -- LLSD map (or array of maps) in the format: // object_id UUID(required) id of object // side integer(required) TE index of face to set, or -1 for all faces // gltf_json string(optional) override data to set, empty string nulls out override data, omissions of this parameter keeps existing data // asset_id UUID(optional) id of material asset to set, omission of this parameter keeps existing material asset id - // + // // NOTE: Unless you already have a gltf_json string you want to send, strongly prefer using queueModify // If the queue/flush API is insufficient, extend it. static void queueUpdate(const LLSD& data); diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp index 1952b5b8a1..7659e5f082 100644 --- a/indra/newview/llgrouplist.cpp +++ b/indra/newview/llgrouplist.cpp @@ -223,7 +223,7 @@ void LLGroupList::refresh() if (mForAgent) { const LLUUID& highlight_id = gAgent.getGroupID(); - S32 count = gAgent.mGroups.size(); + S32 count = static_cast<S32>(gAgent.mGroups.size()); LLUUID id; bool have_filter = !mNameFilter.empty(); diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 32943a9bb7..100aacb8ac 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -168,7 +168,7 @@ S32 LLGroupRoleData::getMembersInRole(uuid_vec_t members, { // This is the everyone role, just return the size of members, // because everyone is in the everyone role. - return members.size(); + return static_cast<S32>(members.size()); } // Sort the members list, if needed. @@ -184,7 +184,7 @@ S32 LLGroupRoleData::getMembersInRole(uuid_vec_t members, } // Return the number of members in the intersection. - S32 max_size = llmin( members.size(), mMemberIDs.size() ); + auto max_size = llmin( members.size(), mMemberIDs.size() ); uuid_vec_t in_role( max_size ); uuid_vec_t::iterator in_role_end; in_role_end = std::set_intersection(mMemberIDs.begin(), mMemberIDs.end(), diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h index 84adcd024f..18efae7654 100644 --- a/indra/newview/llgroupmgr.h +++ b/indra/newview/llgroupmgr.h @@ -151,7 +151,7 @@ public: const uuid_vec_t& getRoleMembers() const { return mMemberIDs; } S32 getMembersInRole(uuid_vec_t members, bool needs_sort = true); - S32 getTotalMembersInRole() { return mMemberCount ? mMemberCount : mMemberIDs.size(); } //FIXME: Returns 0 for Everyone role when Member list isn't yet loaded, see MAINT-5225 + S32 getTotalMembersInRole() { return mMemberCount ? mMemberCount : static_cast<S32>(mMemberIDs.size()); } //FIXME: Returns 0 for Everyone role when Member list isn't yet loaded, see MAINT-5225 LLRoleData getRoleData() const { return mRoleData; } void setRoleData(LLRoleData data) { mRoleData = data; } diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp index 83c7b8a354..f544b70329 100644 --- a/indra/newview/llheroprobemanager.cpp +++ b/indra/newview/llheroprobemanager.cpp @@ -101,7 +101,7 @@ void LLHeroProbeManager::update() U32 count = log2((F32)res) + 0.5f; mMipChain.resize(count); - for (int i = 0; i < count; ++i) + for (U32 i = 0; i < count; ++i) { mMipChain[i].allocate(res, res, GL_RGBA16F); res /= 2; @@ -198,7 +198,7 @@ void LLHeroProbeManager::update() mFaceUpdateList[i] = ceilf(cube_facing * gPipeline.RenderHeroProbeConservativeUpdateMultiplier); } - + mProbes[0]->mOrigin = probe_pos; } else @@ -359,7 +359,8 @@ void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face, bool res /= 2; - S32 mip = i - (mMipChain.size() - mips); + llassert(mMipChain.size() <= size_t(S32_MAX)); + GLint mip = i - (S32(mMipChain.size()) - mips); if (mip >= 0) { @@ -487,7 +488,8 @@ void LLHeroProbeManager::updateUniforms() mHeroData.heroSphere.mV[3] = mProbes[0]->mRadius; } - mHeroData.heroMipCount = mMipChain.size(); + llassert(mMipChain.size() <= size_t(S32_MAX)); + mHeroData.heroMipCount = S32(mMipChain.size()); } void LLHeroProbeManager::renderDebug() diff --git a/indra/newview/llheroprobemanager.h b/indra/newview/llheroprobemanager.h index e45b0049b2..c8d505f4c3 100644 --- a/indra/newview/llheroprobemanager.h +++ b/indra/newview/llheroprobemanager.h @@ -51,18 +51,18 @@ class alignas(16) LLHeroProbeManager { LL_ALIGN_NEW public: - enum class DetailLevel + enum class DetailLevel { STATIC_ONLY = 0, STATIC_AND_DYNAMIC, REALTIME = 2 }; - // allocate an environment map of the given resolution + // allocate an environment map of the given resolution LLHeroProbeManager(); ~LLHeroProbeManager(); - // release any GL state + // release any GL state void cleanup(); // maintain reflection probes @@ -90,11 +90,11 @@ public: LLVector3 mMirrorPosition; LLVector3 mMirrorNormal; HeroProbeData mHeroData; - + private: friend class LLPipeline; friend class LLReflectionMapManager; - + // update UBO used for rendering (call only once per render pipe flush) void updateUniforms(); @@ -103,7 +103,7 @@ private: // render target for cube snapshots // used to generate mipmaps without doing a copy-to-texture LLRenderTarget mRenderTarget; - + LLRenderTarget mHeroRenderTarget; std::vector<LLRenderTarget> mMipChain; @@ -120,7 +120,7 @@ private: // update the specified face of the specified probe void updateProbeFace(LLReflectionMap* probe, U32 face, bool is_dynamic, F32 near_clip); void generateRadiance(LLReflectionMap *probe); - + // list of active reflection maps std::vector<LLPointer<LLReflectionMap>> mProbes; @@ -136,10 +136,10 @@ private: // resolution of reflection probes U32 mProbeResolution = 1024; - + // maximum LoD of reflection probes (mip levels - 1) F32 mMaxProbeLOD = 6.f; - + F32 mHeroProbeStrength = 1.f; bool mIsInTransition = false; @@ -148,9 +148,9 @@ private: bool mRenderingMirror = false; std::map<int, int> mFaceUpdateList; - + U32 mCurrentProbeUpdateFrame = 0; - + std::vector<LLPointer<LLVOVolume>> mHeroVOList; LLPointer<LLVOVolume> mNearestHero; diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index 4224f7d134..e1bf6c2077 100644 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -443,7 +443,7 @@ void LLHUDNameTag::addLine(const std::string &text_utf8, // "QualityAssurance AssuresQuality1" will end up as "QualityAssurance AssuresQua..." because we are enforcing single line do { - S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, wline.length(), LLFontGL::ANYWHERE); + auto segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, static_cast<S32>(wline.length()), LLFontGL::ANYWHERE); if (segment_length + line_length < wline.length()) // since we only draw one string, line_length should be 0 { // token does does not fit into signle line, need to draw "...". @@ -451,7 +451,7 @@ void LLHUDNameTag::addLine(const std::string &text_utf8, const LLWString dots_pad(utf8str_to_wstring(std::string("...."))); S32 elipses_width = font->getWidthF32(dots_pad.c_str()); // truncated string length - segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels - elipses_width, wline.length(), LLFontGL::ANYWHERE); + segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels - elipses_width, static_cast<S32>(wline.length()), LLFontGL::ANYWHERE); const LLWString dots(utf8str_to_wstring(std::string("..."))); LLHUDTextSegment segment(iter->substr(line_length, segment_length) + dots, style, color, font); mTextSegments.push_back(segment); @@ -472,7 +472,7 @@ void LLHUDNameTag::addLine(const std::string &text_utf8, // "QualityAssurance AssuresQuality 1" will be split into two lines "QualityAssurance" and "AssuresQuality" do { - S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, static_cast<S32>(wline.length()), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); LLHUDTextSegment segment(iter->substr(line_length, segment_length), style, color, font); mTextSegments.push_back(segment); line_length += segment_length; @@ -511,7 +511,7 @@ void LLHUDNameTag::addLabel(const std::string& label_utf8, F32 max_pixels) do { S32 segment_length = mFontp->maxDrawableChars(iter->substr(line_length).c_str(), - max_pixels, wstr.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + max_pixels, static_cast<S32>(wstr.length()), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); LLHUDTextSegment segment(iter->substr(line_length, segment_length), LLFontGL::NORMAL, mColor, mFontp); mLabelSegments.push_back(segment); line_length += segment_length; diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp index 80d88702da..5608ab763f 100644 --- a/indra/newview/llhudrender.cpp +++ b/indra/newview/llhudrender.cpp @@ -138,7 +138,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f)); F32 right_x; - font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true); + font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, static_cast<S32>(wstr.length()), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true); LLUI::popMatrix(); gGL.popMatrix(); diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index d087d538af..5ee0ab437d 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -274,7 +274,7 @@ void LLHUDText::addLine(const std::string &text_utf8, do { F32 max_pixels = HUD_TEXT_MAX_WIDTH_NO_BUBBLE; - S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + S32 segment_length = font->maxDrawableChars(iter->substr(line_length).c_str(), max_pixels, static_cast<S32>(wline.length()), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); LLHUDTextSegment segment(iter->substr(line_length, segment_length), style, color, font); mTextSegments.push_back(segment); line_length += segment_length; diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index ba763780ed..e2e83ef42b 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -203,7 +203,7 @@ void inventory_offer_handler(LLOfferInfo* info) // Strip any SLURL from the message display. (DEV-2754) std::string msg = info->mDesc; - int indx = msg.find(" ( http://slurl.com/secondlife/"); + auto indx = msg.find(" ( http://slurl.com/secondlife/"); if (indx == std::string::npos) { // try to find new slurl host @@ -701,7 +701,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, } else { - S32 index = original_name.find(" Resident"); + auto index = original_name.find(" Resident"); if (index != std::string::npos) { original_name = original_name.substr(0, index); @@ -1656,7 +1656,7 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url) message_data["region_id"].asUUID(), position, local_bin_bucket.data(), - local_bin_bucket.size(), + S32(local_bin_bucket.size()), local_sender, message_data["asset_id"].asUUID()); }); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 62bc95db82..7ed10b062c 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -741,7 +741,7 @@ void LLIMModel::LLIMSession::onAdHocNameCache(const LLAvatarName& av_name) if (!av_name.isValidName()) { - S32 separator_index = mName.rfind(" "); + auto separator_index = mName.rfind(" "); std::string name = mName.substr(0, separator_index); ++separator_index; std::string conference_word = mName.substr(separator_index, mName.length()); @@ -1188,7 +1188,7 @@ void LLIMModel::LLIMSession::addMessagesFromServerHistory(const LLSD& history, } } - S32 shifted_size = shift_msgs.size(); + auto shifted_size = shift_msgs.size(); while (shift_msgs.size() > 0) { // Finally add back any new messages, and tweak the index value to be correct. LLSD newer_message = shift_msgs.front(); @@ -1250,7 +1250,7 @@ LLIMModel::LLIMSession* LLIMModel::findIMSession(const LLUUID& session_id) const //*TODO consider switching to using std::set instead of std::list for holding LLUUIDs across the whole code LLIMModel::LLIMSession* LLIMModel::findAdHocIMSession(const uuid_vec_t& ids) { - S32 num = ids.size(); + auto num = ids.size(); if (!num) return NULL; if (mId2SessionMap.empty()) return NULL; @@ -1504,7 +1504,7 @@ void LLIMModel::getMessagesSilently(const LLUUID& session_id, chat_message_list_ return; } - int i = session->mMsgs.size() - start_index; + int i = static_cast<int>(session->mMsgs.size()) - start_index; for (chat_message_list_t::iterator iter = session->mMsgs.begin(); iter != session->mMsgs.end() && i > 0; @@ -1985,12 +1985,12 @@ void start_deprecated_conference_chat( { U8* bucket; U8* pos; - S32 count; + size_t count; S32 bucket_size; // *FIX: this could suffer from endian issues count = agents_to_invite.size(); - bucket_size = UUID_BYTES * count; + bucket_size = UUID_BYTES * static_cast<S32>(count); bucket = new U8[bucket_size]; pos = bucket; @@ -3830,7 +3830,7 @@ void LLIMMgr::noteOfflineUsers( const LLUUID& session_id, const std::vector<LLUUID>& ids) { - S32 count = ids.size(); + auto count = ids.size(); if(count == 0) { const std::string& only_user = LLTrans::getString("only_user_message"); @@ -3868,7 +3868,7 @@ void LLIMMgr::noteMutedUsers(const LLUUID& session_id, return; } - S32 count = ids.size(); + auto count = ids.size(); if(count > 0) { LLIMModel* im_model = LLIMModel::getInstance(); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 76323be3dc..81d738cf42 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -454,8 +454,8 @@ void LLInvFVBridge::removeBatch(std::vector<LLFolderViewModelItem*>& batch) LLViewerInventoryCategory* cat = NULL; LLInventoryModel::cat_array_t descendent_categories; LLInventoryModel::item_array_t descendent_items; - S32 count = batch.size(); - S32 i,j; + size_t count = batch.size(); + size_t i,j; for(i = 0; i < count; ++i) { bridge = (LLInvFVBridge*)(batch[i]); @@ -506,8 +506,8 @@ void LLInvFVBridge::removeBatchNoCheck(std::vector<LLFolderViewModelItem*>& ba uuid_vec_t move_ids; LLInventoryModel::update_map_t update; bool start_new_message = true; - S32 count = batch.size(); - S32 i; + size_t count = batch.size(); + size_t i; // first, hide any 'preview' floaters that correspond to the items // being deleted. @@ -642,11 +642,8 @@ bool LLInvFVBridge::isClipboardPasteable() const // In normal mode, we need to check each element of the clipboard to know if we can paste or not std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for(S32 i = 0; i < count; i++) + for (const auto& item_id : objects) { - const LLUUID &item_id = objects.at(i); - // Folders are pastable if all items in there are copyable const LLInventoryCategory *cat = model->getCategory(item_id); if (cat) @@ -682,10 +679,9 @@ bool LLInvFVBridge::isClipboardPasteableAsLink() const std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for(S32 i = 0; i < count; i++) + for (const auto& item_id : objects) { - const LLInventoryItem *item = model->getItem(objects.at(i)); + const LLInventoryItem *item = model->getItem(item_id); if (item) { if (!LLAssetType::lookupCanLink(item->getActualType())) @@ -698,7 +694,7 @@ bool LLInvFVBridge::isClipboardPasteableAsLink() const return false; } } - const LLViewerInventoryCategory *cat = model->getCategory(objects.at(i)); + const LLViewerInventoryCategory *cat = model->getCategory(item_id); if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType())) { return false; @@ -1190,8 +1186,8 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, gInventory.collectDescendents(local_version_folder_id, categories, items, false); static LLCachedControl<U32> max_depth(gSavedSettings, "InventoryOutboxMaxFolderDepth", 4); static LLCachedControl<U32> max_count(gSavedSettings, "InventoryOutboxMaxFolderCount", 20); - if (categories.size() >= max_count - || depth > (max_depth + 1)) + if (categories.size() >= (size_t)max_count + || (U32)depth > (max_depth + 1)) { disabled_items.push_back(std::string("New Folder")); } @@ -2175,8 +2171,7 @@ bool LLItemBridge::removeItem() if (!item->getIsLinkType()) { LLInventoryModel::item_array_t item_array = gInventory.collectLinksTo(mUUID); - const U32 num_links = item_array.size(); - if (num_links > 0) + if (!item_array.empty()) { // Warn if the user is will break any links when deleting this item. LLNotifications::instance().add(params); @@ -2375,8 +2370,8 @@ std::string LLFolderBridge::getLabelSuffix() const LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; gInventory.collectDescendents(getUUID(), cat_array, item_array, true); - S32 count = item_array.size(); - if(count > 0) + auto count = item_array.size(); + if (count > 0) { std::ostringstream oss; oss << count; @@ -2514,7 +2509,7 @@ bool LLFolderBridge::isClipboardPasteable() const // Search for the direct descendent of current Friends subfolder among all pasted items, // and return false if is found. - for(S32 i = objects.size() - 1; i >= 0; --i) + for (S32 i = static_cast<S32>(objects.size()) - 1; i >= 0; --i) { const LLUUID &obj_id = objects.at(i); if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) ) @@ -2548,10 +2543,8 @@ bool LLFolderBridge::isClipboardPasteableAsLink() const const LLUUID ¤t_cat_id = current_cat->getUUID(); std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for(S32 i = 0; i < count; i++) + for (const auto& obj_id : objects) { - const LLUUID &obj_id = objects.at(i); const LLInventoryCategory *cat = model->getCategory(obj_id); if (cat) { @@ -3193,13 +3186,13 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(*current_folder, cat_array, item_array); - S32 item_count(0); + size_t item_count(0); if( item_array ) { item_count = item_array->size(); } - S32 cat_count(0); + size_t cat_count(0); if( cat_array ) { cat_count = cat_array->size(); @@ -3218,18 +3211,18 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) // Fetch the items if (item_count) { - for (S32 i = 0; i < item_count; ++i) + for (size_t i = 0; i < item_count; ++i) { - ids.push_back(item_array->at(i)->getUUID()); + ids.emplace_back(item_array->at(i)->getUUID()); } outfit = new LLRightClickInventoryFetchObserver(ids); } // Fetch the subfolders if (cat_count) { - for (S32 i = 0; i < cat_count; ++i) + for (size_t i = 0; i < cat_count; ++i) { - ids.push_back(cat_array->at(i)->getUUID()); + ids.emplace_back(cat_array->at(i)->getUUID()); } categories = new LLRightClickInventoryFetchDescendentsObserver(ids); } @@ -3614,7 +3607,7 @@ void LLFolderBridge::copyOutfitToClipboard() LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(mUUID, cat_array, item_array); - S32 item_count(0); + size_t item_count(0); if( item_array ) { item_count = item_array->size(); @@ -3622,7 +3615,7 @@ void LLFolderBridge::copyOutfitToClipboard() if (item_count) { - for (S32 i = 0; i < item_count;) + for (size_t i = 0; i < item_count;) { LLSD uuid =item_array->at(i)->getUUID(); LLViewerInventoryItem* item = gInventory.getItem(uuid); @@ -3636,7 +3629,7 @@ void LLFolderBridge::copyOutfitToClipboard() } } - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text),0,text.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text), 0, static_cast<S32>(text.size())); } void LLFolderBridge::openItem() @@ -3929,11 +3922,11 @@ void LLFolderBridge::perform_pasteFromClipboard() LLInventoryItem *item = model->getItem(item_id); LLInventoryCategory *cat = model->getCategory(item_id); - if (item && !can_move_item_to_marketplace(master_folder, dest_folder, item, error_msg, objects.size() - index, true)) + if (item && !can_move_item_to_marketplace(master_folder, dest_folder, item, error_msg, static_cast<S32>(objects.size()) - index, true)) { break; } - if (cat && !can_move_folder_to_marketplace(master_folder, dest_folder, cat, error_msg, objects.size() - index, true, true)) + if (cat && !can_move_folder_to_marketplace(master_folder, dest_folder, cat, error_msg, static_cast<S32>(objects.size()) - index, true, true)) { break; } @@ -5193,7 +5186,7 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response { LLInventoryObject::object_list_t inventory_objects; object->getInventoryContents(inventory_objects); - int contents_count = inventory_objects.size(); + int contents_count = static_cast<int>(inventory_objects.size()); LLInventoryCopyAndWearObserver* inventoryObserver = new LLInventoryCopyAndWearObserver(cat_and_wear->mCatID, contents_count, cat_and_wear->mFolderResponded, cat_and_wear->mReplace); @@ -5822,8 +5815,8 @@ bool check_category(LLInventoryModel* model, LLInventoryModel::item_array_t descendent_items; model->collectDescendents(cat_id, descendent_categories, descendent_items, true); - S32 num_descendent_categories = descendent_categories.size(); - S32 num_descendent_items = descendent_items.size(); + auto num_descendent_categories = descendent_categories.size(); + auto num_descendent_items = descendent_items.size(); if (num_descendent_categories + num_descendent_items == 0) { @@ -5833,7 +5826,7 @@ bool check_category(LLInventoryModel* model, return check_item(cat_id, active_panel, filter); } - for (S32 i = 0; i < num_descendent_categories; ++i) + for (size_t i = 0; i < num_descendent_categories; ++i) { LLInventoryCategory* category = descendent_categories[i]; if(!check_category(model, category->getUUID(), active_panel, filter)) @@ -5842,7 +5835,7 @@ bool check_category(LLInventoryModel* model, } } - for (S32 i = 0; i < num_descendent_items; ++i) + for (size_t i = 0; i < num_descendent_items; ++i) { LLViewerInventoryItem* item = descendent_items[i]; if(!check_item(item->getUUID(), active_panel, filter)) @@ -6256,8 +6249,8 @@ void LLCallingCardBridge::checkSearchBySuffixChanges() // changes in mDisplayName are processed by rename function and here it will be always same // suffixes are also of fixed length, and we are processing change of one at a time, // so it should be safe to use length (note: mSearchableName is capitalized) - S32 old_length = mSearchableName.length(); - S32 new_length = mDisplayName.length() + getLabelSuffix().length(); + auto old_length = mSearchableName.length(); + auto new_length = mDisplayName.length() + getLabelSuffix().length(); if (old_length == new_length) { return; diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 6aca3947cf..114ccfdd3f 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -434,7 +434,7 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent LLInventoryModel::cat_array_t* cat_array = NULL; LLInventoryModel::item_array_t* item_array = NULL; gInventory.getDirectDescendentsOf(object_id,cat_array,item_array); - S32 descendents_actual = 0; + size_t descendents_actual = 0; if(cat_array && item_array) { descendents_actual = cat_array->size() + item_array->size(); diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 8c2bc80b6b..8471b2cea1 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -156,7 +156,7 @@ S32 count_descendants_items(const LLUUID& cat_id) LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(cat_id,cat_array,item_array); - S32 count = item_array->size(); + S32 count = static_cast<S32>(item_array->size()); LLInventoryModel::cat_array_t cat_array_copy = *cat_array; for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) @@ -1098,7 +1098,7 @@ S32 compute_stock_count(LLUUID cat_uuid, bool force_count /* false */) LLInventoryModel::cat_array_t* cat_array; LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(cat_uuid,cat_array,item_array); - return item_array->size(); + return static_cast<S32>(item_array->size()); } // When force_count is true, we do not do any verification of the marketplace status and simply compute @@ -1327,12 +1327,12 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve if (accept) { // If the dest folder is a stock folder, we do not count the incoming items toward the total (stock items are seen as one) - int existing_item_count = (move_in_stock ? 0 : bundle_size); + unsigned int existing_item_count = (move_in_stock ? 0 : bundle_size); // If the dest folder is a stock folder, we do assume that the incoming items are also stock items (they should anyway) - int existing_stock_count = (move_in_stock ? bundle_size : 0); + unsigned int existing_stock_count = (move_in_stock ? bundle_size : 0); - int existing_folder_count = 0; + unsigned int existing_folder_count = 0; // Get the version folder: that's where the counts start from const LLViewerInventoryCategory * version_folder = ((root_folder && (root_folder != dest_folder)) ? gInventory.getFirstDescendantOf(root_folder->getUUID(), dest_folder->getUUID()) : NULL); @@ -1352,7 +1352,7 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve existing_item_count += count_copyable_items(existing_items) + count_stock_folders(existing_categories); existing_stock_count += count_stock_items(existing_items); - existing_folder_count += existing_categories.size(); + existing_folder_count += static_cast<S32>(existing_categories.size()); // If the incoming item is a nocopy (stock) item, we need to consider that it will create a stock folder if (!inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()) && !move_in_stock) @@ -1424,7 +1424,7 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn LLInventoryModel::item_array_t descendent_items; gInventory.collectDescendents(inv_cat->getUUID(), descendent_categories, descendent_items, false); - int dragged_folder_count = descendent_categories.size() + bundle_size; // Note: We assume that we're moving a bunch of folders in. That might be wrong... + int dragged_folder_count = static_cast<int>(descendent_categories.size()) + bundle_size; // Note: We assume that we're moving a bunch of folders in. That might be wrong... int dragged_item_count = count_copyable_items(descendent_items) + count_stock_folders(descendent_categories); int dragged_stock_count = count_stock_items(descendent_items); int existing_item_count = 0; @@ -1446,14 +1446,14 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn LLInventoryModel::item_array_t existing_items; gInventory.collectDescendents(version_folder->getUUID(), existing_categories, existing_items, false); - existing_folder_count += existing_categories.size(); + existing_folder_count += static_cast<int>(existing_categories.size()); existing_item_count += count_copyable_items(existing_items) + count_stock_folders(existing_categories); existing_stock_count += count_stock_items(existing_items); } - const int total_folder_count = existing_folder_count + dragged_folder_count; - const int total_item_count = existing_item_count + dragged_item_count; - const int total_stock_count = existing_stock_count + dragged_stock_count; + const unsigned int total_folder_count = existing_folder_count + dragged_folder_count; + const unsigned int total_item_count = existing_item_count + dragged_item_count; + const unsigned int total_stock_count = existing_stock_count + dragged_stock_count; if (total_folder_count > gSavedSettings.getU32("InventoryOutboxMaxFolderCount")) { @@ -1876,7 +1876,7 @@ void validate_marketplacelistings( } // How many types of items? Which type is it if only one? - S32 count = items_vector.size(); + auto count = items_vector.size(); U32 default_key = (U32)(LLInventoryType::IT_COUNT) << 24; // This is the key for any normal copyable item U32 unique_key = (count == 1 ? items_vector.begin()->first : default_key); // The key in the case of one item type only diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 8d3a795750..c69f797868 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -187,7 +187,7 @@ LLInventoryGallery::~LLInventoryGallery() mHiddenItems.pop_back(); panelp->die(); } - + if (gInventory.containsObserver(mCategoriesObserver)) { @@ -200,7 +200,7 @@ LLInventoryGallery::~LLInventoryGallery() gInventory.removeObserver(mThumbnailsObserver); } delete mThumbnailsObserver; - + LLGestureMgr::instance().removeObserver(mGestureObserver); delete mGestureObserver; } @@ -257,13 +257,13 @@ void LLInventoryGallery::updateRootFolder() { updateRemovedItem(mItems[i]->getUUID()); } - S32 hidden_count = mHiddenItems.size(); + S32 hidden_count = static_cast<S32>(mHiddenItems.size()); for (S32 i = hidden_count - 1; i >= 0; i--) { updateRemovedItem(mHiddenItems[i]->getUUID()); } mItemBuildQuery.clear(); - + if (gInventory.containsObserver(mCategoriesObserver)) { gInventory.removeObserver(mCategoriesObserver); @@ -284,7 +284,7 @@ void LLInventoryGallery::updateRootFolder() mRootChangedSignal(); gInventory.addObserver(mCategoriesObserver); - + // Start observing changes in selected category. mCategoriesObserver->addCategory(mFolderID, boost::bind(&LLInventoryGallery::refreshList, this, mFolderID)); @@ -294,7 +294,7 @@ void LLInventoryGallery::updateRootFolder() // the observer will refresh the list as soon as the new items // arrive. category->fetch(); - + //refreshList(cat_id); LLInventoryModel::cat_array_t* cat_array; LLInventoryModel::item_array_t* item_array; @@ -308,7 +308,7 @@ void LLInventoryGallery::updateRootFolder() { mItemBuildQuery.insert((*iter)->getUUID()); } - + for (LLInventoryModel::item_array_t::const_iterator iter = item_array->begin(); iter != item_array->end(); iter++) @@ -343,7 +343,7 @@ void LLInventoryGallery::initGallery() { uuid_vec_t cats; getCurrentCategories(cats); - int n = cats.size(); + int n = static_cast<int>(cats.size()); buildGalleryPanel(n); mScrollPanel->addChild(mGalleryPanel); for (int i = 0; i < n; i++) @@ -448,7 +448,7 @@ void LLInventoryGallery::reArrangeRows(S32 row_diff) buf_items.push_back(*it); } mHiddenItems.clear(); - + mItemsInRow+= row_diff; updateGalleryWidth(); @@ -458,7 +458,7 @@ void LLInventoryGallery::reArrangeRows(S32 row_diff) { return compareGalleryItem(item1, item2, sort_by_date, sort_folders_by_name); }); - + for (std::vector<LLInventoryGalleryItem*>::const_iterator it = buf_items.begin(); it != buf_items.end(); ++it) { (*it)->setHidden(false); @@ -619,8 +619,8 @@ void LLInventoryGallery::removeFromGalleryMiddle(LLInventoryGalleryItem* item) removeFromGalleryLast(mItems[i]); } removeFromGalleryLast(mItems[n]); - int saved_count = saved.size(); - for (int i = 0; i < saved_count; i++) + size_t saved_count = saved.size(); + for (size_t i = 0; i < saved_count; i++) { addToGallery(saved.back()); saved.pop_back(); @@ -735,7 +735,7 @@ void LLInventoryGallery::setFilterSubString(const std::string& string) { mFilterSubString = string; mFilter->setFilterSubString(string); - + //reArrangeRows(); } @@ -763,7 +763,7 @@ bool LLInventoryGallery::checkAgainstFilters(LLInventoryGalleryItem* item, const { return false; } - + bool hidden = false; if(mFilter->getFilterCreatorType() == LLInventoryFilter::FILTERCREATOR_SELF) @@ -806,7 +806,7 @@ bool LLInventoryGallery::checkAgainstFilters(LLInventoryGalleryItem* item, const desc = item->getItemName() + item->getItemNameSuffix(); break; } - + LLStringUtil::toUpper(desc); std::string cur_filter = filter_substring; @@ -1882,13 +1882,10 @@ bool LLInventoryGallery::canPaste() const } // In normal mode, we need to check each element of the clipboard to know if we can paste or not - std::vector<LLUUID> objects; + uuid_vec_t objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for (S32 i = 0; i < count; i++) + for (const auto& item_id : objects) { - const LLUUID& item_id = objects.at(i); - // Each item must be copyable to be pastable if (!isItemCopyable(item_id)) { @@ -2012,7 +2009,7 @@ void LLInventoryGallery::deleteSelection() if (item && get_is_item_worn(item)) { has_worn = true; - LLWearableType::EType type = item->getWearableType(); + LLWearableType::EType type = item->getWearableType(); if (type == LLWearableType::WT_SHAPE || type == LLWearableType::WT_SKIN || type == LLWearableType::WT_HAIR @@ -2388,7 +2385,7 @@ void LLInventoryGallery::onCOFChanged() LLCommonUtils::computeDifference(vnew, mCOFLinkedItems, vadded, vremoved); mCOFLinkedItems = vnew; - + for (uuid_vec_t::const_iterator iter = vadded.begin(); iter != vadded.end(); ++iter) @@ -2419,7 +2416,7 @@ void LLInventoryGallery::onGesturesChanged() LLCommonUtils::computeDifference(vnew, mActiveGestures, vadded, vremoved); mActiveGestures = vnew; - + for (uuid_vec_t::const_iterator iter = vadded.begin(); iter != vadded.end(); ++iter) @@ -2597,7 +2594,7 @@ void LLInventoryGallery::startDrag() ids.push_back(selected_id); } - const LLViewerInventoryCategory* cat = gInventory.getCategory(selected_id); + const LLViewerInventoryCategory* cat = gInventory.getCategory(selected_id); if (cat) { if (gInventory.isObjectDescendentOf(selected_id, gInventory.getLibraryRootFolderID())) @@ -2675,7 +2672,7 @@ bool LLInventoryGallery::checkAgainstFilterType(const LLUUID& object_id) break; } } - + if (filterTypes & LLInventoryFilter::FILTERTYPE_DATE) { const U16 HOURS_TO_SECONDS = 3600; @@ -3118,7 +3115,7 @@ void LLThumbnailsObserver::changed(U32 mask) { const LLUUID& obj_id = (*iter).first; LLItemData& data = (*iter).second; - + LLInventoryObject* obj = gInventory.getObject(obj_id); if (!obj) { @@ -3329,7 +3326,7 @@ bool dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, bool drop, // //-------------------------------------------------------------------------------- - + //-------------------------------------------------------------------------------- // Determine if item can be moved & dropped // Note: if user_confirm is false, we already went through those accept logic test and can skip them @@ -3356,7 +3353,7 @@ bool dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, bool drop, { //disable dropping in or out of marketplace for now return false; - + /*const LLViewerInventoryCategory * master_folder = model->getFirstDescendantOf(marketplacelistings_id, folder_id); LLViewerInventoryCategory * dest_folder = cat; accept = can_move_item_to_marketplace(master_folder, dest_folder, inv_item, tooltip_msg, LLToolDragAndDrop::instance().getCargoCount() - LLToolDragAndDrop::instance().getCargoIndex());*/ @@ -3368,9 +3365,10 @@ bool dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, bool drop, LLViewerInventoryCategory * dest_folder = cat; accept = dest_folder->acceptItem(inv_item); } - + LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(false); + if (accept && drop) { if (inv_item->getType() == LLAssetType::AT_GESTURE @@ -3442,7 +3440,7 @@ bool dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, bool drop, gInventory.changeItemParent((LLViewerInventoryItem*)inv_item, folder_id, move_is_into_trash); } - + if (move_is_from_marketplacelistings) { // If we move from an active (listed) listing, checks that it's still valid, if not, unlist @@ -3662,7 +3660,6 @@ bool dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); //const LLUUID from_folder_uuid = inv_cat->getParentUUID(); - const bool move_is_into_current_outfit = (dest_id == current_outfit_id); const bool move_is_into_marketplacelistings = model->isObjectDescendentOf(dest_id, marketplacelistings_id); const bool move_is_from_marketplacelistings = model->isObjectDescendentOf(cat_id, marketplacelistings_id); @@ -3771,7 +3768,7 @@ bool dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, is_movable = false; // tooltip? } - + LLInventoryModel::cat_array_t descendent_categories; LLInventoryModel::item_array_t descendent_items; if (is_movable) @@ -3837,7 +3834,7 @@ bool dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, } } } - + if (is_movable && move_is_into_marketplacelistings) { const LLViewerInventoryCategory * master_folder = model->getFirstDescendantOf(marketplacelistings_id, dest_id); @@ -3910,7 +3907,7 @@ bool dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, { //disable dropping in or out of marketplace for now return false; - + // If we are moving a folder at the listing folder level (i.e. its parent is the marketplace listings folder) /*if (from_folder_uuid == marketplacelistings_id) { diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp index f9fb47c5c1..8e56ccc01d 100644 --- a/indra/newview/llinventorygallerymenu.cpp +++ b/indra/newview/llinventorygallerymenu.cpp @@ -110,6 +110,7 @@ LLContextMenu* LLInventoryGalleryContextMenu::createMenu() registrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, uuids, gFloaterView->getParentFloater(mGallery))); enable_registrar.add("Inventory.CanSetUploadLocation", boost::bind(&LLInventoryGalleryContextMenu::canSetUploadLocation, this, _2)); + enable_registrar.add("Inventory.EnvironmentEnabled", [](LLUICtrl*, const LLSD&) { return LLEnvironment::instance().isInventoryEnabled(); @@ -121,7 +122,7 @@ LLContextMenu* LLInventoryGalleryContextMenu::createMenu() return (!agent_url.empty() && !task_url.empty()); }); - + LLContextMenu* menu = createFromFile("menu_gallery_inventory.xml"); updateMenuItemsVisibility(menu); @@ -448,7 +449,7 @@ void LLInventoryGalleryContextMenu::onRename(const LLSD& notification, const LLS if (!new_name.empty()) { LLUUID id = notification["payload"]["id"].asUUID(); - + LLViewerInventoryCategory* cat = gInventory.getCategory(id); if(cat && (cat->getName() != new_name)) { @@ -457,7 +458,7 @@ void LLInventoryGalleryContextMenu::onRename(const LLSD& notification, const LLS update_inventory_category(cat->getUUID(),updates, NULL); return; } - + LLViewerInventoryItem* item = gInventory.getItem(id); if(item && (item->getName() != new_name)) { @@ -506,12 +507,12 @@ bool LLInventoryGalleryContextMenu::canSetUploadLocation(const LLSD& userdata) bool is_inbox_folder(LLUUID item_id) { const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX); - + if (inbox_id.isNull()) { return false; } - + return gInventory.isObjectDescendentOf(item_id, inbox_id); } @@ -865,7 +866,7 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men disabled_items.push_back(std::string("Open")); disabled_items.push_back(std::string("Open Original")); } - + if(LLAssetType::AT_GESTURE == obj->getType()) { items.push_back(std::string("Gesture Separator")); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 9090718691..d57cb13362 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -657,12 +657,12 @@ LLViewerInventoryCategory* LLInventoryModel::getCategory(const LLUUID& id) const S32 LLInventoryModel::getItemCount() const { - return mItemMap.size(); + return static_cast<S32>(mItemMap.size()); } S32 LLInventoryModel::getCategoryCount() const { - return mCategoryMap.size(); + return static_cast<S32>(mCategoryMap.size()); } // Return the direct descendents of the id provided. The array @@ -822,17 +822,14 @@ void LLInventoryModel::ensureCategoryForTypeExists(LLFolderType::EType preferred } else if (root_id.notNull()) { - cat_array_t* cats = NULL; - cats = get_ptr_in_map(mParentChildCategoryTree, root_id); + cat_array_t* cats = get_ptr_in_map(mParentChildCategoryTree, root_id); if (cats) { - S32 count = cats->size(); - for (S32 i = 0; i < count; ++i) + for (auto& p_cat : *cats) { - LLViewerInventoryCategory* p_cat = cats->at(i); if (p_cat && p_cat->getPreferredType() == preferred_type) { - const LLUUID& folder_id = cats->at(i)->getUUID(); + const LLUUID& folder_id = p_cat->getUUID(); if (rv.isNull() || folder_id < rv) { rv = folder_id; @@ -891,17 +888,14 @@ const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot( } else if (root_id.notNull()) { - cat_array_t* cats = NULL; - cats = get_ptr_in_map(mParentChildCategoryTree, root_id); + cat_array_t* cats = get_ptr_in_map(mParentChildCategoryTree, root_id); if(cats) { - S32 count = cats->size(); - for(S32 i = 0; i < count; ++i) + for (auto& p_cat : *cats) { - LLViewerInventoryCategory* p_cat = cats->at(i); if(p_cat && p_cat->getPreferredType() == preferred_type) { - const LLUUID& folder_id = cats->at(i)->getUUID(); + const LLUUID& folder_id = p_cat->getUUID(); if (rv.isNull() || folder_id < rv) { rv = folder_id; @@ -1286,10 +1280,8 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, cat_array_t* cat_array = get_ptr_in_map(mParentChildCategoryTree, id); if(cat_array) { - S32 count = cat_array->size(); - for(S32 i = 0; i < count; ++i) + for (auto& cat : *cat_array) { - LLViewerInventoryCategory* cat = cat_array->at(i); if(add(cat,NULL)) { cats.push_back(cat); @@ -1298,16 +1290,13 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, } } - LLViewerInventoryItem* item = NULL; item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, id); // Move onto items if(item_array) { - S32 count = item_array->size(); - for(S32 i = 0; i < count; ++i) + for (auto& item : *item_array) { - item = item_array->at(i); if(add(NULL, item)) { items.push_back(item); @@ -1908,10 +1897,10 @@ void LLInventoryModel::onDescendentsPurgedFromServer(const LLUUID& object_id, bo categories, items, LLInventoryModel::INCLUDE_TRASH); - S32 count = items.size(); + auto count = items.size(); LLUUID uu_id; - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { uu_id = items.at(i)->getUUID(); @@ -2691,8 +2680,8 @@ bool LLInventoryModel::loadSkeleton( } } - S32 cached_category_count = 0; - S32 cached_item_count = 0; + size_t cached_category_count = 0; + size_t cached_item_count = 0; if(!temp_cats.empty()) { update_map_t child_counts; @@ -2741,12 +2730,10 @@ bool LLInventoryModel::loadSkeleton( // found to generate a set of categories we should add. We // will go through each category loaded and if the version // does not match, invalidate the version. - S32 count = categories.size(); cat_set_t::iterator not_cached = temp_cats.end(); - std::set<LLUUID> cached_ids; - for(S32 i = 0; i < count; ++i) + uuid_set_t cached_ids; + for (auto& cat : categories) { - LLViewerInventoryCategory* cat = categories[i]; cat_set_t::iterator cit = temp_cats.find(cat); if (cit == temp_cats.end()) { @@ -2992,13 +2979,11 @@ void LLInventoryModel::buildParentChildMap() // Now we have a structure with all of the categories that we can // iterate over and insert into the correct place in the child // category tree. - S32 count = cats.size(); S32 i; S32 lost = 0; cat_array_t lost_cats; - for(i = 0; i < count; ++i) + for (auto& cat : cats) { - LLViewerInventoryCategory* cat = cats.at(i); catsp = getUnlockedCatArray(cat->getParentUUID()); if(catsp && // Only the two root folders should be children of null. @@ -3084,13 +3069,10 @@ void LLInventoryModel::buildParentChildMap() items.push_back(item); } } - count = items.size(); lost = 0; uuid_vec_t lost_item_ids; - for(i = 0; i < count; ++i) + for (auto& item : items) { - LLPointer<LLViewerInventoryItem> item; - item = items.at(i); itemsp = getUnlockedItemArray(item->getParentUUID()); if(itemsp) { @@ -3471,12 +3453,9 @@ bool LLInventoryModel::saveToFile(const std::string& filename, fileXML << LLSDOStreamer<LLSDNotationFormatter>(cache_ver) << std::endl; - S32 count = categories.size(); S32 cat_count = 0; - S32 i; - for (i = 0; i < count; ++i) + for (auto& cat : categories) { - LLViewerInventoryCategory* cat = categories[i]; if (cat->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN) { fileXML << LLSDOStreamer<LLSDNotationFormatter>(cat->exportLLSD()) << std::endl; @@ -3490,10 +3469,10 @@ bool LLInventoryModel::saveToFile(const std::string& filename, } } - S32 it_count = items.size(); - for (i = 0; i < it_count; ++i) + auto it_count = items.size(); + for (auto& item : items) { - fileXML << LLSDOStreamer<LLSDNotationFormatter>(items[i]->asLLSD()) << std::endl; + fileXML << LLSDOStreamer<LLSDNotationFormatter>(item->asLLSD()) << std::endl; if (fileXML.fail()) { @@ -3959,11 +3938,9 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) if (tid.notNull() && tid == LLInventoryState::sWearNewClothingTransactionID) { - count = wearable_ids.size(); - for (i = 0; i < count; ++i) + for (const auto& wearable_id : wearable_ids) { - LLViewerInventoryItem* wearable_item; - wearable_item = gInventory.getItem(wearable_ids[i]); + LLViewerInventoryItem* wearable_item = gInventory.getItem(wearable_id); LLAppearanceMgr::instance().wearItemOnAvatar(wearable_item->getUUID(), true, true); } } @@ -4058,7 +4035,7 @@ void LLInventoryModel::emptyFolderType(const std::string notification, LLFolderT LLInventoryModel::item_array_t items; const LLUUID trash_id = findCategoryUUIDForType(preferred_type); gInventory.collectDescendents(trash_id, cats, items, LLInventoryModel::INCLUDE_TRASH); //All descendants - S32 item_count = items.size() + cats.size(); + S32 item_count = static_cast<S32>(items.size() + cats.size()); args["COUNT"] = item_count; } LLNotificationsUtil::add(notification, args, LLSD(), @@ -4180,7 +4157,7 @@ void LLInventoryModel::checkTrashOverflow() LLInventoryModel::item_array_t items; const LLUUID trash_id = findCategoryUUIDForType(LLFolderType::FT_TRASH); gInventory.collectDescendents(trash_id, cats, items, LLInventoryModel::INCLUDE_TRASH); - S32 item_count = items.size() + cats.size(); + auto item_count = items.size() + cats.size(); if (item_count >= trash_max_capacity) { @@ -4989,7 +4966,7 @@ void LLInventoryModel::FetchItemHttpHandler::processData(LLSD & content, LLCore: LLInventoryModel::update_map_t update; LLUUID folder_id; LLSD content_items(content["items"]); - const S32 count(content_items.size()); + const S32 count(static_cast<S32>(content_items.size())); // Does this loop ever execute more than once? for (S32 i(0); i < count; ++i) diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index 9b0dc2fd50..9cb94b313e 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -734,7 +734,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis() // Reserve one request for actions outside of fetch (like renames) const U32 max_concurrent_fetches = llclamp(ais_pool - 1, 1, 50); - if (mFetchCount >= max_concurrent_fetches) + if ((U32)mFetchCount >= max_concurrent_fetches) { return; } @@ -747,7 +747,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis() const F64 end_time = curent_time + max_time; S32 last_fetch_count = mFetchCount; - while (!mFetchFolderQueue.empty() && mFetchCount < max_concurrent_fetches && curent_time < end_time) + while (!mFetchFolderQueue.empty() && (U32)mFetchCount < max_concurrent_fetches && curent_time < end_time) { const FetchQueueInfo & fetch_info(mFetchFolderQueue.front()); bulkFetchViaAis(fetch_info); @@ -758,7 +758,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis() // Ideally we shouldn't fetch items if recursive fetch isn't done, // but there is a chance some request will start timeouting and recursive // fetch will get stuck on a signle folder, don't block item fetch in such case - while (!mFetchItemQueue.empty() && mFetchCount < max_concurrent_fetches && curent_time < end_time) + while (!mFetchItemQueue.empty() && (U32)mFetchCount < max_concurrent_fetches && curent_time < end_time) { const FetchQueueInfo& fetch_info(mFetchItemQueue.front()); bulkFetchViaAis(fetch_info); @@ -1496,7 +1496,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http return; } - S32 size = mRequestSD["folders"].size(); + auto size = mRequestSD["folders"].size(); if (size > 1) { @@ -1513,7 +1513,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http { recursive_cats.push_back(folder_id); } - if (folders.size() == (S32)(size / 2)) + if (folders.size() == (size / 2)) { LLSD request_body; request_body["folders"] = folders; diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 3aed82e259..ac791e224e 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -477,7 +477,7 @@ bool LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInven // from memory. return true; } - const S32 current_num_known_descendents = cats->size() + items->size(); + const S32 current_num_known_descendents = static_cast<S32>(cats->size() + items->size()); // Got the number of descendents that we were expecting, so we're done. if (current_num_known_descendents == expected_num_descendents) @@ -715,7 +715,7 @@ void LLInventoryCategoriesObserver::changed(U32 mask) continue; } - const S32 current_num_known_descendents = cats->size() + items->size(); + const S32 current_num_known_descendents = static_cast<S32>(cats->size() + items->size()); bool cat_changed = false; @@ -795,7 +795,7 @@ bool LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t } else { - current_num_known_descendents = cats->size() + items->size(); + current_num_known_descendents = static_cast<S32>(cats->size() + items->size()); } } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index d338e308ab..9dc13bcf09 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -563,7 +563,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve view_item->refresh(); } LLFolderViewFolder* parent = view_item->getParentFolder(); - if(parent) + if(parent && parent->getViewModelItem()) { parent->getViewModelItem()->dirtyDescendantsFilter(); } @@ -614,7 +614,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve // Sort the folder. if (mask & LLInventoryObserver::SORT) { - if (view_folder) + if (view_folder && view_folder->getViewModelItem()) { view_folder->getViewModelItem()->requestSort(); } @@ -659,7 +659,8 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve // Don't process the item if it is the root if (old_parent) { - LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(old_parent->getViewModelItem()); + LLFolderViewModelItem* old_parent_vmi = old_parent->getViewModelItem(); + LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(old_parent_vmi); LLFolderViewFolder* new_parent = (LLFolderViewFolder*)getItemByID(model_item->getParentUUID()); // Item has been moved. if (old_parent != new_parent) @@ -693,7 +694,10 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve { updateFolderLabel(viewmodel_folder->getUUID()); } - old_parent->getViewModelItem()->dirtyDescendantsFilter(); + if (old_parent_vmi) + { + old_parent_vmi->dirtyDescendantsFilter(); + } } } } @@ -709,11 +713,15 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve view_item->destroyView(); if(parent) { - parent->getViewModelItem()->dirtyDescendantsFilter(); - LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(parent->getViewModelItem()); - if(viewmodel_folder) + LLFolderViewModelItem* parent_wmi = parent->getViewModelItem(); + if (parent_wmi) { - updateFolderLabel(viewmodel_folder->getUUID()); + parent_wmi->dirtyDescendantsFilter(); + LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(parent_wmi); + if (viewmodel_folder) + { + updateFolderLabel(viewmodel_folder->getUUID()); + } } } } @@ -1220,7 +1228,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, // Make sure panel won't lock in a loop over existing items if // folder is enormous and at least some work gets done const S32 MIN_ITEMS_PER_CALL = 500; - const S32 starting_item_count = mItemMap.size(); + const S32 starting_item_count = static_cast<S32>(mItemMap.size()); LLFolderViewFolder *parentp = dynamic_cast<LLFolderViewFolder*>(folder_view_item); bool done = true; @@ -1251,7 +1259,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, if (!mBuildChildrenViews && mode == BUILD_TIMELIMIT - && MIN_ITEMS_PER_CALL + starting_item_count < mItemMap.size()) + && MIN_ITEMS_PER_CALL + starting_item_count < static_cast<S32>(mItemMap.size())) { // Single folder view, check if we still have time // @@ -1665,7 +1673,7 @@ bool LLInventoryPanel::beginIMSession() item_array, LLInventoryModel::EXCLUDE_TRASH, is_buddy); - S32 count = item_array.size(); + auto count = item_array.size(); if(count > 0) { //*TODO by what to replace that? @@ -1674,7 +1682,7 @@ bool LLInventoryPanel::beginIMSession() // create the session LLAvatarTracker& at = LLAvatarTracker::instance(); LLUUID id; - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { id = item_array.at(i)->getCreatorUUID(); if(at.isBuddyOnline(id)) @@ -1761,7 +1769,7 @@ void LLInventoryPanel::purgeSelectedItems() const std::set<LLFolderViewItem*> inventory_selected = mFolderRoot.get()->getSelectionList(); if (inventory_selected.empty()) return; LLSD args; - S32 count = inventory_selected.size(); + auto count = inventory_selected.size(); std::vector<LLUUID> selected_items; for (std::set<LLFolderViewItem*>::const_iterator it = inventory_selected.begin(), end_it = inventory_selected.end(); it != end_it; @@ -1774,7 +1782,7 @@ void LLInventoryPanel::purgeSelectedItems() count += items.size() + cats.size(); selected_items.push_back(item_id); } - args["COUNT"] = count; + args["COUNT"] = static_cast<S32>(count); LLNotificationsUtil::add("PurgeSelectedItems", args, LLSD(), boost::bind(callbackPurgeSelectedItems, _1, _2, selected_items)); } diff --git a/indra/newview/llkeyconflict.cpp b/indra/newview/llkeyconflict.cpp index af70025647..666ab4f5d0 100644 --- a/indra/newview/llkeyconflict.cpp +++ b/indra/newview/llkeyconflict.cpp @@ -476,8 +476,8 @@ void LLKeyConflictHandler::saveToSettings(bool temporary) // so make sure to cleanup. // Also this helps in keeping file small. iter->second.mKeyBind.trimEmpty(); - U32 size = iter->second.mKeyBind.getDataCount(); - for (U32 i = 0; i < size; ++i) + auto size = iter->second.mKeyBind.getDataCount(); + for (size_t i = 0; i < size; ++i) { if (iter->first.empty()) { @@ -491,7 +491,7 @@ void LLKeyConflictHandler::saveToSettings(bool temporary) continue; } - LLKeyData data = key.mKeyBind.getKeyData(i); + LLKeyData data = key.mKeyBind.getKeyData(static_cast<U32>(i)); // Still write empty LLKeyData to make sure we will maintain UI position if (data.mKey == KEY_NONE) { diff --git a/indra/newview/lllandmarklist.cpp b/indra/newview/lllandmarklist.cpp index b88986ce25..3fa0ab99f3 100644 --- a/indra/newview/lllandmarklist.cpp +++ b/indra/newview/lllandmarklist.cpp @@ -118,7 +118,7 @@ void LLLandmarkList::processGetAssetReply( file.read((U8*)&buffer[0], file_length); buffer[file_length] = 0; - LLLandmark* landmark = LLLandmark::constructFromString(&buffer[0], buffer.size()); + LLLandmark* landmark = LLLandmark::constructFromString(&buffer[0], static_cast<S32>(buffer.size())); if (landmark) { gLandmarkList.mList[uuid] = landmark; diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index 27de9aea0d..6ab5e05b7d 100644 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -438,7 +438,7 @@ std::vector<LLViewerObject*> LLLocalBitmap::prepUpdateObjects(LLUUID old_id, U32 std::vector<LLViewerObject*> obj_list; LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id, TEX_LIST_STANDARD); - for(U32 face_iterator = 0; face_iterator < old_texture->getNumFaces(channel); face_iterator++) + for (S32 face_iterator = 0; face_iterator < old_texture->getNumFaces(channel); face_iterator++) { // getting an object from a face LLFace* face_to_object = (*old_texture->getFaceList(channel))[face_iterator]; @@ -554,7 +554,7 @@ void LLLocalBitmap::updateUserPrims(LLUUID old_id, LLUUID new_id, U32 channel) void LLLocalBitmap::updateUserVolumes(LLUUID old_id, LLUUID new_id, U32 channel) { LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id, TEX_LIST_STANDARD); - for (U32 volume_iter = 0; volume_iter < old_texture->getNumVolumes(channel); volume_iter++) + for (S32 volume_iter = 0; volume_iter < old_texture->getNumVolumes(channel); volume_iter++) { LLVOVolume* volobjp = (*old_texture->getVolumeList(channel))[volume_iter]; switch (channel) diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp index 0740e1289a..fab18f2d26 100644 --- a/indra/newview/lllocalgltfmaterials.cpp +++ b/indra/newview/lllocalgltfmaterials.cpp @@ -1,25 +1,25 @@ -/** +/** * @file lllocalrendermaterials.cpp * @brief Local GLTF materials source * * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2022, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -51,14 +51,14 @@ /*=======================================*/ /* Formal declarations, constants, etc. */ -/*=======================================*/ +/*=======================================*/ static const F32 LL_LOCAL_TIMER_HEARTBEAT = 3.0; static const S32 LL_LOCAL_UPDATE_RETRIES = 5; /*=======================================*/ /* LLLocalGLTFMaterial: unit class */ -/*=======================================*/ +/*=======================================*/ LLLocalGLTFMaterial::LLLocalGLTFMaterial(std::string filename, S32 index) : mFilename(filename) , mShortName(gDirUtilp->getBaseFileName(filename, true)) @@ -309,7 +309,7 @@ bool LLLocalGLTFMaterialTimer::isRunning() bool LLLocalGLTFMaterialTimer::tick() { - // todo: do on idle? No point in timer + // todo: do on idle? No point in timer LLLocalGLTFMaterialMgr::getInstance()->doUpdates(); return false; } @@ -346,19 +346,19 @@ S32 LLLocalGLTFMaterialMgr::addUnit(const std::string& filename) tinygltf::Model model; LLTinyGLTFHelper::loadModel(filename, model); - S32 materials_in_file = model.materials.size(); + auto materials_in_file = model.materials.size(); if (materials_in_file <= 0) { return 0; } S32 loaded_materials = 0; - for (S32 i = 0; i < materials_in_file; i++) + for (size_t i = 0; i < materials_in_file; i++) { // Todo: this is rather inefficient, files will be spammed with // separate loads and date checks, find a way to improve this. // May be doUpdates() should be checking individual files. - LLPointer<LLLocalGLTFMaterial> unit = new LLLocalGLTFMaterial(filename, i); + LLPointer<LLLocalGLTFMaterial> unit = new LLLocalGLTFMaterial(filename, static_cast<S32>(i)); // load material from file if (unit->updateSelf()) diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index adced99a95..329fb881e3 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -452,11 +452,11 @@ void LLLogChat::loadChatHistory(const std::string& file_name, std::list<LLSD>& m return; } - S32 save_num_messages = messages.size(); + auto save_num_messages = messages.size(); char buffer[LOG_RECALL_SIZE]; /*Flawfinder: ignore*/ char *bptr; - S32 len; + size_t len; bool firstline = true; if (load_all_history || fseek(fptr, (LOG_RECALL_SIZE - 1) * -1 , SEEK_END)) @@ -1142,7 +1142,7 @@ void LLLoadHistoryThread::run() if(mNewLoad) { loadHistory(mFileName, mMessages, mLoadParams); - int count = mMessages->size(); + auto count = mMessages->size(); LL_INFOS() << "mMessages->size(): " << count << LL_ENDL; setFinished(); } @@ -1189,7 +1189,7 @@ void LLLoadHistoryThread::loadHistory(const std::string& file_name, std::list<LL char buffer[LOG_RECALL_SIZE]; /*Flawfinder: ignore*/ char *bptr; - S32 len; + size_t len; bool firstline = true; if (load_all_history || fseek(fptr, (LOG_RECALL_SIZE - 1) * -1 , SEEK_END)) diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index 64dcaeb1cc..c11a98be50 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -1267,24 +1267,24 @@ void LLManipTranslate::renderSnapGuides() LLVector3 line_end = selection_center + (mSnapOffsetMeters * mSnapOffsetAxis) - (translate_axis * (guide_size_meters * 0.5f + offset_nearest_grid_unit)); LLVector3 line_mid = (line_start + line_end) * 0.5f; - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW] * 0.2f); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA] * 0.2f); gGL.vertex3fv(line_start.mV); - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA]); gGL.vertex3fv(line_mid.mV); gGL.vertex3fv(line_mid.mV); - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW] * 0.2f); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA] * 0.2f); gGL.vertex3fv(line_end.mV); line_start.setVec(selection_center + (mSnapOffsetAxis * -mSnapOffsetMeters) + (translate_axis * guide_size_meters * 0.5f)); line_end.setVec(selection_center + (mSnapOffsetAxis * -mSnapOffsetMeters) - (translate_axis * guide_size_meters * 0.5f)); line_mid = (line_start + line_end) * 0.5f; - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW] * 0.2f); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA] * 0.2f); gGL.vertex3fv(line_start.mV); - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA]); gGL.vertex3fv(line_mid.mV); gGL.vertex3fv(line_mid.mV); - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW] * 0.2f); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA] * 0.2f); gGL.vertex3fv(line_end.mV); for (S32 i = -num_ticks_per_side; i <= num_ticks_per_side; i++) @@ -1316,7 +1316,7 @@ void LLManipTranslate::renderSnapGuides() tick_end = tick_start + (mSnapOffsetAxis * mSnapOffsetMeters * tick_scale); - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA]); gGL.vertex3fv(tick_start.mV); gGL.vertex3fv(tick_end.mV); @@ -1337,7 +1337,7 @@ void LLManipTranslate::renderSnapGuides() gGL.begin(LLRender::LINES); { - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA]); gGL.vertex3fv(line_start.mV); gGL.vertex3fv(line_end.mV); @@ -1347,7 +1347,7 @@ void LLManipTranslate::renderSnapGuides() // draw snap guide arrow gGL.begin(LLRender::TRIANGLES); { - gGL.color4f(line_color.mV[VX], line_color.mV[VY], line_color.mV[VZ], line_color.mV[VW]); + gGL.color4f(line_color.mV[VRED], line_color.mV[VGREEN], line_color.mV[VBLUE], line_color.mV[VALPHA]); LLVector3 arrow_dir; LLVector3 arrow_span = translate_axis; diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 26b6986a25..92f8ed949e 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -1263,7 +1263,7 @@ bool LLMaterialEditor::decodeAsset(const std::vector<char>& buffer) tinygltf::Model model_in; - if (loader.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, data.c_str(), data.length(), "")) + if (loader.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, data.c_str(), static_cast<unsigned int>(data.length()), "")) { // assets are only supposed to have one item // *NOTE: This duplicates some functionality from diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 271a35ba42..ee5e5b438e 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -431,7 +431,7 @@ void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUI const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); LLSD response_data; - U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size()); + U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), static_cast<S32>(content_binary.size())); if (uzip_result != LLUZipHelper::ZR_OK) { LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL; @@ -472,7 +472,7 @@ void LLMaterialMgr::onGetAllResponse(bool success, const LLSD& content, const LL const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); LLSD response_data; - U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size()); + U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), static_cast<S32>(content_binary.size())); if (uzip_result != LLUZipHelper::ZR_OK) { LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL; @@ -539,7 +539,7 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content) const LLSD::Binary& content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary(); LLSD response_data; - U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), content_binary.size()); + U32 uzip_result = LLUZipHelper::unzip_llsd(response_data, content_binary.data(), static_cast<S32>(content_binary.size())); if (uzip_result != LLUZipHelper::ZR_OK) { LL_WARNS("Materials") << "Cannot unzip LLSD binary content: " << uzip_result << LL_ENDL; @@ -670,7 +670,7 @@ void LLMaterialMgr::processGetQueue() std::string materialString = zip_llsd(materialsData); - S32 materialSize = materialString.size(); + auto materialSize = materialString.size(); if (materialSize <= 0) { LL_ERRS("Materials") << "cannot zip LLSD binary content" << LL_ENDL; @@ -960,7 +960,7 @@ void LLMaterialMgr::processPutQueue() std::string materialString = zip_llsd(materialsData); - S32 materialSize = materialString.size(); + auto materialSize = materialString.size(); if (materialSize > 0) { diff --git a/indra/newview/llmediadataclient.cpp b/indra/newview/llmediadataclient.cpp index be8d543711..0f3e0306af 100644 --- a/indra/newview/llmediadataclient.cpp +++ b/indra/newview/llmediadataclient.cpp @@ -692,7 +692,7 @@ void LLObjectMediaDataClient::sortQueue() mQueue.sort(compareRequestScores); // ...then cull items over the max - U32 size = mQueue.size(); + U32 size = static_cast<U32>(mQueue.size()); if (size > mMaxSortedQueueSize) { U32 num_to_cull = (size - mMaxSortedQueueSize); diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index f0fd731fb5..01c922df16 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -448,7 +448,7 @@ U32 get_volume_memory_size(const LLVolume* volume) U32 indices = 0; U32 vertices = 0; - for (U32 i = 0; i < volume->getNumVolumeFaces(); ++i) + for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) { const LLVolumeFace& face = volume->getVolumeFace(i); indices += face.mNumIndices; @@ -916,7 +916,7 @@ void LLMeshRepoThread::run() // Dispatch all HttpHandler notifications mHttpRequest->update(0L); } - sRequestWaterLevel = mHttpRequestSet.size(); // Stats data update + sRequestWaterLevel = static_cast<S32>(mHttpRequestSet.size()); // Stats data update // NOTE: order of queue processing intentionally favors LOD requests over header requests // Todo: we are processing mLODReqQ, mHeaderReqQ, mSkinRequests, mDecompositionRequests and mPhysicsShapeRequests @@ -3082,7 +3082,7 @@ void LLMeshHandlerBase::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespo LLCore::BufferArray * body(response->getBody()); S32 body_offset(0); U8 * data(NULL); - S32 data_size(body ? body->size() : 0); + auto data_size(body ? body->size() : 0); if (data_size > 0) { @@ -3143,7 +3143,7 @@ void LLMeshHandlerBase::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespo if (data) { body->read(body_offset, (char *) data, data_size - body_offset); - LLMeshRepository::sBytesReceived += data_size; + LLMeshRepository::sBytesReceived += static_cast<U32>(data_size); } else { @@ -3152,7 +3152,7 @@ void LLMeshHandlerBase::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespo } } - processData(body, body_offset, data, data_size - body_offset); + processData(body, body_offset, data, static_cast<S32>(data_size) - body_offset); delete [] data; } @@ -3624,8 +3624,8 @@ S32 LLMeshRepository::update() return 0 ; } - S32 size = mUploadWaitList.size() ; - for (S32 i = 0; i < size; ++i) + auto size = mUploadWaitList.size() ; + for (size_t i = 0; i < size; ++i) { mUploads.push_back(mUploadWaitList[i]); mUploadWaitList[i]->preStart() ; @@ -3633,7 +3633,7 @@ S32 LLMeshRepository::update() } mUploadWaitList.clear() ; - return size ; + return static_cast<S32>(size); } void LLMeshRepository::unregisterMesh(LLVOVolume* vobj) @@ -4864,7 +4864,7 @@ void LLPhysicsDecomp::setMeshData(LLCDMeshData& mesh, bool vertex_based) { mesh.mVertexBase = mCurRequest->mPositions[0].mV; mesh.mVertexStrideBytes = 12; - mesh.mNumVertices = mCurRequest->mPositions.size(); + mesh.mNumVertices = static_cast<int>(mCurRequest->mPositions.size()); if(!vertex_based) { @@ -4872,7 +4872,7 @@ void LLPhysicsDecomp::setMeshData(LLCDMeshData& mesh, bool vertex_based) mesh.mIndexBase = &(mCurRequest->mIndices[0]); mesh.mIndexStrideBytes = 6; - mesh.mNumTriangles = mCurRequest->mIndices.size()/3; + mesh.mNumTriangles = static_cast<int>(mCurRequest->mIndices.size())/3; } if ((vertex_based || mesh.mNumTriangles > 0) && mesh.mNumVertices > 2) @@ -5203,16 +5203,16 @@ void LLPhysicsDecomp::Request::assignData(LLModel* mdl) { if (!mdl) { - return ; + return; } U16 index_offset = 0; - U16 tri[3] ; + U16 tri[3]{}; mPositions.clear(); mIndices.clear(); - mBBox[1] = LLVector3(F32_MIN, F32_MIN, F32_MIN) ; - mBBox[0] = LLVector3(F32_MAX, F32_MAX, F32_MAX) ; + mBBox[1] = LLVector3(F32_MIN, F32_MIN, F32_MIN); + mBBox[0] = LLVector3(F32_MAX, F32_MAX, F32_MAX); //queue up vertex positions and indices for (S32 i = 0; i < mdl->getNumVolumeFaces(); ++i) @@ -5223,36 +5223,34 @@ void LLPhysicsDecomp::Request::assignData(LLModel* mdl) continue; } - for (U32 j = 0; j < face.mNumVertices; ++j) + for (S32 j = 0; j < face.mNumVertices; ++j) { mPositions.push_back(LLVector3(face.mPositions[j].getF32ptr())); - for(U32 k = 0 ; k < 3 ; k++) + for (U32 k = 0 ; k < 3 ; k++) { - mBBox[0].mV[k] = llmin(mBBox[0].mV[k], mPositions[j].mV[k]) ; - mBBox[1].mV[k] = llmax(mBBox[1].mV[k], mPositions[j].mV[k]) ; + mBBox[0].mV[k] = llmin(mBBox[0].mV[k], mPositions[j].mV[k]); + mBBox[1].mV[k] = llmax(mBBox[1].mV[k], mPositions[j].mV[k]); } } - updateTriangleAreaThreshold() ; + updateTriangleAreaThreshold(); - for (U32 j = 0; j+2 < face.mNumIndices; j += 3) + for (S32 j = 0; j+2 < face.mNumIndices; j += 3) { tri[0] = face.mIndices[j] + index_offset ; - tri[1] = face.mIndices[j + 1] + index_offset ; - tri[2] = face.mIndices[j + 2] + index_offset ; + tri[1] = face.mIndices[j + 1] + index_offset; + tri[2] = face.mIndices[j + 2] + index_offset; - if(isValidTriangle(tri[0], tri[1], tri[2])) + if (isValidTriangle(tri[0], tri[1], tri[2])) { - mIndices.push_back(tri[0]); - mIndices.push_back(tri[1]); - mIndices.push_back(tri[2]); + mIndices.emplace_back(tri[0]); + mIndices.emplace_back(tri[1]); + mIndices.emplace_back(tri[2]); } } index_offset += face.mNumVertices; } - - return ; } void LLPhysicsDecomp::Request::updateTriangleAreaThreshold() @@ -5283,10 +5281,10 @@ void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp) { decomp.mMesh.resize(decomp.mHull.size()); - for (U32 i = 0; i < decomp.mHull.size(); ++i) + for (size_t i = 0; i < decomp.mHull.size(); ++i) { LLCDHull hull; - hull.mNumVertices = decomp.mHull[i].size(); + hull.mNumVertices = static_cast<int>(decomp.mHull[i].size()); hull.mVertexBase = decomp.mHull[i][0].mV; hull.mVertexStrideBytes = 12; @@ -5305,7 +5303,7 @@ void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp) if (!decomp.mBaseHull.empty() && decomp.mBaseHullMesh.empty()) { //get mesh for base hull LLCDHull hull; - hull.mNumVertices = decomp.mBaseHull.size(); + hull.mNumVertices = static_cast<int>(decomp.mBaseHull.size()); hull.mVertexBase = decomp.mBaseHull[0].mV; hull.mVertexStrideBytes = 12; diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index c73cffab5a..7ecd7cdff9 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -1362,7 +1362,7 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe S32 size_indices = 0; S32 size_vertices = 0; - for (U32 face_idx = 0; face_idx < base_model->getNumVolumeFaces(); ++face_idx) + for (S32 face_idx = 0; face_idx < base_model->getNumVolumeFaces(); ++face_idx) { const LLVolumeFace &face = base_model->getVolumeFace(face_idx); size_indices += face.mNumIndices; @@ -1388,7 +1388,7 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe S32 combined_positions_shift = 0; S32 indices_idx_shift = 0; S32 combined_indices_shift = 0; - for (U32 face_idx = 0; face_idx < base_model->getNumVolumeFaces(); ++face_idx) + for (S32 face_idx = 0; face_idx < base_model->getNumVolumeFaces(); ++face_idx) { const LLVolumeFace &face = base_model->getVolumeFace(face_idx); @@ -1513,7 +1513,7 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe S32 valid_faces = 0; // Crude method to copy indices back into face - for (U32 face_idx = 0; face_idx < base_model->getNumVolumeFaces(); ++face_idx) + for (S32 face_idx = 0; face_idx < base_model->getNumVolumeFaces(); ++face_idx) { const LLVolumeFace &face = base_model->getVolumeFace(face_idx); @@ -1531,7 +1531,7 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe // Copy relevant indices and vertices for (S32 i = 0; i < size_new_indices; ++i) { - U32 idx = output_indices[i]; + S32 idx = (S32)output_indices[i]; if ((i % 3) == 0) { @@ -1560,7 +1560,7 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe // U16 vertices overflow shouldn't happen, but just in case size_new_indices = 0; valid_faces = 0; - for (U32 face_idx = 0; face_idx < base_model->getNumVolumeFaces(); ++face_idx) + for (S32 face_idx = 0; face_idx < base_model->getNumVolumeFaces(); ++face_idx) { genMeshOptimizerPerFace(base_model, target_model, face_idx, indices_decimator, error_threshold, simplification_mode); const LLVolumeFace &face = target_model->getVolumeFace(face_idx); @@ -1906,7 +1906,7 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d LLModel* target_model = mModel[lod][mdl_idx]; // carry over normalized transform into simplified model - for (int i = 0; i < base->getNumVolumeFaces(); ++i) + for (S32 i = 0; i < base->getNumVolumeFaces(); ++i) { LLVolumeFace& src = base->getVolumeFace(i); LLVolumeFace& dst = target_model->getVolumeFace(i); @@ -1920,7 +1920,7 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d if (model_meshopt_mode == MESH_OPTIMIZER_PRECISE) { // Run meshoptimizer for each face - for (U32 face_idx = 0; face_idx < base->getNumVolumeFaces(); ++face_idx) + for (S32 face_idx = 0; face_idx < base->getNumVolumeFaces(); ++face_idx) { F32 res = genMeshOptimizerPerFace(base, target_model, face_idx, indices_decimator, lod_error_threshold, MESH_OPTIMIZER_FULL); if (res < 0) @@ -1936,7 +1936,7 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d if (model_meshopt_mode == MESH_OPTIMIZER_SLOPPY) { // Run meshoptimizer for each face - for (U32 face_idx = 0; face_idx < base->getNumVolumeFaces(); ++face_idx) + for (S32 face_idx = 0; face_idx < base->getNumVolumeFaces(); ++face_idx) { if (genMeshOptimizerPerFace(base, target_model, face_idx, indices_decimator, lod_error_threshold, MESH_OPTIMIZER_NO_TOPOLOGY) < 0) { @@ -2283,7 +2283,7 @@ void LLModelPreview::updateStatusMessages() mModelNoErrors = true; const U32 lod_high = LLModel::LOD_HIGH; - U32 high_submodel_count = mModel[lod_high].size() - countRootModels(mModel[lod_high]); + U32 high_submodel_count = static_cast<U32>(mModel[lod_high].size()) - countRootModels(mModel[lod_high]); for (S32 lod = 0; lod <= lod_high; ++lod) { @@ -2482,10 +2482,10 @@ void LLModelPreview::updateStatusMessages() if (!decomp.empty()) { - phys_hulls += decomp.size(); + phys_hulls += static_cast<S32>(decomp.size()); for (U32 i = 0; i < decomp.size(); ++i) { - phys_points += decomp[i].size(); + phys_points += static_cast<S32>(decomp[i].size()); } } else @@ -3437,8 +3437,8 @@ bool LLModelPreview::render() gGL.multMatrix((GLfloat*)mat.mMatrix); - U32 num_models = mVertexBuffer[mPreviewLOD][model].size(); - for (U32 i = 0; i < num_models; ++i) + auto num_models = mVertexBuffer[mPreviewLOD][model].size(); + for (size_t i = 0; i < num_models; ++i) { LLVertexBuffer* buffer = mVertexBuffer[mPreviewLOD][model][i]; @@ -3446,7 +3446,7 @@ bool LLModelPreview::render() if (textures) { - int materialCnt = instance.mModel->mMaterialList.size(); + auto materialCnt = instance.mModel->mMaterialList.size(); if (i < materialCnt) { const std::string& binding = instance.mModel->mMaterialList[i]; @@ -3584,9 +3584,9 @@ bool LLModelPreview::render() if (render_mesh) { - U32 num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); + auto num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); if (pass > 0){ - for (U32 i = 0; i < num_models; ++i) + for (size_t i = 0; i < num_models; ++i) { LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][i]; @@ -3649,8 +3649,8 @@ bool LLModelPreview::render() if (physics.mHull.empty()) { - U32 num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); - for (U32 v = 0; v < num_models; ++v) + auto num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); + for (size_t v = 0; v < num_models; ++v) { LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][v]; @@ -3717,7 +3717,7 @@ bool LLModelPreview::render() const LLMeshSkinInfo *skin = &model->mSkinInfo; LLSkinningUtil::initJointNums(&model->mSkinInfo, getPreviewAvatar());// inits skin->mJointNums if nessesary U32 joint_count = LLSkinningUtil::getMeshJointCount(skin); - U32 bind_count = skin->mAlternateBindMatrix.size(); + auto bind_count = skin->mAlternateBindMatrix.size(); if (joint_overrides && bind_count > 0 @@ -3762,7 +3762,7 @@ bool LLModelPreview::render() } } - for (U32 i = 0, e = mVertexBuffer[mPreviewLOD][model].size(); i < e; ++i) + for (U32 i = 0, e = static_cast<U32>(mVertexBuffer[mPreviewLOD][model].size()); i < e; ++i) { LLVertexBuffer* buffer = mVertexBuffer[mPreviewLOD][model][i]; @@ -3773,7 +3773,7 @@ bool LLModelPreview::render() if (textures) { - int materialCnt = instance.mModel->mMaterialList.size(); + auto materialCnt = instance.mModel->mMaterialList.size(); if (i < materialCnt) { const std::string& binding = instance.mModel->mMaterialList[i]; diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 5d55816f94..96be917019 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -123,7 +123,7 @@ void LLOutfitGallery::onOpen(const LLSD& info) { uuid_vec_t cats; getCurrentCategories(cats); - int n = cats.size(); + int n = static_cast<int>(cats.size()); buildGalleryPanel(n); mScrollPanel->addChild(mGalleryPanel); for (int i = 0; i < n; i++) @@ -601,8 +601,8 @@ void LLOutfitGallery::removeFromGalleryMiddle(LLOutfitGalleryItem* item) removeFromGalleryLast(mItems[i]); } removeFromGalleryLast(mItems[n]); - int saved_count = saved.size(); - for (int i = 0; i < saved_count; i++) + auto saved_count = saved.size(); + for (size_t i = 0; i < saved_count; i++) { addToGallery(saved.back()); saved.pop_back(); diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 94b32ceea9..0f5f7aebf8 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -376,7 +376,7 @@ void LLOutfitsList::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const uuid_vec_t uuids; (*iter).second->getSelectedUUIDs(uuids); - S32 prev_size = selected_uuids.size(); + auto prev_size = selected_uuids.size(); selected_uuids.resize(prev_size + uuids.size()); std::copy(uuids.begin(), uuids.end(), selected_uuids.begin() + prev_size); } diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index d387bbce43..5255b3763c 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -39,7 +39,7 @@ #include "llviewercontrol.h" namespace -{ +{ // Atmosphere Tab const std::string FIELD_SKY_AMBIENT_LIGHT("ambient_light"); const std::string FIELD_SKY_BLUE_HORIZON("blue_horizon"); @@ -484,10 +484,10 @@ void LLPanelSettingsSkyCloudTab::onCloudMapChanged() void LLPanelSettingsSkyCloudTab::onCloudDensityChanged() { if (!mSkySettings) return; - LLColor3 density(getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_X)->getValue().asReal(), - getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_Y)->getValue().asReal(), + LLColor3 density(getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_X)->getValue().asReal(), + getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_Y)->getValue().asReal(), getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_D)->getValue().asReal()); - + mSkySettings->setCloudPosDensity1(density); setIsDirty(); } @@ -566,7 +566,7 @@ void LLPanelSettingsSkySunMoonTab::refresh() getChildView(PANEL_SKY_MOON_LAYOUT)->setAllChildrenEnabled(false); getChildView(FIELD_SKY_SUN_BEACON)->setEnabled(true); getChildView(FIELD_SKY_MOON_BEACON)->setEnabled(true); - + if (!mSkySettings) return; } @@ -579,7 +579,7 @@ void LLPanelSettingsSkySunMoonTab::refresh() getChild<LLColorSwatchCtrl>(FIELD_SKY_SUN_MOON_COLOR)->set(mSkySettings->getSunlightColor() / SLIDER_SCALE_SUN_AMBIENT); LLColor3 glow(mSkySettings->getGlow()); - + // takes 40 - 0.2 range -> 0 - 1.99 UI range getChild<LLUICtrl>(FIELD_SKY_GLOW_SIZE)->setValue(2.0 - (glow.mV[0] / SLIDER_SCALE_GLOW_R)); getChild<LLUICtrl>(FIELD_SKY_GLOW_FOCUS)->setValue(glow.mV[2] / SLIDER_SCALE_GLOW_B); @@ -629,7 +629,7 @@ void LLPanelSettingsSkySunMoonTab::onGlowChanged() LLColor3 glow(getChild<LLUICtrl>(FIELD_SKY_GLOW_SIZE)->getValue().asReal(), 0.0f, getChild<LLUICtrl>(FIELD_SKY_GLOW_FOCUS)->getValue().asReal()); // takes 0 - 1.99 UI range -> 40 -> 0.2 range - glow.mV[0] = (2.0f - glow.mV[0]) * SLIDER_SCALE_GLOW_R; + glow.mV[0] = (2.0f - glow.mV[0]) * SLIDER_SCALE_GLOW_R; glow.mV[2] *= SLIDER_SCALE_GLOW_B; mSkySettings->setGlow(glow); @@ -775,9 +775,9 @@ void LLPanelSettingsSkySunMoonTab::onMoonBrightnessChanged() mSkySettings->update(); setIsDirty(); } - + LLPanelSettingsSkyDensityTab::LLPanelSettingsSkyDensityTab() -{ +{ } bool LLPanelSettingsSkyDensityTab::postBuild() diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 6890469131..a14f1d54a2 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llpaneleditwearable.cpp * @brief UI panel for editing of a particular wearable item. * * $LicenseInfo:firstyear=2009&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -216,7 +216,7 @@ LLEditWearableDictionary::LLEditWearableDictionary() { } -//virtual +//virtual LLEditWearableDictionary::~LLEditWearableDictionary() { } @@ -709,7 +709,7 @@ void LLPanelEditWearable::setWearablePanelVisibilityChangeCallback(LLPanel* body } } -// virtual +// virtual bool LLPanelEditWearable::postBuild() { // buttons @@ -828,7 +828,7 @@ bool LLPanelEditWearable::postBuild() return true; } -// virtual +// virtual // LLUICtrl bool LLPanelEditWearable::isDirty() const { @@ -880,7 +880,7 @@ void LLPanelEditWearable::setWearable(LLViewerWearable *wearable, bool disable_c showWearable(mWearablePtr, true, disable_camera_switch); } -//static +//static void LLPanelEditWearable::onBackButtonClicked(void* userdata) { LLPanelEditWearable* panel = (LLPanelEditWearable*)userdata; @@ -890,7 +890,7 @@ void LLPanelEditWearable::onBackButtonClicked(void* userdata) } } -//static +//static void LLPanelEditWearable::onRevertButtonClicked(void* userdata) { LLPanelEditWearable *panel = (LLPanelEditWearable*) userdata; @@ -1480,9 +1480,9 @@ void LLPanelEditWearable::getSortedParams(value_map_t &sorted_params, const std: { LLViewerVisualParam *param = (LLViewerVisualParam*) *iter; - if (param->getID() == -1 + if (param->getID() == -1 || !param->isTweakable() - || param->getEditGroup() != edit_group + || param->getEditGroup() != edit_group || !(param->getSex() & avatar_sex)) { continue; @@ -1596,7 +1596,7 @@ void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LL { LLLocalTextureObject *lto = getWearable()->getLocalTextureObject(te); mPreviousAlphaTexture[te] = lto->getID(); - + LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( IMG_INVISIBLE ); gAgentAvatarp->setLocalTexture(te, image, false, index); gAgentAvatarp->wearableUpdated(getWearable()->getType()); diff --git a/indra/newview/llpanelemojicomplete.cpp b/indra/newview/llpanelemojicomplete.cpp index 5cbc565a70..3faa01ae0c 100644 --- a/indra/newview/llpanelemojicomplete.cpp +++ b/indra/newview/llpanelemojicomplete.cpp @@ -94,13 +94,13 @@ void LLPanelEmojiComplete::draw() if (mVertical) { x = mRenderRect.mLeft; - y = mRenderRect.mTop - (mCurSelected - firstVisibleIdx + 1) * mEmojiHeight; + y = mRenderRect.mTop - static_cast<S32>(mCurSelected - firstVisibleIdx + 1) * mEmojiHeight; width = mRenderRect.getWidth(); height = mEmojiHeight; } else { - x = mRenderRect.mLeft + (mCurSelected - firstVisibleIdx) * mEmojiWidth; + x = mRenderRect.mLeft + static_cast<S32>(mCurSelected - firstVisibleIdx) * mEmojiWidth; y = mRenderRect.mBottom; width = mEmojiWidth; height = mRenderRect.getHeight(); @@ -113,7 +113,7 @@ void LLPanelEmojiComplete::draw() F32 textLeft = mVertical ? mRenderRect.mLeft + mEmojiWidth + mPadding : 0; F32 textWidth = mVertical ? getRect().getWidth() - textLeft - mPadding : 0; - for (U32 curIdx = firstVisibleIdx; curIdx < lastVisibleIdx; curIdx++) + for (size_t curIdx = firstVisibleIdx; curIdx < lastVisibleIdx; curIdx++) { LLWString text(1, mEmojis[curIdx].Character); mIconFont->render(text, 0, iconCenterX, iconCenterY, @@ -129,7 +129,7 @@ void LLPanelEmojiComplete::draw() std::string text = shortCode.substr(0, mEmojis[curIdx].Begin); mTextFont->renderUTF8(text, 0, x0, iconCenterY, LLColor4::white, LLFontGL::LEFT, LLFontGL::VCENTER, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - text.size(), x1); + static_cast<S32>(text.size()), x1); x0 += mTextFont->getWidthF32(text); x1 = textLeft + textWidth - x0; } @@ -138,7 +138,7 @@ void LLPanelEmojiComplete::draw() std::string text = shortCode.substr(mEmojis[curIdx].Begin, mEmojis[curIdx].End - mEmojis[curIdx].Begin); mTextFont->renderUTF8(text, 0, x0, iconCenterY, LLColor4::yellow6, LLFontGL::LEFT, LLFontGL::VCENTER, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - text.size(), x1); + static_cast<S32>(text.size()), x1); x0 += mTextFont->getWidthF32(text); x1 = textLeft + textWidth - x0; } @@ -147,7 +147,7 @@ void LLPanelEmojiComplete::draw() std::string text = shortCode.substr(mEmojis[curIdx].End); mTextFont->renderUTF8(text, 0, x0, iconCenterY, LLColor4::white, LLFontGL::LEFT, LLFontGL::VCENTER, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - text.size(), x1); + static_cast<S32>(text.size()), x1); } iconCenterY -= mEmojiHeight; } @@ -349,7 +349,7 @@ U32 LLPanelEmojiComplete::getMaxShortCodeWidth() const U32 max_width = 0; for (const LLEmojiSearchResult& result : mEmojis) { - S32 width = mTextFont->getWidth(result.String); + U32 width = mTextFont->getWidth(result.String); if (width > max_width) { max_width = width; @@ -373,11 +373,11 @@ void LLPanelEmojiComplete::onEmojisChanged() { width += mScrollbar->getThickness(); } - height = mVisibleEmojis * mEmojiHeight; + height = static_cast<S32>(mVisibleEmojis) * mEmojiHeight; } else { - width = mVisibleEmojis * mEmojiWidth; + width = static_cast<S32>(mVisibleEmojis) * mEmojiWidth; height = getRect().getHeight(); } LLUICtrl::reshape(width, height, false); @@ -445,8 +445,8 @@ void LLPanelEmojiComplete::updateConstraints() if (!mNoScroll && mVisibleEmojis < mTotalEmojis) { mRenderRect.mRight -= mScrollbar->getThickness(); - mScrollbar->setDocSize(mTotalEmojis); - mScrollbar->setPageSize(mVisibleEmojis); + mScrollbar->setDocSize(static_cast<S32>(mTotalEmojis)); + mScrollbar->setPageSize(static_cast<S32>(mVisibleEmojis)); mScrollbar->setOrigin(mRenderRect.mRight, 0); mScrollbar->reshape(mScrollbar->getThickness(), mRenderRect.mTop, true); mScrollbar->setVisible(true); @@ -459,7 +459,7 @@ void LLPanelEmojiComplete::updateConstraints() else { mEmojiHeight = mRenderRect.getHeight(); - mRenderRect.stretch((mRenderRect.getWidth() - mVisibleEmojis * mEmojiWidth) / -2, 0); + mRenderRect.stretch((mRenderRect.getWidth() - static_cast<S32>(mVisibleEmojis) * mEmojiWidth) / -2, 0); } updateScrollPos(); @@ -486,7 +486,7 @@ void LLPanelEmojiComplete::updateScrollPos() if (mScrollbar && mScrollbar->getVisible()) { - mScrollbar->setDocPos(mScrollPos); + mScrollbar->setDocPos(static_cast<S32>(mScrollPos)); } } diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index f0cb5d68aa..43612865fc 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -339,7 +339,7 @@ void LLPanelEnvironmentInfo::refreshFromEstate() refresh(); } -std::string LLPanelEnvironmentInfo::getNameForTrackIndex(S32 index) +std::string LLPanelEnvironmentInfo::getNameForTrackIndex(U32 index) { std::string invname; if (!mCurrentEnvironment || index < LLSettingsDay::TRACK_WATER || index >= LLSettingsDay::TRACK_MAX) diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index ff39714cea..b478142987 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -1,25 +1,25 @@ -/** +/** * @file llpanelenvironment.h * @brief LLPanelExperiences class definition * * $LicenseInfo:firstyear=2013&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2013, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -136,7 +136,7 @@ protected: virtual bool isLargeEnough() = 0; virtual void refreshFromSource() = 0; - std::string getNameForTrackIndex(S32 index); + std::string getNameForTrackIndex(U32 index); LLFloaterSettingsPicker * getSettingsPicker(bool create = true); LLFloaterEditExtDayCycle * getEditFloater(bool create = true); diff --git a/indra/newview/llpanelexperiencelog.cpp b/indra/newview/llpanelexperiencelog.cpp index 176da130bb..24c9d7dced 100644 --- a/indra/newview/llpanelexperiencelog.cpp +++ b/indra/newview/llpanelexperiencelog.cpp @@ -108,8 +108,8 @@ void LLPanelExperienceLog::refresh() bool waiting = false; LLUUID waiting_id; - int itemsToSkip = mPageSize*mCurrentPage; - int items = 0; + unsigned int itemsToSkip = mPageSize*mCurrentPage; + unsigned int items = 0; bool moreItems = false; LLSD events_to_save = events; if (events.isMap() && events.size() != 0) @@ -126,7 +126,7 @@ void LLPanelExperienceLog::refresh() events_to_save.erase(day->first); continue; } - int size = dayArray.size(); + unsigned int size = static_cast<unsigned int>(dayArray.size()); if(itemsToSkip > size) { itemsToSkip -= size; @@ -137,7 +137,7 @@ void LLPanelExperienceLog::refresh() moreItems = true; break; } - for(int i = dayArray.size() - itemsToSkip - 1; i >= 0; i--) + for(int i = static_cast<int>(dayArray.size()) - itemsToSkip - 1; i >= 0; i--) { if(items >= mPageSize) { diff --git a/indra/newview/llpanelgroupcreate.cpp b/indra/newview/llpanelgroupcreate.cpp index fd960c9e97..4a370525ff 100644 --- a/indra/newview/llpanelgroupcreate.cpp +++ b/indra/newview/llpanelgroupcreate.cpp @@ -1,24 +1,24 @@ -/** +/** * @file llpanelgroupcreate.cpp * * $LicenseInfo:firstyear=2019&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2019, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -194,7 +194,7 @@ void LLPanelGroupCreate::onBtnCreate() // Validate the group name length. std::string gr_name = mGroupNameEditor->getText(); LLStringUtil::trim(gr_name); - S32 group_name_len = gr_name.size(); + S32 group_name_len = static_cast<S32>(gr_name.size()); if (group_name_len < DB_GROUP_NAME_MIN_LEN || group_name_len > DB_GROUP_NAME_STR_LEN) { diff --git a/indra/newview/llpanelgroupcreate.h b/indra/newview/llpanelgroupcreate.h index fd0b6e243d..116621f58f 100644 --- a/indra/newview/llpanelgroupcreate.h +++ b/indra/newview/llpanelgroupcreate.h @@ -1,24 +1,24 @@ -/** +/** * @file llpanelgroupcreate.h * * $LicenseInfo:firstyear=2019&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2019, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index cb6d44f1e7..bc56b49e5d 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -1173,7 +1173,7 @@ void LLPanelGroupMembersSubTab::confirmEjectMembers() std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected(); if (selection.empty()) return; - S32 selection_count = selection.size(); + auto selection_count = selection.size(); if (selection_count == 1) { LLSD args; @@ -1868,7 +1868,7 @@ void LLPanelGroupMembersSubTab::confirmBanMembers() std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected(); if (selection.empty()) return; - S32 selection_count = selection.size(); + auto selection_count = selection.size(); if (selection_count == 1) { LLSD args; @@ -2197,7 +2197,7 @@ void LLPanelGroupRolesSubTab::update(LLGroupChange gc) if (matchesSearchFilter(rd.mRoleName, rd.mRoleTitle)) { // If this is the everyone role, then EVERYONE is in it. - S32 members_in_role = (*rit).first.isNull() ? gdatap->mMembers.size() : (*rit).second->getTotalMembersInRole(); + S32 members_in_role = (*rit).first.isNull() ? static_cast<S32>(gdatap->mMembers.size()) : (*rit).second->getTotalMembersInRole(); LLSD row = createRoleItem((*rit).first,rd.mRoleName, rd.mRoleTitle, members_in_role); item = mRolesList->addElement(row, ((*rit).first.isNull()) ? ADD_TOP : ADD_BOTTOM, this); if (had_selection && ((*rit).first == last_selected)) @@ -3109,7 +3109,7 @@ void LLPanelGroupBanListSubTab::activate() { mCreateBanButton->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS) && group_datap->mBanList.size() < GB_MAX_BANNED_AGENTS); - setBanCount(group_datap->mBanList.size()); + setBanCount(static_cast<U32>(group_datap->mBanList.size())); } else { @@ -3236,7 +3236,7 @@ void LLPanelGroupBanListSubTab::handleDeleteBanEntry() // update ban-count related elements mCreateBanButton->setEnabled(true); - setBanCount(gdatap->mBanList.size()); + setBanCount(static_cast<U32>(gdatap->mBanList.size())); LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mGroupID, LLGroupMgr::BAN_DELETE, ban_ids); } @@ -3314,7 +3314,7 @@ void LLPanelGroupBanListSubTab::populateBanList() mRefreshBanListButton->setEnabled(true); mCreateBanButton->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS) && gdatap->mBanList.size() < GB_MAX_BANNED_AGENTS); - setBanCount(gdatap->mBanList.size()); + setBanCount(static_cast<U32>(gdatap->mBanList.size())); } void LLPanelGroupBanListSubTab::setGroupID(const LLUUID& id) diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index aa90c1960e..ed80c8b732 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -335,7 +335,7 @@ void LLPanelLogin::addFavoritesToStartLocation() { // first login panel has no favorites, just update name length and buttons std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple(); - mUsernameLength = user_defined_name.length(); + mUsernameLength = static_cast<unsigned int>(user_defined_name.length()); updateLoginButtons(); return; } @@ -355,7 +355,7 @@ void LLPanelLogin::addFavoritesToStartLocation() LLStringUtil::toLower(user_defined_name); std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites_" + LLGridManager::getInstance()->getGrid() + ".xml"); std::string old_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); - mUsernameLength = user_defined_name.length(); + mUsernameLength = static_cast<unsigned int>(user_defined_name.length()); updateLoginButtons(); std::string::size_type index = user_defined_name.find_first_of(" ._"); @@ -597,13 +597,13 @@ void LLPanelLogin::setFields(LLPointer<LLCredential> credential) login_id += lastname; } sInstance->getChild<LLComboBox>("username_combo")->setLabel(login_id); - sInstance->mUsernameLength = login_id.length(); + sInstance->mUsernameLength = static_cast<unsigned int>(login_id.length()); } else if(identifier.has("type") && (std::string)identifier["type"] == "account") { std::string login_id = identifier["account_name"].asString(); sInstance->getChild<LLComboBox>("username_combo")->setLabel(login_id); - sInstance->mUsernameLength = login_id.length(); + sInstance->mUsernameLength = static_cast<unsigned int>(login_id.length()); } else { @@ -627,7 +627,7 @@ void LLPanelLogin::setFields(LLPointer<LLCredential> credential) // nice row of asterisks. const std::string filler("123456789!123456"); sInstance->getChild<LLUICtrl>("password_edit")->setValue(filler); - sInstance->mPasswordLength = filler.length(); + sInstance->mPasswordLength = static_cast<unsigned int>(filler.length()); sInstance->updateLoginButtons(); } else @@ -793,7 +793,7 @@ void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl) { location_combo->setLabel(new_start_slurl.getLocationString()); - sInstance->mLocationLength = new_start_slurl.getLocationString().length(); + sInstance->mLocationLength = static_cast<unsigned int>(new_start_slurl.getLocationString().length()); sInstance->updateLoginButtons(); } } @@ -1124,7 +1124,7 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data) } LLLineEditor* password_edit(self->getChild<LLLineEditor>("password_edit")); - self->mPasswordLength = password_edit->getText().length(); + self->mPasswordLength = static_cast<unsigned int>(password_edit->getText().length()); self->updateLoginButtons(); } @@ -1158,8 +1158,8 @@ void LLPanelLogin::updateServer() // restore creds user_combo->setTextEntry(username); pswd_edit->setValue(password); - sInstance->mUsernameLength = username.length(); - sInstance->mPasswordLength = password.length(); + sInstance->mUsernameLength = static_cast<unsigned int>(username.length()); + sInstance->mPasswordLength = static_cast<unsigned int>(password.length()); } else { diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index b6ec403b87..0925351350 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -179,7 +179,7 @@ U32 LLPanelMarketplaceInbox::getFreshItemCount() const U32 LLPanelMarketplaceInbox::getTotalItemCount() const { - U32 item_count = 0; + size_t item_count = 0; if (mInventoryPanel) { @@ -192,7 +192,7 @@ U32 LLPanelMarketplaceInbox::getTotalItemCount() const } } - return item_count; + return static_cast<U32>(item_count); } void LLPanelMarketplaceInbox::onClearSearch() diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index aa60c5cf6c..2dd4866da3 100644 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -1241,7 +1241,7 @@ void LLPanelNearByMedia::onMenuAction(const LLSD& userdata) if (!url.empty()) { - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(url), 0, url.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(url), 0, static_cast<S32>(url.size())); } } else if ("copy_data" == command_name) @@ -1254,12 +1254,12 @@ void LLPanelNearByMedia::onMenuAction(const LLSD& userdata) { pos += encoding_specifier.size(); std::string res = LLBase64::decodeAsString(url.substr(pos)); - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(res), 0, res.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(res), 0, static_cast<S32>(res.size())); } else { url = LLURI::unescape(url); - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(url), 0, url.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(url), 0, static_cast<S32>(url.size())); } } } diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index e08179dd58..42cf06424e 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -871,8 +871,8 @@ void LLPanelPeople::updateButtons() LLPanel* groups_panel = mTabContainer->getCurrentPanel(); groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); // a real group selected - U32 groups_count = gAgent.mGroups.size(); - S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit(); + U32 groups_count = static_cast<U32>(gAgent.mGroups.size()); + U32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit(); U32 groups_remaining = max_groups > groups_count ? max_groups - groups_count : 0; groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d", groups_count)); groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[REMAINING]", llformat("%d", groups_remaining)); diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 94603471f7..2a27a6e143 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -986,7 +986,7 @@ void shorten_name(std::string &name, const LLStyle::Params& style_params, S32 ma LLWString wline = utf8str_to_wstring(name); // panel supports two lines long names - S32 segment_length = font->maxDrawableChars(wline.c_str(), max_pixels, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); + S32 segment_length = font->maxDrawableChars(wline.c_str(), max_pixels, static_cast<S32>(wline.length()), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE); if (segment_length == wline.length()) { // no work needed @@ -994,7 +994,7 @@ void shorten_name(std::string &name, const LLStyle::Params& style_params, S32 ma } S32 first_line_length = segment_length; - segment_length = font->maxDrawableChars(wline.substr(first_line_length).c_str(), max_pixels, wline.length(), LLFontGL::ANYWHERE); + segment_length = font->maxDrawableChars(wline.substr(first_line_length).c_str(), max_pixels, static_cast<S32>(wline.length()), LLFontGL::ANYWHERE); if (segment_length + first_line_length == wline.length()) { // no work needed @@ -1004,7 +1004,7 @@ void shorten_name(std::string &name, const LLStyle::Params& style_params, S32 ma // name does not fit, cut it, add ... const LLWString dots_pad(utf8str_to_wstring(std::string("...."))); S32 elipses_width = font->getWidthF32(dots_pad.c_str()); - segment_length = font->maxDrawableChars(wline.substr(first_line_length).c_str(), max_pixels - elipses_width, wline.length(), LLFontGL::ANYWHERE); + segment_length = font->maxDrawableChars(wline.substr(first_line_length).c_str(), max_pixels - elipses_width, static_cast<S32>(wline.length()), LLFontGL::ANYWHERE); name = name.substr(0, segment_length + first_line_length) + std::string("..."); } diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 579f0941c3..19e2d5de99 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -1430,7 +1430,7 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata) else if (item_name == "copy_user_id") { LLWString wstr = utf8str_to_wstring(getAvatarId().asString()); - LLClipboard::instance().copyToClipboard(wstr, 0, wstr.size()); + LLClipboard::instance().copyToClipboard(wstr, 0, static_cast<S32>(wstr.size())); } else if (item_name == "agent_permissions") { @@ -1455,7 +1455,7 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata) { wstr = utf8str_to_wstring(av_name.getUserName()); } - LLClipboard::instance().copyToClipboard(wstr, 0, wstr.size()); + LLClipboard::instance().copyToClipboard(wstr, 0, static_cast<S32>(wstr.size())); } else if (item_name == "edit_display_name") { diff --git a/indra/newview/llpanelpulldown.h b/indra/newview/llpanelpulldown.h index 834bd2595c..850ea09664 100644 --- a/indra/newview/llpanelpulldown.h +++ b/indra/newview/llpanelpulldown.h @@ -1,25 +1,25 @@ -/** +/** * @file llpanelpulldown.h * @brief A panel that serves as a basis for multiple toolbar pulldown panels * * $LicenseInfo:firstyear=2020&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2020, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index d453d2c914..902412d359 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -598,7 +598,7 @@ void LLTeleportHistoryPanel::getNextTab(const LLDate& item_date, S32& tab_idx, L { const U32 seconds_in_day = 24 * 60 * 60; - S32 tabs_cnt = mItemContainers.size(); + S32 tabs_cnt = static_cast<S32>(mItemContainers.size()); S32 curr_year = 0, curr_month = 0, curr_day = 0; tab_date = LLDate::now(); @@ -695,7 +695,7 @@ void LLTeleportHistoryPanel::refresh() // tab_boundary_date would be earliest possible date for this tab S32 tab_idx = 0; getNextTab(date, tab_idx, tab_boundary_date); - tab_idx = mItemContainers.size() - 1 - tab_idx; + tab_idx = static_cast<S32>(mItemContainers.size()) - 1 - tab_idx; if (tab_idx >= 0) { LLAccordionCtrlTab* tab = mItemContainers.at(tab_idx); @@ -743,7 +743,7 @@ void LLTeleportHistoryPanel::refresh() break; } - for (S32 n = mItemContainers.size() - 1; n >= 0; --n) + for (S32 n = static_cast<S32>(mItemContainers.size()) - 1; n >= 0; --n) { LLAccordionCtrlTab* tab = mItemContainers.at(n); LLFlatListView* fv = getFlatListViewFromTab(tab); @@ -798,14 +798,14 @@ void LLTeleportHistoryPanel::replaceItem(S32 removed_index) LLTeleportHistoryFlatItem* item = LLTeleportHistoryFlatItemStorage::instance() .getFlatItemForPersistentItem(mGearItemMenu, history_items[history_items.size() - 1], // Most recent item, it was added instead of removed - history_items.size(), // index will be decremented inside loop below + static_cast<S32>(history_items.size()), // index will be decremented inside loop below sFilterSubString); fv->addItem(item, LLUUID::null, ADD_TOP); // Index of each item, from last to removed item should be decremented // to point to the right item in LLTeleportHistoryStorage - for (S32 tab_idx = mItemContainers.size() - 1; tab_idx >= 0; --tab_idx) + for (S32 tab_idx = static_cast<S32>(mItemContainers.size()) - 1; tab_idx >= 0; --tab_idx) { LLAccordionCtrlTab* tab = mItemContainers.at(tab_idx); if (!tab->getVisible()) @@ -821,8 +821,8 @@ void LLTeleportHistoryPanel::replaceItem(S32 removed_index) std::vector<LLPanel*> items; fv->getItems(items); - S32 items_cnt = items.size(); - for (S32 n = 0; n < items_cnt; ++n) + auto items_cnt = items.size(); + for (size_t n = 0; n < items_cnt; ++n) { LLTeleportHistoryFlatItem *item = (LLTeleportHistoryFlatItem*) items[n]; @@ -857,9 +857,9 @@ void LLTeleportHistoryPanel::showTeleportHistory() mTeleportHistory = LLTeleportHistoryStorage::getInstance(); } - mCurrentItem = mTeleportHistory->getItems().size() - 1; + mCurrentItem = static_cast<S32>(mTeleportHistory->getItems().size()) - 1; - for (S32 n = mItemContainers.size() - 1; n >= 0; --n) + for (S32 n = static_cast<S32>(mItemContainers.size()) - 1; n >= 0; --n) { LLAccordionCtrlTab* tab = mItemContainers.at(n); if (tab) @@ -884,9 +884,9 @@ void LLTeleportHistoryPanel::handleItemSelect(LLFlatListView* selected) if (item) mLastSelectedItemIndex = item->getIndex(); - S32 tabs_cnt = mItemContainers.size(); + auto tabs_cnt = mItemContainers.size(); - for (S32 n = 0; n < tabs_cnt; n++) + for (size_t n = 0; n < tabs_cnt; n++) { LLAccordionCtrlTab* tab = mItemContainers.at(n); @@ -1001,7 +1001,7 @@ LLFlatListView* LLTeleportHistoryPanel::getFlatListViewFromTab(LLAccordionCtrlTa void LLTeleportHistoryPanel::gotSLURLCallback(const std::string& slurl) { - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl), 0, slurl.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl), 0, static_cast<S32>(slurl.size())); LLSD args; args["SLURL"] = slurl; @@ -1015,9 +1015,9 @@ void LLTeleportHistoryPanel::onGearMenuAction(const LLSD& userdata) if ("expand_all" == command_name) { - S32 tabs_cnt = mItemContainers.size(); + auto tabs_cnt = mItemContainers.size(); - for (S32 n = 0; n < tabs_cnt; n++) + for (size_t n = 0; n < tabs_cnt; n++) { mItemContainers.at(n)->setDisplayChildren(true); } @@ -1025,9 +1025,9 @@ void LLTeleportHistoryPanel::onGearMenuAction(const LLSD& userdata) } else if ("collapse_all" == command_name) { - S32 tabs_cnt = mItemContainers.size(); + auto tabs_cnt = mItemContainers.size(); - for (S32 n = 0; n < tabs_cnt; n++) + for (size_t n = 0; n < tabs_cnt; n++) { mItemContainers.at(n)->setDisplayChildren(false); } @@ -1082,12 +1082,12 @@ bool LLTeleportHistoryPanel::isActionEnabled(const LLSD& userdata) const if (command_name == "collapse_all" || command_name == "expand_all") { - S32 tabs_cnt = mItemContainers.size(); + auto tabs_cnt = mItemContainers.size(); bool has_expanded_tabs = false; bool has_collapsed_tabs = false; - for (S32 n = 0; n < tabs_cnt; n++) + for (size_t n = 0; n < tabs_cnt; n++) { LLAccordionCtrlTab* tab = mItemContainers.at(n); if (!tab->getVisible()) diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp index 537bd0d303..c1534c9abd 100644 --- a/indra/newview/llpanelwearing.cpp +++ b/indra/newview/llpanelwearing.cpp @@ -478,11 +478,11 @@ void LLPanelWearing::getAttachmentLimitsCoro(std::string url) void LLPanelWearing::setAttachmentDetails(LLSD content) { mObjectNames.clear(); - S32 number_attachments = content["attachments"].size(); - for(int i = 0; i < number_attachments; i++) + auto number_attachments = content["attachments"].size(); + for(size_t i = 0; i < number_attachments; i++) { - S32 number_objects = content["attachments"][i]["objects"].size(); - for(int j = 0; j < number_objects; j++) + auto number_objects = content["attachments"][i]["objects"].size(); + for(size_t j = 0; j < number_objects; j++) { LLUUID task_id = content["attachments"][i]["objects"][j]["id"].asUUID(); std::string name = content["attachments"][i]["objects"][j]["name"].asString(); @@ -594,6 +594,6 @@ void LLPanelWearing::copyToClipboard() } } - LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text),0,text.size()); + LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text), 0, static_cast<S32>(text.size())); } // EOF diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp index 52a7383da6..c9fbeba2f3 100644 --- a/indra/newview/llpathfindingnavmesh.cpp +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -140,12 +140,12 @@ void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMes if ( pContent.has(NAVMESH_DATA_FIELD) ) { const LLSD::Binary &value = pContent.get(NAVMESH_DATA_FIELD).asBinary(); - unsigned int binSize = value.size(); + auto binSize = value.size(); std::string newStr(reinterpret_cast<const char *>(&value[0]), binSize); std::istringstream streamdecomp( newStr ); size_t decompBinSize = 0; bool valid = false; - U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ; + U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh(valid, decompBinSize, streamdecomp, static_cast<S32>(binSize)); if ( !valid ) { LL_WARNS() << "Unable to decompress the navmesh llsd." << LL_ENDL; diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp index a92a8fe138..61791492e7 100644 --- a/indra/newview/llpathfindingpathtool.cpp +++ b/indra/newview/llpathfindingpathtool.cpp @@ -35,9 +35,6 @@ #include "llagent.h" #include "llpathfindingmanager.h" -#include "llpathinglib.h" -#include "llsingleton.h" -#include "lltool.h" #include "llviewercamera.h" #include "llviewerregion.h" #include "llviewerwindow.h" diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index 04b39a63f0..64f438976a 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -302,7 +302,7 @@ namespace LLPerfStats std::vector<LLVector3d> positions; uuid_vec_t avatar_ids; LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, our_pos, distance); - return positions.size(); + return static_cast<int>(positions.size()); } const U32 NUM_PERIODS = 50; @@ -378,7 +378,7 @@ namespace LLPerfStats auto count = countNearbyAvatars(std::min(LLPipeline::RenderFarClip, tunables.userImpostorDistance)); if( count != tunables.nonImpostors ) { - tunables.updateNonImposters( (count < LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER)?count : 0 ); + tunables.updateNonImposters(((U32)count < LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER) ? count : 0); LL_DEBUGS("AutoTune") << "There are " << count << "avatars within " << std::min(LLPipeline::RenderFarClip, tunables.userImpostorDistance) << "m of the camera" << LL_ENDL; } } diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 56f23a0458..7cbbb89313 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -549,11 +549,9 @@ void LLPreviewGesture::addAnimations() // Copy into something we can sort std::vector<LLInventoryItem*> animations; - - S32 count = items.size(); - for(i = 0; i < count; ++i) + for (auto& item : items) { - animations.push_back( items.at(i) ); + animations.emplace_back(item); } // Do the sort @@ -594,12 +592,9 @@ void LLPreviewGesture::addSounds() // Copy sounds into something we can sort std::vector<LLInventoryItem*> sounds; - - S32 i; - S32 count = items.size(); - for(i = 0; i < count; ++i) + for (auto& item : items) { - sounds.push_back( items.at(i) ); + sounds.emplace_back(item); } // Do the sort @@ -951,8 +946,8 @@ void LLPreviewGesture::loadUIFromGesture(LLMultiGesture* gesture) mKeyCombo->setEnabledByValue(LLKeyboard::stringFromKey(KEY_F10), gesture->mMask != MASK_CONTROL); // Make UI steps for each gesture step - S32 i; - S32 count = gesture->mSteps.size(); + size_t i; + size_t count = gesture->mSteps.size(); for (i = 0; i < count; ++i) { LLGestureStep* step = gesture->mSteps[i]; diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index 6fa9c59194..620b7c8b2d 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -593,7 +593,7 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem, bool sync) LLSaveNotecardInfo* info = new LLSaveNotecardInfo(this, mItemUUID, mObjectUUID, tid, copyitem); - S32 size = buffer.length() + 1; + S32 size = static_cast<S32>(buffer.length()) + 1; file.write((U8*)buffer.c_str(), size); gAssetStorage->storeAssetData(tid, LLAssetType::AT_NOTECARD, diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index a6ab08601d..c2188ea638 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1203,9 +1203,9 @@ struct LLEntryAndEdCore void LLScriptEdCore::deleteBridges() { - S32 count = mBridges.size(); + auto count = mBridges.size(); LLEntryAndEdCore* eandc; - for(S32 i = 0; i < count; i++) + for(size_t i = 0; i < count; i++) { eandc = mBridges.at(i); delete eandc; diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 68454bcd60..259332a3ff 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -673,7 +673,7 @@ void LLPreviewTexture::adjustAspectRatio() std::string ratio = std::to_string(num)+":" + std::to_string(denom); mRatiosList.push_back(ratio); combo->add(ratio); - combo->setCurrentByIndex(mRatiosList.size()- 1); + combo->setCurrentByIndex(static_cast<S32>(mRatiosList.size()) - 1); } else { diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 2604c2ba53..79c07d8c09 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -56,7 +56,7 @@ void LLReflectionMap::update(U32 resolution, U32 face, bool force_dynamic, F32 n llassert(mCubeArray.notNull()); llassert(mCubeIndex != -1); //llassert(LLPipeline::sRenderDeferred); - + // make sure we don't walk off the edge of the render target while (resolution > gPipeline.mRT->deferredScreen.getWidth() || resolution > gPipeline.mRT->deferredScreen.getHeight()) @@ -65,7 +65,7 @@ void LLReflectionMap::update(U32 resolution, U32 face, bool force_dynamic, F32 n } F32 clip = (near_clip > 0) ? near_clip : getNearClip(); - + gViewerWindow->cubeSnapshot(LLVector3(mOrigin), mCubeArray, mCubeIndex, face, clip, getIsDynamic() || force_dynamic, useClipPlane, clipPlane); } @@ -145,7 +145,7 @@ void LLReflectionMap::autoAdjustOrigin() LLVector3 origin(fp); F32 height = LLWorld::instance().resolveLandHeightAgent(origin) + 2.f; fp[2] = llmax(fp[2], height); - + // make sure radius encompasses all objects LLSimdScalar r2 = 0.0; for (int i = 0; i < 8; ++i) @@ -165,7 +165,7 @@ void LLReflectionMap::autoAdjustOrigin() // make sure near clip doesn't poke through ground fp[2] = llmax(fp[2], height+mRadius*0.5f); - + } } else if (mViewerObject && !mViewerObject->isDead()) @@ -237,7 +237,7 @@ F32 LLReflectionMap::getNearClip() bool LLReflectionMap::getIsDynamic() { if (gSavedSettings.getS32("RenderReflectionProbeDetail") > (S32) LLReflectionMapManager::DetailLevel::STATIC_ONLY && - mViewerObject && + mViewerObject && mViewerObject->getVolume()) { return ((LLVOVolume*)mViewerObject)->getReflectionProbeIsDynamic(); @@ -247,7 +247,7 @@ bool LLReflectionMap::getIsDynamic() } bool LLReflectionMap::getBox(LLMatrix4& box) -{ +{ if (mViewerObject) { LLVolume* volume = mViewerObject->getVolume(); @@ -270,7 +270,7 @@ bool LLReflectionMap::getBox(LLMatrix4& box) // construct object to camera space (with scale) mv = mv * rm * scale; - // inverse is camera space to object unit cube + // inverse is camera space to object unit cube mv = mv.inverse(); box = LLMatrix4(mv.m); @@ -337,7 +337,7 @@ void LLReflectionMap::doOcclusion(const LLVector4a& eye) mOccluded = false; return; } - + if (mOcclusionQuery == 0) { // no query was previously issued, allocate one and issue LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("rmdo - glGenQueries"); diff --git a/indra/newview/llreflectionmap.h b/indra/newview/llreflectionmap.h index 9e888f20d0..117ea4cfa6 100644 --- a/indra/newview/llreflectionmap.h +++ b/indra/newview/llreflectionmap.h @@ -36,7 +36,7 @@ class alignas(16) LLReflectionMap : public LLRefCount { LL_ALIGN_NEW public: - + enum class ProbeType { ALL = 0, @@ -44,8 +44,8 @@ public: IRRADIANCE, REFLECTION }; - - // allocate an environment map of the given resolution + + // allocate an environment map of the given resolution LLReflectionMap(); ~LLReflectionMap(); @@ -86,7 +86,7 @@ public: // point at which environment map was last generated from (in agent space) LLVector4a mOrigin; - + // distance from main viewer camera F32 mDistance = -1.f; @@ -106,7 +106,7 @@ public: // cube map used to sample this environment map LLPointer<LLCubeMapArray> mCubeArray; S32 mCubeIndex = -1; // index into cube map array or -1 if not currently stored in cube map array - + // probe has had at least one full update and is ready to render bool mComplete = false; @@ -136,7 +136,7 @@ public: GLuint mOcclusionQuery = 0; bool mOccluded = false; U32 mOcclusionPendingFrames = 0; - + ProbeType mType; }; diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index f62cac3276..cb1ab0dac2 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -233,7 +233,7 @@ void LLReflectionMapManager::update() U32 count = log2((F32)res) + 0.5f; mMipChain.resize(count); - for (int i = 0; i < count; ++i) + for (U32 i = 0; i < count; ++i) { mMipChain[i].allocate(res, res, GL_RGB16F); res /= 2; @@ -316,7 +316,7 @@ void LLReflectionMapManager::update() // next distribute the free indices U32 count = llmin(mReflectionProbeCount, (U32)mProbes.size()); - for (S32 i = 1; i < count && !mCubeFree.empty(); ++i) + for (U32 i = 1; i < count && !mCubeFree.empty(); ++i) { // find the closest probe that needs a cube index LLReflectionMap* probe = mProbes[i]; @@ -330,7 +330,7 @@ void LLReflectionMapManager::update() } } - for (int i = 0; i < mProbes.size(); ++i) + for (unsigned int i = 0; i < mProbes.size(); ++i) { LLReflectionMap* probe = mProbes[i]; if (probe->getNumRefs() == 1) @@ -787,7 +787,7 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face) res /= 2; - S32 mip = i - (mMipChain.size() - mips); + GLint mip = i - (static_cast<GLint>(mMipChain.size()) - mips); if (mip >= 0) { @@ -1081,8 +1081,8 @@ void LLReflectionMapManager::updateUniforms() // 4. For each bucket, store the index of the nearest probe that might influence pixels in that bucket // 5. In the shader, lookup the bucket for the pixel depth to get the index of the first probe that could possibly influence // the current pixel. - int depth_min = llclamp(llfloor(refmap->mMinDepth), 0, 255); - int depth_max = llclamp(llfloor(refmap->mMaxDepth), 0, 255); + unsigned int depth_min = llclamp(llfloor(refmap->mMinDepth), 0, 255); + unsigned int depth_max = llclamp(llfloor(refmap->mMaxDepth), 0, 255); for (U32 i = depth_min; i <= depth_max; ++i) { if (refmap->mMinDepth < minDepth[i]) diff --git a/indra/newview/llreflectionmapmanager.h b/indra/newview/llreflectionmapmanager.h index 5c0651bc24..f81fb30738 100644 --- a/indra/newview/llreflectionmapmanager.h +++ b/indra/newview/llreflectionmapmanager.h @@ -67,7 +67,7 @@ public: // add a probe for the given spatial group LLReflectionMap* addProbe(LLSpatialGroup* group = nullptr); - + // Populate "maps" with the N most relevant Reflection Maps where N is no more than maps.size() // If less than maps.size() ReflectionMaps are available, will assign trailing elements to nullptr. // maps -- presized array of Reflection Map pointers @@ -160,7 +160,7 @@ private: // update the specified face of the specified probe void updateProbeFace(LLReflectionMap* probe, U32 face); - + // list of active reflection maps std::vector<LLPointer<LLReflectionMap> > mProbes; diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 8e45a60f86..cdccaf44e9 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -527,7 +527,7 @@ void LLSceneMonitor::dumpToFile(const std::string &file_name) os << std::setprecision(10); LLTrace::PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults(); - const U32 frame_count = scene_load_recording.getNumRecordedPeriods(); + const auto frame_count = scene_load_recording.getNumRecordedPeriods(); F64Seconds frame_time; diff --git a/indra/newview/llsceneview.cpp b/indra/newview/llsceneview.cpp index 26859800fd..a61474636a 100644 --- a/indra/newview/llsceneview.cpp +++ b/indra/newview/llsceneview.cpp @@ -102,7 +102,7 @@ void LLSceneView::draw() LLViewerRegion* region = gAgent.getRegion(); if (region) { - for (U32 i = 0; i < gObjectList.getNumObjects(); ++i) + for (S32 i = 0; i < gObjectList.getNumObjects(); ++i) { LLViewerObject* object = gObjectList.getObject(i); @@ -194,13 +194,13 @@ void LLSceneView::draw() F32 size_range = size_domain[1]-size_domain[0]; - U32 count = size[idx].size(); + auto count = size[idx].size(); F32 total = 0.f; gGL.begin(LLRender::LINE_STRIP); - for (U32 i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { F32 rad = size[idx][i]; total += rad; @@ -260,11 +260,11 @@ void LLSceneView::draw() U32 triangle_range = tri_domain[1]-tri_domain[0]; - U32 count = triangles[idx].size(); + auto count = triangles[idx].size(); gGL.begin(LLRender::LINE_STRIP); //plot triangles - for (U32 i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { U32 tri_count = triangles[idx][i]; F32 y = (F32) (tri_count-tri_domain[0])/triangle_range*tri_rect.getHeight()+tri_rect.mBottom; @@ -325,13 +325,13 @@ void LLSceneView::draw() F32 cost_range = streaming_domain[1]-streaming_domain[0]; - U32 count = streaming_cost[idx].size(); + auto count = streaming_cost[idx].size(); F32 total = 0; gGL.begin(LLRender::LINE_STRIP); //plot triangles - for (U32 i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { F32 sc = streaming_cost[idx][i]; total += sc; @@ -391,13 +391,13 @@ void LLSceneView::draw() F32 cost_range = physics_domain[1]-physics_domain[0]; - U32 count = physics_cost[idx].size(); + auto count = physics_cost[idx].size(); F32 total = 0; gGL.begin(LLRender::LINE_STRIP); //plot triangles - for (U32 i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) { F32 pc = physics_cost[idx][i]; total += pc; diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp index 104bf79832..2d8a5eaf13 100644 --- a/indra/newview/llsechandler_basic.cpp +++ b/indra/newview/llsechandler_basic.cpp @@ -75,7 +75,7 @@ LLBasicCertificate::LLBasicCertificate(const std::string& pem_cert, { // BIO_new_mem_buf returns a read only bio, but takes a void* which isn't const // so we need to cast it. - BIO * pem_bio = BIO_new_mem_buf((void*)pem_cert.c_str(), pem_cert.length()); + BIO * pem_bio = BIO_new_mem_buf((void*)pem_cert.c_str(), static_cast<int>(pem_cert.length())); if(pem_bio == NULL) { LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL; @@ -747,7 +747,7 @@ bool _cert_subdomain_wildcard_match(const std::string& subdomain, { // split wildcard into the portion before the *, and the portion after - int wildcard_pos = wildcard.find_first_of('*'); + auto wildcard_pos = wildcard.find_first_of('*'); // check the case where there is no wildcard. if(wildcard_pos == wildcard.npos) { @@ -779,7 +779,7 @@ bool _cert_subdomain_wildcard_match(const std::string& subdomain, std::string new_subdomain = subdomain.substr(wildcard_pos, subdomain.npos); // iterate through the current subdomain, finding instances of the match string. - int sub_pos = new_subdomain.find_first_of(new_wildcard_match_string); + auto sub_pos = new_subdomain.find_first_of(new_wildcard_match_string); while(sub_pos != std::string::npos) { new_subdomain = new_subdomain.substr(sub_pos, std::string::npos); @@ -811,8 +811,8 @@ bool _cert_hostname_wildcard_match(const std::string& hostname, const std::strin std::string new_cn = common_name; // find the last '.' in the hostname and the match name. - int subdomain_pos = new_hostname.find_last_of('.'); - int subcn_pos = new_cn.find_last_of('.'); + auto subdomain_pos = new_hostname.find_last_of('.'); + auto subcn_pos = new_cn.find_last_of('.'); // if the last char is a '.', strip it if(subdomain_pos == (new_hostname.length()-1)) @@ -1860,7 +1860,7 @@ std::string LLSecAPIBasicHandler::_legacyLoadPassword() unsigned char unique_id[MAC_ADDRESS_BYTES]; LLMachineID::getUniqueID(unique_id, sizeof(unique_id)); LLXORCipher cipher(unique_id, sizeof(unique_id)); - cipher.decrypt(&buffer[0], buffer.size()); + cipher.decrypt(&buffer[0], static_cast<U32>(buffer.size())); return std::string((const char*)&buffer[0], buffer.size()); } diff --git a/indra/newview/llsechandler_basic.h b/indra/newview/llsechandler_basic.h index b4108d0c0e..1484c6d0e1 100644 --- a/indra/newview/llsechandler_basic.h +++ b/indra/newview/llsechandler_basic.h @@ -138,7 +138,7 @@ public: virtual iterator find(const LLSD& params); // return the number of certs in the store - virtual int size() const { return mCerts.size(); } + virtual int size() const { return static_cast<int>(mCerts.size()); } // insert the cert to the store. if a copy of the cert already exists in the store, it is removed first virtual void add(LLPointer<LLCertificate> cert) { insert(end(), cert); } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index a690e4bb88..b3420f9c57 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -7676,7 +7676,7 @@ void LLObjectSelection::updateEffects() S32 LLObjectSelection::getNumNodes() { - return mList.size(); + return static_cast<S32>(mList.size()); } void LLObjectSelection::addNode(LLSelectNode *nodep) @@ -7743,7 +7743,7 @@ bool LLObjectSelection::isEmpty() const S32 LLObjectSelection::getObjectCount() { cleanupNodes(); - S32 count = mList.size(); + S32 count = static_cast<S32>(mList.size()); return count; } @@ -8482,7 +8482,7 @@ bool LLSelectMgr::selectionMove(const LLVector3& displ, if (enable_rot) { - int children_count = obj->getChildren().size(); + auto children_count = obj->getChildren().size(); if (obj_count > 1 && children_count > 0) { // for linked sets, rotate around the group center diff --git a/indra/newview/llsetkeybinddialog.cpp b/indra/newview/llsetkeybinddialog.cpp index 6508220c1e..e172e15a0e 100644 --- a/indra/newview/llsetkeybinddialog.cpp +++ b/indra/newview/llsetkeybinddialog.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llsetkeybinddialog.cpp * @brief LLSetKeyBindDialog class implementation. * * $LicenseInfo:firstyear=2019&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2019, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/llsetkeybinddialog.h b/indra/newview/llsetkeybinddialog.h index 57ec65f7f3..195b4d77d9 100644 --- a/indra/newview/llsetkeybinddialog.h +++ b/indra/newview/llsetkeybinddialog.h @@ -1,25 +1,25 @@ -/** +/** * @file llsetkeybinddialog.h * @brief LLSetKeyBindDialog class definition * * $LicenseInfo:firstyear=2019&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2019, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/llsettingspicker.cpp b/indra/newview/llsettingspicker.cpp index 6054bd026c..85f0678c4c 100644 --- a/indra/newview/llsettingspicker.cpp +++ b/indra/newview/llsettingspicker.cpp @@ -1,4 +1,4 @@ -/** +/** * @author Rider Linden * @brief LLSettingsPicker class header file including related functions * @@ -82,7 +82,7 @@ LLFloaterSettingsPicker::LLFloaterSettingsPicker(LLView * owner, LLUUID initial_ } -LLFloaterSettingsPicker::~LLFloaterSettingsPicker() +LLFloaterSettingsPicker::~LLFloaterSettingsPicker() { } @@ -99,7 +99,7 @@ bool LLFloaterSettingsPicker::postBuild() mFilterEdit = getChild<LLFilterEditor>(FLT_INVENTORY_SEARCH); mFilterEdit->setCommitCallback([this](LLUICtrl*, const LLSD& param){ onFilterEdit(param.asString()); }); - + mInventoryPanel = getChild<LLInventoryPanel>(PNL_INVENTORY); if (mInventoryPanel) { @@ -160,7 +160,7 @@ void LLFloaterSettingsPicker::setValue(const LLSD& value) mSettingItemID = value.asUUID(); } -LLSD LLFloaterSettingsPicker::getValue() const +LLSD LLFloaterSettingsPicker::getValue() const { return LLSD(mSettingItemID); } @@ -326,7 +326,7 @@ void LLFloaterSettingsPicker::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr // track 1 always present track_selection->add(getString(STR_TRACK_GROUND), LLSD::Integer(LLSettingsDay::TRACK_GROUND_LEVEL), ADD_TOP, true); LLUIString formatted_label = getString(STR_TRACK_SKY); - for (int i = 2; i < LLSettingsDay::TRACK_MAX; i++) + for (U32 i = 2; i < LLSettingsDay::TRACK_MAX; i++) { if (!pday->isTrackEmpty(i)) { @@ -335,7 +335,7 @@ void LLFloaterSettingsPicker::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr } } } - + mSettingAssetID = asset_id; track_selection->setEnabled(true); track_selection->selectFirstItem(); diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 6ac4d56b74..42927769de 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -1404,7 +1404,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress() const U32 flags = getFlags(); LLSettingsDay::ptr_t day_clone = std::make_shared<LLSettingsVODay>(settings); - for (S32 i = 0; i < LLSettingsDay::TRACK_MAX; ++i) + for (U32 i = 0; i < LLSettingsDay::TRACK_MAX; ++i) { const LLSettingsDay::CycleTrack_t& track = getCycleTrackConst(i); LLSettingsDay::CycleTrack_t::const_iterator iter = track.begin(); diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index c07d4b7e56..0d81f2c099 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -505,7 +505,7 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem() U32 LLSidepanelInventory::getSelectedCount() { - int count = 0; + size_t count = 0; std::set<LLFolderViewItem*> selection_list = mPanelMainInventory->getActivePanel()->getRootFolder()->getSelectionList(); count += selection_list.size(); @@ -517,7 +517,7 @@ U32 LLSidepanelInventory::getSelectedCount() count += selection_list.size(); } - return count; + return static_cast<U32>(count); } LLInventoryPanel *LLSidepanelInventory::getActivePanel() diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index 4ffbd8a562..9b4ed4c946 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -137,7 +137,7 @@ void LLSkinningUtil::initSkinningMatrixPalette( LLMatrix4a world[LL_CHARACTER_MAX_ANIMATED_JOINTS]; - for (U32 j = 0; j < count; ++j) + for (S32 j = 0; j < count; ++j) { S32 joint_num = skin->mJointNums[j]; LLJoint *joint = avatar->getJoint(joint_num); @@ -200,7 +200,7 @@ void LLSkinningUtil::checkSkinWeights(LLVector4a* weights, U32 num_vertices, con void LLSkinningUtil::scrubSkinWeights(LLVector4a* weights, U32 num_vertices, const LLMeshSkinInfo* skin) { - const S32 max_joints = skin->mJointNames.size(); + const S32 max_joints = static_cast<S32>(skin->mJointNames.size()); for (U32 j=0; j<num_vertices; j++) { F32 *w = weights[j].getF32ptr(); @@ -324,7 +324,7 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a if (vol_face.mJointRiggingInfoTab.needsUpdate()) { S32 num_verts = vol_face.mNumVertices; - S32 num_joints = skin->mJointNames.size(); + S32 num_joints = static_cast<S32>(skin->mJointNames.size()); if (num_verts > 0 && vol_face.mWeights && num_joints > 0) { initJointNums(const_cast<LLMeshSkinInfo*>(skin), avatar); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 513b7b0c22..782d57aed8 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2364,12 +2364,12 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume, bool wireframe LLCDMeshData mesh; mesh.mIndexBase = &index[0]; mesh.mVertexBase = pos[0].mV; - mesh.mNumVertices = pos.size(); + mesh.mNumVertices = static_cast<int>(pos.size()); mesh.mVertexStrideBytes = 12; mesh.mIndexStrideBytes = 6; mesh.mIndexType = LLCDMeshData::INT_16; - mesh.mNumTriangles = index.size()/3; + mesh.mNumTriangles = static_cast<int>(index.size())/3; LLCDMeshData res; diff --git a/indra/newview/llsplitbutton.cpp b/indra/newview/llsplitbutton.cpp index 77eedeaf2f..6c252ed31f 100644 --- a/indra/newview/llsplitbutton.cpp +++ b/indra/newview/llsplitbutton.cpp @@ -216,7 +216,7 @@ LLSplitButton::LLSplitButton(const LLSplitButton::Params& p) //a panel for hidden item buttons LLPanel::Params panel_params = p.items_panel; - mItemsPanel= prepareItemsPanel(panel_params, p.items.numValidElements()); + mItemsPanel= prepareItemsPanel(panel_params, static_cast<S32>(p.items.numValidElements())); addChild(mItemsPanel); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index cfdf3a0f56..dd005874a5 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -386,7 +386,7 @@ bool idle_startup() const std::string delims (" "); std::string system; - int begIdx, endIdx; + size_t begIdx, endIdx; std::string osString = LLOSInfo::instance().getOSStringSimple(); begIdx = osString.find_first_not_of (delims); @@ -3650,7 +3650,7 @@ bool process_login_success_response() if (!look_at_str.empty()) { size_t len = look_at_str.size(); - LLMemoryStream mstr((U8*)look_at_str.c_str(), len); + LLMemoryStream mstr((U8*)look_at_str.c_str(), static_cast<S32>(len)); LLSD sd = LLSDSerialize::fromNotation(mstr, len); gAgentStartLookAt = ll_vector3_from_sd(sd); } @@ -3688,7 +3688,7 @@ bool process_login_success_response() if(!home_location.empty()) { size_t len = home_location.size(); - LLMemoryStream mstr((U8*)home_location.c_str(), len); + LLMemoryStream mstr((U8*)home_location.c_str(), static_cast<S32>(len)); LLSD sd = LLSDSerialize::fromNotation(mstr, len); S32 region_x = sd["region_handle"][0].asInteger(); S32 region_y = sd["region_handle"][1].asInteger(); diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index cb08421606..843da97089 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -1375,13 +1375,13 @@ U32 LLTextureCache::openAndReadEntries(std::vector<Entry>& entries) void LLTextureCache::writeEntriesAndClose(const std::vector<Entry>& entries) { - S32 num_entries = entries.size(); + auto num_entries = entries.size(); llassert_always(num_entries == mHeaderEntriesInfo.mEntries); if (!mReadOnly) { LLAPRFile* aprfile = openHeaderEntriesFile(false, (S32)sizeof(EntriesInfo)); - for (S32 idx=0; idx<num_entries; idx++) + for (size_t idx=0; idx<num_entries; idx++) { S32 bytes_written = aprfile->write((void*)(&entries[idx]), (S32)sizeof(Entry)); if(bytes_written != sizeof(Entry)) diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h index 70766b0605..faf722dc8f 100644 --- a/indra/newview/lltexturecache.h +++ b/indra/newview/lltexturecache.h @@ -140,8 +140,8 @@ public: void unlockWorkers() { mWorkersMutex.unlock(); } // debug - S32 getNumReads() { return mReaders.size(); } - S32 getNumWrites() { return mWriters.size(); } + S32 getNumReads() { return static_cast<S32>(mReaders.size()); } + S32 getNumWrites() { return static_cast<S32>(mWriters.size()); } S64Bytes getUsage() { return S64Bytes(mTexturesSizeTotal); } S64Bytes getMaxUsage() { return S64Bytes(sCacheMaxTexturesSize); } U32 getEntries() { return mHeaderEntriesInfo.mEntries; } diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 56d0480be4..ee13baaa18 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1655,7 +1655,7 @@ bool LLTextureFetchWorker::doWork(S32 param) return true; } - S32 append_size(mHttpBufferArray->size()); + S32 append_size(static_cast<S32>(mHttpBufferArray->size())); S32 total_size(cur_size + append_size); S32 src_offset(0); llassert_always(append_size == mRequestedSize); @@ -1664,7 +1664,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // In case of a partial response, our offset may // not be trivially contiguous with the data we have. // Get back into alignment. - if ( (mHttpReplyOffset > cur_size) || (cur_size > mHttpReplyOffset + append_size)) + if ( ((S32)mHttpReplyOffset > cur_size) || (cur_size > (S32)mHttpReplyOffset + append_size)) { LL_WARNS(LOG_TXT) << "Partial HTTP response produces break in image data for texture " << mID << ". Aborting load." << LL_ENDL; @@ -2193,7 +2193,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(LLCore::HttpResponse * response, { // get length of stream: LLCore::BufferArray * body(response->getBody()); - data_size = body ? body->size() : 0; + data_size = body ? static_cast<S32>(body->size()) : 0; LL_DEBUGS(LOG_TXT) << "HTTP RECEIVED: " << mID.asString() << " Bytes: " << data_size << LL_ENDL; if (data_size > 0) @@ -3405,7 +3405,7 @@ void LLTextureFetch::cancelHttpWaiters() int LLTextureFetch::getHttpWaitersCount() { mNetworkQueueMutex.lock(); // +Mfnq - int ret(mHttpWaitResource.size()); + int ret(static_cast<int>(mHttpWaitResource.size())); mNetworkQueueMutex.unlock(); // -Mfnq return ret; } diff --git a/indra/newview/lltextureinfo.cpp b/indra/newview/lltextureinfo.cpp index e3c3864025..84ef45c97a 100644 --- a/indra/newview/lltextureinfo.cpp +++ b/indra/newview/lltextureinfo.cpp @@ -80,7 +80,7 @@ void LLTextureInfo::addRequest(const LLUUID& id) U32 LLTextureInfo::getTextureInfoMapSize() { - return mTextures.size(); + return static_cast<U32>(mTextures.size()); } bool LLTextureInfo::has(const LLUUID& id) diff --git a/indra/newview/lltoastalertpanel.cpp b/indra/newview/lltoastalertpanel.cpp index c8502d78ca..05ac9dacf3 100644 --- a/indra/newview/lltoastalertpanel.cpp +++ b/indra/newview/lltoastalertpanel.cpp @@ -161,14 +161,14 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal options = supplied_options; } - S32 num_options = options.size(); + auto num_options = options.size(); // Calc total width of buttons S32 button_width = 0; S32 sp = font->getWidth(std::string("OO")); S32 btn_total_width = 0; S32 default_size_btns = 0; - for( S32 i = 0; i < num_options; i++ ) + for (size_t i = 0; i < num_options; i++) { S32 w = S32(font->getWidth( options[i].second ) + 0.99f) + sp + 2 * LLBUTTON_H_PAD; if (mButtonData[i].mWidth > w) @@ -184,7 +184,7 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal if( num_options > 1 ) { - btn_total_width = btn_total_width + (button_width * default_size_btns) + ((num_options - 1) * BTN_HPAD); + btn_total_width = btn_total_width + (button_width * default_size_btns) + ((static_cast<S32>(num_options) - 1) * BTN_HPAD); } else { diff --git a/indra/newview/lltoastpanel.cpp b/indra/newview/lltoastpanel.cpp index b50f38354c..0ac2653021 100644 --- a/indra/newview/lltoastpanel.cpp +++ b/indra/newview/lltoastpanel.cpp @@ -216,7 +216,7 @@ bool LLCheckBoxToastPanel::setCheckBox(const std::string& check_title, S32 dialog_width = max_msg_width + 2 * h_pad; S32 dialog_height = LLToastPanel::getRect().getHeight(); - dialog_height += LINE_HEIGHT * lines.size(); + dialog_height += LINE_HEIGHT * static_cast<S32>(lines.size()); dialog_height += LINE_HEIGHT / 2; LLToastPanel::reshape(dialog_width, dialog_height, false); @@ -227,7 +227,7 @@ bool LLCheckBoxToastPanel::setCheckBox(const std::string& check_title, LLRect check_rect; // if we are part of the toast, we need to leave space for buttons S32 msg_y = v_pad + (parent_view ? 0 : (BTN_HEIGHT + LINE_HEIGHT / 2)); - mCheck->setRect(check_rect.setOriginAndSize(msg_x, msg_y, max_msg_width, LINE_HEIGHT*lines.size())); + mCheck->setRect(check_rect.setOriginAndSize(msg_x, msg_y, max_msg_width, LINE_HEIGHT * static_cast<S32>(lines.size()))); mCheck->setLabel(check_title); mCheck->setCommitCallback(cb); diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index fdd9e88fb1..6d0704a469 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -363,16 +363,13 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, items, LLInventoryModel::EXCLUDE_TRASH, is_not_preferred); - S32 count = cats.size(); - S32 i; - for(i = 0; i < count; ++i) + for (auto& cat : cats) { - folder_ids.push_back(cats.at(i)->getUUID()); + folder_ids.emplace_back(cat->getUUID()); } - count = items.size(); - for(i = 0; i < count; ++i) + for (auto& item : items) { - item_ids.push_back(items.at(i)->getUUID()); + item_ids.emplace_back(item->getUUID()); } if (!folder_ids.empty() || !item_ids.empty()) { @@ -414,9 +411,9 @@ void LLToolDragAndDrop::beginMultiDrag( { // find categories (i.e. inventory folders) in the cargo. LLInventoryCategory* cat = NULL; - S32 count = llmin(cargo_ids.size(), types.size()); - std::set<LLUUID> cat_ids; - for(S32 i = 0; i < count; ++i) + auto count = llmin(cargo_ids.size(), types.size()); + uuid_set_t cat_ids; + for (size_t i = 0; i < count; ++i) { cat = gInventory.getCategory(cargo_ids[i]); if (cat) @@ -434,10 +431,9 @@ void LLToolDragAndDrop::beginMultiDrag( items, LLInventoryModel::EXCLUDE_TRASH, is_not_preferred); - S32 cat_count = cats.size(); - for(S32 i = 0; i < cat_count; ++i) + for (auto& cat : cats) { - cat_ids.insert(cat->getUUID()); + cat_ids.emplace(cat->getUUID()); } } } @@ -2669,7 +2665,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory( // *HACK: In order to resolve SL-22177, we need to block drags // from notecards and objects onto other objects. - if ((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource)) + if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource)) { return ACCEPT_NO; } diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h index 364319dc56..ad6402c4ad 100644 --- a/indra/newview/lltooldraganddrop.h +++ b/indra/newview/lltooldraganddrop.h @@ -87,7 +87,7 @@ public: void setCargoCount(U32 count) { mCargoCount = count; } void resetCargoCount() { mCargoCount = 0; } - U32 getCargoCount() const { return (mCargoCount > 0) ? mCargoCount : mCargoIDs.size(); } + U32 getCargoCount() const { return (mCargoCount > 0) ? mCargoCount : static_cast<S32>(mCargoIDs.size()); } S32 getCargoIndex() const { return mCurItemIndex; } static S32 getOperationId() { return sOperationId; } diff --git a/indra/newview/lltrackpicker.cpp b/indra/newview/lltrackpicker.cpp index 72e12a7192..bef314f964 100644 --- a/indra/newview/lltrackpicker.cpp +++ b/indra/newview/lltrackpicker.cpp @@ -1,4 +1,4 @@ -/** +/** * @author AndreyK Productengine * @brief LLTrackPicker class header file including related functions * diff --git a/indra/newview/lltrackpicker.h b/indra/newview/lltrackpicker.h index 49cc1a5c64..eda8259d33 100644 --- a/indra/newview/lltrackpicker.h +++ b/indra/newview/lltrackpicker.h @@ -1,4 +1,4 @@ -/** +/** * @file lltrackpicker.h * @author AndreyK Productengine * @brief LLTrackPicker class header file including related functions @@ -6,21 +6,21 @@ * $LicenseInfo:firstyear=2018&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2018, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index ae3bcfdf79..b6fbcaa330 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -1148,7 +1148,7 @@ std::string LLTranslate::addNoTranslateTags(std::string mesg) upd_msg.insert(dif + match.getStart(), AZURE_NOTRANSLATE_OPENING_TAG); upd_msg.insert(dif + AZURE_NOTRANSLATE_OPENING_TAG.size() + match.getEnd() + 1, AZURE_NOTRANSLATE_CLOSING_TAG); mesg.erase(match.getStart(), match.getEnd() - match.getStart()); - dif += match.getEnd() - match.getStart() + AZURE_NOTRANSLATE_OPENING_TAG.size() + AZURE_NOTRANSLATE_CLOSING_TAG.size(); + dif += match.getEnd() - match.getStart() + static_cast<S32>(AZURE_NOTRANSLATE_OPENING_TAG.size() + AZURE_NOTRANSLATE_CLOSING_TAG.size()); } return upd_msg; } @@ -1170,9 +1170,9 @@ std::string LLTranslate::removeNoTranslateTags(std::string mesg) { std::string upd_msg(mesg); LLUrlMatch match; - S32 opening_tag_size = AZURE_NOTRANSLATE_OPENING_TAG.size(); - S32 closing_tag_size = AZURE_NOTRANSLATE_CLOSING_TAG.size(); - S32 dif = 0; + auto opening_tag_size = AZURE_NOTRANSLATE_OPENING_TAG.size(); + auto closing_tag_size = AZURE_NOTRANSLATE_CLOSING_TAG.size(); + size_t dif = 0; //remove 'no-translate' tags we added to the links before while (LLUrlRegistry::instance().findUrl(mesg, match)) { diff --git a/indra/newview/lluploaddialog.cpp b/indra/newview/lluploaddialog.cpp index ec54123074..4961d38f8e 100644 --- a/indra/newview/lluploaddialog.cpp +++ b/indra/newview/lluploaddialog.cpp @@ -102,7 +102,7 @@ void LLUploadDialog::setMessage( const std::string& msg) S32 max_msg_width = 0; std::list<std::string> msg_lines; - S32 size = msg.size() + 1; + auto size = msg.size() + 1; std::vector<char> temp_msg(size); // non-const copy to make strtok happy strcpy( &temp_msg[0], msg.c_str()); char* token = strtok( &temp_msg[0], "\n" ); @@ -117,7 +117,7 @@ void LLUploadDialog::setMessage( const std::string& msg) S32 line_height = font->getLineHeight(); S32 dialog_width = max_msg_width + 2 * HPAD; - S32 dialog_height = line_height * msg_lines.size() + 2 * VPAD; + S32 dialog_height = line_height * static_cast<S32>(msg_lines.size()) + 2 * VPAD; reshape( dialog_width, dialog_height, false ); diff --git a/indra/newview/llurl.cpp b/indra/newview/llurl.cpp index a4eb231341..6bff31122e 100644 --- a/indra/newview/llurl.cpp +++ b/indra/newview/llurl.cpp @@ -71,7 +71,7 @@ void LLURL::init(const char * url) char *parse; char *leftover_url = url_copy; - S32 span = 0; + size_t span = 0; // copy and lop off tag if ((parse = strchr(url_copy,'#'))) diff --git a/indra/newview/llurllineeditorctrl.cpp b/indra/newview/llurllineeditorctrl.cpp index c3b6167a7e..de0ed645eb 100644 --- a/indra/newview/llurllineeditorctrl.cpp +++ b/indra/newview/llurllineeditorctrl.cpp @@ -89,5 +89,5 @@ void LLURLLineEditor::copyEscapedURLToClipboard() else // human-readable location text_to_copy = utf8str_to_wstring(unescaped_text); - LLClipboard::instance().copyToClipboard(text_to_copy, 0, text_to_copy.size()); + LLClipboard::instance().copyToClipboard(text_to_copy, 0, static_cast<S32>(text_to_copy.size())); } diff --git a/indra/newview/llurlwhitelist.cpp b/indra/newview/llurlwhitelist.cpp index f5651646a6..e2d2fe00e2 100644 --- a/indra/newview/llurlwhitelist.cpp +++ b/indra/newview/llurlwhitelist.cpp @@ -128,8 +128,8 @@ bool LLUrlWhiteList::clear () std::string url_cleanup(std::string pattern) { LLStringUtil::trim(pattern); - S32 length = pattern.length(); - S32 position = 0; + size_t length = pattern.length(); + size_t position = 0; std::string::reverse_iterator it = pattern.rbegin(); ++it; // skip last char, might be '/' ++position; @@ -139,7 +139,7 @@ std::string url_cleanup(std::string pattern) if (c == '/') { // found second to last '/' - S32 desired_length = length - position; + auto desired_length = length - position; LLStringUtil::truncate(pattern, desired_length); break; } diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 06410e4d6d..26707f5d9a 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -542,7 +542,7 @@ void LLViewerAssetStorage::assetRequestCoro( const LLSD::Binary &raw = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW].asBinary(); - S32 size = raw.size(); + S32 size = static_cast<S32>(raw.size()); if (size > 0) { mTotalBytesFetched += size; diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index 17d440d8c9..337c18f218 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -606,7 +606,7 @@ LLSD LLNewBufferedResourceUploadInfo::exportTempFile() // copy buffer to the cache for upload LLFileSystem file(getAssetId(), getAssetType(), LLFileSystem::APPEND); - file.write((U8*) mBuffer.c_str(), mBuffer.size()); + file.write((U8*) mBuffer.c_str(), static_cast<S32>(mBuffer.size())); return LLSD(); } @@ -708,7 +708,7 @@ LLSD LLBufferedAssetUploadInfo::prepareUpload() LLFileSystem file(getAssetId(), getAssetType(), LLFileSystem::APPEND); - S32 size = mContents.length() + 1; + S32 size = static_cast<S32>(mContents.length()) + 1; file.write((U8*)mContents.c_str(), size); mStoredToCache = true; diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index 7ed8bebcb3..a070711727 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -816,7 +816,7 @@ bool LLViewerCamera::areVertsVisible(LLViewerObject* volumep, bool all_verts) { const LLVolumeFace& face = volume->getVolumeFace(i); - for (U32 v = 0; v < face.mNumVertices; v++) + for (S32 v = 0; v < face.mNumVertices; v++) { const LLVector4a& src_vec = face.mPositions[v]; LLVector4a vec; diff --git a/indra/newview/llviewercontrol.h b/indra/newview/llviewercontrol.h index 866c929f71..b69b065d10 100644 --- a/indra/newview/llviewercontrol.h +++ b/indra/newview/llviewercontrol.h @@ -1,25 +1,25 @@ -/** +/** * @file llviewercontrol.h * @brief references to viewer-specific control files * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -32,7 +32,7 @@ // Enabled this definition to compile a 'hacked' viewer that // allows a hacked godmode to be toggled on and off. -#define TOGGLE_HACKED_GODLIKE_VIEWER +#define TOGGLE_HACKED_GODLIKE_VIEWER #ifdef TOGGLE_HACKED_GODLIKE_VIEWER extern bool gHackGodmode; #endif diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index b0853de932..09f77c0c29 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -971,7 +971,7 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot) { LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Texture Unbind"); - for (U32 i = 0; i < gGLManager.mNumTextureImageUnits; i++) + for (S32 i = 0; i < gGLManager.mNumTextureImageUnits; i++) { //dummy cleanup of any currently bound textures if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) { diff --git a/indra/newview/llviewergesture.cpp b/indra/newview/llviewergesture.cpp index 4ddddf03f5..eacf68dda5 100644 --- a/indra/newview/llviewergesture.cpp +++ b/indra/newview/llviewergesture.cpp @@ -156,7 +156,7 @@ LLGesture *LLViewerGestureList::create_gesture(U8 **buffer, S32 max_size) // output_str bool LLViewerGestureList::matchPrefix(const std::string& in_str, std::string* out_str) { - S32 in_len = in_str.length(); + S32 in_len = static_cast<S32>(in_str.length()); std::string in_str_lc = in_str; LLStringUtil::toLower(in_str_lc); diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp index 8cc2f1e5d6..ea3088613f 100644 --- a/indra/newview/llviewerinput.cpp +++ b/indra/newview/llviewerinput.cpp @@ -1124,7 +1124,7 @@ bool LLViewerInput::handleGlobalBindsKeyDown(KEY key, MASK mask) return false; } S32 mode = getMode(); - return scanKey(mGlobalKeyBindings[mode], mGlobalKeyBindings[mode].size(), key, mask, true, false, false, false); + return scanKey(mGlobalKeyBindings[mode], static_cast<S32>(mGlobalKeyBindings[mode].size()), key, mask, true, false, false, false); } bool LLViewerInput::handleGlobalBindsKeyUp(KEY key, MASK mask) @@ -1137,7 +1137,7 @@ bool LLViewerInput::handleGlobalBindsKeyUp(KEY key, MASK mask) } S32 mode = getMode(); - return scanKey(mGlobalKeyBindings[mode], mGlobalKeyBindings[mode].size(), key, mask, false, true, false, false); + return scanKey(mGlobalKeyBindings[mode], static_cast<S32>(mGlobalKeyBindings[mode].size()), key, mask, false, true, false, false); } bool LLViewerInput::handleGlobalBindsMouse(EMouseClickType clicktype, MASK mask, bool down) @@ -1153,18 +1153,18 @@ bool LLViewerInput::handleGlobalBindsMouse(EMouseClickType clicktype, MASK mask, S32 mode = getMode(); if (down) { - res = scanMouse(mGlobalMouseBindings[mode], mGlobalMouseBindings[mode].size(), clicktype, mask, MOUSE_STATE_DOWN, true); + res = scanMouse(mGlobalMouseBindings[mode], static_cast<S32>(mGlobalMouseBindings[mode].size()), clicktype, mask, MOUSE_STATE_DOWN, true); } else { - res = scanMouse(mGlobalMouseBindings[mode], mGlobalMouseBindings[mode].size(), clicktype, mask, MOUSE_STATE_UP, true); + res = scanMouse(mGlobalMouseBindings[mode], static_cast<S32>(mGlobalMouseBindings[mode].size()), clicktype, mask, MOUSE_STATE_UP, true); } return res; } bool LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, const std::string& function_name) { - S32 index; + size_t index; typedef boost::function<bool(EKeystate)> function_t; function_t function = NULL; std::string name; @@ -1211,7 +1211,7 @@ bool LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, cons // check for duplicate first and overwrite if (result->mIsGlobal) { - S32 size = mGlobalKeyBindings[mode].size(); + auto size = mGlobalKeyBindings[mode].size(); for (index = 0; index < size; index++) { if (key == mGlobalKeyBindings[mode][index].mKey && mask == mGlobalKeyBindings[mode][index].mMask) @@ -1223,7 +1223,7 @@ bool LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, cons } else { - S32 size = mKeyBindings[mode].size(); + auto size = mKeyBindings[mode].size(); for (index = 0; index < size; index++) { if (key == mKeyBindings[mode][index].mKey && mask == mKeyBindings[mode][index].mMask) @@ -1254,7 +1254,7 @@ bool LLViewerInput::bindKey(const S32 mode, const KEY key, const MASK mask, cons bool LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const MASK mask, const std::string& function_name) { - S32 index; + size_t index; typedef boost::function<bool(EKeystate)> function_t; function_t function = NULL; @@ -1293,7 +1293,7 @@ bool LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const // check for duplicate first and overwrite if (result->mIsGlobal) { - S32 size = mGlobalMouseBindings[mode].size(); + auto size = mGlobalMouseBindings[mode].size(); for (index = 0; index < size; index++) { if (mouse == mGlobalMouseBindings[mode][index].mMouse && mask == mGlobalMouseBindings[mode][index].mMask) @@ -1305,7 +1305,7 @@ bool LLViewerInput::bindMouse(const S32 mode, const EMouseClickType mouse, const } else { - S32 size = mMouseBindings[mode].size(); + auto size = mMouseBindings[mode].size(); for (index = 0; index < size; index++) { if (mouse == mMouseBindings[mode][index].mMouse && mask == mMouseBindings[mode][index].mMask) @@ -1608,7 +1608,7 @@ bool LLViewerInput::scanKey(KEY key, bool key_down, bool key_up, bool key_level) // don't process key down on repeated keys bool repeat = gKeyboard->getKeyRepeated(key); - bool res = scanKey(mKeyBindings[mode], mKeyBindings[mode].size(), key, mask, key_down, key_up, key_level, repeat); + bool res = scanKey(mKeyBindings[mode], static_cast<S32>(mKeyBindings[mode].size()), key, mask, key_down, key_up, key_level, repeat); return res; } @@ -1744,7 +1744,7 @@ bool LLViewerInput::scanMouse(EMouseClickType click, EMouseState state) const bool res = false; S32 mode = getMode(); MASK mask = gKeyboard->currentMask(true); - res = scanMouse(mMouseBindings[mode], mMouseBindings[mode].size(), click, mask, state, false); + res = scanMouse(mMouseBindings[mode], static_cast<S32>(mMouseBindings[mode].size()), click, mask, state, false); // No user defined actions found or those actions can't handle the key/button, // so handle CONTROL_LBUTTON if nessesary. @@ -1805,14 +1805,14 @@ void LLViewerInput::scanMouse() bool LLViewerInput::isMouseBindUsed(const EMouseClickType mouse, const MASK mask, const S32 mode) const { - S32 size = mMouseBindings[mode].size(); - for (S32 index = 0; index < size; index++) + auto size = mMouseBindings[mode].size(); + for (size_t index = 0; index < size; index++) { if (mouse == mMouseBindings[mode][index].mMouse && mask == mMouseBindings[mode][index].mMask) return true; } size = mGlobalMouseBindings[mode].size(); - for (S32 index = 0; index < size; index++) + for (size_t index = 0; index < size; index++) { if (mouse == mGlobalMouseBindings[mode][index].mMouse && mask == mGlobalMouseBindings[mode][index].mMask) return true; diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 88f88d7436..96541b030c 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -746,7 +746,7 @@ S32 LLViewerInventoryCategory::getViewerDescendentCount() const S32 descendents_actual = 0; if(cats && items) { - descendents_actual = cats->size() + items->size(); + descendents_actual = static_cast<S32>(cats->size() + items->size()); } return descendents_actual; } diff --git a/indra/newview/llviewerjointattachment.h b/indra/newview/llviewerjointattachment.h index 3869213cc5..fe66949f73 100644 --- a/indra/newview/llviewerjointattachment.h +++ b/indra/newview/llviewerjointattachment.h @@ -74,7 +74,7 @@ public: S32 getGroup() const { return mGroup; } S32 getPieSlice() const { return mPieSlice; } - S32 getNumObjects() const { return mAttachedObjects.size(); } + S32 getNumObjects() const { return static_cast<S32>(mAttachedObjects.size()); } S32 getNumAnimatedObjects() const; void clampObjectPosition(); diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index ebc9b88709..f0567b18c4 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -423,7 +423,7 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, bool damp_w const S32 offset = (S32) mMesh->mFaceVertexOffset; - for (S32 i = 0; i < idx_count; ++i) + for (U32 i = 0; i < idx_count; ++i) { *(idx++) = *(src_idx++)+offset; } diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 18ee227f68..e3da52fc78 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -587,7 +587,7 @@ void do_bulk_upload(std::vector<std::string> filenames, const LLSD& notification tinygltf::Model model; if (LLTinyGLTFHelper::loadModel(filename, model)) { - S32 materials_in_file = model.materials.size(); + S32 materials_in_file = static_cast<S32>(model.materials.size()); for (S32 i = 0; i < materials_in_file; i++) { @@ -644,7 +644,7 @@ bool get_bulk_upload_expected_cost(const std::vector<std::string>& filenames, S3 if (LLTinyGLTFHelper::loadModel(filename, model)) { - S32 materials_in_file = model.materials.size(); + S32 materials_in_file = static_cast<S32>(model.materials.size()); for (S32 i = 0; i < materials_in_file; i++) { diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index e35375f43c..5a32f9654d 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6100,8 +6100,8 @@ void send_group_notice(const LLUUID& group_id, item_def["owner_id"] = item->getPermissions().getOwner(); std::ostringstream ostr; LLSDSerialize::serialize(item_def, ostr, LLSDSerialize::LLSD_XML); - bin_bucket_size = ostr.str().copy( - (char*)bin_bucket, ostr.str().size()); + bin_bucket_size = static_cast<S32>(ostr.str().copy( + (char*)bin_bucket, ostr.str().size())); bin_bucket[bin_bucket_size] = '\0'; } else diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 654f2aa1de..8af0057c88 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -7513,9 +7513,9 @@ void LLViewerObject::setGLTFAsset(const LLUUID& id) LLSculptParams* sculpt_params = (LLSculptParams*)param->data; sculpt_params->setSculptTexture(id, LL_SCULPT_TYPE_GLTF); - + setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, true, true); - + // Update the volume LLVolumeParams volume_params; volume_params.setSculptID(id, LL_SCULPT_TYPE_GLTF); @@ -7532,7 +7532,7 @@ public: const LLSD& input) const { LLSD object_data = input["body"]["ObjectData"]; - S32 num_entries = object_data.size(); + S32 num_entries = static_cast<S32>(object_data.size()); for ( S32 i = 0; i < num_entries; i++ ) { diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 81b4952a39..b96a1a6644 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -294,7 +294,7 @@ public: virtual void addChild(LLViewerObject *childp); virtual void removeChild(LLViewerObject *childp); const_child_list_t& getChildren() const { return mChildList; } - S32 numChildren() const { return mChildList.size(); } + S32 numChildren() const { return static_cast<S32>(mChildList.size()); } void addThisAndAllChildren(std::vector<LLViewerObject*>& objects); void addThisAndNonJointChildren(std::vector<LLViewerObject*>& objects); bool isChild(LLViewerObject *childp) const; diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 2f8e71c5e9..08a1ba0f9b 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1480,7 +1480,7 @@ void LLViewerObjectList::removeFromActiveList(LLViewerObject* objectp) objectp->setListIndex(-1); - S32 last_index = mActiveObjects.size()-1; + S32 last_index = static_cast<S32>(mActiveObjects.size()) - 1; if (idx != last_index) { @@ -1511,7 +1511,7 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp) if (idx <= -1) { mActiveObjects.push_back(objectp); - objectp->setListIndex(mActiveObjects.size()-1); + objectp->setListIndex(static_cast<S32>(mActiveObjects.size()) - 1); objectp->setOnActiveList(true); } else diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp index b3cdc7a2d2..b1673d2232 100644 --- a/indra/newview/llvieweroctree.cpp +++ b/indra/newview/llvieweroctree.cpp @@ -1135,7 +1135,7 @@ void LLOcclusionCullingGroup::checkOcclusion() mOcclusionCheckCount[LLViewerCamera::sCurCameraID]++; } - static LLCachedControl<S32> occlusion_timeout(gSavedSettings, "RenderOcclusionTimeout", 4); + static LLCachedControl<U32> occlusion_timeout(gSavedSettings, "RenderOcclusionTimeout", 4); if (available || mOcclusionCheckCount[LLViewerCamera::sCurCameraID] > occlusion_timeout) { diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index d67e617a35..8c24b2438b 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -615,15 +615,13 @@ void LLViewerParcelMgr::removeObserver(LLParcelObserver* observer) void LLViewerParcelMgr::notifyObservers() { std::vector<LLParcelObserver*> observers; - S32 count = mObservers.size(); - S32 i; - for(i = 0; i < count; ++i) + for (auto observer : mObservers) { - observers.push_back(mObservers.at(i)); + observers.emplace_back(observer); } - for(i = 0; i < count; ++i) + for (auto observer : observers) { - observers.at(i)->changed(); + observer->changed(); } } @@ -2149,7 +2147,7 @@ void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 which) void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 flags, const LLAccessEntry::map& entries, LLViewerRegion* region, S32 parcel_local_id) { - S32 count = entries.size(); + S32 count = static_cast<S32>(entries.size()); S32 num_sections = (S32) ceil(count/PARCEL_MAX_ENTRIES_PER_PACKET); S32 sequence_id = 1; bool start_message = true; diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp index 30d17fe532..b556aef768 100644 --- a/indra/newview/llviewerpartsim.cpp +++ b/indra/newview/llviewerpartsim.cpp @@ -279,7 +279,7 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt) LLVector3 gravity(0.f, 0.f, GRAVITY); - LLViewerPartSim::checkParticleCount(mParticles.size()); + LLViewerPartSim::checkParticleCount(static_cast<U32>(mParticles.size())); LLViewerCamera* camera = LLViewerCamera::getInstance(); LLViewerRegion *regionp = getRegion(); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 699cde8969..c75d590df8 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -137,7 +137,7 @@ public: bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web) { // make sure that we at least have a region name - int num_params = params.size(); + auto num_params = params.size(); if (num_params < 1) { return false; @@ -151,7 +151,7 @@ public: } boost::regex name_rx("[A-Za-z0-9()_%]+"); boost::regex coord_rx("[0-9]+"); - for (int i = 0; i < num_params; i++) + for (size_t i = 0; i < num_params; i++) { if (i > 0) { @@ -924,7 +924,7 @@ const LLUUID& LLViewerRegion::getOwner() const void LLViewerRegion::setRegionNameAndZone (const std::string& name_zone) { std::string::size_type pipe_pos = name_zone.find('|'); - S32 length = name_zone.size(); + auto length = name_zone.size(); if (pipe_pos != std::string::npos) { mName = name_zone.substr(0, pipe_pos); @@ -1179,7 +1179,7 @@ void LLViewerRegion::killCacheEntry(U32 local_id) U32 LLViewerRegion::getNumOfActiveCachedObjects() const { - return mImpl->mActiveSet.size(); + return static_cast<U32>(mImpl->mActiveSet.size()); } void LLViewerRegion::addActiveCacheEntry(LLVOCacheEntry* entry) @@ -1266,7 +1266,7 @@ bool LLViewerRegion::addVisibleGroup(LLViewerOctreeGroup* group) U32 LLViewerRegion::getNumOfVisibleGroups() const { - return mImpl ? mImpl->mVisibleGroups.size() : 0; + return mImpl ? static_cast<U32>(mImpl->mVisibleGroups.size()) : 0; } void LLViewerRegion::updateReflectionProbes() @@ -1754,7 +1754,7 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) } std::vector<LLDrawable*> delete_list; - S32 update_counter = llmin(max_update, mImpl->mActiveSet.size()); + auto update_counter = llmin(max_update, mImpl->mActiveSet.size()); LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry); for(; update_counter > 0; --update_counter, ++iter) @@ -1793,10 +1793,9 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) if(!delete_list.empty()) { mInvisibilityCheckHistory |= 1; - S32 count = delete_list.size(); - for(S32 i = 0; i < count; i++) + for (auto drawable : delete_list) { - gObjectList.killObject(delete_list[i]->getVObj()); + gObjectList.killObject(drawable->getVObj()); } delete_list.clear(); } @@ -2674,10 +2673,9 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) if(iter != mOrphanMap.end()) { std::vector<U32>* orphans = &mOrphanMap[entry->getLocalID()]; - S32 size = orphans->size(); - for(S32 i = 0; i < size; i++) + for (U32 orphan : *orphans) { - LLVOCacheEntry* child = getCacheEntry((*orphans)[i]); + LLVOCacheEntry* child = getCacheEntry(orphan); if(child) { entry->addChild(child); @@ -2942,7 +2940,7 @@ void LLViewerRegion::requestCacheMisses() mCacheDirty = true ; // LL_INFOS() << "KILLDEBUG Sent cache miss full " << full_count << " crc " << crc_count << LL_ENDL; - LLViewerStatsRecorder::instance().requestCacheMissesEvent(mCacheMissList.size()); + LLViewerStatsRecorder::instance().requestCacheMissesEvent(static_cast<S32>(mCacheMissList.size())); mCacheMissList.clear(); } diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 82d0caecb5..0ab0265586 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -233,7 +233,7 @@ public: } F32 right_x; - mStyle->getFont()->render(mLabel, 0, image_rect.mRight + EMBEDDED_ITEM_LABEL_PADDING, draw_rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::UNDERLINE, LLFontGL::NO_SHADOW, mLabel.length(), S32_MAX, &right_x); + mStyle->getFont()->render(mLabel, 0, image_rect.mRight + EMBEDDED_ITEM_LABEL_PADDING, draw_rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::UNDERLINE, LLFontGL::NO_SHADOW, static_cast<S32>(mLabel.length()), S32_MAX, &right_x); return right_x; } diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 545bfeaafa..c1062b9a01 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -335,7 +335,7 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const s return gTextureList.getImageFromUrl(url, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id); } -//static +//static LLImageRaw* LLViewerTextureManager::getRawImageFromMemory(const U8* data, U32 size, std::string_view mimetype) { return gTextureList.getRawImageFromMemory(data, size, mimetype); @@ -777,8 +777,8 @@ void LLViewerTexture::removeFace(U32 ch, LLFace* facep) if(mNumFaces[ch] > 1) { S32 index = facep->getIndexInTex(ch); - llassert(index < mFaceList[ch].size()); - llassert(index < mNumFaces[ch]); + llassert(index < (S32)mFaceList[ch].size()); + llassert(index < (S32)mNumFaces[ch]); mFaceList[ch][index] = mFaceList[ch][--mNumFaces[ch]]; mFaceList[ch][index]->setIndexInTex(ch, index); } @@ -830,8 +830,8 @@ void LLViewerTexture::removeVolume(U32 ch, LLVOVolume* volumep) if (mNumVolumes[ch] > 1) { S32 index = volumep->getIndexInTex(ch); - llassert(index < mVolumeList[ch].size()); - llassert(index < mNumVolumes[ch]); + llassert(index < (S32)mVolumeList[ch].size()); + llassert(index < (S32)mNumVolumes[ch]); mVolumeList[ch][index] = mVolumeList[ch][--mNumVolumes[ch]]; mVolumeList[ch][index]->setIndexInTex(ch, index); } @@ -1338,8 +1338,8 @@ void LLViewerFetchedTexture::addToCreateTexture() // if(mRequestedDiscardLevel <= mDesiredDiscardLevel && !mForceToSaveRawImage) { - S32 w = mFullWidth >> mRawDiscardLevel; - S32 h = mFullHeight >> mRawDiscardLevel; + U32 w = mFullWidth >> mRawDiscardLevel; + U32 h = mFullHeight >> mRawDiscardLevel; //if big image, do not load extra data //scale it down to size >= LLViewerTexture::sMinLargeImageSize @@ -1684,7 +1684,7 @@ void LLViewerFetchedTexture::processTextureStats() else { U32 desired_size = MAX_IMAGE_SIZE_DEFAULT; // MAX_IMAGE_SIZE_DEFAULT = 2048 and max size ever is 4096 - if(!mKnownDrawWidth || !mKnownDrawHeight || mFullWidth <= mKnownDrawWidth || mFullHeight <= mKnownDrawHeight) + if(!mKnownDrawWidth || !mKnownDrawHeight || (S32)mFullWidth <= mKnownDrawWidth || (S32)mFullHeight <= mKnownDrawHeight) { if (mFullWidth > desired_size || mFullHeight > desired_size) { @@ -3536,12 +3536,12 @@ void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep) return; } - S32 end = te_list.size(); + auto end = te_list.size(); for(std::list< LLPointer<LLViewerTexture> >::iterator iter = mTextureList.begin(); iter != mTextureList.end(); ++iter) { - S32 i = 0; + size_t i = 0; for(i = 0; i < end; i++) { diff --git a/indra/newview/llviewertextureanim.cpp b/indra/newview/llviewertextureanim.cpp index 9342eb2865..238e6830ea 100644 --- a/indra/newview/llviewertextureanim.cpp +++ b/indra/newview/llviewertextureanim.cpp @@ -43,13 +43,13 @@ LLViewerTextureAnim::LLViewerTextureAnim(LLVOVolume* vobj) : LLTextureAnim() mScaleS = mScaleT = 1; mRot = 0; - mInstanceIndex = sInstanceList.size(); + mInstanceIndex = static_cast<S32>(sInstanceList.size()); sInstanceList.push_back(this); } LLViewerTextureAnim::~LLViewerTextureAnim() { - S32 end_idx = sInstanceList.size()-1; + S32 end_idx = static_cast<S32>(sInstanceList.size()) - 1; if (end_idx != mInstanceIndex) { diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 930bf4230e..b90c1868fc 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -723,7 +723,7 @@ void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image) llassert_always(mInitialized) ; llassert(image); - S32 count = 0; + size_t count = 0; if (image->isInImageList()) { count = mImageList.erase(image) ; @@ -931,7 +931,7 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag { for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i) { - for (U32 fi = 0; fi < imagep->getNumFaces(i); ++fi) + for (S32 fi = 0; fi < imagep->getNumFaces(i); ++fi) { LLFace* face = (*(imagep->getFaceList(i)))[fi]; @@ -1256,7 +1256,7 @@ void LLViewerTextureList::decodeAllImages(F32 max_time) } std::shared_ptr<LL::WorkQueue> main_queue = LLImageGLThread::sEnabledTextures ? LL::WorkQueue::getInstance("mainloop") : NULL; // Run threads - S32 fetch_pending = 0; + size_t fetch_pending = 0; while (1) { LLAppViewer::instance()->getTextureCache()->update(1); // unpauses the texture cache thread diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index a2cbc85c60..e4ebb7b0e8 100644 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -134,7 +134,7 @@ public: void handleIRCallback(void **data, const S32 number); - S32 getNumImages() { return mImageList.size(); } + S32 getNumImages() { return static_cast<S32>(mImageList.size()); } // Local UI images // Local UI images @@ -191,7 +191,7 @@ private: LLGLenum primary_format = 0, const LLUUID& force_id = LLUUID::null ); - + LLImageRaw* getRawImageFromMemory(const U8* data, U32 size, std::string_view mimetype); LLViewerFetchedTexture* getImageFromMemory(const U8* data, U32 size, std::string_view mimetype); diff --git a/indra/newview/llviewerthrottle.cpp b/indra/newview/llviewerthrottle.cpp index 485dd683be..b0a00c29a4 100644 --- a/indra/newview/llviewerthrottle.cpp +++ b/indra/newview/llviewerthrottle.cpp @@ -246,9 +246,9 @@ LLViewerThrottleGroup LLViewerThrottle::getThrottleGroup(const F32 bandwidth_kbp //Clamp the bandwidth users can set. F32 set_bandwidth = llclamp(bandwidth_kbps, MIN_BANDWIDTH, MAX_BANDWIDTH); - S32 count = mPresets.size(); + auto count = mPresets.size(); - S32 i; + size_t i; for (i = 0; i < count; i++) { if (mPresets[i].getTotal() > set_bandwidth) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 3218b94aca..70aee2dc43 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -618,7 +618,7 @@ public: LLViewerRegion* region = gAgent.getRegion(); if (region) { - for (U32 i = 0; i < gObjectList.getNumObjects(); ++i) + for (S32 i = 0; i < gObjectList.getNumObjects(); ++i) { LLViewerObject* object = gObjectList.getObject(i); if (object && @@ -1666,13 +1666,13 @@ bool LLViewerWindow::handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S recording.getPerSec(LLStatViewer::FPS), //mFPSStat.getMeanPerSec(), recording.getLastValue(LLStatViewer::SIM_PHYSICS_FPS), recording.getLastValue(LLStatViewer::SIM_TIME_DILATION)); - S32 len = temp_str.length(); + int len = static_cast<int>(temp_str.length()); TextOutA(hdc, 0, 0, temp_str.c_str(), len); LLVector3d pos_global = gAgent.getPositionGlobal(); temp_str = llformat( "Avatar pos %6.1lf %6.1lf %6.1lf", pos_global.mdV[0], pos_global.mdV[1], pos_global.mdV[2]); - len = temp_str.length(); + len = static_cast<S32>(temp_str.length()); TextOutA(hdc, 0, 25, temp_str.c_str(), len); TextOutA(hdc, 0, 50, "Set \"HeadlessClient FALSE\" in settings.ini file to reenable", 61); diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp index c509d656e1..703f33771c 100644 --- a/indra/newview/llvlcomposition.cpp +++ b/indra/newview/llvlcomposition.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llvlcomposition.cpp * @brief Viewer-side representation of a composition layer... * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -220,7 +220,7 @@ LLTerrainMaterials::Type LLTerrainMaterials::getMaterialType() { LL_PROFILE_ZONE_SCOPED; - const BOOL use_textures = texturesReady(false, false) || !materialsReady(false, false); + const bool use_textures = texturesReady(false, false) || !materialsReady(false, false); return use_textures ? Type::TEXTURE : Type::PBR; } @@ -428,8 +428,7 @@ const LLUUID (&LLVLComposition::getDefaultTextures())[ASSET_COUNT] LLVLComposition::LLVLComposition(LLSurface *surfacep, const U32 width, const F32 scale) : LLTerrainMaterials(), - LLViewerLayer(width, scale), - mParamsReady(false) + LLViewerLayer(width, scale) { // Load Terrain Textures - Original ones const LLUUID (&default_textures)[LLVLComposition::ASSET_COUNT] = LLVLComposition::getDefaultTextures(); @@ -471,7 +470,7 @@ bool LLVLComposition::generateHeights(const F32 x, const F32 y, llassert(mSurfacep); - if (!mSurfacep || !mSurfacep->getRegion()) + if (!mSurfacep || !mSurfacep->getRegion()) { // We don't always have the region yet here.... return false; @@ -539,7 +538,7 @@ bool LLVLComposition::generateHeights(const F32 x, const F32 y, vec[1] = (F32)(origin_global.mdV[VY]+location.mV[VY])*xyScaleInv; vec[2] = height*zScaleInv; // - // Choose material value by adding to the exact height a random value + // Choose material value by adding to the exact height a random value // vec1[0] = vec[0]*(0.2222222222f); vec1[1] = vec[1]*(0.2222222222f); @@ -873,7 +872,7 @@ bool LLVLComposition::generateMinimapTileLand(const F32 x, const F32 y, U32 st_comps = 3; U32 st_width = BASE_SIZE; U32 st_height = BASE_SIZE; - + if (tex_comps != st_comps) { llassert(false); @@ -978,7 +977,7 @@ bool LLVLComposition::generateMinimapTileLand(const F32 x, const F32 y, { unboost_minimap_material(mDetailMaterials[i]); } - + return true; } diff --git a/indra/newview/llvlcomposition.h b/indra/newview/llvlcomposition.h index a003f74eda..763ff69442 100644 --- a/indra/newview/llvlcomposition.h +++ b/indra/newview/llvlcomposition.h @@ -1,25 +1,25 @@ -/** +/** * @file llvlcomposition.h * @brief Viewer-side representation of a composition layer... * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -115,8 +115,7 @@ public: bool generateHeights(const F32 x, const F32 y, const F32 width, const F32 height); bool generateComposition(); // Generate texture from composition values. - bool generateMinimapTileLand(const F32 x, const F32 y, const F32 width, const F32 height); - bool generateTexture(const F32 x, const F32 y, const F32 width, const F32 height); + bool generateMinimapTileLand(const F32 x, const F32 y, const F32 width, const F32 height); // Use these as indeces ito the get/setters below that use 'corner' enum ECorner diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 7c9f7170f6..035c02c804 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2327,7 +2327,7 @@ void LLVOAvatar::updateMeshData() S32 f_num = 0 ; const U32 VERTEX_NUMBER_THRESHOLD = 128 ;//small number of this means each part of an avatar has its own vertex buffer. - const S32 num_parts = mMeshLOD.size(); + const auto num_parts = mMeshLOD.size(); // this order is determined by number of LODS // if a mesh earlier in this list changed LODs while a later mesh doesn't, @@ -5715,7 +5715,7 @@ void LLVOAvatar::checkTextureLoading() return ; //have not been invisible for enough time. } - mLoadedCallbackTextures = pause ? mCallbackTextureList.size() : 0; + mLoadedCallbackTextures = pause ? static_cast<S32>(mCallbackTextureList.size()) : 0; for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = mCallbackTextureList.begin(); iter != mCallbackTextureList.end(); ++iter) @@ -6594,8 +6594,8 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL if ( vobj && vobj->isMesh() && pSkinData ) { - const int bindCnt = pSkinData->mAlternateBindMatrix.size(); - const int jointCnt = pSkinData->mJointNames.size(); + const unsigned int bindCnt = static_cast<unsigned int>(pSkinData->mAlternateBindMatrix.size()); + const unsigned int jointCnt = static_cast<unsigned int>(pSkinData->mJointNames.size()); if ((bindCnt > 0) && (bindCnt != jointCnt)) { LL_WARNS_ONCE() << "invalid mesh, bindCnt " << bindCnt << "!= jointCnt " << jointCnt << ", joint overrides will be ignored." << LL_ENDL; @@ -6622,10 +6622,10 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL LL_DEBUGS("AnimatedObjects") << "adding attachment overrides for " << mesh_id << " to root object " << root_object->getID() << LL_ENDL; } - bool fullRig = jointCnt>=JOINT_COUNT_REQUIRED_FOR_FULLRIG; + bool fullRig = jointCnt >= JOINT_COUNT_REQUIRED_FOR_FULLRIG; if ( fullRig && !mesh_overrides_loaded ) { - for ( int i=0; i<jointCnt; ++i ) + for (unsigned int i = 0; i < jointCnt; ++i) { std::string lookingForJoint = pSkinData->mJointNames[i].c_str(); LLJoint* pJoint = getJoint( lookingForJoint ); @@ -7496,7 +7496,7 @@ S32 LLVOAvatar::getMaxAttachments() const //----------------------------------------------------------------------------- bool LLVOAvatar::canAttachMoreObjects(U32 n) const { - return (getNumAttachments() + n) <= getMaxAttachments(); + return (getNumAttachments() + n) <= (U32)getMaxAttachments(); } //----------------------------------------------------------------------------- @@ -7530,7 +7530,7 @@ S32 LLVOAvatar::getMaxAnimatedObjectAttachments() const //----------------------------------------------------------------------------- bool LLVOAvatar::canAttachMoreAnimatedObjects(U32 n) const { - return (getNumAnimatedObjectAttachments() + n) <= getMaxAnimatedObjectAttachments(); + return (getNumAnimatedObjectAttachments() + n) <= (U32)getMaxAnimatedObjectAttachments(); } //----------------------------------------------------------------------------- @@ -7942,7 +7942,7 @@ LLVOAvatar* LLVOAvatar::findAvatarFromAttachment( LLViewerObject* obj ) S32 LLVOAvatar::getAttachmentCount() const { - S32 count = 0; + size_t count = 0; for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) { @@ -7950,7 +7950,7 @@ S32 LLVOAvatar::getAttachmentCount() const count += pAttachment->mAttachedObjects.size(); } - return count; + return static_cast<S32>(count); } bool LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const @@ -8979,7 +8979,7 @@ void LLVOAvatar::addChat(const LLChat& chat) mChats.push_back(chat); - S32 chat_length = 0; + size_t chat_length = 0; for( chat_iter = mChats.begin(); chat_iter != mChats.end(); ++chat_iter) { chat_length += chat_iter->mText.size(); @@ -9591,7 +9591,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } // SUNSHINE CLEANUP - is this case OK now? - S32 num_params = contents->mParamWeights.size(); + auto num_params = contents->mParamWeights.size(); if (num_params <= 1) { // In this case, we have no reliable basis for knowing @@ -9635,7 +9635,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& contents, bool slam_params) { - S32 num_params = contents.mParamWeights.size(); + auto num_params = contents.mParamWeights.size(); ESex old_sex = getSex(); if (applyParsedTEMessage(contents.mTEContents) > 0 && isChanged(TEXTURE)) @@ -9686,7 +9686,7 @@ void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& conte bool interp_params = false; S32 params_changed_count = 0; - for( S32 i = 0; i < num_params; i++ ) + for( size_t i = 0; i < num_params; i++ ) { LLVisualParam* param = contents.mParams[i]; F32 newWeight = contents.mParamWeights[i]; @@ -11135,7 +11135,7 @@ void LLVOAvatar::accountRenderComplexityForObject( attached_object->mRiggedAttachedWarned = true; } - hud_object_complexity.texturesCount += textures.size(); + hud_object_complexity.texturesCount += static_cast<U32>(textures.size()); for (LLVOVolume::texture_cost_t::iterator volume_texture = textures.begin(); volume_texture != textures.end(); diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 4074abf893..c92de576f9 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -339,7 +339,7 @@ void LLVOCacheEntry::setState(U32 state) if(getState() == ACTIVE) { - const S32 MIN_INTERVAL = 64 + sMinFrameRange; + const U32 MIN_INTERVAL = 64U + sMinFrameRange; U32 last_visible = getVisible(); setVisible(); @@ -553,7 +553,7 @@ bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, const LLVecto if(!vis) { S32 cur_vis = llmax(group->getAnyVisible(), (S32)getVisible()); - vis = (cur_vis + sMinFrameRange > LLViewerOctreeEntryData::getCurrentFrame()); + vis = (cur_vis + (S32)sMinFrameRange > LLViewerOctreeEntryData::getCurrentFrame()); } //within the back sphere @@ -1301,7 +1301,7 @@ void LLVOCache::removeEntry(HeaderEntryInfo* entry) removeFromCache(entry); delete entry; - mNumEntries = mHandleEntryMap.size() ; + mNumEntries = static_cast<U32>(mHandleEntryMap.size()); } } @@ -1486,7 +1486,7 @@ void LLVOCache::writeCacheHeader() success = check_write(&apr_file, (void*)*iter, sizeof(HeaderEntryInfo)); } - mNumEntries = mHeaderEntryQueue.size() ; + mNumEntries = static_cast<U32>(mHeaderEntryQueue.size()); if(success && mNumEntries < MAX_NUM_OBJECT_ENTRIES) { HeaderEntryInfo* entry = new HeaderEntryInfo() ; @@ -1730,7 +1730,7 @@ void LLVOCache::purgeEntries(U32 size) removeFromCache(entry) ; // This now handles removing extras cache where appropriate. delete entry; } - mNumEntries = mHandleEntryMap.size() ; + mNumEntries = static_cast<U32>(mHandleEntryMap.size()); } void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, bool dirty_cache, bool removal_enabled) @@ -1802,7 +1802,7 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry: if(success) { - S32 num_entries = cache_entry_map.size(); // if removal is enabled num_entries might be wrong + S32 num_entries = static_cast<S32>(cache_entry_map.size()); // if removal is enabled num_entries might be wrong success = check_write(&apr_file, &num_entries, sizeof(S32)); if (success) { @@ -1877,13 +1877,13 @@ void LLVOCache::removeGenericExtrasForHandle(U64 handle) auto* entry = mHandleEntryMap[handle]; if (entry) { + LL_WARNS("GLTF", "VOCache") << "Removing generic extras for handle " << entry->mHandle << "Filename: " << getObjectCacheExtrasFilename(handle) << LL_ENDL; removeEntry(entry); } else { //shouldn't happen, but if it does, we should remove the extras file since it's orphaned - LL_WARNS("GLTF", "VOCache") << "Removing generic extras for handle " << entry->mHandle << "Filename: " << getObjectCacheExtrasFilename(handle) << LL_ENDL; - LLFile::remove(getObjectCacheExtrasFilename(entry->mHandle)); + LLFile::remove(getObjectCacheExtrasFilename(handle)); } } @@ -1902,9 +1902,7 @@ void LLVOCache::writeGenericExtrasToCache(U64 handle, const LLUUID& id, const LL return; } - // <FS:Beq> FIRE-33808 - Material Override Cache causes long delays std::string filename = getObjectCacheExtrasFilename(handle); - // </FS:Beq> llofstream out(filename, std::ios::out | std::ios::binary); if(!out.good()) { @@ -1937,9 +1935,8 @@ void LLVOCache::writeGenericExtrasToCache(U64 handle, const LLUUID& id, const LL LLViewerRegion* pRegion = LLWorld::getInstance()->getRegionFromHandle(handle); U32 num_entries = 0; - U32 inmem_entries = 0; U32 skipped = 0; - inmem_entries = cache_extras_entry_map.size(); + size_t inmem_entries = cache_extras_entry_map.size(); for (auto [local_id, entry] : cache_extras_entry_map) { // Only write out GLTFOverrides that we can actually apply again on import. diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 2d0f66db6d..9679a20ae0 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -140,7 +140,7 @@ public: void removeChild(LLVOCacheEntry* entry); void removeAllChildren(); LLVOCacheEntry* getChild(); //remove the first child, and return it. - S32 getNumOfChildren() const {return mChildrenList.size();} + S32 getNumOfChildren() const { return static_cast<S32>(mChildrenList.size()); } void setBoundingInfo(const LLVector3& pos, const LLVector3& scale); //called from processing object update message void updateParentBoundingInfo(); diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index 6af9593df8..e04bdbf1d9 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -696,7 +696,7 @@ void LLGrassPartition::getGeometry(LLSpatialGroup* group) vertex_count += facep->getGeomCount(); index_count += facep->getIndicesCount(); - S32 idx = draw_vec.size()-1; + S32 idx = static_cast<S32>(draw_vec.size()) - 1; bool fullbright = facep->isState(LLFace::FULLBRIGHT); diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp index b1ff6eb346..305fd77126 100644 --- a/indra/newview/llvoicevisualizer.cpp +++ b/indra/newview/llvoicevisualizer.cpp @@ -248,7 +248,7 @@ void LLVoiceVisualizer::lipStringToF32s ( std::string& in_string, F32*& out_F32s { delete[] out_F32s; // get rid of the current array - count_F32s = in_string.length(); + count_F32s = static_cast<U32>(in_string.length()); if (count_F32s == 0) { // we don't like zero length arrays diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 291b89a398..3c2a0ef6a3 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -7395,8 +7395,8 @@ LLIOPipe::EStatus LLVivoxProtocolParser::process_impl( } // Look for input delimiter(s) in the input buffer. If one is found, send the message to the xml parser. - int start = 0; - int delim; + size_t start = 0; + size_t delim; while((delim = mInput.find("\n\n\n", start)) != std::string::npos) { @@ -7407,7 +7407,7 @@ LLIOPipe::EStatus LLVivoxProtocolParser::process_impl( XML_SetElementHandler(parser, ExpatStartTag, ExpatEndTag); XML_SetCharacterDataHandler(parser, ExpatCharHandler); XML_SetUserData(parser, this); - XML_Parse(parser, mInput.data() + start, delim - start, false); + XML_Parse(parser, mInput.data() + start, static_cast<int>(delim - start), false); LL_DEBUGS("VivoxProtocolParser") << "parsing: " << mInput.substr(start, delim - start) << LL_ENDL; start = delim + 3; diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index fa4dbd586e..81f16cf8cb 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -317,7 +317,7 @@ bool LLVOPartGroup::updateGeometry(LLDrawable *drawable) F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio(); pixel_meter_ratio *= pixel_meter_ratio; - LLViewerPartSim::checkParticleCount(mViewerPartGroupp->mParticles.size()) ; + LLViewerPartSim::checkParticleCount(static_cast<U32>(mViewerPartGroupp->mParticles.size())); S32 count=0; mDepth = 0.f; @@ -899,7 +899,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) llassert(facep->getGeomCount() == 4); llassert(facep->getIndicesCount() == 6); - S32 idx = draw_vec.size()-1; + S32 idx = static_cast<S32>(draw_vec.size()) - 1; bool fullbright = facep->isState(LLFace::FULLBRIGHT); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 8e91354bb0..de62256134 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4036,7 +4036,7 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const U32 media_faces = 0; const LLDrawable* drawablep = mDrawable; - U32 num_faces = drawablep->getNumFaces(); + S32 num_faces = drawablep->getNumFaces(); const LLVolumeParams& volume_params = getVolume()->getParams(); @@ -5021,7 +5021,7 @@ void LLRiggedVolume::update( else #endif { - for (U32 j = 0; j < dst_face.mNumVertices; ++j) + for (S32 j = 0; j < dst_face.mNumVertices; ++j) { LLMatrix4a final_mat; LLSkinningUtil::getPerVertexSkinMatrix(weight[j].getF32ptr(), mat, false, final_mat, max_joints); @@ -5048,7 +5048,7 @@ void LLRiggedVolume::update( box_max = max; } - for (U32 j = 1; j < dst_face.mNumVertices; ++j) + for (S32 j = 1; j < dst_face.mNumVertices; ++j) { min.setMin(min, pos[j]); max.setMax(max, pos[j]); @@ -5267,7 +5267,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, //add face to drawmap LLSpatialGroup::drawmap_elem_t& draw_vec = group->mDrawMap[passType]; - S32 idx = draw_vec.size()-1; + S32 idx = static_cast<S32>(draw_vec.size()) - 1; bool fullbright = (type == LLRenderPass::PASS_FULLBRIGHT) || (type == LLRenderPass::PASS_INVISIBLE) || diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index a68ad0029f..5ee6aec9f9 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -959,14 +959,14 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu return; } - const uuid_vec_t& ids = mUUIDs; // selected items IDs - U32 mask = 0; // mask of selected items' types - U32 n_items = ids.size(); // number of selected items - U32 n_worn = 0; // number of worn items among the selected ones - U32 n_already_worn = 0; // number of items worn of same type as selected items - U32 n_links = 0; // number of links among the selected items - U32 n_editable = 0; // number of editable items among the selected ones - U32 n_touchable = 0; // number of touchable items among the selected ones + const uuid_vec_t& ids = mUUIDs; // selected items IDs + U32 mask = 0; // mask of selected items' types + U32 n_items = static_cast<U32>(ids.size()); // number of selected items + U32 n_worn = 0; // number of worn items among the selected ones + U32 n_already_worn = 0; // number of items worn of same type as selected items + U32 n_links = 0; // number of links among the selected items + U32 n_editable = 0; // number of editable items among the selected ones + U32 n_touchable = 0; // number of touchable items among the selected ones bool can_be_worn = true; diff --git a/indra/newview/llwearablelist.h b/indra/newview/llwearablelist.h index be00c058a2..680b958b46 100644 --- a/indra/newview/llwearablelist.h +++ b/indra/newview/llwearablelist.h @@ -46,7 +46,7 @@ class LLWearableList : public LLSingleton<LLWearableList> public: void cleanup() ; - S32 getLength() const { return mList.size(); } + S32 getLength() const { return static_cast<S32>(mList.size()); } void getAsset(const LLAssetID& assetID, const std::string& wearable_name, diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index 6c5313a3ac..d8852de954 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -131,8 +131,8 @@ std::string LLWeb::escapeURL(const std::string& url) // The CURL curl_escape() function escapes colons, slashes, // and all characters but A-Z and 0-9. Do a cheesy mini-escape. std::string escaped_url; - S32 len = url.length(); - for (S32 i = 0; i < len; i++) + auto len = url.length(); + for (size_t i = 0; i < len; i++) { char c = url[i]; if (c == ' ') diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index e0c8186578..2eadea20ef 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1352,8 +1352,8 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi { LLViewerRegion* regionp = *iter; const LLVector3d& origin_global = regionp->getOriginGlobal(); - S32 count = regionp->mMapAvatars.size(); - for (S32 i = 0; i < count; i++) + auto count = regionp->mMapAvatars.size(); + for (size_t i = 0; i < count; i++) { LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.at(i), origin_global); if(dist_vec_squared(pos_global, relative_to) <= radius_squared) diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index 1cd72a1cc5..ec6e22cd7a 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -282,7 +282,7 @@ void LLXMLRPCTransaction::Handler::onCompleted(LLCore::HttpHandle handle, body->read(0, bodydata, body->size()); - mImpl->mResponse = XMLRPC_REQUEST_FromXML(bodydata, body->size(), 0); + mImpl->mResponse = XMLRPC_REQUEST_FromXML(bodydata, static_cast<int>(body->size()), 0); delete[] bodydata; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 249e66d098..4819ea4346 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -776,10 +776,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; if (mRT == &mMainRT) { // hacky -- allocate auxillary buffer - gCubeSnapshot = true; - mReflectionMapManager.initReflectionMaps(); - mHeroProbeManager.initReflectionMaps(); - if (sReflectionProbesEnabled) { gCubeSnapshot = true; @@ -3682,10 +3678,8 @@ void LLPipeline::renderHighlights() // Make sure the selection image gets downloaded and decoded mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); - U32 count = mSelectedFaces.size(); - for (U32 i = 0; i < count; i++) + for (auto facep : mSelectedFaces) { - LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { LL_ERRS() << "Bad face on selection" << LL_ENDL; @@ -3701,10 +3695,8 @@ void LLPipeline::renderHighlights() // Paint 'em red! color.setVec(1.f, 0.f, 0.f, 0.5f); - int count = mHighlightFaces.size(); - for (S32 i = 0; i < count; i++) + for (auto facep : mHighlightFaces) { - LLFace* facep = mHighlightFaces[i]; facep->renderSelected(LLViewerTexture::sNullImagep, color); } } @@ -3730,10 +3722,8 @@ void LLPipeline::renderHighlights() mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); - U32 count = mSelectedFaces.size(); - for (U32 i = 0; i < count; i++) + for (auto facep : mSelectedFaces) { - LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { LL_ERRS() << "Bad face on selection" << LL_ENDL; @@ -3760,10 +3750,8 @@ void LLPipeline::renderHighlights() mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); - U32 count = mSelectedFaces.size(); - for (U32 i = 0; i < count; i++) + for (auto facep : mSelectedFaces) { - LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { LL_ERRS() << "Bad face on selection" << LL_ENDL; @@ -4804,7 +4792,7 @@ void LLPipeline::rebuildPools() assertInitialized(); - S32 max_count = mPools.size(); + auto max_count = mPools.size(); pool_set_t::iterator iter1 = mPools.upper_bound(mLastRebuildPool); while(max_count > 0 && mPools.size() > 0) // && num_rebuilds < MAX_REBUILDS) { diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 874cec7fcd..1d2033b4f0 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -351,7 +351,7 @@ public: void findReferences(LLDrawable *drawablep); // Find the lists which have references to this object bool verify(); // Verify that all data in the pipeline is "correct" - S32 getLightCount() const { return mLights.size(); } + S32 getLightCount() const { return static_cast<S32>(mLights.size()); } void calcNearbyLights(LLCamera& camera); void setupHWLights(); diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index 64f612f943..cc4f80a15c 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -102,6 +102,22 @@ width="65"> Low </text> + <slider + control_name="RenderLocalLightCount" + decimal_digits="0" + follows="left|top" + height="16" + increment="1" + initial_value="256" + label="Max. nearby lights:" + label_width="185" + layout="topleft" + left="30" + min_val="0" + max_val="8192" + name="MaxLights" + top_delta="16" + width="336" /> <check_box control_name="RenderVSyncEnable" diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp index 4f32299b0d..f6ed745e96 100644 --- a/indra/newview/tests/llsechandler_basic_test.cpp +++ b/indra/newview/tests/llsechandler_basic_test.cpp @@ -634,19 +634,19 @@ namespace tut // Read each of the 4 Pem certs and store in mX509*Cert pointers BIO * validation_bio; - validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), mPemTestCert.length()); + validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), static_cast<S32>(mPemTestCert.length())); PEM_read_bio_X509(validation_bio, &mX509TestCert, 0, NULL); BIO_free(validation_bio); - validation_bio = BIO_new_mem_buf((void*)mPemRootCert.c_str(), mPemRootCert.length()); + validation_bio = BIO_new_mem_buf((void*)mPemRootCert.c_str(), static_cast<S32>(mPemRootCert.length())); PEM_read_bio_X509(validation_bio, &mX509RootCert, 0, NULL); BIO_free(validation_bio); - validation_bio = BIO_new_mem_buf((void*)mPemIntermediateCert.c_str(), mPemIntermediateCert.length()); + validation_bio = BIO_new_mem_buf((void*)mPemIntermediateCert.c_str(), static_cast<S32>(mPemIntermediateCert.length())); PEM_read_bio_X509(validation_bio, &mX509IntermediateCert, 0, NULL); BIO_free(validation_bio); - validation_bio = BIO_new_mem_buf((void*)mPemChildCert.c_str(), mPemChildCert.length()); + validation_bio = BIO_new_mem_buf((void*)mPemChildCert.c_str(), static_cast<S32>(mPemChildCert.length())); PEM_read_bio_X509(validation_bio, &mX509ChildCert, 0, NULL); BIO_free(validation_bio); } diff --git a/indra/newview/tests/llviewercontrollistener_test.cpp b/indra/newview/tests/llviewercontrollistener_test.cpp index 175c442dc5..f261a04544 100644 --- a/indra/newview/tests/llviewercontrollistener_test.cpp +++ b/indra/newview/tests/llviewercontrollistener_test.cpp @@ -3,7 +3,7 @@ * @author Nat Goodspeed * @date 2022-06-09 * @brief Test for llviewercontrollistener. - * + * * $LicenseInfo:firstyear=2022&license=viewerlgpl$ * Copyright (c) 2022, Linden Research, Inc. * $/LicenseInfo$ diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index c8144f2a93..6e88b2f674 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -59,7 +59,7 @@ class ViewerManifest(LLManifest): # files during the build (see copy_w_viewer_manifest # and copy_l_viewer_manifest targets) return 'package' in self.args['actions'] - + def construct(self): super(ViewerManifest, self).construct() self.path(src="../../scripts/messages/message_template.msg", dst="app_settings/message_template.msg") @@ -87,7 +87,7 @@ class ViewerManifest(LLManifest): # ... and the entire image filters directory self.path("filters") - + # ... and the included spell checking dictionaries pkgdir = os.path.join(self.args['build'], os.pardir, 'packages') with self.prefix(src=pkgdir): @@ -260,14 +260,14 @@ class ViewerManifest(LLManifest): def app_name_oneword(self): return ''.join(self.app_name().split()) - + def icon_path(self): return "icons/" + self.channel_type() def extract_names(self,src): """Extract contributor names from source file, returns string""" try: - with open(src, 'r') as contrib_file: + with open(src, 'r') as contrib_file: lines = contrib_file.readlines() except IOError: print("Failed to open '%s'" % src) @@ -491,7 +491,7 @@ class Windows_x86_64_Manifest(ViewerManifest): raise Exception("Directories are not supported by test_CRT_and_copy_action()") else: print("Doesn't exist:", src) - + def construct(self): super().construct() @@ -543,7 +543,7 @@ class Windows_x86_64_Manifest(ViewerManifest): self.path2basename(os.path.join(os.pardir, 'llplugin', 'slplugin', self.args['configuration']), "slplugin.exe") - + # Get shared libs from the shared libs staging directory with self.prefix(src=os.path.join(self.args['build'], os.pardir, 'sharedlibs', self.args['buildtype'])): @@ -572,7 +572,7 @@ class Windows_x86_64_Manifest(ViewerManifest): # Vivox libraries self.path("vivoxsdk_x64.dll") self.path("ortp_x64.dll") - + # OpenSSL self.path("libcrypto-1_1-x64.dll") self.path("libssl-1_1-x64.dll") @@ -699,7 +699,7 @@ class Windows_x86_64_Manifest(ViewerManifest): self.path("plugins/") if not self.is_packaging_viewer(): - self.package_file = "copied_deps" + self.package_file = "copied_deps" def nsi_file_commands(self, install=True): def INSTDIR(path): @@ -758,7 +758,7 @@ class Windows_x86_64_Manifest(ViewerManifest): installer_file = self.installer_base_name() + '_Setup.exe' substitution_strings['installer_file'] = installer_file - + version_vars = """ !define INSTEXE "SLVersionChecker.exe" !define VERSION "%(version_short)s" @@ -767,7 +767,7 @@ class Windows_x86_64_Manifest(ViewerManifest): !define VERSION_REGISTRY "%(version_registry)s" !define VIEWER_EXE "%(final_exe)s" """ % substitution_strings - + if self.channel_type() == 'release': substitution_strings['caption'] = CHANNEL_VENDOR_BASE else: @@ -898,7 +898,7 @@ class Darwin_x86_64_Manifest(ViewerManifest): # yields a slightly smaller binary but makes crash # logs mostly useless. This may be desirable for the # final release. Or not. - if ("package" in self.args['actions'] or + if ("package" in self.args['actions'] or "unpacked" in self.args['actions']): self.run_command( ['strip', '-S', executable]) @@ -923,7 +923,7 @@ class Darwin_x86_64_Manifest(ViewerManifest): with self.prefix(src=relpkgdir, dst=""): self.path("libndofdev.dylib") - self.path("libhunspell-*.dylib") + self.path("libhunspell-*.dylib") with self.prefix(src_dst="cursors_mac"): self.path("*.tif") @@ -1012,7 +1012,7 @@ class Darwin_x86_64_Manifest(ViewerManifest): 'libvivoxsdk.dylib', ): self.path2basename(relpkgdir, libfile) - + # OpenAL dylibs if self.args['openal'] == 'ON': for libfile in ( |