wmbiff: use one for-loop when creating backing XPM.
Fixes static analysis warning about uninitialized value. Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
This commit is contained in:
		
							parent
							
								
									70ceed6e38
								
							
						
					
					
						commit
						2ec13c2f6f
					
				
					 1 changed files with 35 additions and 27 deletions
				
			
		| 
						 | 
					@ -908,24 +908,27 @@ static char **CreateBackingXPM(int width, int height,
 | 
				
			||||||
	const int colors = 5;
 | 
						const int colors = 5;
 | 
				
			||||||
	const int base = colors + 1;
 | 
						const int base = colors + 1;
 | 
				
			||||||
	const int margin = 4;
 | 
						const int margin = 4;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
	int top = findTopOfMasterXPM(skin_xpm);
 | 
						int top = findTopOfMasterXPM(skin_xpm);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret[0] = malloc_ordie(30);
 | 
						ret[0] = malloc_ordie(30);
 | 
				
			||||||
	sprintf(ret[0], "%d %d %d %d", width, height, colors, 1);
 | 
						sprintf(ret[0], "%d %d %d %d", width, height, colors, 1);
 | 
				
			||||||
	ret[1] = (char *) " \tc #0000FF";	/* no color */
 | 
						ret[1] = (char *) " \tc #0000FF";	/* no color */
 | 
				
			||||||
	ret[2] = (char *) ".\tc #505075";	/* background gray */
 | 
					 | 
				
			||||||
	ret[2] = malloc_ordie(30);
 | 
						ret[2] = malloc_ordie(30);
 | 
				
			||||||
	sprintf(ret[2], ".\tc %s", background);
 | 
						sprintf(ret[2], ".\tc %s", background);
 | 
				
			||||||
	ret[3] = (char *) "+\tc #000000";	/* shadowed */
 | 
						ret[3] = (char *) "+\tc #000000";	/* shadowed */
 | 
				
			||||||
	ret[4] = (char *) "@\tc #C7C3C7";	/* highlight */
 | 
						ret[4] = (char *) "@\tc #C7C3C7";	/* highlight */
 | 
				
			||||||
	ret[5] = (char *) ":\tc #004941";	/* led off */
 | 
						ret[5] = (char *) ":\tc #004941";	/* led off */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = base; i < base + height; i++) {
 | 
						for (i = base; i < base + height; i++) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ret[i] = malloc_ordie(width);
 | 
							ret[i] = malloc_ordie(width);
 | 
				
			||||||
	}
 | 
					
 | 
				
			||||||
	for (i = base; i < base + margin; i++) {
 | 
							if (i < base + margin) {
 | 
				
			||||||
			memset(ret[i], ' ', width);
 | 
								memset(ret[i], ' ', width);
 | 
				
			||||||
	}
 | 
							} else if (i < height + base - margin) {
 | 
				
			||||||
	for (i = base + margin; i < height + base - margin; i++) {
 | 
					
 | 
				
			||||||
			memset(ret[i], ' ', margin);
 | 
								memset(ret[i], ' ', margin);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (i == base + margin) {
 | 
								if (i == base + margin) {
 | 
				
			||||||
| 
						 | 
					@ -936,7 +939,8 @@ static char **CreateBackingXPM(int width, int height,
 | 
				
			||||||
				// "    +..:::...:::...:::...:::...:::.......:::...:::...:::...@    "
 | 
									// "    +..:::...:::...:::...:::...:::.......:::...:::...:::...@    "
 | 
				
			||||||
				// "    +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@    "                                                                                               ",
 | 
									// "    +.:...:.:...:.:...:.:...:.:...:..:..:...:.:...:.:...:..@    "                                                                                               ",
 | 
				
			||||||
				ret[i][margin] = '+';
 | 
									ret[i][margin] = '+';
 | 
				
			||||||
			memset(ret[i] + margin + 1, '.', width - margin - margin - 1);
 | 
									memset(ret[i] + margin + 1, '.',
 | 
				
			||||||
 | 
										   width - margin - margin - 1);
 | 
				
			||||||
				ret[i][width - margin - 1] = '@';
 | 
									ret[i][width - margin - 1] = '@';
 | 
				
			||||||
				memcpy(ret[i],
 | 
									memcpy(ret[i],
 | 
				
			||||||
					   skin_xpm[((i - (base + margin) - 1) % 11) + top + 1],
 | 
										   skin_xpm[((i - (base + margin) - 1) % 11) + top + 1],
 | 
				
			||||||
| 
						 | 
					@ -944,12 +948,16 @@ static char **CreateBackingXPM(int width, int height,
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			memset(ret[i] + width - margin, ' ', margin);
 | 
								memset(ret[i] + width - margin, ' ', margin);
 | 
				
			||||||
	}
 | 
					
 | 
				
			||||||
	for (i = base + height - margin; i < height + base; i++) {
 | 
							} else {
 | 
				
			||||||
			memset(ret[i], ' ', width);
 | 
								memset(ret[i], ' ', width);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	ret[height + base] = NULL;	/* not sure if this is necessary, it just
 | 
					
 | 
				
			||||||
								   seemed like a good idea  */
 | 
						}
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * Not sure if this is necessary, it just seemed like a good idea
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						ret[height + base] = NULL;
 | 
				
			||||||
	return (ret);
 | 
						return (ret);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue