Index: src/pcb-printf.c =================================================================== --- src/pcb-printf.c (revision 10548) +++ src/pcb-printf.c (revision 10549) @@ -164,7 +164,7 @@ value = value_local; if (allow == 0) - allow = PCB_UNIT_ALLOW_ALL; + allow = PCB_UNIT_ALLOW_ALL_SANE; i = printf_spec_->used + 64; if (i > sizeof(printf_spec_new_local)) @@ -422,7 +422,7 @@ char tmp[128]; /* large enough for rendering a long long int */ int tmplen, retval = -1, slot_recursion = 0, mq_has_spec; char *dot, *free_fmt = NULL; - enum pcb_allow_e mask = PCB_UNIT_ALLOW_ALL; + enum pcb_allow_e mask = PCB_UNIT_ALLOW_ALL_SANE; gds_init(&spec); @@ -644,7 +644,7 @@ case '2': case 'D': value[count++] = va_arg(args, pcb_coord_t); - if (CoordsToString(string, value, count, &spec, mask & PCB_UNIT_ALLOW_ALL, suffix) != 0) goto err; + if (CoordsToString(string, value, count, &spec, mask & PCB_UNIT_ALLOW_ALL_SANE, suffix) != 0) goto err; break; case 'd': value[1] = va_arg(args, pcb_coord_t); @@ -661,7 +661,7 @@ } } if (!found) - if (CoordsToString(string, value, 1, &spec, mask & PCB_UNIT_ALLOW_ALL, suffix) != 0) goto err; + if (CoordsToString(string, value, 1, &spec, mask & PCB_UNIT_ALLOW_ALL_SANE, suffix) != 0) goto err; } break; case 'a': @@ -700,7 +700,7 @@ } } if (!found) - if (CoordsToString(string, value, 1, &spec, PCB_UNIT_ALLOW_ALL, suffix) != 0) goto err; + if (CoordsToString(string, value, 1, &spec, PCB_UNIT_ALLOW_ALL_SANE, suffix) != 0) goto err; } break; } Index: src/unit.h =================================================================== --- src/unit.h (revision 10548) +++ src/unit.h (revision 10549) @@ -49,7 +49,7 @@ PCB_UNIT_ALLOW_DMIL = 8192, /* for kicad legacy decimil units */ - PCB_UNIT_ALLOW_METRIC = PCB_UNIT_ALLOW_NM | PCB_UNIT_ALLOW_DU | PCB_UNIT_ALLOW_UM | PCB_UNIT_ALLOW_MM | PCB_UNIT_ALLOW_CM | PCB_UNIT_ALLOW_M | PCB_UNIT_ALLOW_KM, + PCB_UNIT_ALLOW_METRIC = PCB_UNIT_ALLOW_NM | PCB_UNIT_ALLOW_UM | PCB_UNIT_ALLOW_MM | PCB_UNIT_ALLOW_CM | PCB_UNIT_ALLOW_M | PCB_UNIT_ALLOW_KM, PCB_UNIT_ALLOW_IMPERIAL = PCB_UNIT_ALLOW_DMIL | PCB_UNIT_ALLOW_CMIL | PCB_UNIT_ALLOW_MIL | PCB_UNIT_ALLOW_IN, /* This is all units allowed in parse_l.l */ #if 0 @@ -61,6 +61,9 @@ /* Used for pcb-printf %mS - should not include unusual units like km, cmil and dmil */ PCB_UNIT_ALLOW_NATURAL = PCB_UNIT_ALLOW_NM | PCB_UNIT_ALLOW_UM | PCB_UNIT_ALLOW_MM | PCB_UNIT_ALLOW_M | PCB_UNIT_ALLOW_MIL | PCB_UNIT_ALLOW_IN, + /* Allow all but the most exotic */ + PCB_UNIT_ALLOW_ALL_SANE = ~(PCB_UNIT_ALLOW_DU | PCB_UNIT_ALLOW_DMIL), + PCB_UNIT_ALLOW_ALL = ~0 };