Use pre-increment when post-increment is not necessary

This commit is contained in:
Vittorio Romeo 2022-02-17 00:14:30 +00:00
parent fbd624bcf3
commit a3b27b4a6d
28 changed files with 142 additions and 142 deletions

View File

@ -7559,7 +7559,7 @@ static int glad_gl_get_extensions( int version, const char **out_exts, unsigned
if (exts_i == NULL) { if (exts_i == NULL) {
return 0; return 0;
} }
for(index = 0; index < num_exts_i; index++) { for(index = 0; index < num_exts_i; ++index) {
const char *gl_str_tmp = (const char*) glad_glGetStringi(GL_EXTENSIONS, index); const char *gl_str_tmp = (const char*) glad_glGetStringi(GL_EXTENSIONS, index);
size_t len = strlen(gl_str_tmp) + 1; size_t len = strlen(gl_str_tmp) + 1;
@ -7580,7 +7580,7 @@ static int glad_gl_get_extensions( int version, const char **out_exts, unsigned
static void glad_gl_free_extensions(char **exts_i, unsigned int num_exts_i) { static void glad_gl_free_extensions(char **exts_i, unsigned int num_exts_i) {
if (exts_i != NULL) { if (exts_i != NULL) {
unsigned int index; unsigned int index;
for(index = 0; index < num_exts_i; index++) { for(index = 0; index < num_exts_i; ++index) {
free((void *) (exts_i[index])); free((void *) (exts_i[index]));
} }
free((void *)exts_i); free((void *)exts_i);
@ -7610,7 +7610,7 @@ static int glad_gl_has_extension(int version, const char *exts, unsigned int num
} }
} else { } else {
unsigned int index; unsigned int index;
for(index = 0; index < num_exts_i; index++) { for(index = 0; index < num_exts_i; ++index) {
const char *e = exts_i[index]; const char *e = exts_i[index];
if(strcmp(e, ext) == 0) { if(strcmp(e, ext) == 0) {
return 1; return 1;
@ -7682,7 +7682,7 @@ static int glad_gl_find_core_gl(void) {
}; };
version = (const char*) glad_glGetString(GL_VERSION); version = (const char*) glad_glGetString(GL_VERSION);
if (!version) return 0; if (!version) return 0;
for (i = 0; prefixes[i]; i++) { for (i = 0; prefixes[i]; ++i) {
const size_t length = strlen(prefixes[i]); const size_t length = strlen(prefixes[i]);
if (strncmp(version, prefixes[i], length) == 0) { if (strncmp(version, prefixes[i], length) == 0) {
version += length; version += length;
@ -7783,7 +7783,7 @@ static int glad_gl_find_core_gles1(void) {
}; };
version = (const char*) glad_glGetString(GL_VERSION); version = (const char*) glad_glGetString(GL_VERSION);
if (!version) return 0; if (!version) return 0;
for (i = 0; prefixes[i]; i++) { for (i = 0; prefixes[i]; ++i) {
const size_t length = strlen(prefixes[i]); const size_t length = strlen(prefixes[i]);
if (strncmp(version, prefixes[i], length) == 0) { if (strncmp(version, prefixes[i], length) == 0) {
version += length; version += length;
@ -7830,7 +7830,7 @@ int gladLoadGLES1( GLADloadfunc load) {
#endif /* GLAD_GL_IMPLEMENTATION */ #endif /* GLAD_GL_IMPLEMENTATION */

View File

@ -136,7 +136,7 @@ int main()
else else
{ {
// Start up our thread pool // Start up our thread pool
for (unsigned int i = 0; i < threadCount; i++) for (unsigned int i = 0; i < threadCount; ++i)
{ {
threads.emplace_back(threadFunction); threads.emplace_back(threadFunction);
} }
@ -284,7 +284,7 @@ float getElevation(float x, float y)
float elevation = 0.0f; float elevation = 0.0f;
for (int i = 0; i < perlinOctaves; i++) for (int i = 0; i < perlinOctaves; ++i)
{ {
elevation += stb_perlin_noise3( elevation += stb_perlin_noise3(
x * perlinFrequency * static_cast<float>(std::pow(perlinFrequencyBase, i)), x * perlinFrequency * static_cast<float>(std::pow(perlinFrequencyBase, i)),
@ -467,9 +467,9 @@ void processWorkItem(std::vector<sf::Vertex>& vertices, const WorkItem& workItem
const float scalingFactorX = static_cast<float>(windowWidth) / static_cast<float>(resolutionX); const float scalingFactorX = static_cast<float>(windowWidth) / static_cast<float>(resolutionX);
const float scalingFactorY = static_cast<float>(windowHeight) / static_cast<float>(resolutionY); const float scalingFactorY = static_cast<float>(windowHeight) / static_cast<float>(resolutionY);
for (unsigned int y = rowStart; y < rowEnd; y++) for (unsigned int y = rowStart; y < rowEnd; ++y)
{ {
for (unsigned int x = 0; x < resolutionX; x++) for (unsigned int x = 0; x < resolutionX; ++x)
{ {
unsigned int arrayIndexBase = ((y - rowStart) * resolutionX + x) * 6; unsigned int arrayIndexBase = ((y - rowStart) * resolutionX + x) * 6;
@ -610,7 +610,7 @@ void generateTerrain(sf::Vertex* buffer)
{ {
std::scoped_lock lock(workQueueMutex); std::scoped_lock lock(workQueueMutex);
for (unsigned int i = 0; i < blockCount; i++) for (unsigned int i = 0; i < blockCount; ++i)
{ {
WorkItem workItem = {buffer, i}; WorkItem workItem = {buffer, i};
workQueue.push_back(workItem); workQueue.push_back(workItem);

View File

@ -34,9 +34,9 @@
// //
// Fractal Noise: // Fractal Noise:
// //
// Three common fractal noise functions are included, which produce // Three common fractal noise functions are included, which produce
// a wide variety of nice effects depending on the parameters // a wide variety of nice effects depending on the parameters
// provided. Note that each function will call stb_perlin_noise3 // provided. Note that each function will call stb_perlin_noise3
// 'octaves' times, so this parameter will affect runtime. // 'octaves' times, so this parameter will affect runtime.
// //
// float stb_perlin_ridge_noise3(float x, float y, float z, // float stb_perlin_ridge_noise3(float x, float y, float z,
@ -56,7 +56,7 @@
// lacunarity = ~ 2.0 -- spacing between successive octaves (use exactly 2.0 for wrapping output) // lacunarity = ~ 2.0 -- spacing between successive octaves (use exactly 2.0 for wrapping output)
// gain = 0.5 -- relative weighting applied to each successive octave // gain = 0.5 -- relative weighting applied to each successive octave
// offset = 1.0? -- used to invert the ridges, may need to be larger, not sure // offset = 1.0? -- used to invert the ridges, may need to be larger, not sure
// //
// //
// Contributors: // Contributors:
// Jack Mott - additional noise functions // Jack Mott - additional noise functions
@ -81,40 +81,40 @@ extern float stb_perlin_turbulence_noise3(float x, float y, float z, float lacun
// @OPTIMIZE: should this be unsigned char instead of int for cache? // @OPTIMIZE: should this be unsigned char instead of int for cache?
static unsigned char stb__perlin_randtab[512] = static unsigned char stb__perlin_randtab[512] =
{ {
23, 125, 161, 52, 103, 117, 70, 37, 247, 101, 203, 169, 124, 126, 44, 123, 23, 125, 161, 52, 103, 117, 70, 37, 247, 101, 203, 169, 124, 126, 44, 123,
152, 238, 145, 45, 171, 114, 253, 10, 192, 136, 4, 157, 249, 30, 35, 72, 152, 238, 145, 45, 171, 114, 253, 10, 192, 136, 4, 157, 249, 30, 35, 72,
175, 63, 77, 90, 181, 16, 96, 111, 133, 104, 75, 162, 93, 56, 66, 240, 175, 63, 77, 90, 181, 16, 96, 111, 133, 104, 75, 162, 93, 56, 66, 240,
8, 50, 84, 229, 49, 210, 173, 239, 141, 1, 87, 18, 2, 198, 143, 57, 8, 50, 84, 229, 49, 210, 173, 239, 141, 1, 87, 18, 2, 198, 143, 57,
225, 160, 58, 217, 168, 206, 245, 204, 199, 6, 73, 60, 20, 230, 211, 233, 225, 160, 58, 217, 168, 206, 245, 204, 199, 6, 73, 60, 20, 230, 211, 233,
94, 200, 88, 9, 74, 155, 33, 15, 219, 130, 226, 202, 83, 236, 42, 172, 94, 200, 88, 9, 74, 155, 33, 15, 219, 130, 226, 202, 83, 236, 42, 172,
165, 218, 55, 222, 46, 107, 98, 154, 109, 67, 196, 178, 127, 158, 13, 243, 165, 218, 55, 222, 46, 107, 98, 154, 109, 67, 196, 178, 127, 158, 13, 243,
65, 79, 166, 248, 25, 224, 115, 80, 68, 51, 184, 128, 232, 208, 151, 122, 65, 79, 166, 248, 25, 224, 115, 80, 68, 51, 184, 128, 232, 208, 151, 122,
26, 212, 105, 43, 179, 213, 235, 148, 146, 89, 14, 195, 28, 78, 112, 76, 26, 212, 105, 43, 179, 213, 235, 148, 146, 89, 14, 195, 28, 78, 112, 76,
250, 47, 24, 251, 140, 108, 186, 190, 228, 170, 183, 139, 39, 188, 244, 246, 250, 47, 24, 251, 140, 108, 186, 190, 228, 170, 183, 139, 39, 188, 244, 246,
132, 48, 119, 144, 180, 138, 134, 193, 82, 182, 120, 121, 86, 220, 209, 3, 132, 48, 119, 144, 180, 138, 134, 193, 82, 182, 120, 121, 86, 220, 209, 3,
91, 241, 149, 85, 205, 150, 113, 216, 31, 100, 41, 164, 177, 214, 153, 231, 91, 241, 149, 85, 205, 150, 113, 216, 31, 100, 41, 164, 177, 214, 153, 231,
38, 71, 185, 174, 97, 201, 29, 95, 7, 92, 54, 254, 191, 118, 34, 221, 38, 71, 185, 174, 97, 201, 29, 95, 7, 92, 54, 254, 191, 118, 34, 221,
131, 11, 163, 99, 234, 81, 227, 147, 156, 176, 17, 142, 69, 12, 110, 62, 131, 11, 163, 99, 234, 81, 227, 147, 156, 176, 17, 142, 69, 12, 110, 62,
27, 255, 0, 194, 59, 116, 242, 252, 19, 21, 187, 53, 207, 129, 64, 135, 27, 255, 0, 194, 59, 116, 242, 252, 19, 21, 187, 53, 207, 129, 64, 135,
61, 40, 167, 237, 102, 223, 106, 159, 197, 189, 215, 137, 36, 32, 22, 5, 61, 40, 167, 237, 102, 223, 106, 159, 197, 189, 215, 137, 36, 32, 22, 5,
// and a second copy so we don't need an extra mask or static initializer // and a second copy so we don't need an extra mask or static initializer
23, 125, 161, 52, 103, 117, 70, 37, 247, 101, 203, 169, 124, 126, 44, 123, 23, 125, 161, 52, 103, 117, 70, 37, 247, 101, 203, 169, 124, 126, 44, 123,
152, 238, 145, 45, 171, 114, 253, 10, 192, 136, 4, 157, 249, 30, 35, 72, 152, 238, 145, 45, 171, 114, 253, 10, 192, 136, 4, 157, 249, 30, 35, 72,
175, 63, 77, 90, 181, 16, 96, 111, 133, 104, 75, 162, 93, 56, 66, 240, 175, 63, 77, 90, 181, 16, 96, 111, 133, 104, 75, 162, 93, 56, 66, 240,
8, 50, 84, 229, 49, 210, 173, 239, 141, 1, 87, 18, 2, 198, 143, 57, 8, 50, 84, 229, 49, 210, 173, 239, 141, 1, 87, 18, 2, 198, 143, 57,
225, 160, 58, 217, 168, 206, 245, 204, 199, 6, 73, 60, 20, 230, 211, 233, 225, 160, 58, 217, 168, 206, 245, 204, 199, 6, 73, 60, 20, 230, 211, 233,
94, 200, 88, 9, 74, 155, 33, 15, 219, 130, 226, 202, 83, 236, 42, 172, 94, 200, 88, 9, 74, 155, 33, 15, 219, 130, 226, 202, 83, 236, 42, 172,
165, 218, 55, 222, 46, 107, 98, 154, 109, 67, 196, 178, 127, 158, 13, 243, 165, 218, 55, 222, 46, 107, 98, 154, 109, 67, 196, 178, 127, 158, 13, 243,
65, 79, 166, 248, 25, 224, 115, 80, 68, 51, 184, 128, 232, 208, 151, 122, 65, 79, 166, 248, 25, 224, 115, 80, 68, 51, 184, 128, 232, 208, 151, 122,
26, 212, 105, 43, 179, 213, 235, 148, 146, 89, 14, 195, 28, 78, 112, 76, 26, 212, 105, 43, 179, 213, 235, 148, 146, 89, 14, 195, 28, 78, 112, 76,
250, 47, 24, 251, 140, 108, 186, 190, 228, 170, 183, 139, 39, 188, 244, 246, 250, 47, 24, 251, 140, 108, 186, 190, 228, 170, 183, 139, 39, 188, 244, 246,
132, 48, 119, 144, 180, 138, 134, 193, 82, 182, 120, 121, 86, 220, 209, 3, 132, 48, 119, 144, 180, 138, 134, 193, 82, 182, 120, 121, 86, 220, 209, 3,
91, 241, 149, 85, 205, 150, 113, 216, 31, 100, 41, 164, 177, 214, 153, 231, 91, 241, 149, 85, 205, 150, 113, 216, 31, 100, 41, 164, 177, 214, 153, 231,
38, 71, 185, 174, 97, 201, 29, 95, 7, 92, 54, 254, 191, 118, 34, 221, 38, 71, 185, 174, 97, 201, 29, 95, 7, 92, 54, 254, 191, 118, 34, 221,
131, 11, 163, 99, 234, 81, 227, 147, 156, 176, 17, 142, 69, 12, 110, 62, 131, 11, 163, 99, 234, 81, 227, 147, 156, 176, 17, 142, 69, 12, 110, 62,
27, 255, 0, 194, 59, 116, 242, 252, 19, 21, 187, 53, 207, 129, 64, 135, 27, 255, 0, 194, 59, 116, 242, 252, 19, 21, 187, 53, 207, 129, 64, 135,
61, 40, 167, 237, 102, 223, 106, 159, 197, 189, 215, 137, 36, 32, 22, 5, 61, 40, 167, 237, 102, 223, 106, 159, 197, 189, 215, 137, 36, 32, 22, 5,
}; };
static float stb__perlin_lerp(float a, float b, float t) static float stb__perlin_lerp(float a, float b, float t)
@ -226,7 +226,7 @@ float stb_perlin_ridge_noise3(float x, float y, float z,float lacunarity, float
float amplitude = 0.5f; float amplitude = 0.5f;
float sum = 0.0f; float sum = 0.0f;
for (i = 0; i < octaves; i++) { for (i = 0; i < octaves; ++i) {
float r = (float)(stb_perlin_noise3(x*frequency,y*frequency,z*frequency,x_wrap,y_wrap,z_wrap)); float r = (float)(stb_perlin_noise3(x*frequency,y*frequency,z*frequency,x_wrap,y_wrap,z_wrap));
r = r<0 ? -r : r; // fabs() r = r<0 ? -r : r; // fabs()
r = offset - r; r = offset - r;
@ -245,8 +245,8 @@ float stb_perlin_fbm_noise3(float x, float y, float z,float lacunarity, float ga
float frequency = 1.0f; float frequency = 1.0f;
float amplitude = 1.0f; float amplitude = 1.0f;
float sum = 0.0f; float sum = 0.0f;
for (i = 0; i < octaves; i++) { for (i = 0; i < octaves; ++i) {
sum += stb_perlin_noise3(x*frequency,y*frequency,z*frequency,x_wrap,y_wrap,z_wrap)*amplitude; sum += stb_perlin_noise3(x*frequency,y*frequency,z*frequency,x_wrap,y_wrap,z_wrap)*amplitude;
frequency *= lacunarity; frequency *= lacunarity;
amplitude *= gain; amplitude *= gain;
@ -260,8 +260,8 @@ float stb_perlin_turbulence_noise3(float x, float y, float z, float lacunarity,
float frequency = 1.0f; float frequency = 1.0f;
float amplitude = 1.0f; float amplitude = 1.0f;
float sum = 0.0f; float sum = 0.0f;
for (i = 0; i < octaves; i++) { for (i = 0; i < octaves; ++i) {
float r = stb_perlin_noise3(x*frequency,y*frequency,z*frequency,x_wrap,y_wrap,z_wrap)*amplitude; float r = stb_perlin_noise3(x*frequency,y*frequency,z*frequency,x_wrap,y_wrap,z_wrap)*amplitude;
r = r<0 ? -r : r; // fabs() r = r<0 ? -r : r; // fabs()
sum += r; sum += r;
@ -279,38 +279,38 @@ This software is available under 2 licenses -- choose whichever you prefer.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
ALTERNATIVE A - MIT License ALTERNATIVE A - MIT License
Copyright (c) 2017 Sean Barrett Copyright (c) 2017 Sean Barrett
Permission is hereby granted, free of charge, to any person obtaining a copy of Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions: so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software. copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
ALTERNATIVE B - Public Domain (www.unlicense.org) ALTERNATIVE B - Public Domain (www.unlicense.org)
This is free and unencumbered software released into the public domain. This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
software, either in source code form or as a compiled binary, for any purpose, software, either in source code form or as a compiled binary, for any purpose,
commercial or non-commercial, and by any means. commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this In jurisdictions that recognize copyright laws, the author or authors of this
software dedicate any and all copyright interest in the software to the public software dedicate any and all copyright interest in the software to the public
domain. We make this dedication for the benefit of the public at large and to domain. We make this dedication for the benefit of the public at large and to
the detriment of our heirs and successors. We intend this dedication to be an the detriment of our heirs and successors. We intend this dedication to be an
overt act of relinquishment in perpetuity of all present and future rights to overt act of relinquishment in perpetuity of all present and future rights to
this software under copyright law. this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*/ */

View File

@ -7559,7 +7559,7 @@ static int glad_gl_get_extensions( int version, const char **out_exts, unsigned
if (exts_i == NULL) { if (exts_i == NULL) {
return 0; return 0;
} }
for(index = 0; index < num_exts_i; index++) { for(index = 0; index < num_exts_i; ++index) {
const char *gl_str_tmp = (const char*) glad_glGetStringi(GL_EXTENSIONS, index); const char *gl_str_tmp = (const char*) glad_glGetStringi(GL_EXTENSIONS, index);
size_t len = strlen(gl_str_tmp) + 1; size_t len = strlen(gl_str_tmp) + 1;
@ -7580,7 +7580,7 @@ static int glad_gl_get_extensions( int version, const char **out_exts, unsigned
static void glad_gl_free_extensions(char **exts_i, unsigned int num_exts_i) { static void glad_gl_free_extensions(char **exts_i, unsigned int num_exts_i) {
if (exts_i != NULL) { if (exts_i != NULL) {
unsigned int index; unsigned int index;
for(index = 0; index < num_exts_i; index++) { for(index = 0; index < num_exts_i; ++index) {
free((void *) (exts_i[index])); free((void *) (exts_i[index]));
} }
free((void *)exts_i); free((void *)exts_i);
@ -7610,7 +7610,7 @@ static int glad_gl_has_extension(int version, const char *exts, unsigned int num
} }
} else { } else {
unsigned int index; unsigned int index;
for(index = 0; index < num_exts_i; index++) { for(index = 0; index < num_exts_i; ++index) {
const char *e = exts_i[index]; const char *e = exts_i[index];
if(strcmp(e, ext) == 0) { if(strcmp(e, ext) == 0) {
return 1; return 1;
@ -7682,7 +7682,7 @@ static int glad_gl_find_core_gl(void) {
}; };
version = (const char*) glad_glGetString(GL_VERSION); version = (const char*) glad_glGetString(GL_VERSION);
if (!version) return 0; if (!version) return 0;
for (i = 0; prefixes[i]; i++) { for (i = 0; prefixes[i]; ++i) {
const size_t length = strlen(prefixes[i]); const size_t length = strlen(prefixes[i]);
if (strncmp(version, prefixes[i], length) == 0) { if (strncmp(version, prefixes[i], length) == 0) {
version += length; version += length;
@ -7783,7 +7783,7 @@ static int glad_gl_find_core_gles1(void) {
}; };
version = (const char*) glad_glGetString(GL_VERSION); version = (const char*) glad_glGetString(GL_VERSION);
if (!version) return 0; if (!version) return 0;
for (i = 0; prefixes[i]; i++) { for (i = 0; prefixes[i]; ++i) {
const size_t length = strlen(prefixes[i]); const size_t length = strlen(prefixes[i]);
if (strncmp(version, prefixes[i], length) == 0) { if (strncmp(version, prefixes[i], length) == 0) {
version += length; version += length;
@ -7830,7 +7830,7 @@ int gladLoadGLES1( GLADloadfunc load) {
#endif /* GLAD_GL_IMPLEMENTATION */ #endif /* GLAD_GL_IMPLEMENTATION */

View File

@ -282,7 +282,7 @@ public:
return false; return false;
// Move the points in the point cloud to random positions // Move the points in the point cloud to random positions
for (std::size_t i = 0; i < 10000; i++) for (std::size_t i = 0; i < 10000; ++i)
{ {
// Spread the coordinates from -480 to +480 // Spread the coordinates from -480 to +480
// So they'll always fill the viewport at 800x600 // So they'll always fill the viewport at 800x600
@ -427,7 +427,7 @@ int main()
if (current == 0) if (current == 0)
current = effects.size() - 1; current = effects.size() - 1;
else else
current--; --current;
description.setString("Current effect: " + effects[current]->getName()); description.setString("Current effect: " + effects[current]->getName());
break; break;
@ -436,7 +436,7 @@ int main()
if (current == effects.size() - 1) if (current == effects.size() - 1)
current = 0; current = 0;
else else
current++; ++current;
description.setString("Current effect: " + effects[current]->getName()); description.setString("Current effect: " + effects[current]->getName());
break; break;

View File

@ -25,7 +25,7 @@ void main()
half_size /= resolution; half_size /= resolution;
// Iterate over all vertices // Iterate over all vertices
for (int i = 0; i < gl_in.length(); i++) for (int i = 0; i < gl_in.length(); ++i)
{ {
// Retrieve the passed vertex position // Retrieve the passed vertex position
vec2 pos = gl_in[i].gl_Position.xy; vec2 pos = gl_in[i].gl_Position.xy;

View File

@ -29,9 +29,9 @@ namespace
{ {
Matrix temp; Matrix temp;
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; ++i)
{ {
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; ++j)
temp[i][j] = left[0][j] * right[i][0] + left[1][j] * right[i][1] + left[2][j] * right[i][2] + left[3][j] * right[i][3]; temp[i][j] = left[0][j] * right[i][0] + left[1][j] * right[i][1] + left[2][j] * right[i][2] + left[3][j] * right[i][3];
} }
@ -665,7 +665,7 @@ public:
vkGetPhysicalDeviceQueueFamilyProperties(gpu, &objectCount, queueFamilyProperties.data()); vkGetPhysicalDeviceQueueFamilyProperties(gpu, &objectCount, queueFamilyProperties.data());
for (std::size_t i = 0; i < queueFamilyProperties.size(); i++) for (std::size_t i = 0; i < queueFamilyProperties.size(); ++i)
{ {
VkBool32 surfaceSupported = VK_FALSE; VkBool32 surfaceSupported = VK_FALSE;
@ -870,7 +870,7 @@ public:
imageViewCreateInfo.subresourceRange.layerCount = 1; imageViewCreateInfo.subresourceRange.layerCount = 1;
// Create an image view for each swapchain image // Create an image view for each swapchain image
for (std::size_t i = 0; i < swapchainImages.size(); i++) for (std::size_t i = 0; i < swapchainImages.size(); ++i)
{ {
imageViewCreateInfo.image = swapchainImages[i]; imageViewCreateInfo.image = swapchainImages[i];
@ -1220,7 +1220,7 @@ public:
framebufferCreateInfo.height = swapchainExtent.height; framebufferCreateInfo.height = swapchainExtent.height;
framebufferCreateInfo.layers = 1; framebufferCreateInfo.layers = 1;
for (std::size_t i = 0; i < swapchainFramebuffers.size(); i++) for (std::size_t i = 0; i < swapchainFramebuffers.size(); ++i)
{ {
// Each framebuffer consists of a corresponding swapchain image and the shared depth image // Each framebuffer consists of a corresponding swapchain image and the shared depth image
VkImageView attachments[] = {swapchainImageViews[i], depthImageView}; VkImageView attachments[] = {swapchainImageViews[i], depthImageView};
@ -1277,7 +1277,7 @@ public:
uint32_t memoryType = 0; uint32_t memoryType = 0;
for (; memoryType < memoryProperties.memoryTypeCount; memoryType++) for (; memoryType < memoryProperties.memoryTypeCount; ++memoryType)
{ {
if ((memoryRequirements.memoryTypeBits & static_cast<unsigned int>(1 << memoryType)) && if ((memoryRequirements.memoryTypeBits & static_cast<unsigned int>(1 << memoryType)) &&
((memoryProperties.memoryTypes[memoryType].propertyFlags & properties) == properties)) ((memoryProperties.memoryTypes[memoryType].propertyFlags & properties) == properties))
@ -1546,7 +1546,7 @@ public:
void setupUniformBuffers() void setupUniformBuffers()
{ {
// Create a uniform buffer for every frame that might be in flight to prevent clobbering // Create a uniform buffer for every frame that might be in flight to prevent clobbering
for (size_t i = 0; i < swapchainImages.size(); i++) for (size_t i = 0; i < swapchainImages.size(); ++i)
{ {
uniformBuffers.push_back(0); uniformBuffers.push_back(0);
uniformBuffersMemory.push_back(0); uniformBuffersMemory.push_back(0);
@ -1599,7 +1599,7 @@ public:
uint32_t memoryType = 0; uint32_t memoryType = 0;
for (; memoryType < memoryProperties.memoryTypeCount; memoryType++) for (; memoryType < memoryProperties.memoryTypeCount; ++memoryType)
{ {
if ((memoryRequirements.memoryTypeBits & static_cast<unsigned int>(1 << memoryType)) && if ((memoryRequirements.memoryTypeBits & static_cast<unsigned int>(1 << memoryType)) &&
((memoryProperties.memoryTypes[memoryType].propertyFlags & properties) == properties)) ((memoryProperties.memoryTypes[memoryType].propertyFlags & properties) == properties))
@ -2124,7 +2124,7 @@ public:
} }
// For every descriptor set, set up the bindings to our uniform buffer and texture sampler // For every descriptor set, set up the bindings to our uniform buffer and texture sampler
for (std::size_t i = 0; i < descriptorSets.size(); i++) for (std::size_t i = 0; i < descriptorSets.size(); ++i)
{ {
VkWriteDescriptorSet writeDescriptorSets[2]; VkWriteDescriptorSet writeDescriptorSets[2];
@ -2218,7 +2218,7 @@ public:
commandBufferBeginInfo.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT; commandBufferBeginInfo.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT;
// Set up the command buffers for each frame in flight // Set up the command buffers for each frame in flight
for (std::size_t i = 0; i < commandBuffers.size(); i++) for (std::size_t i = 0; i < commandBuffers.size(); ++i)
{ {
// Begin the command buffer // Begin the command buffer
if (vkBeginCommandBuffer(commandBuffers[i], &commandBufferBeginInfo) != VK_SUCCESS) if (vkBeginCommandBuffer(commandBuffers[i], &commandBufferBeginInfo) != VK_SUCCESS)
@ -2268,7 +2268,7 @@ public:
semaphoreCreateInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; semaphoreCreateInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
// Create a semaphore to track when an swapchain image is available for each frame in flight // Create a semaphore to track when an swapchain image is available for each frame in flight
for (std::size_t i = 0; i < maxFramesInFlight; i++) for (std::size_t i = 0; i < maxFramesInFlight; ++i)
{ {
imageAvailableSemaphores.push_back(0); imageAvailableSemaphores.push_back(0);
@ -2281,7 +2281,7 @@ public:
} }
// Create a semaphore to track when rendering is complete for each frame in flight // Create a semaphore to track when rendering is complete for each frame in flight
for (std::size_t i = 0; i < maxFramesInFlight; i++) for (std::size_t i = 0; i < maxFramesInFlight; ++i)
{ {
renderFinishedSemaphores.push_back(0); renderFinishedSemaphores.push_back(0);
@ -2303,7 +2303,7 @@ public:
fenceCreateInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT; fenceCreateInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT;
// Create a fence to track when queue submission is complete for each frame in flight // Create a fence to track when queue submission is complete for each frame in flight
for (std::size_t i = 0; i < maxFramesInFlight; i++) for (std::size_t i = 0; i < maxFramesInFlight; ++i)
{ {
fences.push_back(0); fences.push_back(0);

View File

@ -7559,7 +7559,7 @@ static int glad_gl_get_extensions( int version, const char **out_exts, unsigned
if (exts_i == NULL) { if (exts_i == NULL) {
return 0; return 0;
} }
for(index = 0; index < num_exts_i; index++) { for(index = 0; index < num_exts_i; ++index) {
const char *gl_str_tmp = (const char*) glad_glGetStringi(GL_EXTENSIONS, index); const char *gl_str_tmp = (const char*) glad_glGetStringi(GL_EXTENSIONS, index);
size_t len = strlen(gl_str_tmp) + 1; size_t len = strlen(gl_str_tmp) + 1;
@ -7580,7 +7580,7 @@ static int glad_gl_get_extensions( int version, const char **out_exts, unsigned
static void glad_gl_free_extensions(char **exts_i, unsigned int num_exts_i) { static void glad_gl_free_extensions(char **exts_i, unsigned int num_exts_i) {
if (exts_i != NULL) { if (exts_i != NULL) {
unsigned int index; unsigned int index;
for(index = 0; index < num_exts_i; index++) { for(index = 0; index < num_exts_i; ++index) {
free((void *) (exts_i[index])); free((void *) (exts_i[index]));
} }
free((void *)exts_i); free((void *)exts_i);
@ -7610,7 +7610,7 @@ static int glad_gl_has_extension(int version, const char *exts, unsigned int num
} }
} else { } else {
unsigned int index; unsigned int index;
for(index = 0; index < num_exts_i; index++) { for(index = 0; index < num_exts_i; ++index) {
const char *e = exts_i[index]; const char *e = exts_i[index];
if(strcmp(e, ext) == 0) { if(strcmp(e, ext) == 0) {
return 1; return 1;
@ -7682,7 +7682,7 @@ static int glad_gl_find_core_gl(void) {
}; };
version = (const char*) glad_glGetString(GL_VERSION); version = (const char*) glad_glGetString(GL_VERSION);
if (!version) return 0; if (!version) return 0;
for (i = 0; prefixes[i]; i++) { for (i = 0; prefixes[i]; ++i) {
const size_t length = strlen(prefixes[i]); const size_t length = strlen(prefixes[i]);
if (strncmp(version, prefixes[i], length) == 0) { if (strncmp(version, prefixes[i], length) == 0) {
version += length; version += length;
@ -7783,7 +7783,7 @@ static int glad_gl_find_core_gles1(void) {
}; };
version = (const char*) glad_glGetString(GL_VERSION); version = (const char*) glad_glGetString(GL_VERSION);
if (!version) return 0; if (!version) return 0;
for (i = 0; prefixes[i]; i++) { for (i = 0; prefixes[i]; ++i) {
const size_t length = strlen(prefixes[i]); const size_t length = strlen(prefixes[i]);
if (strncmp(version, prefixes[i], length) == 0) { if (strncmp(version, prefixes[i], length) == 0) {
version += length; version += length;
@ -7830,7 +7830,7 @@ int gladLoadGLES1( GLADloadfunc load) {
#endif /* GLAD_GL_IMPLEMENTATION */ #endif /* GLAD_GL_IMPLEMENTATION */

View File

@ -465,7 +465,7 @@ Out Utf<16>::toLatin1(In begin, In end, Out output, char replacement)
while (begin < end) while (begin < end)
{ {
*output++ = *begin < 256 ? static_cast<char>(*begin) : replacement; *output++ = *begin < 256 ? static_cast<char>(*begin) : replacement;
begin++; ++begin;
} }
return output; return output;
@ -607,7 +607,7 @@ Out Utf<32>::toLatin1(In begin, In end, Out output, char replacement)
while (begin < end) while (begin < end)
{ {
*output++ = *begin < 256 ? static_cast<char>(*begin) : replacement; *output++ = *begin < 256 ? static_cast<char>(*begin) : replacement;
begin++; ++begin;
} }
return output; return output;

View File

@ -57,7 +57,7 @@ AlResource::AlResource()
globalDevice = std::make_unique<priv::AudioDevice>(); globalDevice = std::make_unique<priv::AudioDevice>();
// Increment the resources counter // Increment the resources counter
count++; ++count;
} }
@ -68,7 +68,7 @@ AlResource::~AlResource()
std::scoped_lock lock(mutex); std::scoped_lock lock(mutex);
// Decrement the resources counter // Decrement the resources counter
count--; --count;
// If there's no more resource alive, we can destroy the device // If there's no more resource alive, we can destroy the device
if (count == 0) if (count == 0)

View File

@ -143,7 +143,7 @@ namespace
{ {
// If there's room in the output buffer, copy the sample there // If there's room in the output buffer, copy the sample there
*data->buffer++ = sample; *data->buffer++ = sample;
data->remaining--; --data->remaining;
} }
else else
{ {

View File

@ -508,7 +508,7 @@ JNIEXPORT void ANativeActivity_onCreate(ANativeActivity* activity, void* savedSt
states->inputQueue = nullptr; states->inputQueue = nullptr;
states->config = nullptr; states->config = nullptr;
for (unsigned int i = 0; i < sf::Mouse::ButtonCount; i++) for (unsigned int i = 0; i < sf::Mouse::ButtonCount; ++i)
states->isButtonPressed[i] = false; states->isButtonPressed[i] = false;
gladLoaderLoadEGL(EGL_DEFAULT_DISPLAY); gladLoaderLoadEGL(EGL_DEFAULT_DISPLAY);

View File

@ -563,11 +563,11 @@ Ftp::Response Ftp::DataChannel::open(Ftp::TransferMode mode)
while (isdigit(str[index])) while (isdigit(str[index]))
{ {
datum = static_cast<Uint8>(static_cast<Uint8>(datum * 10) + static_cast<Uint8>(str[index] - '0')); datum = static_cast<Uint8>(static_cast<Uint8>(datum * 10) + static_cast<Uint8>(str[index] - '0'));
index++; ++index;
} }
// Skip separator // Skip separator
index++; ++index;
} }
// Reconstruct connection port and address // Reconstruct connection port and address

View File

@ -245,7 +245,7 @@ void Http::Response::parse(const std::string& data)
// Copy the actual content data // Copy the actual content data
std::istreambuf_iterator<char> it(in); std::istreambuf_iterator<char> it(in);
std::istreambuf_iterator<char> itEnd; std::istreambuf_iterator<char> itEnd;
for (std::size_t i = 0; ((i < length) && (it != itEnd)); i++) for (std::size_t i = 0; ((i < length) && (it != itEnd)); ++i)
m_body.push_back(*it++); m_body.push_back(*it++);
} }

View File

@ -91,7 +91,7 @@ void SocketSelector::add(Socket& socket)
if (FD_ISSET(handle, &m_impl->allSockets)) if (FD_ISSET(handle, &m_impl->allSockets))
return; return;
m_impl->socketCount++; ++m_impl->socketCount;
#else #else
@ -125,7 +125,7 @@ void SocketSelector::remove(Socket& socket)
if (!FD_ISSET(handle, &m_impl->allSockets)) if (!FD_ISSET(handle, &m_impl->allSockets))
return; return;
m_impl->socketCount--; --m_impl->socketCount;
#else #else

View File

@ -465,7 +465,7 @@ int WindowImplAndroid::processMotionEvent(AInputEvent* _event, ActivityStates& s
size_t pointerCount = AMotionEvent_getPointerCount(_event); size_t pointerCount = AMotionEvent_getPointerCount(_event);
for (size_t p = 0; p < pointerCount; p++) for (size_t p = 0; p < pointerCount; ++p)
{ {
int32_t id = AMotionEvent_getPointerId(_event, p); int32_t id = AMotionEvent_getPointerId(_event, p);

View File

@ -256,7 +256,7 @@ JoystickCaps JoystickImpl::getCapabilities() const
if (usage == HUP_BUTTON) if (usage == HUP_BUTTON)
{ {
caps.buttonCount++; ++caps.buttonCount;
break; break;
} }
else if (usage == HUP_GENERIC_DESKTOP) else if (usage == HUP_GENERIC_DESKTOP)

View File

@ -275,7 +275,7 @@ namespace
const char* extension = extensionString; const char* extension = extensionString;
while (*extensionString && (*extensionString != ' ')) while (*extensionString && (*extensionString != ' '))
extensionString++; ++extensionString;
extensions.emplace_back(extension, extensionString); extensions.emplace_back(extension, extensionString);
} }
@ -343,7 +343,7 @@ void GlContext::initResource()
if (sharedContext) if (sharedContext)
{ {
// Increment the resources counter // Increment the resources counter
resourceCount++; ++resourceCount;
return; return;
} }
@ -360,7 +360,7 @@ void GlContext::initResource()
} }
// Increment the resources counter // Increment the resources counter
resourceCount++; ++resourceCount;
} }
@ -375,7 +375,7 @@ void GlContext::cleanupResource()
std::scoped_lock lock(mutex); std::scoped_lock lock(mutex);
// Decrement the resources counter // Decrement the resources counter
resourceCount--; --resourceCount;
// If there's no more resource alive, we can trigger the global context cleanup // If there's no more resource alive, we can trigger the global context cleanup
if (resourceCount == 0) if (resourceCount == 0)
@ -412,7 +412,7 @@ void GlContext::acquireTransientContext()
transientContext = std::make_unique<TransientContext>(); transientContext = std::make_unique<TransientContext>();
// Increase the reference count // Increase the reference count
transientContext->referenceCount++; ++transientContext->referenceCount;
} }
@ -429,7 +429,7 @@ void GlContext::releaseTransientContext()
assert(transientContext); assert(transientContext);
// Decrease the reference count // Decrease the reference count
transientContext->referenceCount--; --transientContext->referenceCount;
// If this is the last TransientContextLock that is released // If this is the last TransientContextLock that is released
// destroy the state object // destroy the state object

View File

@ -261,7 +261,7 @@ JoystickCaps JoystickImpl::getCapabilities() const
if (usage == HUP_BUTTON) if (usage == HUP_BUTTON)
{ {
caps.buttonCount++; ++caps.buttonCount;
break; break;
} }
else if (usage == HUP_GENERIC_DESKTOP) else if (usage == HUP_GENERIC_DESKTOP)

View File

@ -134,7 +134,7 @@ void HIDJoystickManager::update()
void HIDJoystickManager::pluggedIn(void* context, IOReturn, void*, IOHIDDeviceRef) void HIDJoystickManager::pluggedIn(void* context, IOReturn, void*, IOHIDDeviceRef)
{ {
HIDJoystickManager* manager = static_cast<HIDJoystickManager*>(context); HIDJoystickManager* manager = static_cast<HIDJoystickManager*>(context);
manager->m_joystickCount++; ++manager->m_joystickCount;
} }
@ -142,7 +142,7 @@ void HIDJoystickManager::pluggedIn(void* context, IOReturn, void*, IOHIDDeviceRe
void HIDJoystickManager::pluggedOut(void* context, IOReturn, void*, IOHIDDeviceRef) void HIDJoystickManager::pluggedOut(void* context, IOReturn, void*, IOHIDDeviceRef)
{ {
HIDJoystickManager* manager = static_cast<HIDJoystickManager*>(context); HIDJoystickManager* manager = static_cast<HIDJoystickManager*>(context);
manager->m_joystickCount--; --manager->m_joystickCount;
} }

View File

@ -128,7 +128,7 @@ bool JoystickImpl::isConnected(unsigned int index)
for (unsigned int i(0); i < sf::Joystick::Count; ++i) for (unsigned int i(0); i < sf::Joystick::Count; ++i)
{ {
if (m_locationIDs[i] != 0) if (m_locationIDs[i] != 0)
openedCount++; ++openedCount;
} }

View File

@ -55,7 +55,7 @@ std::vector<VideoMode> VideoModeImpl::getFullscreenModes()
// Loop on each mode and convert it into a sf::VideoMode object. // Loop on each mode and convert it into a sf::VideoMode object.
const CFIndex modesCount = CFArrayGetCount(cgmodes); const CFIndex modesCount = CFArrayGetCount(cgmodes);
for (CFIndex i = 0; i < modesCount; i++) for (CFIndex i = 0; i < modesCount; ++i)
{ {
CGDisplayModeRef cgmode = static_cast<CGDisplayModeRef>(const_cast<void*>(CFArrayGetValueAtIndex(cgmodes, i))); CGDisplayModeRef cgmode = static_cast<CGDisplayModeRef>(const_cast<void*>(CFArrayGetValueAtIndex(cgmodes, i)));

View File

@ -70,7 +70,7 @@ Display* OpenDisplay()
} }
} }
referenceCount++; ++referenceCount;
return sharedDisplay; return sharedDisplay;
} }
@ -82,7 +82,7 @@ void CloseDisplay(Display* display)
assert(display == sharedDisplay); assert(display == sharedDisplay);
referenceCount--; --referenceCount;
if (referenceCount == 0) if (referenceCount == 0)
XCloseDisplay(display); XCloseDisplay(display);
} }
@ -120,7 +120,7 @@ XIM OpenXIM()
XSetLocaleModifiers(prevXLoc.c_str()); XSetLocaleModifiers(prevXLoc.c_str());
} }
referenceCountXIM++; ++referenceCountXIM;
return sharedXIM; return sharedXIM;
} }
@ -132,7 +132,7 @@ void CloseXIM(XIM xim)
assert(xim == sharedXIM); assert(xim == sharedXIM);
referenceCountXIM--; --referenceCountXIM;
if ((referenceCountXIM == 0) && (xim != nullptr)) if ((referenceCountXIM == 0) && (xim != nullptr))
XCloseIM(xim); XCloseIM(xim);

View File

@ -740,14 +740,14 @@ void GlxContext::createContext(GlxContext* shared)
else if (m_settings.minorVersion > 0) else if (m_settings.minorVersion > 0)
{ {
// If the minor version is not 0, we decrease it and try again // If the minor version is not 0, we decrease it and try again
m_settings.minorVersion--; --m_settings.minorVersion;
m_settings.attributeFlags = settings.attributeFlags; m_settings.attributeFlags = settings.attributeFlags;
} }
else else
{ {
// If the minor version is 0, we decrease the major version // If the minor version is 0, we decrease the major version
m_settings.majorVersion--; --m_settings.majorVersion;
m_settings.minorVersion = 9; m_settings.minorVersion = 9;
m_settings.attributeFlags = settings.attributeFlags; m_settings.attributeFlags = settings.attributeFlags;

View File

@ -1372,7 +1372,7 @@ void WindowImplX11::setVideoMode(const VideoMode& mode)
bool modeFound = false; bool modeFound = false;
RRMode xRandMode; RRMode xRandMode;
for (int i = 0; (i < res->nmode) && !modeFound; i++) for (int i = 0; (i < res->nmode) && !modeFound; ++i)
{ {
if (crtcInfo->rotation == RR_Rotate_90 || crtcInfo->rotation == RR_Rotate_270) if (crtcInfo->rotation == RR_Rotate_90 || crtcInfo->rotation == RR_Rotate_270)
std::swap(res->modes[i].height, res->modes[i].width); std::swap(res->modes[i].height, res->modes[i].width);

View File

@ -683,14 +683,14 @@ void WglContext::createContext(WglContext* shared)
else if (m_settings.minorVersion > 0) else if (m_settings.minorVersion > 0)
{ {
// If the minor version is not 0, we decrease it and try again // If the minor version is not 0, we decrease it and try again
m_settings.minorVersion--; --m_settings.minorVersion;
m_settings.attributeFlags = settings.attributeFlags; m_settings.attributeFlags = settings.attributeFlags;
} }
else else
{ {
// If the minor version is 0, we decrease the major version // If the minor version is 0, we decrease the major version
m_settings.majorVersion--; --m_settings.majorVersion;
m_settings.minorVersion = 9; m_settings.minorVersion = 9;
m_settings.attributeFlags = settings.attributeFlags; m_settings.attributeFlags = settings.attributeFlags;

View File

@ -233,7 +233,7 @@ m_cursorGrabbed (m_fullscreen)
switchToFullscreen(mode); switchToFullscreen(mode);
// Increment window count // Increment window count
windowCount++; ++windowCount;
} }
@ -262,7 +262,7 @@ WindowImplWin32::~WindowImplWin32()
DestroyWindow(m_handle); DestroyWindow(m_handle);
// Decrement the window count // Decrement the window count
windowCount--; --windowCount;
// Unregister window class if we were the last window // Unregister window class if we were the last window
if (windowCount == 0) if (windowCount == 0)

View File

@ -220,11 +220,11 @@ void SensorImpl::setEnabled(bool enabled)
{ {
if (deviceMotionEnabledCount == 0) if (deviceMotionEnabledCount == 0)
[[SFAppDelegate getInstance].motionManager startDeviceMotionUpdates]; [[SFAppDelegate getInstance].motionManager startDeviceMotionUpdates];
deviceMotionEnabledCount++; ++deviceMotionEnabledCount;
} }
else else
{ {
deviceMotionEnabledCount--; --deviceMotionEnabledCount;
if (deviceMotionEnabledCount == 0) if (deviceMotionEnabledCount == 0)
[[SFAppDelegate getInstance].motionManager stopDeviceMotionUpdates]; [[SFAppDelegate getInstance].motionManager stopDeviceMotionUpdates];
} }