1. make sscanf checking in rect_layer.c more robust
2. remove trailing whitespace on saving level
@@ -707,7 +707,7 @@ RectLayer *create_rect_layer_from_line_stream(LineStream *line_stream, const cha
id,
&rect.x, &rect.y,
&rect.w, &rect.h,
- hex, &n) == EOF) {
+ hex, &n) <= 0) {
log_fail("%s\n", strerror(errno));
RETURN_LT(layer->lt, NULL);
}
@@ -720,14 +720,14 @@ RectLayer *create_rect_layer_from_line_stream(LineStream *line_stream, const cha
Action action = {0};
- if (sscanf(line, "%d%n", (int*)&action.type, &n) != EOF) {
+ if (sscanf(line, "%d%n", (int*)&action.type, &n) > 0) {
line += n;
switch (action.type) {
case ACTION_NONE: break;
case ACTION_TOGGLE_GOAL:
case ACTION_HIDE_LABEL: {
- if (sscanf(line, "%"STRINGIFY(ENTITY_MAX_ID_SIZE)"s", action.entity_id) == EOF) {
+ if (sscanf(line, "%"STRINGIFY(ENTITY_MAX_ID_SIZE)"s", action.entity_id) <= 0) {
log_fail("%s\n", strerror(errno));
RETURN_LT(layer->lt, NULL);
}
