| 83 | } |
| 84 | |
| 85 | void buildMessage(char *buffer, LAS_MESSAGE_TYPE type, LAS_FORMAT_STRING(const char*) fmt, va_list args) { |
| 86 | int len = vsnprintf(buffer, LAS_MAX_MESSAGE_LENGTH, fmt, args); |
| 87 | if (len > LAS_MAX_MESSAGE_LENGTH) { // avoid buffer overflow. messages longer than LAS_MAX_MESSAGE_LENGTH should not occur! |
| 88 | fprintf(stderr, "INTERNAL: message cropped from %d to %d chars", len, LAS_MAX_MESSAGE_LENGTH); |
| 89 | len = LAS_MAX_MESSAGE_LENGTH; |
| 90 | } |
| 91 | // remove trailing line feed |
| 92 | while (len > 0 && buffer[len - 1] == '\n') { |
| 93 | buffer[len - 1] = '\0'; |
| 94 | --len; |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | void LASMessage(LAS_MESSAGE_TYPE type, LAS_FORMAT_STRING(const char*) fmt, ...) { |
| 99 | assert(type <= LAS_FATAL_ERROR); // message type must be less than or equal to LAS_FATAL_ERROR (LAS_QUIET must not be used in LASMessage calls) |
no outgoing calls
no test coverage detected