From 293ca03ba7fc4ab7677c544d8179b443ff639671 Mon Sep 17 00:00:00 2001 From: Kouzinopoulos Charis Date: Mon, 11 Feb 2008 10:26:15 +0200 Subject: [PATCH] Bugfix: Fixed crash in create_files(), fixed potential overflowing problems by substituting int with unsigned int, fixed indentation --- helper.c | 56 +++++++++++++++++++++++++++----------------------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/helper.c b/helper.c index 4c0d605..530071c 100644 --- a/helper.c +++ b/helper.c @@ -6,22 +6,22 @@ /*Prints text and pattern*/ void print_pattern( char **text, char **pattern, int m, int n ) { - int i,j; + unsigned int i,j; /*Prints the pattern*/ - for(j = 0; j < m; j++) { + for( j = 0; j < m; j++ ) { - for(i = 0; i < m; i++) + for( i = 0; i < m; i++ ) printf("%i",pattern[j][i]); printf("\n"); } /*Prints the text*/ - for(j = 0; j < n; j++) { + for( j = 0; j < n; j++ ) { printf("\n"); - for(i = 0; i < n; i++) + for( i = 0; i < n; i++ ) printf("%c",text[j][i]); } } @@ -29,11 +29,9 @@ void print_pattern( char **text, char **pattern, int m, int n ) /*Returns the square of a number*/ int power(int number, int power) { - int i; + int i, returned_number = number; - int returned_number = number; - - for(i=1;i