Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finished ex1 ;) #4

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

finished ex1 ;) #4

wants to merge 6 commits into from

Conversation

dabushori
Copy link
Owner

No description provided.

@@ -1,38 +1,38 @@
# Prerequisites
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't change CR/LF - it creates unrequired diff

@@ -0,0 +1,40 @@
#include "ErrorCode.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove documentation from C file (C15)

* @param[in] code the error code.
* @return whether the error code indicates a success or not.
*/
bool error_isSuccess(ErrorCode code) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameters are not constants (C2)

* @return whether the error code indicates a success or not.
*/
bool error_isSuccess(ErrorCode code) {
if (code == ERROR_SUCCESS) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return code == ERROR_SUCCESS

* @return const char* the textual representation of the error code.
*/
const char *error_getErrorMessage(ErrorCode code) {
switch (code) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bloated code (C11)

mat->values[i] = (double *)calloc(width, sizeof(double));
if (mat->values[i] == NULL) {
for (int j = 0; j < i; j++) {
free(mat->values[j]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

B1

free(mat);
return ERROR_ALLOCATION_FAILED;
}
for (int i = 0; i < mat->height; i++) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Postfix increment (C5)

return ERROR_NULL;
}

uint32_t h = source->height, w = source->width;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

h and w are generally not very good nor indicative names for variables

if (matrix == NULL) {
return ERROR_NULL;
}
int row = (int)rowIndex, col = (int)colIndex;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad cast (S9)

@@ -0,0 +1,113 @@
#pragma once
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shared resources not in master (G7)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants