DatabaseWrite Writes/Updates a string to the database
| 4312 | // DatabaseWrite |
| 4313 | // Writes/Updates a string to the database |
| 4314 | bool DMFCBase::DatabaseWrite(const char *label, const char *entry, int entrylen) { |
| 4315 | if (DatabaseRegisteredName[0] == '\0') |
| 4316 | return false; |
| 4317 | if (!label || !entry) |
| 4318 | return false; |
| 4319 | |
| 4320 | int reg_len = strlen(DatabaseRegisteredName); |
| 4321 | int copy = MAX_DBLABEL_SIZE - 1 - reg_len; |
| 4322 | char buffer[MAX_DBLABEL_SIZE]; |
| 4323 | |
| 4324 | strcpy(buffer, DatabaseRegisteredName); |
| 4325 | strncpy(&buffer[reg_len], label, copy); |
| 4326 | buffer[MAX_DBLABEL_SIZE - 1] = '\0'; |
| 4327 | |
| 4328 | return DatabaseWrite(buffer, entry, entrylen); |
| 4329 | } |
| 4330 | |
| 4331 | // DatabaseWrite |
| 4332 | // Writes/Updates a value to the database |
no test coverage detected