Great! Now let me suggest some kind of "Patchlevel 0".
Most of these patches deal with well-known issues discussed on the list or on the tracker; some of them are years old. Of course, there are lots of more patches e.g. on the tracker; I just randomly picked some obvious ones that were not likely to cause strong objections. The developers have no resources to push them into master; however, the users could collect them and release inofficially. If somebody is interested, we could discuss what we want to be included, and what we don't; if nobody is interested, I'll just stack more patches than otherwise expected and use them locally. Best wishes, Ineiev
>From 9b8d3cda761b1a719d10768cd34d4908c70023a5 Mon Sep 17 00:00:00 2001 From: Ineiev <ine...@users.berlios.de> Date: Sun, 12 Sep 2010 08:14:14 +0000 Subject: [PATCH 01/12] RectPoly: check arguments to avoid empty polygons fixes PCB segfaults when running DRC #3064413 --- src/polygon.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/polygon.c b/src/polygon.c index 586e8cc..72e65d5 100644 --- a/src/polygon.c +++ b/src/polygon.c @@ -330,8 +330,8 @@ RectPoly (LocationType x1, LocationType x2, LocationType y1, LocationType y2) PLINE *contour = NULL; Vector v; - assert (x2 > x1); - assert (y2 > y1); + if (x1 >= x2 || y1 >= y2) + return NULL; v[0] = x1; v[1] = y1; if ((contour = poly_NewContour (v)) == NULL) -- 1.6.5.2
>From 1e25441acaa40ceff0518e71b6d5f87cbc322bb8 Mon Sep 17 00:00:00 2001 From: Ineiev <ine...@users.sourceforge.net> Date: Fri, 20 Feb 2009 20:19:01 +0300 Subject: [PATCH 02/12] misfix annoying decimals bug 1741659 bug report by Kai-Martin Knaak also make polar coordinates less verbous --- src/hid/gtk/gui-misc.c | 88 ++++++++++++++++++++++++++++++++++------------- 1 files changed, 63 insertions(+), 25 deletions(-) diff --git a/src/hid/gtk/gui-misc.c b/src/hid/gtk/gui-misc.c index a607a69..5ffbbd6 100644 --- a/src/hid/gtk/gui-misc.c +++ b/src/hid/gtk/gui-misc.c @@ -1,10 +1,8 @@ -/* $Id$ */ - /* * COPYRIGHT * * PCB, interactive printed circuit board design - * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 1994,1995,1996,2009 Thomas Nau * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,8 +40,6 @@ #include <dmalloc.h> #endif -RCSID ("$Id$"); - #define DEFAULT_CURSORSHAPE GDK_CROSSHAIR #define CUSTOM_CURSOR_CLOCKWISE (GDK_LAST_CURSOR + 10) @@ -549,6 +545,53 @@ ghid_set_status_line_label (void) ghid_status_line_set_text (text); } +/* returns an auxiliary value needed to adjust mm grid. + the adjustment is needed to prevent ..99 tails in position labels. + + All these are a workaround to precision lost + because of double->integer transform + while fitting Crosshair to grid in crosshair.c + + There is another way to fix: report mm dimensions with %.3f, like + in the Lesstif hid; but this reduces the information + */ +static double +ghid_get_grid_factor(void) +{ + /* when grid units are mm, they shall be an integer of + 1 mm / grid_factor_per_mm */ + const int grid_factor_per_mm = 10000;/*min grid is .1 um < PCB unit*/ + if (Settings.grid_units_mm) + return floor (PCB->Grid * COOR_TO_MM * grid_factor_per_mm +.5) / + grid_factor_per_mm; + return 0; +} +/* transforms a pcb coordinate to selected units + adjusted to the nearest grid point for mm grid */ +static double +ghid_grid_pcb_to_units (double x, double grid_factor) +{ + double x_scaled = (Settings.grid_units_mm? COOR_TO_MM: 1./100) * x; + double nearest_gridpoint; + + if (PCB->Grid < 4.5)/*nothing to adjust: the grid is too fine */ + return x_scaled; + /* adjustment is not needed for inches + probably because x/100 is always 'integer' enough */ + if (!Settings.grid_units_mm) + return x_scaled; + nearest_gridpoint = floor (x / PCB->Grid + .5); + /* honour snapping to an unaligned object */ + if (fabs (nearest_gridpoint * PCB->Grid - x) > 1) + return x_scaled; + /* without mm-adjusted grid_factor + (return floor (x / PCB->Grid + .5) * PCB->Grid * COOR_TO_MM), + the bug appears for 0.1 or 0.05 mm grid at coordinates more than 4000 mm. + grid_factor makes the stuff work at least up to 254 m, + which is 100 times more than maximum board size as of Aug 2010. */ + return nearest_gridpoint * grid_factor; +} + /* --------------------------------------------------------------------------- * output of cursor position */ @@ -556,32 +599,27 @@ void ghid_set_cursor_position_labels (void) { gchar text[128]; + int prec = Settings.grid_units_mm ? 4: 2; + double grid_factor = ghid_get_grid_factor(); if (Marked.status) - {double scale, dx, dy, r, a; - scale = Settings.grid_units_mm ? COOR_TO_MM: 1. / 100; - dx = (Crosshair.X - Marked.X) * scale; - dy = (Marked.Y - Crosshair.Y) * scale; - r = sqrt( dx * dx + dy * dy); - a = atan2(dy, dx) * 180 / M_PI; - if (Settings.grid_units_mm) - snprintf (text, sizeof (text), "r %-.4f; phi %-.1f; %-.4f %-.4f", - r, a, dx, dy); - - else - snprintf (text, sizeof (text), "r %-.2f; phi %-.1f; %-.2f %-.2f", - r, a, dx, dy); + { + double dx, dy, r, a; + + dx = ghid_grid_pcb_to_units (Crosshair.X - Marked.X, grid_factor); + dy = ghid_grid_pcb_to_units (Crosshair.Y - Marked.Y, grid_factor); + r = sqrt (dx * dx + dy * dy); + a = atan2 (dy, dx) * RAD_TO_DEG; + snprintf (text, sizeof (text), "%-.*f %-.1f; %-.*f %-.*f", + prec, r, a, prec, dx, prec, dy); ghid_cursor_position_relative_label_set_text (text); } else - ghid_cursor_position_relative_label_set_text ("r __.__; phi __._; __.__ __.__"); + ghid_cursor_position_relative_label_set_text ("__.__ __._; __.__ __.__"); - if (Settings.grid_units_mm) - snprintf (text, sizeof (text), "%-.4f %-.4f", - COOR_TO_MM * Crosshair.X, COOR_TO_MM * Crosshair.Y); - else - snprintf (text, sizeof (text), "%-.2f %-.2f", - Crosshair.X / 100., Crosshair.Y / 100.); + snprintf (text, sizeof (text), "%-.*f %-.*f", + prec, ghid_grid_pcb_to_units (Crosshair.X, grid_factor), + prec, ghid_grid_pcb_to_units (Crosshair.Y, grid_factor)); ghid_cursor_position_label_set_text (text); } -- 1.6.5.2
>From 54c234dd5447afc90377b736b31cc43dd9c685e5 Mon Sep 17 00:00:00 2001 From: Ineiev <ine...@users.sourceforge.net> Date: Fri, 20 Feb 2009 21:36:32 +0300 Subject: [PATCH 03/12] misfix disappearing crosshair mark bug 1882970 (reported by Steven Michalske hardkrash) (0) when the cursor leaves the window, the mark disappears (with attached objects); when the cursor enters again, the mark is redrawn only if there are any attached objects; (1) When there are no attached objects, the mark disappears on button press, but is not redrawn again when button press and release form a click. --- src/hid/gtk/gui-output-events.c | 42 ++++++-------------------------------- 1 files changed, 7 insertions(+), 35 deletions(-) diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c index 6164415..def375e 100644 --- a/src/hid/gtk/gui-output-events.c +++ b/src/hid/gtk/gui-output-events.c @@ -1,5 +1,3 @@ -/* $Id$ */ - /* * COPYRIGHT * @@ -54,14 +52,7 @@ #define TOOLTIP_UPDATE_DELAY 200 -RCSID ("$Id$"); - static gint x_pan_speed, y_pan_speed; - -/* Set to true if cursor is currently in viewport. This is a hack to prevent - * Crosshair stack corruption due to unmatching window enter / leave events */ -gboolean cursor_in_viewport = false; - void ghid_port_ranges_changed (void) { @@ -627,7 +618,6 @@ ghid_port_button_press_cb (GtkWidget * drawing_area, GdkEventButton * ev, GtkUIManager * ui) { ModifierKeysState mk; - gboolean drag; GdkModifierType state; /* Reject double and triple click events */ @@ -638,7 +628,6 @@ ghid_port_button_press_cb (GtkWidget * drawing_area, mk = ghid_modifier_keys_state (&state); ghid_show_crosshair (FALSE); HideCrosshair (TRUE); - drag = have_crosshair_attachments (); do_mouse_action(ev->button, mk); @@ -657,26 +646,21 @@ ghid_port_button_release_cb (GtkWidget * drawing_area, GdkEventButton * ev, GtkUIManager * ui) { ModifierKeysState mk; - gboolean drag; GdkModifierType state; ghid_note_event_location (ev); state = (GdkModifierType) (ev->state); mk = ghid_modifier_keys_state (&state); - drag = have_crosshair_attachments (); - if (drag) - HideCrosshair (TRUE); + HideCrosshair (TRUE); do_mouse_action(ev->button, mk + M_Release); - if (drag) - { - AdjustAttachedObjects (); - ghid_invalidate_all (); - RestoreCrosshair (TRUE); - ghid_screen_update (); - } + AdjustAttachedObjects (); + ghid_invalidate_all (); + RestoreCrosshair (TRUE); + ghid_screen_update (); + ghid_set_status_line_label (); g_idle_add (ghid_idle_cb, NULL); return TRUE; @@ -939,13 +923,7 @@ ghid_port_window_enter_cb (GtkWidget * widget, { ghid_screen_update (); } - - if(! cursor_in_viewport) - { - RestoreCrosshair (TRUE); - cursor_in_viewport = TRUE; - } - + CrosshairOn (TRUE); return FALSE; } @@ -1037,12 +1015,6 @@ ghid_port_window_leave_cb (GtkWidget * widget, } } - if(cursor_in_viewport) - { - HideCrosshair (TRUE); - cursor_in_viewport = FALSE; - } - ghid_show_crosshair (FALSE); out->has_entered = FALSE; -- 1.6.5.2
>From 95ffb71c27616b0a4a9af861b71655c318065148 Mon Sep 17 00:00:00 2001 From: Ineiev <ine...@users.berlios.de> Date: Thu, 30 Jul 2009 04:15:08 +0000 Subject: [PATCH 04/12] GTK: misfix RouteStylesChanged action [2826008] trigger ghid_route_style_buttons_update to update button states --- src/hid/gtk/gtkhid-main.c | 1 + src/hid/gtk/gui-top-window.c | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c index 7d59672..cde233a 100644 --- a/src/hid/gtk/gtkhid-main.c +++ b/src/hid/gtk/gtkhid-main.c @@ -1269,6 +1269,7 @@ RouteStylesChanged (int argc, char **argv, int x, int y) if (PCB && PCB->RouteStyle[0].Name) for (n = 0; n < NUM_STYLES; ++n) ghid_route_style_set_button_label ((&PCB->RouteStyle[n])->Name, n); + ghid_route_style_buttons_update (); return 0; } diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c index 9c30a93..e241600 100644 --- a/src/hid/gtk/gui-top-window.c +++ b/src/hid/gtk/gui-top-window.c @@ -1883,7 +1883,7 @@ make_route_style_buttons (GtkWidget * vbox, GHidPort * port) void ghid_route_style_button_set_active (gint n) { - if (n < 0 || n >= N_ROUTE_STYLES) + if (n < 0 || n >= N_ROUTE_STYLES || !route_style_button[n].button) return; gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON @@ -1900,6 +1900,9 @@ ghid_route_style_buttons_update (void) RouteStyleType *rst; gint i; + if (NULL == PCB || NULL == ghidgui) + return; + for (i = 0; i < NUM_STYLES + 2; ++i) { if (i < NUM_STYLES) @@ -1922,9 +1925,9 @@ ghid_route_style_buttons_update (void) ghid_route_style_button_set_active (i); route_style_index = i; ghidgui->toggle_holdoff = FALSE; - - gtk_widget_set_sensitive (route_style_edit_button, - (i == NUM_STYLES + 2) ? FALSE : TRUE); + if (route_style_edit_button) + gtk_widget_set_sensitive (route_style_edit_button, + (i == NUM_STYLES + 2) ? FALSE : TRUE); } void -- 1.6.5.2
>From 2b814821e47f97bc82a306b8cc339ae35332a11e Mon Sep 17 00:00:00 2001 From: Ineiev <ine...@users.berlios.de> Date: Fri, 27 Nov 2009 09:12:31 +0300 Subject: [PATCH 05/12] fix some lines producing typos in pcb.pdf --- src/action.c | 27 +++++++++++++-------------- 1 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/action.c b/src/action.c index f52fcf4..a7f82d8 100644 --- a/src/action.c +++ b/src/action.c @@ -2522,7 +2522,7 @@ static const char display_syntax[] = "Display(ToggleThindraw|ToggleThindrawPoly|ToggleOrthoMove|ToggleLocalRef)\n" "Display(ToggleCheckPlanes|ToggleShowDRC|ToggleAutoDRC)\n" "Display(ToggleLiveRoute|LockNames|OnlyNames)\n" - "Display(Pinout|PinOrPadName)\n" "Display(Scroll, Direction)"; + "Display(Pinout|PinOrPadName)\nDisplay(Scroll, Direction)"; static const char display_help[] = "Several display-related actions."; @@ -2972,7 +2972,7 @@ ActionDisplay (int argc, char **argv, int childX, int childY) static const char mode_syntax[] = "Mode(Arc|Arrow|Copy|InsertPoint|Line|Lock|Move|None|PasteBuffer)\n" "Mode(Polygon|Rectangle|Remove|Rotate|Text|Thermal|Via)\n" - "Mode(Notify|Release|Cancel|Stroke)\n" "Mode(Save|Restore)"; + "Mode(Notify|Release|Cancel|Stroke)\nMode(Save|Restore)"; static const char mode_help[] = "Change or use the tool mode."; @@ -3262,7 +3262,7 @@ ActionRemoveSelected (int argc, char **argv, int x, int y) /* --------------------------------------------------------------------------- */ -static const char renumber_syntax[] = "Renumber()\n" "Renumber(filename)"; +static const char renumber_syntax[] = "Renumber()\nRenumber(filename)"; static const char renumber_help[] = "Renumber all elements. The changes will be recorded to filename\n" @@ -3823,8 +3823,7 @@ ActionAddRats (int argc, char **argv, int x, int y) static const char delete_syntax[] = "Delete(Object|Selected)\n" - "Delete(AllRats|SelectedRats)" - ; + "Delete(AllRats|SelectedRats)"; static const char delete_help[] = "Delete stuff."; @@ -3995,7 +3994,7 @@ ActionAutoRoute (int argc, char **argv, int x, int y) /* --------------------------------------------------------------------------- */ static const char markcrosshair_syntax[] = - "MarkCrosshair()\n" "MarkCrosshair(Center)"; + "MarkCrosshair()\nMarkCrosshair(Center)"; static const char markcrosshair_help[] = "Set/Reset the Crosshair mark"; @@ -4290,7 +4289,7 @@ ActionChangeClearSize (int argc, char **argv, int x, int y) /* --------------------------------------------------------------------------- */ static const char minmaskgap_syntax[] = - "MinMaskGap(delta)\n" "MinMaskGap(Selected, delta)"; + "MinMaskGap(delta)\nMinMaskGap(Selected, delta)"; static const char minmaskgap_help[] = "Ensures the mask is a minimum distance from pins and pads."; @@ -4374,7 +4373,7 @@ ActionMinMaskGap (int argc, char **argv, int x, int y) /* --------------------------------------------------------------------------- */ static const char mincleargap_syntax[] = - "MinClearGap(delta)\n" "MinClearGap(Selected, delta)"; + "MinClearGap(delta)\nMinClearGap(Selected, delta)"; static const char mincleargap_help[] = "Ensures that polygons are a minimum distance from objects."; @@ -4573,7 +4572,7 @@ ActionChangePinName (int argc, char **argv, int x, int y) /* --------------------------------------------------------------------------- */ static const char changename_syntax[] = - "ChangeName(Object)\n" "ChangeName(Layout|Layer)"; + "ChangeName(Object)\nChangeName(Layout|Layer)"; static const char changename_help[] = "Sets the name of objects."; @@ -5345,7 +5344,7 @@ static const char select_syntax[] = "Select(ElementByName|ObjectByName|PadByName|PinByName)\n" "Select(ElementByName|ObjectByName|PadByName|PinByName, Name)\n" "Select(TextByName|ViaByName)\n" - "Select(TextByName|ViaByName, Name)\n" "Select(Convert)"; + "Select(TextByName|ViaByName, Name)\nSelect(Convert)"; static const char select_help[] = "Toggles or sets the selection"; @@ -5534,7 +5533,7 @@ static const char unselect_syntax[] = "Unselect(All|Block|Connection)\n" "Unselect(ElementByName|ObjectByName|PadByName|PinByName)\n" "Unselect(ElementByName|ObjectByName|PadByName|PinByName, Name)\n" - "Unselect(TextByName|ViaByName)\n" "Unselect(TextByName|ViaByName, Name)\n"; + "Unselect(TextByName|ViaByName)\nUnselect(TextByName|ViaByName, Name)\n"; static const char unselect_help[] = "unselects the object at the pointer location or the specified objects"; @@ -5795,7 +5794,7 @@ ActionSaveTo (int argc, char **argv, int x, int y) /* --------------------------------------------------------------------------- */ static const char savesettings_syntax[] = - "SaveSettings()\n" "SaveSettings(local)"; + "SaveSettings()\nSaveSettings(local)"; static const char savesettings_help[] = "Saves settings."; @@ -6183,7 +6182,7 @@ ActionPasteBuffer (int argc, char **argv, int x, int y) /* --------------------------------------------------------------------------- */ -static const char undo_syntax[] = "Undo()\n" "Undo(ClearList)"; +static const char undo_syntax[] = "Undo()\nUndo(ClearList)"; static const char undo_help[] = "Undo recent changes."; @@ -6732,7 +6731,7 @@ static const char changeflag_syntax[] = "ChangeFlag(SelectedLines|SelectedPins|SelectedVias, flag, value)\n" "ChangeFlag(SelectedPads|SelectedTexts|SelectedNames, flag, value)\n" "ChangeFlag(SelectedElements, flag, value)\n" - "flag = square | octagon | thermal | join\n" "value = 0 | 1"; + "flag = square | octagon | thermal | join\nvalue = 0 | 1"; static const char changeflag_help[] = "Sets or clears flags on objects."; -- 1.6.5.2
>From 6e102106a0ed1786c13428cc4cd500ffd0af92d2 Mon Sep 17 00:00:00 2001 From: Ineiev <ine...@users.sourceforge.net> Date: Thu, 7 May 2009 07:31:37 +0400 Subject: [PATCH 06/12] mv `wish' detection from `INSTALL' to `configure' when wish is absent, the graphical QFP footprint builder is not installed --- INSTALL | 13 ++++--------- configure.ac | 15 +++++++++++---- lib/Makefile.am | 7 ++++--- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/INSTALL b/INSTALL index c4df37d..9212152 100644 --- a/INSTALL +++ b/INSTALL @@ -80,12 +80,8 @@ Printer HID's: is not given. In addition to the libraries listed above, there is a graphical QFP footprint -creator which uses TCL/TK. If you do not wish to use this feature, and you -do not have TCL/TK installed on your system, you may simply set WISH to -/usr/bin/true in your configure environment. For example: - - env WISH=/usr/bin/true ./configure - +creator which uses TCL/TK. If you do not have TCL/TK installed on your +system, the creator will not be installed. Please refer to the output of @@ -114,9 +110,8 @@ from the top level directory. - GNU m4. In particular your m4 must support -F for frozen files. -- wish (part of tcl/tk). If not installed, set WISH=/bin/false in - your configure environment and you just won't get the graphical - QFP footprint builder +- wish (part of tcl/tk). If not installed you just won't + get the graphical QFP footprint builder - gtk if you are using the gtk frontend diff --git a/configure.ac b/configure.ac index 6aab549..fa4966f 100644 --- a/configure.ac +++ b/configure.ac @@ -517,7 +517,7 @@ fi AC_PATH_PROGS(M4, gm4 m4, [none]) if test "X$M4" = "Xnone" ; then - AC_MSG_ERROR([Did not find a m4 executible. You need to make sure + AC_MSG_ERROR([Did not find a m4 executable. You need to make sure that m4 is installed on your system and that m4 is in your path]) fi AC_MSG_CHECKING([if $M4 has the division involving negative numbers bug]) @@ -535,11 +535,18 @@ fi AC_PATH_PROGS(WISH, wish wish83 wish8.3 wish80 wish8.0 cygwish83 cygwish80,[none]) if test "X$WISH" = "Xnone" ; then - AC_MSG_ERROR([Did not find the wish executible. You need to make sure - that tcl is installed on your system and that wish is in your path]) + AC_MSG_RESULT([ + Did not find the wish executable. You need to make sure + that tcl/tk is installed on your system and that wish is in your path + in order to build qfp-ui script. If you do have it installed you may + want to set WISH in your configure environment, for example: + env WISH=/opt/tcl-tk/bin/wish ./configure + + ]) fi +AM_CONDITIONAL(WISH_FOUND, test x$WISH != xnone) -AC_DEFINE_UNQUOTED(M4,$M4,[m4 executible]) +AC_DEFINE_UNQUOTED(M4,$M4,[m4 executable]) GNUM4=$M4 AC_SUBST(GNUM4) AC_DEFINE_UNQUOTED(GNUM4,"$M4",[m4 program used by pcb]) diff --git a/lib/Makefile.am b/lib/Makefile.am index ae1b485..63cb71e 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -10,9 +10,10 @@ LIBSCRIPTS= \ CreateLibraryContents.sh \ CreateLibrary.sh \ ListLibraryContents.sh \ - QueryLibrary.sh \ - qfp-ui - + QueryLibrary.sh +if WISH_FOUND +LIBSCRIPTS+= qfp-ui +endif dist_noinst_SCRIPTS= \ m4lib_to_newlib.sh -- 1.6.5.2
>From f35ac98a162ff3c6e54537d33b7b043996db2f56 Mon Sep 17 00:00:00 2001 From: Ineiev <ine...@users.berlios.de> Date: Mon, 2 Nov 2009 15:38:58 +0000 Subject: [PATCH 07/12] fix refcard.ps orientation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit originally this was a response to the bug report 2890230 by Ø£ØÙ د اÙÙ ØÙ ÙØ¯Ù (Ahmed El-Mahmoudy) --- doc/Makefile.am | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/doc/Makefile.am b/doc/Makefile.am index 1228b33..ff0884d 100755 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -180,6 +180,15 @@ if MISSING_DVIPS else ${DVIPS} -Ppdf -j0 -D 300 -o $@ $< endif +refcard.ps: refcard.dvi +if MISSING_DVIPS + @echo "****************************************************" + @echo "WARNING: dvips is missing on your system but" + @echo "$@ is out of date and needs to rebuilt." + @echo "Changes to $< will be ignored" +else + ${DVIPS} -Ppdf -j0 -D 300 -T 297mm,210mm -o $@ $< +endif .tex.pdf: if MISSING_PDFLATEX -- 1.6.5.2
>From 33cb5be93c7c3e274c67f308432d8448c114d1f2 Mon Sep 17 00:00:00 2001 From: Ineiev <ine...@users.berlios.de> Date: Fri, 27 Nov 2009 08:34:38 +0300 Subject: [PATCH 08/12] fix erratum about sections hierarhy --- doc/pcb.texi | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/doc/pcb.texi b/doc/pcb.texi index cf3ceb1..226b47f 100644 --- a/doc/pcb.texi +++ b/doc/pcb.texi @@ -5237,7 +5237,7 @@ rats-nest" command after moving parts around. After the placement is complete, use the line tool to add traces to the board. As traces are added, the corresponding rats line will disappear. -...@section Forward Annotation of Schematic Changes +...@subsection Forward Annotation of Schematic Changes If schematic changes are made after the layout has started, @code{gsch2pcb} can be used to forward annotate these changes to the layout. To forward annotate schematic changes, run @samp{gsch2pcb -- 1.6.5.2
>From 33ba99a80015886214f007187a36e0824b54d2be Mon Sep 17 00:00:00 2001 From: Ineiev <ine...@users.berlios.de> Date: Thu, 19 Nov 2009 12:49:37 +0300 Subject: [PATCH 09/12] Cleanup RoundRect and SquarePadPoly the corner points were added to segments made with frac_circle() from the wrong side --- src/polygon.c | 36 ++++++++++++++++++++++++++---------- 1 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/polygon.c b/src/polygon.c index 72e65d5..a75c4aa 100644 --- a/src/polygon.c +++ b/src/polygon.c @@ -443,21 +443,29 @@ RoundRect (LocationType x1, LocationType x2, LocationType y1, LocationType y2, assert (x2 > x1); assert (y2 > y1); v[0] = x1 - t; - v[1] = y1; + v[1] = y2; if ((contour = poly_NewContour (v)) == NULL) return NULL; + v[0] = x1 - t; + v[1] = y1; frac_circle (contour, x1, y1, v, 4); - v[0] = x2; + v[0] = x1; v[1] = y1 - t; poly_InclVertex (contour->head.prev, poly_CreateNode (v)); + v[0] = x2; + v[1] = y1 - t; frac_circle (contour, x2, y1, v, 4); v[0] = x2 + t; - v[1] = y2; + v[1] = y1; poly_InclVertex (contour->head.prev, poly_CreateNode (v)); + v[0] = x2 + t; + v[1] = y2; frac_circle (contour, x2, y2, v, 4); - v[0] = x1; + v[0] = x2; v[1] = y2 + t; poly_InclVertex (contour->head.prev, poly_CreateNode (v)); + v[0] = x1; + v[1] = y2 + t; frac_circle (contour, x1, y2, v, 4); return ContourToPoly (contour); } @@ -638,7 +646,7 @@ SquarePadPoly (PadType * pad, BDimension clear) d = sqrt (SQUARE (pad->Point1.X - pad->Point2.X) + SQUARE (pad->Point1.Y - pad->Point2.Y)); - if (d != 0) + if (d > .5) { double a = halfthick / d; tx = (t->Point1.Y - t->Point2.Y) * a; @@ -669,25 +677,33 @@ SquarePadPoly (PadType * pad, BDimension clear) c->Point2.Y -= cx; } - v[0] = c->Point1.X - tx; - v[1] = c->Point1.Y - ty; + v[0] = c->Point1.X + tx; + v[1] = c->Point1.Y + ty; if ((contour = poly_NewContour (v)) == NULL) return 0; + v[0] = c->Point1.X - tx; + v[1] = c->Point1.Y - ty; frac_circle (contour, (t->Point1.X - tx), (t->Point1.Y - ty), v, 4); + v[0] = t->Point1.X - cx; + v[1] = t->Point1.Y - cy; + poly_InclVertex (contour->head.prev, poly_CreateNode (v)); v[0] = t->Point2.X - cx; v[1] = t->Point2.Y - cy; - poly_InclVertex (contour->head.prev, poly_CreateNode (v)); frac_circle (contour, (t->Point2.X - tx), (t->Point2.Y - ty), v, 4); + v[0] = c->Point2.X - tx; + v[1] = c->Point2.Y - ty; + poly_InclVertex (contour->head.prev, poly_CreateNode (v)); v[0] = c->Point2.X + tx; v[1] = c->Point2.Y + ty; - poly_InclVertex (contour->head.prev, poly_CreateNode (v)); frac_circle (contour, (t->Point2.X + tx), (t->Point2.Y + ty), v, 4); + v[0] = t->Point2.X + cx; + v[1] = t->Point2.Y + cy; + poly_InclVertex (contour->head.prev, poly_CreateNode (v)); v[0] = t->Point1.X + cx; v[1] = t->Point1.Y + cy; - poly_InclVertex (contour->head.prev, poly_CreateNode (v)); frac_circle (contour, (t->Point1.X + tx), (t->Point1.Y + ty), v, 4); /* now we have the line contour */ -- 1.6.5.2
>From e7511777705ade02dd2b00ad858b2b1433973132 Mon Sep 17 00:00:00 2001 From: Ineiev <ine...@users.berlios.de> Date: Thu, 27 Aug 2009 21:12:57 +0400 Subject: [PATCH 10/12] cleanup batch gui fit types of functions with declared in hid.h include some necessary headers --- src/hid/batch/batch.c | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/hid/batch/batch.c b/src/hid/batch/batch.c index f3b7d3c..eab81bf 100644 --- a/src/hid/batch/batch.c +++ b/src/hid/batch/batch.c @@ -1,5 +1,3 @@ -/* $Id$ */ - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -11,13 +9,14 @@ #include "global.h" #include "hid.h" +#include "../hidint.h" #include "data.h" +#include "misc.h" #ifdef HAVE_LIBDMALLOC #include <dmalloc.h> #endif - -RCSID ("$Id$"); +#include<unistd.h> /* This is a text-line "batch" HID, which exists for scripting and non-GUI needs. */ @@ -59,6 +58,7 @@ PCBChanged (int argc, char **argv, int x, int y) return 0; } +extern void print_actions (); static int help (int argc, char **argv, int x, int y) { @@ -237,12 +237,14 @@ batch_fill_polygon (hidGC gc, int n_coords, int *x, int *y) } static void -batch_fill_pcb_polygon (hidGC gc, PolygonType *poly) +batch_fill_pcb_polygon (hidGC gc, PolygonType *poly, + const BoxType *clip_box) { } static void -batch_thindraw_pcb_polygon (hidGC gc, PolygonType *poly) +batch_thindraw_pcb_polygon (hidGC gc, PolygonType *poly, + const BoxType *clip_box) { } @@ -395,8 +397,12 @@ batch_fileselect (const char *title, const char *descr, static int batch_attribute_dialog (HID_Attribute * attrs, int n_attrs, HID_Attr_Val * results, - const char *descr) + const char * title_, const char *descr) { + printf ("Attribute dialog %s [%s] (not implemented)\n", title_, descr); + /* return a value to cancel the dialog + because it is not implemented */ + return !0; } static void @@ -411,9 +417,10 @@ batch_beep (void) fflush (stdout); } -static void +static int batch_progress (int so_far, int total, const char *message) { + return 0; } HID batch_gui = { -- 1.6.5.2
>From 047b99e8ca009cec966cd802002ad8d78741364c Mon Sep 17 00:00:00 2001 From: Ineiev <ine...@users.berlios.de> Date: Sat, 29 Aug 2009 10:09:27 +0000 Subject: [PATCH 11/12] Valgrind: fix memory leaks --- src/hid/common/hidinit.c | 12 +++--------- src/mymem.c | 8 ++++---- src/parse_y.y | 9 ++++++++- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/hid/common/hidinit.c b/src/hid/common/hidinit.c index bb1a66b..a7cae91 100644 --- a/src/hid/common/hidinit.c +++ b/src/hid/common/hidinit.c @@ -700,15 +700,11 @@ void derive_default_filename(const char *pcbfile, HID_Attribute *filename_attrib, const char *suffix, char **memory) { char *buf; - char *pf; + const char *pf; - if (pcbfile == NULL) - pf = strdup ("unknown.pcb"); - else - pf = strdup (pcbfile); - - if (!pf || (memory && filename_attrib->default_val.str_value != *memory)) return; + if (memory && filename_attrib->default_val.str_value != *memory) return; + pf = pcbfile? pcbfile: "unknown.pcb"; buf = malloc (strlen (pf) + strlen(suffix) + 1); if (memory) *memory = buf; if (buf) { @@ -722,6 +718,4 @@ derive_default_filename(const char *pcbfile, HID_Attribute *filename_attrib, con free(filename_attrib->default_val.str_value); filename_attrib->default_val.str_value = buf; } - - free (pf); } diff --git a/src/mymem.c b/src/mymem.c index bed0f9b..8014b98 100644 --- a/src/mymem.c +++ b/src/mymem.c @@ -937,14 +937,12 @@ FreeDataMemory (DataTypePtr Data) MYFREE (text->TextString); } END_LOOP; - if (layer->Name) - MYFREE (layer->Name); LINE_LOOP (layer); { - if (line->Number) - MYFREE (line->Number); + MYFREE (line->Number); } END_LOOP; + MYFREE (layer->Name); MYFREE (layer->Line); MYFREE (layer->Arc); MYFREE (layer->Text); @@ -977,6 +975,8 @@ FreeDataMemory (DataTypePtr Data) r_destroy_tree (&Data->pad_tree); if (Data->rat_tree) r_destroy_tree (&Data->rat_tree); + MYFREE (Data->Via); + MYFREE (Data->Element); /* clear struct */ memset (Data, 0, sizeof (DataType)); } diff --git a/src/parse_y.y b/src/parse_y.y index f4fc367..f80b540 100644 --- a/src/parse_y.y +++ b/src/parse_y.y @@ -172,6 +172,7 @@ parsepcb pcbnetlist { int i, j; + char *layer_groups = layer_group_string; PCBTypePtr pcb_save = PCB; if (layer_group_string == NULL) @@ -182,6 +183,8 @@ parsepcb Message("illegal layer-group string\n"); YYABORT; } + SaveFree (layer_groups); + layer_group_string = NULL; /* initialize the polygon clipping now since * we didn't know the layer grouping before. */ @@ -567,6 +570,7 @@ pcbflags | T_FLAGS '(' STRING ')' { yyPCB->Flags = string_to_pcbflags ($3, yyerror); + SaveFree($3); } | ; @@ -651,6 +655,7 @@ pcbstyles Message("illegal route-style string\n"); YYABORT; } + SaveFree($3); } | T_STYLES '[' STRING ']' { @@ -659,6 +664,7 @@ pcbstyles Message("illegal route-style string\n"); YYABORT; } + SaveFree($3); } | ; @@ -856,6 +862,7 @@ layer } Layer = &yyData->Layer[$3-1]; + SaveFree (Layer->Name); /* memory for name is already allocated */ Layer->Name = $4; LayerFlag[$3-1] = true; @@ -1684,7 +1691,7 @@ pad ; flags : NUMBER { $$ = OldFlags($1); } - | STRING { $$ = string_to_flags ($1, yyerror); } + | STRING { $$ = string_to_flags ($1, yyerror); SaveFree($1); } ; symbols -- 1.6.5.2
>From 8152d6f1e14a3b25976a05af698f493d24949a2b Mon Sep 17 00:00:00 2001 From: Ineiev <ine...@users.berlios.de> Date: Sat, 29 Aug 2009 11:46:29 +0000 Subject: [PATCH 12/12] Valgrind: fix potential buffer overflow --- src/create.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/src/create.c b/src/create.c index bf3b688..7ac86f6 100644 --- a/src/create.c +++ b/src/create.c @@ -972,11 +972,9 @@ LibraryMenuTypePtr CreateNewNet (LibraryTypePtr lib, char *name, char *style) { LibraryMenuTypePtr menu; - char temp[64]; - sprintf (temp, " %s", name); menu = GetLibraryMenuMemory (lib); - menu->Name = MyStrdup (temp, "CreateNewNet()"); + menu->Name = Concat (" ", name, NULL); menu->flag = 1; /* net is enabled by default */ if (style == NULL || NSTRCMP ("(unknown)", style) == 0) menu->Style = NULL; -- 1.6.5.2
_______________________________________________ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user