@@ -19,26 +19,25 @@ or to run and ignore warnings run the script I made:
1919#include <string.h>
2020
2121int main ( int argc , char * * argv ) {
22- char file_in [1024 ], file_out [1024 ];
23- strncpy ( file_in , "in.ppm" , 1023 );
24- strncpy ( file_out , "out.ppm" , 1023 );
25- if ( argc > 1 ) { strncpy ( file_in , argv [1 ], 1023 ); }
26- if ( argc > 2 ) { strncpy ( file_in , argv [2 ], 1023 ); }
22+ const char * file_in = "in.ppm" ;
23+ const char * file_out = "out.ppm" ;
24+ if (argc > 1 ) { file_in = argv [1 ]; }
25+ if (argc > 2 ) { file_out = argv [2 ]; }
2726
2827 // i want to test this function that reads an image
29- struct image_t image = ppm_read ( file_in );
30- if ( !image .ptr ) {
28+ struct image_t my_image = ppm_read ( file_in );
29+ if ( !my_image .ptr ) {
3130 fprintf ( stderr , "ERROR: could not read image `%s`\n" , file_in );
3231 return 1 ;
3332 }
3433
3534 // and i'll secondarily make sure the writer works afterwards
36- bool success = ppm_write ( file_out , image );
35+ bool success = ppm_write ( file_out , my_image );
3736 if ( !success ) {
3837 fprintf ( stderr , "ERROR: could not write image `%s`\n" , file_out );
3938 return 1 ;
4039 }
4140
42- free ( image .ptr );
41+ free ( my_image .ptr );
4342 return 0 ;
4443}
0 commit comments