Skip to content
Snippets Groups Projects
Commit dc0987ab authored by Rene's avatar Rene
Browse files

Anpassungen der Debug und Error Nachrichten

parent 2bc5c4dd
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -22,6 +22,7 @@ typedef struct
int width, height;
} rectangle;
/* Deklarieren der Funktionen */
extern void throwError (char *errorMSG);
extern void throwWarning (char *warningMSG);
#define ERROR throwError
......@@ -103,7 +104,6 @@ int main (int argc, char **argv)
searchForColorRectII(searchColor, image, width,height);
}
image->f.destroy_image(image);
XDestroyWindow(display, window);
XCloseDisplay(display);
......@@ -160,7 +160,7 @@ void evaluateArguments (int argc, char **argv)
pickColor = True;
if(lookForColor) {
lookForColor = False;
WARN("Pick excludes -found!");
WARN("Pick excludes -find!");
}
if (colorParam) {
colorParam = False;
......@@ -171,7 +171,7 @@ void evaluateArguments (int argc, char **argv)
if(!strcmp(OPTION, "-find") || !strcmp(OPTION,"-f")) {
if (pickColor) {
WARN("Pick excludes -found!");
WARN("Pick excludes -find!");
NEXTOPT;
NEXTOPT;
continue;
......@@ -184,11 +184,11 @@ void evaluateArguments (int argc, char **argv)
continue;
}
else {
ERROR("-found is missing an argument!");
ERROR("-find is missing an argument!");
}
}
else {
ERROR("-found is missing an argument!");
ERROR("-find is missing an argument!");
}
}
......@@ -229,7 +229,7 @@ rectangle searchForColorRectII (uint32_t color, XImage *image, unsigned width, u
}
}
if(!foundColor) {
ERROR("Farbe wurde nicht gefunden");
ERROR("Color not found!");
}
foundColor = False;
......@@ -381,14 +381,18 @@ unsigned long extractHexFromString(char *hexString) {
unsigned long result = 0;
int j = 1;
int temp;
int temp = 0;
for (int i = strlen(hexString)-1; i >= 0; i--)
{
if(hexString[i] - '0' > 9) {
if(hexString[i] >= '0' && hexString[i] <= '9') {
temp = hexString[i] - '0';
} else if (hexString[i] >= 'a' && hexString[i] <= 'f') {
temp = hexString[i] - 'a' + 10;
} else if (hexString[i] >= 'A' && hexString[i] <= 'F') {
temp = hexString[i] - 'A' + 10;
} else {
temp = hexString[i] - '0';
ERROR("wrong Parameter!");
}
result += temp * j;
j*=16;
......@@ -410,9 +414,13 @@ unsigned long extractIntFromString(char *intString) {
for (int i = strlen(intString)-1; i >= 0; i--)
{
if(intString[i] >= '0' && intString[i] <= '9') {
temp = intString[i] - '0';
result += temp * j;
j*=10;
} else {
ERROR("wrong Parameter!");
}
}
if (debug)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment