Compare commits

...
5 Commits
2 changed files with 5 additions and 3 deletions

No files matched your search

+3 -3
View File
@@ -30,7 +30,7 @@
#define FILE_HEADER_STRING "__info2_image_file_format__"
// ---------------------------------------------------------
// Hilfsfunktionen (static, nur in diesem Modul sichtbar)
// Hilfsfunktionen
// ---------------------------------------------------------
/**
@@ -47,7 +47,7 @@ static int checkFileHeader(FILE *file) {
return 0; // Lesefehler oder Datei zu kurz
}
// Null-Terminierung sicherstellen für strcmp (obwohl wir auch memcmp nutzen könnten)
// Null-Terminierung sicherstellen für strcmp
buffer[headerLen] = '\0';
if (strcmp(buffer, expectedHeader) != 0) {
@@ -73,7 +73,7 @@ static GrayScaleImageSeries *allocateSeries(unsigned short count) {
series->labels = (unsigned char *)calloc(count, sizeof(unsigned char));
if (series->images == NULL || series->labels == NULL) {
// Falls eine Allokation fehlschlägt, alles bisherige freigeben
// Falls eine Allokation fehlschlägt, alles Bisherigen freigeben
free(series->images);
free(series->labels);
free(series);
+2
View File
@@ -114,6 +114,7 @@ Matrix add(const Matrix matrix1, const Matrix matrix2)
return createMatrix(0, 0);
}
for(unsigned int i = 0; i < resRows; ++i)
{
for(unsigned int j = 0; j < resCols; ++j)
@@ -124,6 +125,7 @@ Matrix add(const Matrix matrix1, const Matrix matrix2)
unsigned int i2 = (matrix2.rows == 1) ? 0 : i;
unsigned int j2 = (matrix2.cols == 1) ? 0 : j;
MatrixType val = getMatrixAt(matrix1, i1, j1) + getMatrixAt(matrix2, i2, j2);
setMatrixAt(val, &result, i, j);
}