[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: pcb.git: branch: master updated (658e2517d906c0d925a643b91bde006fce81c57b)
The branch, master has been updated
via 658e2517d906c0d925a643b91bde006fce81c57b (commit)
from 4474f788581363491a39eb2e7f30fe13a1814cde (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
src/pcb-printf.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
=================
Commit Messages
=================
commit 658e2517d906c0d925a643b91bde006fce81c57b
Author: Richard Barlow <richard@xxxxxxxxxxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>
Fix parsing of route styles with units
A bug appeared after route styles started being saved with units
suffixed. When loading a PCB file the units were ignored and therefore
it was assumed the values were in cmils.
This was a problem in the get_unit_struct() function which didn't handle
long strings well. If the unit was followed by more characters strcmp
would return non-zero. The function has already worked out the length of
the unit text and therefore strncmp should be used.
:100644 100644 c57a570... f687e06... M src/pcb-printf.c
=========
Changes
=========
commit 658e2517d906c0d925a643b91bde006fce81c57b
Author: Richard Barlow <richard@xxxxxxxxxxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>
Fix parsing of route styles with units
A bug appeared after route styles started being saved with units
suffixed. When loading a PCB file the units were ignored and therefore
it was assumed the values were in cmils.
This was a problem in the get_unit_struct() function which didn't handle
long strings well. If the unit was followed by more characters strcmp
would return non-zero. The function has already worked out the length of
the unit text and therefore strncmp should be used.
diff --git a/src/pcb-printf.c b/src/pcb-printf.c
index c57a570..f687e06 100644
--- a/src/pcb-printf.c
+++ b/src/pcb-printf.c
@@ -182,10 +182,10 @@ const Unit *get_unit_struct (const char *const_suffix)
}
/* Do lookup */
- if (*suffix)
+ if (*suffix && s_len > 0)
for (i = 0; i < N_UNITS; ++i)
- if (strcmp (suffix, Units[i].suffix) == 0 ||
- strcmp (suffix, Units[i].alias[0]) == 0)
+ if (strncmp (suffix, Units[i].suffix, s_len) == 0 ||
+ strncmp (suffix, Units[i].alias[0], s_len) == 0)
{
g_free (m_suffix);
return &Units[i];
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs