Commit e4e1a5788e692e5292f57c8d7622c82611cc68a4
1 parent
1fec343b
Ugly rev but working rev
Showing
5 changed files
with
31 additions
and
9 deletions
Show diff stats
... | ... | @@ -0,0 +1,20 @@ |
1 | +==7664== Memcheck, a memory error detector | |
2 | +==7664== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. | |
3 | +==7664== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info | |
4 | +==7664== Command: ./tweekd | |
5 | +==7664== | |
6 | +==7664== | |
7 | +==7664== HEAP SUMMARY: | |
8 | +==7664== in use at exit: 408 bytes in 3 blocks | |
9 | +==7664== total heap usage: 16 allocs, 13 frees, 2,428 bytes allocated | |
10 | +==7664== | |
11 | +==7664== LEAK SUMMARY: | |
12 | +==7664== definitely lost: 0 bytes in 0 blocks | |
13 | +==7664== indirectly lost: 0 bytes in 0 blocks | |
14 | +==7664== possibly lost: 408 bytes in 3 blocks | |
15 | +==7664== still reachable: 0 bytes in 0 blocks | |
16 | +==7664== suppressed: 0 bytes in 0 blocks | |
17 | +==7664== Rerun with --leak-check=full to see details of leaked memory | |
18 | +==7664== | |
19 | +==7664== For counts of detected and suppressed errors, rerun with: -v | |
20 | +==7664== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) | ... | ... |
... | ... | @@ -68,7 +68,7 @@ bool isTagPresent(char* tag) |
68 | 68 | if(data == PROFESSOR_TAG) |
69 | 69 | { |
70 | 70 | sendData(&nfc_fd, GET_TAG_DETAILS); |
71 | - printx(INFO, NFC, "Professor Tag Detected %02x\n", data); | |
71 | + //printx(INFO, NFC, "Professor Tag Detected %02x\n", data); | |
72 | 72 | //return (read(serial_fd, tag, 6) == 6); |
73 | 73 | } |
74 | 74 | else if(data == STUDENT_TAG) | ... | ... |
printx.c
... | ... | @@ -18,11 +18,12 @@ float start; |
18 | 18 | |
19 | 19 | void removeCharFromString(char c, char *str) |
20 | 20 | { |
21 | - int len = strlen(str)+1; | |
21 | +/* int len = strlen(str)+1; | |
22 | 22 | |
23 | 23 | for(int i=0; i<len; i++) |
24 | 24 | if(str[i] == c) |
25 | 25 | strncpy(&str[i],&str[i+1],len-i); |
26 | +*/ | |
26 | 27 | } |
27 | 28 | |
28 | 29 | bool initLog() |
... | ... | @@ -57,11 +58,11 @@ void printx(severity s, msgfrom from, char* str, ...) |
57 | 58 | char buffer1[MAX_BUFFER]; |
58 | 59 | char buffer2[MAX_BUFFER]; |
59 | 60 | va_list arglist; |
60 | - float now = clock(); | |
61 | + //float now = clock(); | |
61 | 62 | va_start(arglist, str); |
62 | 63 | vsprintf(buffer1, str, arglist); |
63 | - fprintf(logfile, "[%6f] : %s", (now - start)/CLOCKS_PER_SEC, buffer1); | |
64 | - fflush(logfile); | |
64 | + //fprintf(logfile, "[%6f] : %s", (now - start)/CLOCKS_PER_SEC, buffer1); | |
65 | + //fflush(logfile); | |
65 | 66 | sprintf(buffer2, "[%s] %s%s%s", f_name[from], s_color[s], buffer1, S_RESET); |
66 | 67 | removeCharFromString('\n', buffer2); |
67 | 68 | addToLog(buffer2); | ... | ... |
... | ... | @@ -112,7 +112,7 @@ char* fillHeaderWithSpaces(char* buf, char* text) |
112 | 112 | |
113 | 113 | void addToLog(char* newStr) |
114 | 114 | { |
115 | - for(int i=LOG_LINES-2; i>=0; i--) | |
115 | + for(int i=LOG_LINES-3; i>=0; i--) | |
116 | 116 | strcpy(uilog[i+1], uilog[i]); |
117 | 117 | strcpy(uilog[0], newStr); |
118 | 118 | } |
... | ... | @@ -129,10 +129,10 @@ char* fillLogWithSpaces(char* buf, char* text) |
129 | 129 | } |
130 | 130 | |
131 | 131 | char* fillStatusWithSpaces(char* buf, char* text) |
132 | -{ | |
132 | +{/* | |
133 | 133 | strncpy(buf, text, LOG_LENGTH); |
134 | 134 | strncat(buf, SPACES, LOG_LENGTH-strlen(buf)-1-7); |
135 | - | |
135 | +*/ | |
136 | 136 | return buf; |
137 | 137 | } |
138 | 138 | |
... | ... | @@ -153,7 +153,7 @@ void displayUI() |
153 | 153 | { |
154 | 154 | char buffer[LOG_LENGTH]; |
155 | 155 | struct timeval tv = {0, 5000}; |
156 | - char bufferO[4]; | |
156 | + char bufferO[4] = {0, 0, 0, 0}; | |
157 | 157 | fd_set rdfs; |
158 | 158 | FD_ZERO(&rdfs); |
159 | 159 | FD_SET(STDIN_FILENO, &rdfs); | ... | ... |