Skip to content

Commit 2d93075

Browse files
committed
[FIX] - unCapitalized Comments
Comments are now smaller than ever and are no longer capitalized
1 parent 894f014 commit 2d93075

File tree

4 files changed

+47
-47
lines changed

4 files changed

+47
-47
lines changed

src/converters/bmp_to_jpeg.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,25 +85,25 @@ int bmp_to_jpeg(const char *input_filename, const char *output_filename)
8585
// write JPEG image data
8686
while (cinfo.next_scanline < cinfo.image_height)
8787
{
88-
// Get a pointer to the current row of BMP data
88+
// get a pointer to the current row of BMP data
8989
unsigned char *bmp_row = &bmp_data[(cinfo.image_height - cinfo.next_scanline - 1) * (width * 3 + padding)];
9090

91-
// Allocate an array to hold a row of RGB data in the correct order (RGB)
91+
// allocate an array to hold a row of RGB data in the correct order (RGB)
9292
unsigned char *rgb_row = (unsigned char *)malloc(width * 3);
9393

94-
// Extract RGB data from BGR order and store it in rgb_row
94+
// extract RGB data from BGR order and store it in rgb_row
9595
for (int i = 0; i < width; i++)
9696
{
9797
rgb_row[i * 3 + 0] = bmp_row[i * 3 + 2]; // Blue
9898
rgb_row[i * 3 + 1] = bmp_row[i * 3 + 1]; // Green
9999
rgb_row[i * 3 + 2] = bmp_row[i * 3 + 0]; // Red
100100
}
101101

102-
// Write the corrected RGB row to the JPEG compressor
102+
// write the corrected RGB row to the JPEG compressor
103103
JSAMPROW row_pointer = rgb_row;
104104
jpeg_write_scanlines(&cinfo, &row_pointer, 1);
105105

106-
// Free the allocated memory for the RGB row
106+
// free the allocated memory for the RGB row
107107
free(rgb_row);
108108
}
109109
jpeg_finish_compress(&cinfo);

src/converters/bmp_to_png.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ int bmp_to_png(const char *input_filename, const char *output_filename)
9999
for (int y = 0; y < height; y++) {
100100
png_bytep row_pointer = &bmp_data[(height - y - 1) * (width * 3 + padding)];
101101

102-
// Convert BGR to RGB
102+
// convert BGR to RGB
103103
for (int x = 0; x < width; x++) {
104104
png_bytep pixel = &row_pointer[x * 3];
105105
png_byte temp = pixel[0];

src/converters/jpeg_to_bmp.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ int jpeg_to_bmp(const char *input_filename, const char *output_filename)
1111
return 1;
1212
}
1313

14-
// Initialize JPEG decompressor object
14+
// initialize JPEG decompressor object
1515
struct jpeg_decompress_struct cinfo;
1616
struct jpeg_error_mgr jerr;
1717
cinfo.err = jpeg_std_error(&jerr);
1818
jpeg_create_decompress(&cinfo);
1919

20-
// Specify input file for JPEG decompressor
20+
// specify input file for JPEG decompressor
2121
jpeg_stdio_src(&cinfo, input_file);
2222
jpeg_read_header(&cinfo, TRUE);
2323
jpeg_start_decompress(&cinfo);
2424

25-
// Get image dimensions
25+
// get image dimensions
2626
int width = cinfo.output_width;
2727
int height = cinfo.output_height;
2828

29-
// Allocate memory for JPEG image data
29+
// allocate memory for JPEG image data
3030
unsigned char *jpeg_data = (unsigned char *)malloc(width * height * cinfo.output_components);
3131
if (!jpeg_data)
3232
{
@@ -36,21 +36,21 @@ int jpeg_to_bmp(const char *input_filename, const char *output_filename)
3636
return 1;
3737
}
3838

39-
// Read JPEG image data
39+
// read JPEG image data
4040
while (cinfo.output_scanline < cinfo.output_height)
4141
{
4242
JSAMPROW row_pointer = &jpeg_data[(cinfo.output_height - cinfo.output_scanline - 1) * width * cinfo.output_components];
4343
jpeg_read_scanlines(&cinfo, &row_pointer, 1);
4444
}
4545

46-
// Finish decompression
46+
// finish decompression
4747
jpeg_finish_decompress(&cinfo);
4848

49-
// Close JPEG file
49+
// close JPEG file
5050
fclose(input_file);
5151
jpeg_destroy_decompress(&cinfo);
5252

53-
// Open output BMP file for writing
53+
// open output BMP file for writing
5454
FILE *output_file = fopen(output_filename, "wb");
5555
if (!output_file)
5656
{
@@ -59,23 +59,23 @@ int jpeg_to_bmp(const char *input_filename, const char *output_filename)
5959
return 1;
6060
}
6161

62-
// Write BMP header
62+
// write BMP header
6363
unsigned char bmp_header[54] = {
64-
'B', 'M', // Signature
65-
0, 0, 0, 0, // File size (to be filled later)
66-
0, 0, 0, 0, // Reserved
67-
54, 0, 0, 0, // Offset to pixel data
68-
40, 0, 0, 0, // Header size
69-
0, 0, 0, 0, // Image width (to be filled later)
70-
0, 0, 0, 0, // Image height (to be filled later)
71-
1, 0, // Number of color planes
72-
24, 0, // Bits per pixel (3 bytes)
73-
0, 0, 0, 0, // Compression method
74-
0, 0, 0, 0, // Image size (can be 0)
75-
0, 0, 0, 0, // Horizontal resolution (can be 0)
76-
0, 0, 0, 0, // Vertical resolution (can be 0)
77-
0, 0, 0, 0, // Number of colors in palette (0 for 24-bit)
78-
0, 0, 0, 0 // Number of important colors (can be 0)
64+
'B', 'M', // signature
65+
0, 0, 0, 0, // file size (to be filled later)
66+
0, 0, 0, 0, // reserved
67+
54, 0, 0, 0, // offset to pixel data
68+
40, 0, 0, 0, // header size
69+
0, 0, 0, 0, // image width (to be filled later)
70+
0, 0, 0, 0, // image height (to be filled later)
71+
1, 0, // number of color planes
72+
24, 0, // bits per pixel (3 bytes)
73+
0, 0, 0, 0, // compression method
74+
0, 0, 0, 0, // image size (can be 0)
75+
0, 0, 0, 0, // horizontal resolution (can be 0)
76+
0, 0, 0, 0, // vertical resolution (can be 0)
77+
0, 0, 0, 0, // number of colors in palette (0 for 24-bit)
78+
0, 0, 0, 0 // number of important colors (can be 0)
7979
};
8080

8181
int bmp_file_size = sizeof(bmp_header) + width * height * 3;
@@ -94,7 +94,7 @@ int jpeg_to_bmp(const char *input_filename, const char *output_filename)
9494

9595
fwrite(bmp_header, sizeof(unsigned char), sizeof(bmp_header), output_file);
9696

97-
// Write BMP image data
97+
// write BMP image data
9898
for (int y = height - 1; y >= 0; y--)
9999
{
100100
for (int x = 0; x < width; x++)
@@ -105,7 +105,7 @@ int jpeg_to_bmp(const char *input_filename, const char *output_filename)
105105
fwrite(&jpeg_data[jpeg_index + 0], sizeof(unsigned char), 1, output_file); // Red
106106
}
107107

108-
// Write padding if necessary (multiple of 4 bytes)
108+
// write padding if necessary (multiple of 4 bytes)
109109
for (int p = 0; p < (4 - (width * 3) % 4) % 4; p++)
110110
{
111111
fputc(0, output_file);

src/converters/png_to_bmp.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44

55
int png_to_bmp(const char *input_filename, const char *output_filename)
66
{
7-
// Open PNG file for reading
7+
// open PNG file for reading
88
FILE *input_file = fopen(input_filename, "rb");
99
if (!input_file)
1010
{
1111
fprintf(stderr, "Error: could not open input file %s\n", input_filename);
1212
return 1;
1313
}
14-
// Create PNG read struct
14+
// create PNG read struct
1515
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1616
if (!png_ptr)
1717
{
1818
fprintf(stderr, "Error: could not create PNG read struct\n");
1919
fclose(input_file);
2020
return 1;
2121
}
22-
// Create PNG info struct
22+
// create PNG info struct
2323
png_infop info_ptr = png_create_info_struct(png_ptr);
2424
if (!info_ptr)
2525
{
@@ -28,19 +28,19 @@ int png_to_bmp(const char *input_filename, const char *output_filename)
2828
fclose(input_file);
2929
return 1;
3030
}
31-
// Set error handling
31+
// set error handling
3232
if (setjmp(png_jmpbuf(png_ptr)))
3333
{
3434
fprintf(stderr, "Error: PNG error\n");
3535
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
3636
fclose(input_file);
3737
return 1;
3838
}
39-
// Initialize PNG I/O
39+
// initialize PNG I/O
4040
png_init_io(png_ptr, input_file);
41-
// Read PNG header info
41+
// read PNG header info
4242
png_read_info(png_ptr, info_ptr);
43-
// Get PNG image attributes
43+
// get PNG image attributes
4444
int width = png_get_image_width(png_ptr, info_ptr);
4545
int height = png_get_image_height(png_ptr, info_ptr);
4646
int color_type = png_get_color_type(png_ptr, info_ptr);
@@ -53,7 +53,7 @@ int png_to_bmp(const char *input_filename, const char *output_filename)
5353
fclose(input_file);
5454
return 1;
5555
}
56-
// Allocate memory for PNG image data
56+
// allocate memory for PNG image data
5757
png_bytep *row_pointers = (png_bytep *)malloc(height * sizeof(png_bytep));
5858
if (!row_pointers)
5959
{
@@ -76,12 +76,12 @@ int png_to_bmp(const char *input_filename, const char *output_filename)
7676
return 1;
7777
}
7878
}
79-
// Read PNG image data
79+
// read PNG image data
8080
png_read_image(png_ptr, row_pointers);
81-
// Close PNG file
81+
// close PNG file
8282
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
8383
fclose(input_file);
84-
// Open BMP file for writing
84+
// open BMP file for writing
8585
FILE *output_file = fopen(output_filename, "wb");
8686
if (!output_file)
8787
{
@@ -91,14 +91,14 @@ int png_to_bmp(const char *input_filename, const char *output_filename)
9191
free(row_pointers);
9292
return 1;
9393
}
94-
// Write BMP header
94+
// write BMP header
9595
unsigned char header[54] = {
9696
'B', 'M', 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0,
9797
0, 0, (unsigned char)(width), (unsigned char)(width >> 8), (unsigned char)(width >> 16), (unsigned char)(width >> 24),
9898
(unsigned char)(height), (unsigned char)(height >> 8), (unsigned char)(height >> 16), (unsigned char)(height >> 24),
9999
1, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
100100
fwrite(header, sizeof(unsigned char), 54, output_file);
101-
// Write BMP image data
101+
// write BMP image data
102102
for (int y = height - 1; y >= 0; y--)
103103
{
104104
for (int x = 0; x < width; x++)
@@ -112,9 +112,9 @@ int png_to_bmp(const char *input_filename, const char *output_filename)
112112
for (int p = 0; p < (4 - (width * 3) % 4) % 4; p++)
113113
fputc(0, output_file);
114114
}
115-
// Close BMP file
115+
// close BMP file
116116
fclose(output_file);
117-
// Free memory
117+
// free memory
118118
for (int y = 0; y < height; y++)
119119
free(row_pointers[y]);
120120
free(row_pointers);

0 commit comments

Comments
 (0)