|
From: <gi...@gp...> - 2011-01-23 06:48:28
|
The branch, master has been updated
via 089fbaf59c78fe75475db737e7e2827cd745d570 (commit)
from 5f0f788dc12a10a3c01ade7cf00d5ed63922ca47 (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
=========
configure.ac | 25 +++++++-
src/action.c | 50 ++++++++++----
src/autoplace.c | 9 ++-
src/autoroute.c | 125 ++++++++++++++++++++++------------
src/change.c | 2 +-
src/create.c | 14 ++--
src/dbus-pcbmain.c | 24 ++++---
src/draw.c | 12 ++--
src/drill.c | 6 +-
src/edif.y | 46 +++++--------
src/file.c | 30 ++++----
src/find.c | 64 +++++++++---------
src/free_atexit.c | 2 +-
src/global.h | 3 +-
src/heap.c | 4 +-
src/hid.h | 10 ++-
src/hid/bom/bom.c | 56 ++++++++--------
src/hid/common/actions.c | 6 +-
src/hid/common/draw_helpers.c | 8 +-
src/hid/common/extents.c | 4 +-
src/hid/common/flags.c | 4 +-
src/hid/common/hid_resource.c | 8 +-
src/hid/common/hidinit.c | 9 ++-
src/hid/common/hidnogui.c | 2 +-
src/hid/gcode/gcode.c | 14 ++--
src/hid/gerber/gerber.c | 140 ++++++++++++++++++++++----------------
src/hid/gtk/gtkhid-gdk.c | 22 +++---
src/hid/gtk/gtkhid-main.c | 20 +++---
src/hid/gtk/gui-command-window.c | 2 +-
src/hid/gtk/gui-config.c | 36 +++++-----
src/hid/gtk/gui-dialog-print.c | 24 +++---
src/hid/gtk/gui-dialog-size.c | 66 +++++++++++++++---
src/hid/gtk/gui-dialog.c | 22 +++---
src/hid/gtk/gui-drc-window.c | 26 ++++----
src/hid/gtk/gui-library-window.c | 8 +-
src/hid/gtk/gui-log-window.c | 2 +-
src/hid/gtk/gui-misc.c | 20 +++---
src/hid/gtk/gui-netlist-window.c | 4 +-
src/hid/gtk/gui-output-events.c | 2 +-
src/hid/gtk/gui-pinout-preview.c | 8 +-
src/hid/gtk/gui-top-window.c | 38 +++++-----
src/hid/gtk/gui-utils.c | 10 ++--
src/hid/gtk/gui.h | 16 ++--
src/hid/nelma/nelma.c | 12 ++--
src/hid/png/png.c | 10 ++--
src/hid/ps/eps.c | 136 ++++++++++++++++++++++---------------
src/hid/ps/ps.c | 6 +-
src/insert.c | 22 +++---
src/intersect.c | 8 +-
src/main.c | 4 +-
src/misc.c | 6 +-
src/move.c | 120 ++++++++++++++++----------------
src/mtspace.c | 87 +++++++++++++-----------
src/mymem.c | 48 +++++++-------
src/netlist.c | 2 +-
src/parse_l.l | 4 +-
src/parse_y.y | 7 +-
src/polygon.c | 32 ++++----
src/polygon1.c | 114 +++++++++++++++---------------
src/puller.c | 12 ++--
src/rats.c | 26 ++++----
src/rats.h | 2 +-
src/report.c | 2 +-
src/rtree.c | 10 ++--
src/toporouter.c | 66 +++++++++---------
src/undo.c | 24 +++---
src/vector.c | 20 +++---
src/vendor.c | 4 +-
68 files changed, 987 insertions(+), 800 deletions(-)
=================
Commit Messages
=================
commit 089fbaf59c78fe75475db737e7e2827cd745d570
Author: Newell Jensen <pil...@gm...>
Commit: DJ Delorie <dj...@de...>
Initial C++ compatibility patch
Doesn't cover lesstif or batch hids. Makes source code build without
warnings on C, and build with warnings on C++.
:100644 100644 ca2dbe4... e405819... M configure.ac
:100644 100644 5acd3fd... fd90b19... M src/action.c
:100644 100644 ed2014a... e1461c6... M src/autoplace.c
:100644 100644 976ef09... b2cbab4... M src/autoroute.c
:100644 100644 2545d84... cb53b47... M src/change.c
:100644 100644 07de918... f942c40... M src/create.c
:100644 100644 83b2e97... 07e68c0... M src/dbus-pcbmain.c
:100644 100644 e0890da... bb212e9... M src/draw.c
:100644 100644 1f1d770... a7a908b... M src/drill.c
:100644 100644 d9dbd8e... da33c9b... M src/edif.y
:100644 100644 9e38217... 1df23d5... M src/file.c
:100644 100644 613629a... 615659d... M src/find.c
:100644 100644 501775c... 6527a46... M src/free_atexit.c
:100644 100644 bb78abc... 0420a18... M src/global.h
:100644 100644 fee6412... 9e0f35e... M src/heap.c
:100644 100644 94734ba... b13e75b... M src/hid.h
:100644 100644 04ad123... 661b592... M src/hid/bom/bom.c
:100644 100644 d1e87f5... 43c50f8... M src/hid/common/actions.c
:100644 100644 1c7ead9... dc1f60f... M src/hid/common/draw_helpers.c
:100644 100644 e8bd8ab... 0f51b47... M src/hid/common/extents.c
:100644 100644 30859fb... 9b53328... M src/hid/common/flags.c
:100644 100644 d5ba274... 11f1171... M src/hid/common/hid_resource.c
:100644 100644 bb1a66b... 9c4f8ee... M src/hid/common/hidinit.c
:100644 100644 08adb26... fd86b6a... M src/hid/common/hidnogui.c
:100644 100644 f1bdcea... 64d45cb... M src/hid/gcode/gcode.c
:100644 100644 85e01f3... 63344b3... M src/hid/gerber/gerber.c
:100644 100644 0a2cc59... 6ea9f9b... M src/hid/gtk/gtkhid-gdk.c
:100644 100644 8bbf3eb... 169884e... M src/hid/gtk/gtkhid-main.c
:100644 100644 b97ec0b... d865dee... M src/hid/gtk/gui-command-window.c
:100644 100644 36277eb... 516feb5... M src/hid/gtk/gui-config.c
:100644 100644 0c50aed... 9ced77b... M src/hid/gtk/gui-dialog-print.c
:100644 100644 8409ba5... a5b5888... M src/hid/gtk/gui-dialog-size.c
:100644 100644 80c1157... bb934bd... M src/hid/gtk/gui-dialog.c
:100644 100644 e2fa201... a708193... M src/hid/gtk/gui-drc-window.c
:100644 100644 f54d914... eb366ba... M src/hid/gtk/gui-library-window.c
:100644 100644 ae25ed7... a91f346... M src/hid/gtk/gui-log-window.c
:100644 100644 e3316aa... 1c55a99... M src/hid/gtk/gui-misc.c
:100644 100644 a5e38d1... b60b8ba... M src/hid/gtk/gui-netlist-window.c
:100644 100644 2e820a3... 349f91b... M src/hid/gtk/gui-output-events.c
:100644 100644 212d37a... fc69639... M src/hid/gtk/gui-pinout-preview.c
:100644 100644 f2cdb99... 4186d85... M src/hid/gtk/gui-top-window.c
:100644 100644 3d93d19... 5db7b42... M src/hid/gtk/gui-utils.c
:100644 100644 d2a76ce... df30955... M src/hid/gtk/gui.h
:100644 100644 5f6ebc7... 60f5b37... M src/hid/nelma/nelma.c
:100644 100644 32639c8... 06e22bb... M src/hid/png/png.c
:100644 100644 83ce780... 49a19c7... M src/hid/ps/eps.c
:100644 100644 eacf826... 7c286cc... M src/hid/ps/ps.c
:100644 100644 5e62463... 7e9ebf2... M src/insert.c
:100644 100644 7389ba9... e7612e9... M src/intersect.c
:100644 100644 735fde7... 3fff933... M src/main.c
:100644 100644 e1e14c8... 13c7398... M src/misc.c
:100644 100644 cbb2e3d... 5e3913c... M src/move.c
:100644 100644 3640f5c... 9d593e8... M src/mtspace.c
:100644 100644 09cb6ab... 24f20a2... M src/mymem.c
:100644 100644 4a26bc9... 0c004f9... M src/netlist.c
:100644 100644 9799250... 57cd1c6... M src/parse_l.l
:100644 100644 7aa7b80... d0f31aa... M src/parse_y.y
:100644 100644 72d92c9... c552f3c... M src/polygon.c
:100644 100644 468c139... 8e9aa24... M src/polygon1.c
:100644 100644 66a5a03... 8e56f0b... M src/puller.c
:100644 100644 3e9d6ee... 24be309... M src/rats.c
:100644 100644 eb928d4... 3d70f27... M src/rats.h
:100644 100644 f0668d9... 9135e0d... M src/report.c
:100644 100644 f44672c... e2ef1ee... M src/rtree.c
:100644 100644 bfd494a... 28a3764... M src/toporouter.c
:100644 100644 5226c53... b14e3ec... M src/undo.c
:100644 100644 169afd3... c039b89... M src/vector.c
:100644 100644 a296aa1... 5b7f5eb... M src/vendor.c
=========
Changes
=========
commit 089fbaf59c78fe75475db737e7e2827cd745d570
Author: Newell Jensen <pil...@gm...>
Commit: DJ Delorie <dj...@de...>
Initial C++ compatibility patch
Doesn't cover lesstif or batch hids. Makes source code build without
warnings on C, and build with warnings on C++.
diff --git a/configure.ac b/configure.ac
index ca2dbe4..e405819 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1017,7 +1017,7 @@ LIBS="$LIBS $XM_LIBS $DBUS_LIBS $X_LIBS $GLIB_LIBS $GTK_LIBS $DMALLOC_LIBS $GD_L
# if we have gcc then add -Wall
if test "x$GCC" = "xyes"; then
# see about adding some extra checks if the compiler takes them
- for flag in -Wall -Wdeclaration-after-statement ; do
+ for flag in -Wall ; do
case " ${CFLAGS} " in
*\ ${flag}\ *)
# flag is already present
@@ -1039,6 +1039,29 @@ fi
CXXFLAGS="$CFLAGS"
+# Now add C-specific flags
+if test "x$GCC" = "xyes"; then
+ # see about adding some extra checks if the compiler takes them
+ for flag in -Wdeclaration-after-statement ; do
+ case " ${CFLAGS} " in
+ *\ ${flag}\ *)
+ # flag is already present
+ ;;
+ *)
+ AC_MSG_CHECKING([if the compiler accepts ${flag}])
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS ${flag}"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ CFLAGS="$ac_save_CFLAGS"
+ ]
+ )
+ ;;
+ esac
+ done
+fi
+
# See if we are building gcc with C++.
AC_ARG_ENABLE(build-with-cxx,
[ --enable-build-with-cxx build with C++ compiler instead of C compiler],
diff --git a/src/action.c b/src/action.c
index 5acd3fd..fd90b19 100644
--- a/src/action.c
+++ b/src/action.c
@@ -1495,7 +1495,7 @@ NotifyMode (void)
{
/* Create POLYAREAs from the original polygon
* and the new hole polygon */
- original = PolygonToPoly (Crosshair.AttachedObject.Ptr2);
+ original = PolygonToPoly ((PolygonType *)Crosshair.AttachedObject.Ptr2);
new_hole = PolygonToPoly (&Crosshair.AttachedPolygon);
/* Subtract the hole from the original polygon shape */
@@ -1506,7 +1506,7 @@ NotifyMode (void)
*/
SaveUndoSerialNumber ();
Flags = ((PolygonType *)Crosshair.AttachedObject.Ptr2)->Flags;
- PolyToPolygonsOnLayer (PCB->Data, Crosshair.AttachedObject.Ptr1,
+ PolyToPolygonsOnLayer (PCB->Data, (LayerType *)Crosshair.AttachedObject.Ptr1,
result, Flags);
RemoveObject (POLYGON_TYPE,
Crosshair.AttachedObject.Ptr1,
@@ -2654,6 +2654,27 @@ the crosshair steps along the grid.
%end-doc */
+static enum crosshair_shape
+CrosshairShapeIncrement (enum crosshair_shape shape)
+{
+ switch(shape)
+ {
+ case Basic_Crosshair_Shape:
+ shape = Union_Jack_Crosshair_Shape;
+ break;
+ case Union_Jack_Crosshair_Shape:
+ shape = Dozen_Crosshair_Shape;
+ break;
+ case Dozen_Crosshair_Shape:
+ shape = Crosshair_Shapes_Number;
+ break;
+ case Crosshair_Shapes_Number:
+ shape = Basic_Crosshair_Shape;
+ break;
+ }
+ return shape;
+}
+
static int
ActionDisplay (int argc, char **argv, int childX, int childY)
{
@@ -2735,7 +2756,8 @@ ActionDisplay (int argc, char **argv, int childX, int childY)
break;
case F_CycleCrosshair:
- Crosshair.shape++;
+ //Crosshair.shape++;
+ Crosshair.shape = CrosshairShapeIncrement(Crosshair.shape);
if (Crosshair_Shapes_Number == Crosshair.shape)
Crosshair.shape = Basic_Crosshair_Shape;
break;
@@ -3368,10 +3390,10 @@ ActionRenumber (int argc, char **argv, int x, int y)
*
* We'll actually renumber things in the 2nd pass.
*/
- element_list = calloc (PCB->Data->ElementN, sizeof (ElementTypePtr));
- locked_element_list = calloc (PCB->Data->ElementN, sizeof (ElementTypePtr));
- was = calloc (PCB->Data->ElementN, sizeof (char *));
- is = calloc (PCB->Data->ElementN, sizeof (char *));
+ element_list = (ElementType **)calloc (PCB->Data->ElementN, sizeof (ElementTypePtr));
+ locked_element_list = (ElementType **)calloc (PCB->Data->ElementN, sizeof (ElementTypePtr));
+ was = (char **)calloc (PCB->Data->ElementN, sizeof (char *));
+ is = (char **)calloc (PCB->Data->ElementN, sizeof (char *));
if (element_list == NULL || locked_element_list == NULL || was == NULL
|| is == NULL)
{
@@ -3441,7 +3463,7 @@ ActionRenumber (int argc, char **argv, int x, int y)
unique = TEST_FLAG (UNIQUENAMEFLAG, PCB);
CLEAR_FLAG (UNIQUENAMEFLAG, PCB);
- cnt_list = calloc (cnt_list_sz, sizeof (struct _cnt_list));
+ cnt_list = (struct _cnt_list *)calloc (cnt_list_sz, sizeof (struct _cnt_list));
for (i = 0; i < cnt; i++)
{
/* If there is no refdes, maybe just spit out a warning */
@@ -3464,7 +3486,7 @@ ActionRenumber (int argc, char **argv, int x, int y)
if (j == cnt_list_sz)
{
cnt_list_sz += 100;
- cnt_list = realloc (cnt_list, cnt_list_sz);
+ cnt_list = (struct _cnt_list *)realloc (cnt_list, cnt_list_sz);
if (cnt_list == NULL)
{
fprintf (stderr, "realloc failed() in %s\n", __FUNCTION__);
@@ -3508,7 +3530,7 @@ ActionRenumber (int argc, char **argv, int x, int y)
sz++;
tmpi = tmpi / 10;
}
- tmps = malloc (sz * sizeof (char));
+ tmps = (char *)malloc (sz * sizeof (char));
sprintf (tmps, "%s%d", cnt_list[j].name, cnt_list[j].cnt);
/*
@@ -3598,7 +3620,7 @@ ActionRenumber (int argc, char **argv, int x, int y)
{
free (PCB->NetlistLib.Menu[i].Entry[j].ListEntry);
PCB->NetlistLib.Menu[i].Entry[j].ListEntry =
- malloc ((strlen (is[k]) + strlen (pin) +
+ (char *)malloc ((strlen (is[k]) + strlen (pin) +
2) * sizeof (char));
sprintf (PCB->NetlistLib.Menu[i].Entry[j].ListEntry,
"%s-%s", is[k], pin);
@@ -6063,8 +6085,8 @@ Selects the given buffer to be the current paste buffer.
static int
ActionPasteBuffer (int argc, char **argv, int x, int y)
{
- char *function = argc ? argv[0] : "";
- char *sbufnum = argc > 1 ? argv[1] : "";
+ char *function = argc ? argv[0] : (char *)"";
+ char *sbufnum = argc > 1 ? argv[1] : (char *)"";
char *name;
static char *default_file = NULL;
int free_name = 0;
@@ -7870,7 +7892,7 @@ ActionImport (int argc, char **argv, int x, int y)
cmd[i++] = "-f";
cmd[i++] = user_makefile;
}
- cmd[i++] = user_target ? user_target : "pcb_import";
+ cmd[i++] = user_target ? user_target : (char *)"pcb_import";
cmd[i++] = NULL;
if (pcb_spawnvp (cmd))
diff --git a/src/autoplace.c b/src/autoplace.c
index ed2014a..e1461c6 100644
--- a/src/autoplace.c
+++ b/src/autoplace.c
@@ -132,12 +132,13 @@ typedef struct
}
ElementPtrListType;
+enum ewhich
+ { SHIFT, ROTATE, EXCHANGE };
+
typedef struct
{
ElementTypePtr element;
- enum
- { SHIFT, ROTATE, EXCHANGE }
- which;
+ enum ewhich which;
LocationType DX, DY; /* for shift */
BYTE rotate; /* for rotate/flip */
ElementTypePtr other; /* for exchange */
@@ -528,7 +529,7 @@ ComputeCost (NetListTypePtr Nets, double T0, double T)
boxpp = (struct ebox **)
GetPointerMemory (TEST_FLAG (ONSOLDERFLAG, element) ?
&seboxes : &ceboxes);
- *boxpp = malloc (sizeof (**boxpp));
+ *boxpp = (struct ebox *)malloc (sizeof (**boxpp));
if (*boxpp == NULL )
{
fprintf (stderr, "malloc() failed in %s\n", __FUNCTION__);
diff --git a/src/autoroute.c b/src/autoroute.c
index 976ef09..b2cbab4 100644
--- a/src/autoroute.c
+++ b/src/autoroute.c
@@ -103,6 +103,42 @@ RCSID ("$Id$");
//#define DEBUG_SHOW_ZIGZAG
*/
+static direction_t
+directionIncrement(direction_t dir)
+{
+ switch(dir)
+ {
+ case NORTH:
+ dir = EAST;
+ break;
+ case EAST:
+ dir = SOUTH;
+ break;
+ case SOUTH:
+ dir = WEST;
+ break;
+ case WEST:
+ dir = NE;
+ break;
+ case NE:
+ dir = SE;
+ break;
+ case SE:
+ dir = SW;
+ break;
+ case SW:
+ dir = NW;
+ break;
+ case NW:
+ dir = ALL;
+ break;
+ case ALL:
+ dir = NORTH;
+ break;
+ }
+return dir;
+}
+
static hidGC ar_gc = 0;
#define EXPENSIVE 3e28
@@ -185,9 +221,18 @@ typedef enum
{ NO_CONFLICT = 0, LO_CONFLICT = 1, HI_CONFLICT = 2 }
conflict_t;
+typedef struct routebox_list
+{
+ struct routebox *next, *prev;
+}routebox_list;
+
+typedef enum etype
+ { PAD, PIN, VIA, VIA_SHADOW, LINE, OTHER, EXPANSION_AREA, PLANE, THERMAL }
+ etype;
+
typedef struct routebox
{
- const BoxType box, sbox;
+ BoxType box, sbox;
union
{
PadTypePtr pad;
@@ -202,9 +247,7 @@ typedef struct routebox
parent;
unsigned short group;
unsigned short layer;
- enum
- { PAD, PIN, VIA, VIA_SHADOW, LINE, OTHER, EXPANSION_AREA, PLANE, THERMAL }
- type;
+ etype type;
struct
{
unsigned nonstraight:1;
@@ -263,11 +306,7 @@ typedef struct routebox
/* the direction this came from, if any */
direction_t came_from;
/* circular lists with connectivity information. */
- struct routebox_list
- {
- struct routebox *next, *prev;
- }
- same_net, same_subnet, original_subnet, different_net;
+ routebox_list same_net, same_subnet, original_subnet, different_net;
}
routebox_t;
@@ -609,7 +648,7 @@ AddPin (PointerListType layergroupboxes[], PinTypePtr pin, bool is_via,
for (i = 0; i < max_group; i++)
{
rbpp = (routebox_t **) GetPointerMemory (&layergroupboxes[i]);
- *rbpp = malloc (sizeof (**rbpp));
+ *rbpp = (routebox_t *)malloc (sizeof (**rbpp));
memset ((void *) *rbpp, 0, sizeof (**rbpp));
(*rbpp)->group = i;
ht = HALF_THICK (MAX (pin->Thickness, pin->DrillingHole));
@@ -657,7 +696,7 @@ AddPad (PointerListType layergroupboxes[],
assert (PCB->LayerGroups.Number[layergroup] > 0);
rbpp = (routebox_t **) GetPointerMemory (&layergroupboxes[layergroup]);
assert (rbpp);
- *rbpp = malloc (sizeof (**rbpp));
+ *rbpp = (routebox_t *)malloc (sizeof (**rbpp));
assert (*rbpp);
memset (*rbpp, 0, sizeof (**rbpp));
(*rbpp)->group = layergroup;
@@ -691,7 +730,7 @@ AddLine (PointerListType layergroupboxes[], int layergroup, LineTypePtr line,
assert (PCB->LayerGroups.Number[layergroup] > 0);
rbpp = (routebox_t **) GetPointerMemory (&layergroupboxes[layergroup]);
- *rbpp = malloc (sizeof (**rbpp));
+ *rbpp = (routebox_t *)malloc (sizeof (**rbpp));
memset (*rbpp, 0, sizeof (**rbpp));
(*rbpp)->group = layergroup;
init_const_box (*rbpp,
@@ -739,7 +778,7 @@ AddIrregularObstacle (PointerListType layergroupboxes[],
assert (PCB->LayerGroups.Number[layergroup] > 0);
rbpp = (routebox_t **) GetPointerMemory (&layergroupboxes[layergroup]);
- *rbpp = malloc (sizeof (**rbpp));
+ *rbpp = (routebox_t *)malloc (sizeof (**rbpp));
memset (*rbpp, 0, sizeof (**rbpp));
(*rbpp)->group = layergroup;
init_const_box (*rbpp, X1, Y1, X2, Y2, keep);
@@ -942,7 +981,7 @@ CreateRouteData ()
}
}
/* create routedata */
- rd = malloc (sizeof (*rd));
+ rd = (routedata_t *)malloc (sizeof (*rd));
memset ((void *) rd, 0, sizeof (*rd));
/* create default style */
rd->defaultstyle.Thick = Settings.LineThickness;
@@ -1059,24 +1098,24 @@ CreateRouteData ()
{
case PAD_TYPE:
rb =
- AddPad (layergroupboxes, connection->ptr1,
- connection->ptr2, rd->styles[j]);
+ AddPad (layergroupboxes, (ElementType *)connection->ptr1,
+ (PadType *)connection->ptr2, rd->styles[j]);
break;
case PIN_TYPE:
rb =
- AddPin (layergroupboxes, connection->ptr2, false,
+ AddPin (layergroupboxes, (PinType *)connection->ptr2, false,
rd->styles[j]);
break;
case VIA_TYPE:
rb =
- AddPin (layergroupboxes, connection->ptr2, true,
+ AddPin (layergroupboxes, (PinType *)connection->ptr2, true,
rd->styles[j]);
break;
case POLYGON_TYPE:
rb =
AddPolygon (layergroupboxes,
- GetLayerNumber (PCB->Data, connection->ptr1),
- connection->ptr2, rd->styles[j]);
+ GetLayerNumber (PCB->Data, (LayerType *)connection->ptr1),
+ (struct polygon_st *)connection->ptr2, rd->styles[j]);
break;
}
assert (rb);
@@ -1706,7 +1745,7 @@ CreateEdge (routebox_t * rb,
{
edge_t *e;
assert (__routebox_is_good (rb));
- e = malloc (sizeof (*e));
+ e = (edge_t *)malloc (sizeof (*e));
memset ((void *) e, 0, sizeof (*e));
assert (e);
e->rb = rb;
@@ -2757,7 +2796,7 @@ BreakManyEdges (struct routeone_state * s, rtree_t * targets, rtree_t * tree,
if (e->expand_dir == NE || e->expand_dir == SE ||
e->expand_dir == SW || e->expand_dir == NW)
{
- BoxType *fb = (BoxType *) & fake.sbox;
+ BoxType *fb = (BoxType *) &fake.sbox;
memset (&fake, 0, sizeof (fake));
*fb = e->rb->sbox;
fake.flags.fixed = 1; /* this stops expansion there */
@@ -2766,7 +2805,7 @@ BreakManyEdges (struct routeone_state * s, rtree_t * targets, rtree_t * tree,
#ifndef NDEBUG
/* the routbox_is_good checker wants a lot more! */
fake.flags.inited = 1;
- fb = (BoxType *) & fake.box;
+ fb = (BoxType *) &fake.box;
*fb = e->rb->sbox;
fake.same_net.next = fake.same_net.prev = &fake;
fake.same_subnet.next = fake.same_subnet.prev = &fake;
@@ -2778,7 +2817,7 @@ BreakManyEdges (struct routeone_state * s, rtree_t * targets, rtree_t * tree,
* in clockwise order, which allows finding corners that can
* be expanded.
*/
- for (dir = NORTH; dir <= WEST; dir++)
+ for (dir = NORTH; dir <= WEST; directionIncrement(dir))
{
/* don't break the edge we came from */
if (e->expand_dir != ((dir + 2) % 4))
@@ -2855,7 +2894,7 @@ BreakManyEdges (struct routeone_state * s, rtree_t * targets, rtree_t * tree,
* moveable as possible.
*/
first = last = -1;
- for (dir = NORTH; dir <= WEST; dir++)
+ for (dir = NORTH; dir <= WEST; directionIncrement(dir))
{
if (heap[dir] && !heap_is_empty (heap[dir]))
{
@@ -2895,7 +2934,7 @@ BreakManyEdges (struct routeone_state * s, rtree_t * targets, rtree_t * tree,
assert (0);
break;
}
- moveable_edge (edges, &db, dir + 3, rb, NULL, e, targets,
+ moveable_edge (edges, &db, (direction_t)(dir + 3), rb, NULL, e, targets,
s, NULL, NULL);
}
else if (dir == NORTH) /* north is start, so nothing "before" it */
@@ -2922,7 +2961,7 @@ BreakManyEdges (struct routeone_state * s, rtree_t * targets, rtree_t * tree,
* which it belongs to.
*/
BoxType db = previous_edge (last, dir, &rb->sbox);
- moveable_edge (edges, &db, dir - 1, rb, NULL, e, targets, s,
+ moveable_edge (edges, &db, (direction_t)(dir - 1), rb, NULL, e, targets, s,
NULL, NULL);
}
if (broke.is_valid_center && !blk->flags.source)
@@ -2954,7 +2993,7 @@ BreakManyEdges (struct routeone_state * s, rtree_t * targets, rtree_t * tree,
}
if (heap_is_empty (heap[dir]))
break;
- blk = heap_remove_smallest (heap[dir]);
+ blk = (routebox_t *)heap_remove_smallest (heap[dir]);
broke = break_box_edge (&b, dir, blk);
if (broke.is_valid_left)
moveable_edge (edges, &broke.left, dir, rb, NULL, e, targets,
@@ -2986,7 +3025,7 @@ BreakManyEdges (struct routeone_state * s, rtree_t * targets, rtree_t * tree,
{
/* expand the leftover from the prior direction */
BoxType db = previous_edge (last, dir, &rb->sbox);
- moveable_edge (edges, &db, dir - 1, rb, NULL, e, targets, s,
+ moveable_edge (edges, &db, (direction_t)(dir - 1), rb, NULL, e, targets, s,
NULL, NULL);
}
last = -1;
@@ -3018,7 +3057,7 @@ BreakManyEdges (struct routeone_state * s, rtree_t * targets, rtree_t * tree,
}
}
/* done with all expansion edges of this box */
- for (dir = NORTH; dir <= WEST; dir++)
+ for (dir = NORTH; dir <= WEST; directionIncrement(dir))
{
if (heap[dir])
heap_destroy (&heap[dir]);
@@ -3680,7 +3719,7 @@ CreateSearchEdge (struct routeone_state *s, vetting_t * work, edge_t * parent,
if (cost < s->best_cost)
{
edge_t *ne;
- ne = malloc (sizeof (*ne));
+ ne = (edge_t *)malloc (sizeof (*ne));
memset ((void *) ne, 0, sizeof (*ne));
assert (ne);
ne->flags.via_search = 1;
@@ -3809,7 +3848,7 @@ do_via_search (edge_t * search, struct routeone_state *s,
while (!vector_is_empty (v))
{
BoxType cliparea;
- BoxType *area = vector_remove_last (v);
+ BoxType *area = (BoxType *)vector_remove_last (v);
if (!(i == NO_CONFLICT || AutoRouteParameters.with_conflicts))
{
free (area);
@@ -3827,7 +3866,7 @@ do_via_search (edge_t * search, struct routeone_state *s,
if (j == within->group || !is_layer_group_active[j])
continue;
ne = CreateViaEdge (&cliparea, j, within, search,
- within_conflict_level, i, targets);
+ within_conflict_level, (conflict_t)i, targets);
add_or_destroy_edge (s, ne);
}
}
@@ -3965,9 +4004,9 @@ __conflict_source (const BoxType * box, void *cl)
return 0;
else
{
- routebox_t *this = (routebox_t *) cl;
- path_conflicts (this, rb, false);
- touch_conflicts (this->conflicts_with, 1);
+ routebox_t *dis = (routebox_t *) cl;
+ path_conflicts (dis, rb, false);
+ touch_conflicts (dis->conflicts_with, 1);
}
return 1;
}
@@ -4080,7 +4119,7 @@ RouteOne (routedata_t * rd, routebox_t * from, routebox_t * to, int max_edges)
assert (!from->flags.target);
assert (num_targets > 0);
/* create list of target pointers and from that a r-tree of targets */
- target_list = malloc (num_targets * sizeof (*target_list));
+ target_list = (const BoxType **)malloc (num_targets * sizeof (*target_list));
i = 0;
LIST_LOOP (from, same_net, p);
if (p->flags.target)
@@ -4091,7 +4130,7 @@ RouteOne (routedata_t * rd, routebox_t * from, routebox_t * to, int max_edges)
#endif
}
END_LOOP;
- targets = r_create_tree (target_list, i, 0);
+ targets = r_create_tree ((const BoxType **)target_list, i, 0);
assert (i <= num_targets);
free (target_list);
@@ -4139,7 +4178,7 @@ RouteOne (routedata_t * rd, routebox_t * from, routebox_t * to, int max_edges)
assert (s.workheap);
while (!vector_is_empty (source_vec))
{
- edge_t *e = vector_remove_last (source_vec);
+ edge_t *e = (edge_t *)vector_remove_last (source_vec);
assert (is_layer_group_active[e->rb->group]);
e->cost = edge_cost (e, EXPENSIVE);
heap_insert (s.workheap, e->cost, e);
@@ -4155,7 +4194,7 @@ RouteOne (routedata_t * rd, routebox_t * from, routebox_t * to, int max_edges)
vss.hi_conflict_space_vec = vector_create ();
while (!heap_is_empty (s.workheap))
{
- edge_t *e = heap_remove_smallest (s.workheap);
+ edge_t *e = (edge_t *)heap_remove_smallest (s.workheap);
#ifdef ROUTE_DEBUG
if (aabort)
goto dontexpand;
@@ -4431,7 +4470,7 @@ RouteOne (routedata_t * rd, routebox_t * from, routebox_t * to, int max_edges)
area_vec, ans, nrb, e);
while (!vector_is_empty (broken))
{
- edge_t *ne = vector_remove_last (broken);
+ edge_t *ne = (edge_t *)vector_remove_last (broken);
add_or_destroy_edge (&s, ne);
}
vector_destroy (&broken);
@@ -4468,7 +4507,7 @@ RouteOne (routedata_t * rd, routebox_t * from, routebox_t * to, int max_edges)
{
while (!vector_is_empty (s.best_path->conflicts_with))
{
- rb = vector_remove_last (s.best_path->conflicts_with);
+ rb = (routebox_t *)vector_remove_last (s.best_path->conflicts_with);
rb->flags.is_bad = 1;
result.route_had_conflicts++;
}
@@ -4506,7 +4545,7 @@ RouteOne (routedata_t * rd, routebox_t * from, routebox_t * to, int max_edges)
/* now remove all expansion areas from the r-tree. */
while (!vector_is_empty (area_vec))
{
- routebox_t *rb = vector_remove_last (area_vec);
+ routebox_t *rb = (routebox_t *)vector_remove_last (area_vec);
assert (!rb->flags.homeless);
if (rb->conflicts_with
&& rb->parent.expansion_area->conflicts_with != rb->conflicts_with)
diff --git a/src/change.c b/src/change.c
index 2545d84..cb53b47 100644
--- a/src/change.c
+++ b/src/change.c
@@ -2283,7 +2283,7 @@ QueryInputAndChangeObjectName (int Type, void *Ptr1, void *Ptr2, void *Ptr3)
if (name)
{
/* NB: ChangeObjectName takes ownership of the passed memory */
- char *old = ChangeObjectName (Type, Ptr1, Ptr2, Ptr3, name);
+ char *old = (char *)ChangeObjectName (Type, Ptr1, Ptr2, Ptr3, name);
if (old != (char *) -1)
{
AddObjectToChangeNameUndoList (Type, Ptr1, Ptr2, Ptr3, old);
diff --git a/src/create.c b/src/create.c
index 07de918..f942c40 100644
--- a/src/create.c
+++ b/src/create.c
@@ -93,7 +93,7 @@ CreateNewBuffer (void)
{
DataTypePtr data;
data = (DataTypePtr) calloc (1, sizeof (DataType));
- data->pcb = (void *) PCB;
+ data->pcb = (PCBTypePtr) PCB;
return data;
}
@@ -148,9 +148,9 @@ CreateNewPCB (bool SetDefaultNames)
int i;
/* allocate memory, switch all layers on and copy resources */
- ptr = calloc (1, sizeof (PCBType));
+ ptr = (PCBTypePtr)calloc (1, sizeof (PCBType));
ptr->Data = CreateNewBuffer ();
- ptr->Data->pcb = (void *) ptr;
+ ptr->Data->pcb = (PCBTypePtr) ptr;
ptr->ThermStyle = 4;
ptr->IsleArea = 2.e8;
@@ -719,7 +719,7 @@ CreateNewArcInElement (ElementTypePtr Element,
if (Element->ArcN >= Element->ArcMax)
{
Element->ArcMax += STEP_ELEMENTARC;
- arc = realloc (arc, Element->ArcMax * sizeof (ArcType));
+ arc = (ArcTypePtr)realloc (arc, Element->ArcMax * sizeof (ArcType));
Element->Arc = arc;
memset (arc + Element->ArcN, 0, STEP_ELEMENTARC * sizeof (ArcType));
}
@@ -765,7 +765,7 @@ CreateNewLineInElement (ElementTypePtr Element,
if (Element->LineN >= Element->LineMax)
{
Element->LineMax += STEP_ELEMENTLINE;
- line = realloc (line, Element->LineMax * sizeof (LineType));
+ line = (LineTypePtr)realloc (line, Element->LineMax * sizeof (LineType));
Element->Line = line;
memset (line + Element->LineN, 0, STEP_ELEMENTLINE * sizeof (LineType));
}
@@ -932,7 +932,7 @@ CreateNewLineInSymbol (SymbolTypePtr Symbol,
if (Symbol->LineN >= Symbol->LineMax)
{
Symbol->LineMax += STEP_SYMBOLLINE;
- line = realloc (line, Symbol->LineMax * sizeof (LineType));
+ line = (LineTypePtr)realloc (line, Symbol->LineMax * sizeof (LineType));
Symbol->Line = line;
memset (line + Symbol->LineN, 0, STEP_SYMBOLLINE * sizeof (LineType));
}
@@ -1019,7 +1019,7 @@ CreateNewAttribute (AttributeListTypePtr list, char *name, char *value)
if (list->Number >= list->Max)
{
list->Max += 10;
- list->List = realloc (list->List, list->Max * sizeof (AttributeType));
+ list->List = (AttributeType *)realloc (list->List, list->Max * sizeof (AttributeType));
}
list->List[list->Number].name = STRDUP (name);
list->List[list->Number].value = STRDUP (value);
diff --git a/src/dbus-pcbmain.c b/src/dbus-pcbmain.c
index 83b2e97..07e68c0 100644
--- a/src/dbus-pcbmain.c
+++ b/src/dbus-pcbmain.c
@@ -74,7 +74,7 @@ static void
io_watch_handler_dbus_freed (void *data)
{
IOWatchHandler *handler;
- handler = data;
+ handler = (IOWatchHandler *)data;
// Remove the watch registered with the HID
gui->unwatch_file (handler->pcb_watch);
@@ -121,7 +121,7 @@ static void
timeout_handler_dbus_freed (void *data)
{
TimeoutHandler *handler;
- handler = data;
+ handler = (TimeoutHandler *)data;
// Remove the timeout registered with the HID
gui->stop_timer (handler->pcb_timer);
@@ -133,7 +133,7 @@ void
timeout_handler_cb (hidval data)
{
TimeoutHandler *handler;
- handler = data.ptr;
+ handler = (TimeoutHandler *)data.ptr;
// Re-add the timeout, as PCB will remove the current one
// Do this before calling to dbus, incase DBus removes the timeout.
@@ -152,6 +152,7 @@ watch_add (DBusWatch * dbus_watch, void *data)
int fd;
unsigned int pcb_condition;
unsigned int dbus_flags;
+ hidval temp;
// We won't create a watch until it becomes enabled.
if (!dbus_watch_get_enabled (dbus_watch))
@@ -171,11 +172,11 @@ watch_add (DBusWatch * dbus_watch, void *data)
fd = dbus_watch_get_fd (dbus_watch);
#endif
- handler = malloc (sizeof (IOWatchHandler));
+ handler = (IOWatchHandler *)malloc (sizeof (IOWatchHandler));
+ temp.ptr = (void *)handler;
handler->dbus_watch = dbus_watch;
handler->pcb_watch =
- gui->watch_file (fd, pcb_condition, io_watch_handler_cb,
- (hidval) (void *) handler);
+ gui->watch_file (fd, pcb_condition, io_watch_handler_cb, temp);
dbus_watch_set_data (dbus_watch, handler, io_watch_handler_dbus_freed);
return TRUE;
@@ -203,6 +204,7 @@ static dbus_bool_t
timeout_add (DBusTimeout * timeout, void *data)
{
TimeoutHandler *handler;
+ hidval temp;
// We won't create a timeout until it becomes enabled.
if (!dbus_timeout_get_enabled (timeout))
@@ -212,12 +214,12 @@ timeout_add (DBusTimeout * timeout, void *data)
// to manually re-add the timer each time it expires.
// This is non-ideal, and hopefully can be changed?
- handler = malloc (sizeof (TimeoutHandler));
+ handler = (TimeoutHandler *)malloc (sizeof (TimeoutHandler));
+ temp.ptr = (void *)handler;
handler->dbus_timeout = timeout;
handler->interval = dbus_timeout_get_interval (timeout);
handler->pcb_timer =
- gui->add_timer (timeout_handler_cb, handler->interval,
- (hidval) (void *) handler);
+ gui->add_timer (timeout_handler_cb, handler->interval, temp);
dbus_timeout_set_data (timeout, handler, timeout_handler_dbus_freed);
return TRUE;
@@ -264,6 +266,7 @@ void
pcb_dbus_connection_setup_with_mainloop (DBusConnection * connection)
{
//ConnectionSetup *cs;
+ hidval temp;
/* FIXME we never free the slot, so its refcount just keeps growing,
* which is kind of broken.
@@ -300,7 +303,8 @@ pcb_dbus_connection_setup_with_mainloop (DBusConnection * connection)
// cs, NULL);
/* Register a new mainloop hook to mop up any unfinished IO. */
- gui->add_block_hook (block_hook_cb, (hidval) (void *) connection);
+ temp.ptr = (void *)connection;
+ gui->add_block_hook (block_hook_cb, temp);
return;
nomem:
diff --git a/src/draw.c b/src/draw.c
index e0890da..bb212e9 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -1209,9 +1209,9 @@ DrawPinOrViaNameLowLevel (PinTypePtr Ptr)
TextType text;
if (!Ptr->Name || !Ptr->Name[0])
- name = EMPTY (Ptr->Number);
+ name = (char *)EMPTY (Ptr->Number);
else
- name = EMPTY (TEST_FLAG (SHOWNUMBERFLAG, PCB) ? Ptr->Number : Ptr->Name);
+ name = (char *)EMPTY (TEST_FLAG (SHOWNUMBERFLAG, PCB) ? Ptr->Number : Ptr->Name);
vert = TEST_FLAG (EDGE2FLAG, Ptr);
@@ -1425,9 +1425,9 @@ DrawPadNameLowLevel (PadTypePtr Pad)
TextType text;
if (!Pad->Name || !Pad->Name[0])
- name = EMPTY (Pad->Number);
+ name = (char *)EMPTY (Pad->Number);
else
- name = EMPTY (TEST_FLAG (SHOWNUMBERFLAG, PCB) ? Pad->Number : Pad->Name);
+ name = (char *)EMPTY (TEST_FLAG (SHOWNUMBERFLAG, PCB) ? Pad->Number : Pad->Name);
/* should text be vertical ? */
vert = (Pad->Point1.X == Pad->Point2.X);
@@ -2292,7 +2292,7 @@ EraseObject (int type, void *lptr, void *ptr)
break;
case TEXT_TYPE:
case ELEMENTNAME_TYPE:
- EraseText (lptr, (TextTypePtr) ptr);
+ EraseText ((LayerTypePtr)lptr, (TextTypePtr) ptr);
break;
case POLYGON_TYPE:
ErasePolygon ((PolygonTypePtr) ptr);
@@ -2396,7 +2396,7 @@ hid_expose_callback (HID * hid, BoxType * region, void *item)
if (item)
{
doing_pinout = true;
- DrawElement (item, 0);
+ DrawElement ((ElementTypePtr)item, 0);
doing_pinout = false;
}
else
diff --git a/src/drill.c b/src/drill.c
index 1f1d770..a7a908b 100644
--- a/src/drill.c
+++ b/src/drill.c
@@ -126,7 +126,7 @@ GetDrillInfo (DataTypePtr top)
bool DrillFound = false;
bool NewDrill;
- AllDrills = calloc (1, sizeof (DrillInfoType));
+ AllDrills = (DrillInfoTypePtr)calloc (1, sizeof (DrillInfoType));
ALLPIN_LOOP (top);
{
if (!DrillFound)
@@ -235,7 +235,7 @@ RoundDrillInfo (DrillInfoTypePtr d, int roundto)
= d->Drill[i].ElementN + d->Drill[i+1].ElementN;
if (d->Drill[i].ElementMax)
{
- d->Drill[i].Element = realloc (d->Drill[i].Element,
+ d->Drill[i].Element = (ElementTypePtr *)realloc (d->Drill[i].Element,
d->Drill[i].ElementMax *
sizeof (ElementTypePtr));
@@ -253,7 +253,7 @@ RoundDrillInfo (DrillInfoTypePtr d, int roundto)
d->Drill[i + 1].Element = NULL;
d->Drill[i].PinMax = d->Drill[i].PinN + d->Drill[i + 1].PinN;
- d->Drill[i].Pin = realloc (d->Drill[i].Pin,
+ d->Drill[i].Pin = (PinTypePtr *)realloc (d->Drill[i].Pin,
d->Drill[i].PinMax *
sizeof (PinTypePtr));
memcpy (d->Drill[i].Pin + d->Drill[i].PinN, d->Drill[i + 1].Pin,
diff --git a/src/edif.y b/src/edif.y
index d9dbd8e..da33c9b 100644
--- a/src/edif.y
+++ b/src/edif.y
@@ -57,7 +57,7 @@ LibraryEntryTypePtr GetLibraryEntryMemory (LibraryMenuTypePtr);
str_pair* new_str_pair(char* s1, char* s2)
{
- str_pair* ps = malloc(sizeof(str_pair));
+ str_pair* ps = (str_pair *)malloc(sizeof(str_pair));
ps->str1 = s1;
ps->str2 = s2;
ps->next = NULL;
@@ -66,7 +66,7 @@ LibraryEntryTypePtr GetLibraryEntryMemory (LibraryMenuTypePtr);
pair_list* new_pair_list(str_pair* ps)
{
- pair_list* pl = malloc(sizeof(pair_list));
+ pair_list* pl = (pair_list *)malloc(sizeof(pair_list));
pl->list = ps;
pl->name = NULL;
return pl;
@@ -116,7 +116,7 @@ LibraryEntryTypePtr GetLibraryEntryMemory (LibraryMenuTypePtr);
/* if renamed str2 also exists and must be freed */
if ( name->str2 ) free(name->str2);
free(name);
- buf = malloc(256);
+ buf = (char *)malloc(256);
if ( !buf )
{
/* no memory */
@@ -143,7 +143,7 @@ LibraryEntryTypePtr GetLibraryEntryMemory (LibraryMenuTypePtr);
if ( tl + 3 > 256 )
{
free(buf);
- buf = malloc(tl+3);
+ buf = (char *)malloc(tl+3);
if ( !buf )
{
/* no memory */
@@ -2601,10 +2601,9 @@ Keyword : EDIF_TOK_KEYWORD { $$=$1; }
*
* Garbage function for 'alloca()'.
*/
-char *xmalloc(siz)
-int siz;
+char *xmalloc(int siz)
{
- return (Malloc(siz));
+ return ((char *)Malloc(siz));
}
/*
* Token & context carriers:
@@ -3762,8 +3761,7 @@ static Keyword *KeywordTable[KEYWORD_HASH];
*
* The passed string is entered into the keyword hash table.
*/
-static void EnterKeyword(str)
-char *str;
+static void EnterKeyword(char * str)
{
/*
* Locals.
@@ -3788,8 +3786,7 @@ char *str;
* is real useful for doing string comparisons by pointer value later.
* If there is no match, a NULL is returned.
*/
-static char *FindKeyword(str)
-char *str;
+static char *FindKeyword(char * str)
{
/*
* Locals.
@@ -3837,8 +3834,7 @@ static Token *TokenHash[TOKEN_HASH];
* A pointer to the token of the passed code is returned. If
* no such beastie is present a NULL is returned instead.
*/
-static Token *FindToken(cod)
-register int cod;
+static Token *FindToken(register int cod)
{
/*
* Locals.
@@ -3871,8 +3867,7 @@ static Context *ContextHash[CONTEXT_HASH];
* A pointer to the context of the passed code is returned. If
* no such beastie is present a NULL is returned instead.
*/
-static Context *FindContext(cod)
-register int cod;
+static Context *FindContext(register int cod)
{
/*
* Locals.
@@ -3909,16 +3904,14 @@ static short TokenType[TS_DEPTH]; /* token types */
* Add a token to the debug stack. The passed string and type are
* what is to be pushed.
*/
-static Stack(str,typ)
-char *str;
-int typ;
+static Stack(char * str, int typ)
{
/*
* Free any previous string, then push.
*/
if (TokenStack[TSP & TS_MASK])
Free(TokenStack[TSP & TS_MASK]);
- TokenStack[TSP & TS_MASK] = strcpy(Malloc(strlen(str) + 1),str);
+ TokenStack[TSP & TS_MASK] = strcpy((char *)Malloc(strlen(str) + 1),str);
TokenType[TSP & TS_MASK] = typ;
TSP += 1;
}
@@ -4006,8 +3999,7 @@ static int StringSize = 0; /* current string length */
*
* This adds the passed charater to the current string bucket.
*/
-static void PushString(chr)
-char chr;
+static void PushString(char chr)
{
/*
* Locals.
@@ -4178,8 +4170,7 @@ void ParseEDIF(char* filename,FILE* err)
* list to see if it is enabled. If so the token value is returned,
* if not then zero.
*/
-static int MatchToken(str)
-register char *str;
+static int MatchToken(register char * str)
{
/*
* Locals.
@@ -4207,8 +4198,7 @@ register char *str;
* If the passed keyword string is within the current context, the
* new context is pushed and token value is returned. A zero otherwise.
*/
-static int MatchContext(str)
-register char *str;
+static int MatchContext(register char * str)
{
/*
* Locals.
@@ -4350,7 +4340,7 @@ static int yylex()
break;
Ungetc(c);
yytext[--l] = '\0';
- yylval.s = strcpy(Malloc(l + 1),yytext);
+ yylval.s = strcpy((char *)Malloc(l + 1),yytext);
Stack(yytext,EDIF_TOK_INT);
return (EDIF_TOK_INT);
/*
@@ -4366,7 +4356,7 @@ static int yylex()
Stack(yytext,c);
return (c);
}
- yylval.s = strcpy(Malloc(l + 1),yytext);
+ yylval.s = strcpy((char *)Malloc(l + 1),yytext);
Stack(yytext, EDIF_TOK_IDENT);
return (EDIF_TOK_IDENT);
/*
@@ -4398,7 +4388,7 @@ static int yylex()
Stack(yytext,c);
return (c);
}
- yylval.s = strcpy(Malloc(l + 1),yytext);
+ yylval.s = strcpy((char *)Malloc(l + 1),yytext);
Stack(yytext, EDIF_TOK_KEYWORD);
return (EDIF_TOK_KEYWORD);
/*
diff --git a/src/file.c b/src/file.c
index 9e38217..1df23d5 100644
--- a/src/file.c
+++ b/src/file.c
@@ -440,7 +440,7 @@ PreLoadElementPCB ()
yyFont = &yyPCB->Font;
yyData = yyPCB->Data;
- yyData->pcb = (void *)yyPCB;
+ yyData->pcb = yyPCB;
yyData->LayerN = 0;
}
@@ -556,7 +556,7 @@ WritePCBDataHeader (FILE * FP)
fprintf (FP, "FileVersion[%i]\n", PCB_FILE_VERSION);
fputs ("\nPCB[", FP);
- PrintQuotedString (FP, EMPTY (PCB->Name));
+ PrintQuotedString (FP, (char *)EMPTY (PCB->Name));
fprintf (FP, " %i %i]\n\n", (int) PCB->MaxWidth, (int) PCB->MaxHeight);
fprintf (FP, "Grid[%s %i %i %i]\n",
c_dtostr (PCB->Grid), (int) PCB->GridOffsetX,
@@ -639,7 +639,7 @@ WriteViaData (FILE * FP, DataTypePtr Data)
fprintf (FP, "Via[%i %i %i %i %i %i ",
via->X, via->Y,
via->Thickness, via->Clearance, via->Mask, via->DrillingHole);
- PrintQuotedString (FP, EMPTY (via->Name));
+ PrintQuotedString (FP, (char *)EMPTY (via->Name));
fprintf (FP, " %s]\n", F2S (via, VIA_TYPE));
}
}
@@ -681,7 +681,7 @@ WritePCBNetlistData (FILE * FP)
fprintf (FP, "\tNet(");
PrintQuotedString(FP, &menu->Name[2]);
fprintf (FP, " ");
- PrintQuotedString(FP, UNKNOWN (menu->Style));
+ PrintQuotedString(FP, (char *)UNKNOWN (menu->Style));
fprintf (FP, ")\n\t(\n");
for (p = 0; p < menu->EntryN; p++)
{
@@ -714,11 +714,11 @@ WriteElementData (FILE * FP, DataTypePtr Data)
* both names of an element
*/
fprintf (FP, "\nElement[%s ", F2S (element, ELEMENT_TYPE));
- PrintQuotedString (FP, EMPTY (DESCRIPTION_NAME (element)));
+ PrintQuotedString (FP, (char *)EMPTY (DESCRIPTION_NAME (element)));
fputc (' ', FP);
- PrintQuotedString (FP, EMPTY (NAMEONPCB_NAME (element)));
+ PrintQuotedString (FP, (char *)EMPTY (NAMEONPCB_NAME (element)));
fputc (' ', FP);
- PrintQuotedString (FP, EMPTY (VALUE_NAME (element)));
+ PrintQuotedString (FP, (char *)EMPTY (VALUE_NAME (element)));
fprintf (FP, " %i %i %i %i %i %i %s]\n(\n",
(int) element->MarkX, (int) element->MarkY,
(int) (DESCRIPTION_TEXT (element).X -
@@ -737,9 +737,9 @@ WriteElementData (FILE * FP, DataTypePtr Data)
(int) (pin->Y - element->MarkY),
(int) pin->Thickness, (int) pin->Clearance,
(int) pin->Mask, (int) pin->DrillingHole);
- PrintQuotedString (FP, EMPTY (pin->Name));
+ PrintQuotedString (FP, (char *)EMPTY (pin->Name));
fprintf (FP, " ");
- PrintQuotedString (FP, EMPTY (pin->Number));
+ PrintQuotedString (FP, (char *)EMPTY (pin->Number));
fprintf (FP, " %s]\n", F2S (pin, PIN_TYPE));
}
for (p = 0; p < element->PadN; p++)
@@ -752,9 +752,9 @@ WriteElementData (FILE * FP, DataTypePtr Data)
(int) (pad->Point2.Y - element->MarkY),
(int) pad->Thickness, (int) pad->Clearance,
(int) pad->Mask);
- PrintQuotedString (FP, EMPTY (pad->Name));
+ PrintQuotedString (FP, (char *)EMPTY (pad->Name));
fprintf (FP, " ");
- PrintQuotedString (FP, EMPTY (pad->Number));
+ PrintQuotedString (FP, (char *)EMPTY (pad->Number));
fprintf (FP, " %s]\n", F2S (pad, PAD_TYPE));
}
for (p = 0; p < element->LineN; p++)
@@ -798,7 +798,7 @@ WriteLayerData (FILE * FP, Cardinal Number, LayerTypePtr layer)
(layer->Name && *layer->Name))
{
fprintf (FP, "Layer(%i ", (int) Number + 1);
- PrintQuotedString (FP, EMPTY (layer->Name));
+ PrintQuotedString (FP, (char *)EMPTY (layer->Name));
fputs (")\n(\n", FP);
WriteAttributeList (FP, &layer->Attributes, "\t");
@@ -826,7 +826,7 @@ WriteLayerData (FILE * FP, Cardinal Number, LayerTypePtr layer)
fprintf (FP, "\tText[%i %i %i %i ",
(int) text->X, (int) text->Y,
(int) text->Direction, (int) text->Scale);
- PrintQuotedString (FP, EMPTY (text->TextString));
+ PrintQuotedString (FP, (char *)EMPTY (text->TextString));
fprintf (FP, " %s]\n", F2S (text, TEXT_TYPE));
}
for (n = 0; n < layer->PolygonN; n++)
@@ -1231,7 +1231,7 @@ LoadNewlibFootprintsFromDir(char *libpath, char *toppath)
* entry->ListEntry points to fp name itself.
*/
len = strlen(subdir) + strlen("/") + strlen(subdirentry->d_name) + 1;
- entry->AllocatedMemory = calloc (1, len);
+ entry->AllocatedMemory = (char *)calloc (1, len);
strcat (entry->AllocatedMemory, subdir);
strcat (entry->AllocatedMemory, PCB_DIR_SEPARATOR_S);
@@ -1455,7 +1455,7 @@ ReadLibraryContents (void)
/* create the list entry */
len = strlen (EMPTY (entry->Value)) +
strlen (EMPTY (entry->Description)) + 4;
- entry->ListEntry = calloc (len, sizeof (char));
+ entry->ListEntry = (char *)calloc (len, sizeof (char));
sprintf (entry->ListEntry,
"%s, %s", EMPTY (entry->Value),
EMPTY (entry->Description));
diff --git a/src/find.c b/src/find.c
index 613629a..615659d 100644
--- a/src/find.c
+++ b/src/find.c
@@ -176,7 +176,7 @@ static DrcViolationType
long int *object_id_list,
int *object_type_list)
{
- DrcViolationType *violation = malloc (sizeof (DrcViolationType));
+ DrcViolationType *violation = (DrcViolationType *)malloc (sizeof (DrcViolationType));
violation->title = strdup (title);
violation->explanation = strdup (explanation);
@@ -614,7 +614,7 @@ InitComponentLookup (void)
for (i = 0; i < 2; i++)
{
/* allocate memory for working list */
- PadList[i].Data = calloc (NumberOfPads[i], sizeof (PadTypePtr));
+ PadList[i].Data = (void **)calloc (NumberOfPads[i], sizeof (PadTypePtr));
/* clear some struct members */
PadList[i].Location = 0;
@@ -641,12 +641,12 @@ InitLayoutLookup (void)
if (layer->LineN)
{
/* allocate memory for line pointer lists */
- LineList[i].Data = calloc (layer->LineN, sizeof (LineTypePtr));
+ LineList[i].Data = (void **)calloc (layer->LineN, sizeof (LineTypePtr));
LineList[i].Size = layer->LineN;
}
if (layer->ArcN)
{
- ArcList[i].Data = calloc (layer->ArcN, sizeof (ArcTypePtr));
+ ArcList[i].Data = (void **)calloc (layer->ArcN, sizeof (ArcTypePtr));
ArcList[i].Size = layer->ArcN;
}
@@ -654,7 +654,7 @@ InitLayoutLookup (void)
/* allocate memory for polygon list */
if (layer->PolygonN)
{
- PolygonList[i].Data = calloc (layer->PolygonN, sizeof (PolygonTypePtr));
+ PolygonList[i].Data = (void **)calloc (layer->PolygonN, sizeof (PolygonTypePtr));
PolygonList[i].Size = layer->PolygonN;
}
@@ -679,13 +679,13 @@ InitLayoutLookup (void)
else
TotalV = 0;
/* allocate memory for 'new PV to check' list and clear struct */
- PVList.Data = calloc (TotalP + TotalV, sizeof (PinTypePtr));
+ PVList.Data = (void **)calloc (TotalP + TotalV, sizeof (PinTypePtr));
PVList.Size = TotalP + TotalV;
PVList.Location = 0;
PVList.DrawLocation = 0;
PVList.Number = 0;
/* Initialize ratline data */
- RatList.Data = calloc (PCB->Data->RatN, sizeof (RatTypePtr));
+ RatList.Data = (void **)calloc (PCB->Data->RatN, sizeof (RatTypePtr));
RatList.Size = PCB->Data->RatN;
RatList.Location = 0;
RatList.DrawLocation = 0;
@@ -2771,9 +2771,9 @@ PrintElementNameList (ElementTypePtr Element, FILE * FP)
{
static DynamicStringType cname, pname, vname;
- CreateQuotedString (&cname, EMPTY (DESCRIPTION_NAME (Element)));
- CreateQuotedString (&pname, EMPTY (NAMEONPCB_NAME (Element)));
- CreateQuotedString (&vname, EMPTY (VALUE_NAME (Element)));
+ CreateQuotedString (&cname, (char *)EMPTY (DESCRIPTION_NAME (Element)));
+ CreateQuotedString (&pname, (char *)EMPTY (NAMEONPCB_NAME (Element)));
+ CreateQuotedString (&vname, (char *)EMPTY (VALUE_NAME (Element)));
fprintf (FP, "(%s %s %s)\n", cname.Data, pname.Data, vname.Data);
}
@@ -2828,7 +2828,7 @@ PrintPadConnections (Cardinal Layer, FILE * FP, bool IsFirst)
{
ptr = PADLIST_ENTRY (Layer, 0);
if (ptr != NULL)
- PrintConnectionListEntry (UNKNOWN (ptr->Name), NULL, true, FP);
+ PrintConnectionListEntry ((char *)UNKNOWN (ptr->Name), NULL, true, FP);
else
printf ("Skipping NULL ptr in 1st part of PrintPadConnections\n");
}
@@ -2840,7 +2840,7 @@ PrintPadConnections (Cardinal Layer, FILE * FP, bool IsFirst)
{
ptr = PADLIST_ENTRY (Layer, i);
if (ptr != NULL)
- PrintConnectionListEntry (EMPTY (ptr->Name), ptr->Element, false, FP);
+ PrintConnectionListEntry ((char *)EMPTY (ptr->Name), (ElementTypePtr)ptr->Element, false, FP);
else
printf ("Skipping NULL ptr in 2nd part of PrintPadConnections\n");
}
@@ -2863,7 +2863,7 @@ PrintPinConnections (FILE * FP, bool IsFirst)
{
/* the starting pin */
pv = PVLIST_ENTRY (0);
- PrintConnectionListEntry (EMPTY (pv->Name), NULL, true, FP);
+ PrintConnectionListEntry ((char *)EMPTY (pv->Name), NULL, true, FP);
}
/* we maybe have to start with i=1 if we are handling the
@@ -2873,7 +2873,7 @@ PrintPinConnections (FILE * FP, bool IsFirst)
{
/* get the elements name or assume that its a via */
pv = PVLIST_ENTRY (i);
- PrintConnectionListEntry (EMPTY (pv->Name), pv->Element, false, FP);
+ PrintConnectionListEntry ((char *)EMPTY (pv->Name), (ElementTypePtr)pv->Element, false, FP);
}
}
@@ -2902,26 +2902,26 @@ ListsEmpty (bool AndRats)
static bool
DoIt (bool AndRats, bool AndDraw)
{
- bool new = false;
+ bool newone = false;
do
{
/* lookup connections; these are the steps (2) to (4)
* from the description
*/
- new = LookupPVConnectionsToPVList ();
- if (!new)
- new = LookupLOConnectionsToPVList (AndRats);
- if (!new)
- new = LookupLOConnectionsToLOList (AndRats);
- if (!new)
- new = LookupPVConnectionsToLOList (AndRats);
+ newone = LookupPVConnectionsToPVList ();
+ if (!newone)
+ newone = LookupLOConnectionsToPVList (AndRats);
+ if (!newone)
+ newone = LookupLOConnectionsToLOList (AndRats);
+ if (!newone)
+ newone = LookupPVConnectionsToLOList (AndRats);
if (AndDraw)
DrawNewConnections ();
}
- while (!new && !ListsEmpty (AndRats));
+ while (!newone && !ListsEmpty (AndRats));
if (AndDraw)
Draw ();
- return (new);
+ return (newone);
}
/* returns true if nothing un-found touches the passed line
@@ -2980,7 +2980,7 @@ PrintAndSelectUnusedPinsAndPadsOfElement (ElementTypePtr Element, FILE * FP)
}
/* write name to list and draw selected object */
- CreateQuotedString (&oname, EMPTY (pin->Name));
+ CreateQuotedString (&oname, (char *)EMPTY (pin->Name));
fprintf (FP, "\t%s\n", oname.Data);
SET_FLAG (SELECTEDFLAG, pin);
DrawPin (pin, 0);
@@ -3024,7 +3024,7 @@ PrintAndSelectUnusedPinsAndPadsOfElement (ElementTypePtr Element, FILE * FP)
}
/* write name to list and draw selected object */
- CreateQuotedString (&oname, EMPTY (pad->Name));
+ CreateQuotedString (&oname, (char *)EMPTY (pad->Name));
fprintf (FP, "\t%s\n", oname.Data);
SET_FLAG (SELECTEDFLAG, pad);
DrawPad (pad, 0);
@@ -3089,7 +3089,7 @@ PrintElementConnections (ElementTypePtr Element, FILE * FP, bool AndDraw)
/* pin might have been checked before, add to list if not */
if (TEST_FLAG (TheFlag, pin))
{
- PrintConnectionListEntry (EMPTY (pin->Name), NULL, true, FP);
+ PrintConnectionListEntry ((char *)EMPTY (pin->Name), NULL, true, FP);
fputs ("\t\t__CHECKED_BEFORE__\n\t}\n", FP);
continue;
}
@@ -3113,7 +3113,7 @@ PrintElementConnections (ElementTypePtr Element, FILE * FP, bool AndDraw)
/* pad might have been checked before, add to list if not */
if (TEST_FLAG (TheFlag, pad))
{
- PrintConnectionListEntry (EMPTY (pad->Name), NULL, true, FP);
+ PrintConnectionListEntry ((char *)EMPTY (pad->Name), NULL, true, FP);
fputs ("\t\t__CHECKED_BEFORE__\n\t}\n", FP);
continue;
}
@@ -4339,13 +4339,13 @@ DRCAll (void)
BuildObjectList (&object_count, &object_id_list, &object_type_list);
title = _("Element %s has %i silk lines which are too thin");
- name = UNKNOWN (NAMEONPCB_NAME (element));
+ name = (char *)UNKNOWN (NAMEONPCB_NAME (element));
/* -4 is for the %s and %i place-holders */
/* +11 is the max printed length for a 32 bit integer */
/* +1 is for the \0 termination */
buflen = strlen (title) - 4 + strlen (name) + 11 + 1;
- buffer = malloc (buflen);
+ buffer = (char *)malloc (buflen);
snprintf (buffer, buflen, title, name, tmpcnt);
violation = pcb_drc_violation_new (buffer,
@@ -4478,8 +4478,8 @@ BuildObjectList (int *object_count, long int **object_id_list, int **object_type
case ELEMENT_TYPE:
case RATLINE_TYPE:
*object_count = 1;
- *object_id_list = malloc (sizeof (long int));
- *object_type_list = malloc (sizeof (int));
+ *object_id_list = (long int *)malloc (sizeof (long int));
+ *object_type_list = (int *)malloc (sizeof (int));
**object_id_list = ((AnyObjectType *)thing_ptr3)->ID;
**object_type_list = thing_type;
return;
diff --git a/src/free_atexit.c b/src/free_atexit.c
index 501775c..6527a46 100644
--- a/src/free_atexit.c
+++ b/src/free_atexit.c
@@ -48,7 +48,7 @@ void *leaky_malloc (size_t size)
{
void *new_memory = malloc(size + sizeof(leaky_admin_t));
- free_list = realloc (free_list, (free_size + 1) * sizeof(void *));
+ free_list = (void **)realloc (free_list, (free_size + 1) * sizeof(void *));
free_list[free_size] = new_memory;
*(leaky_idx_t *)new_memory = free_size;
diff --git a/src/global.h b/src/global.h
index bb78abc..0420a18 100644
--- a/src/global.h
+++ b/src/global.h
@@ -153,7 +153,7 @@ typedef struct
BoxType BoundingBox; \
long int ID; \
FlagType Flags; \
- struct LibraryEntryType *net
+ // struct LibraryEntryType *net
/* Lines, pads, and rats all use this so they can be cross-cast. */
#define ANYLINEFIELDS \
@@ -434,6 +434,7 @@ typedef struct
*Value, /* the value field */
*Description; /* some descritional text */
} LibraryEntryType, *LibraryEntryTypePtr;
+//typedef LibraryEntryType *LibraryEntryTypePtr;
/* If the internal flag is set, the only field that is valid is Name,
and the struct is allocated with malloc instead of
diff --git a/src/heap.c b/src/heap.c
index fee6412..9e0f35e 100644
--- a/src/heap.c
+++ b/src/heap.c
@@ -120,7 +120,7 @@ heap_create ()
MIN_COST = -1e23;
assert (MIN_COST < 0);
/* okay, create empty heap */
- heap = calloc (1, sizeof (*heap));
+ heap = (heap_t *)calloc (1, sizeof (*heap));
assert (heap);
assert (__heap_is_good (heap));
return heap;
@@ -179,7 +179,7 @@ heap_insert (heap_t * heap, cost_t cost, void *data)
if (heap->max == 0)
heap->max = 256; /* default initial heap size */
heap->element =
- realloc (heap->element, heap->max * sizeof (*heap->element));
+ (struct heap_element *)realloc (heap->element, heap->max * sizeof (*heap->element));
}
heap->size++;
assert (heap->size < heap->max);
diff --git a/src/hid.h b/src/hid.h
index 94734ba..b13e75b 100644
--- a/src/hid.h
+++ b/src/hid.h
@@ -161,16 +161,18 @@ extern "C"
double real_value;
} HID_Attr_Val;
+ enum hids
+ { HID_Label, HID_Integer, HID_Real, HID_String,
+ HID_Boolean, HID_Enum, HID_Mixed, HID_Path
+ };
+
typedef struct
{
char *name;
/* If the help_text is this, usage() won't show this option */
#define ATTR_UNDOCUMENTED ((char *)(1))
char *help_text;
- enum
- { HID_Label, HID_Integer, HID_Real, HID_String,
- HID_Boolean, HID_Enum, HID_Mixed, HID_Path
- } type;
+ enum hids type;
int min_val, max_val; /* for integer and real */
HID_Attr_Val default_val; /* Also actual value for global attributes. */
const char **enumerations;
diff --git a/src/hid/bom/bom.c b/src/hid/bom/bom.c
index 04ad123..661b592 100644
--- a/src/hid/bom/bom.c
+++ b/src/hid/bom/bom.c
@@ -90,7 +90,7 @@ CleanBOMString (char *in)
char *out;
int i;
- if ((out = malloc ((strlen (in) + 1) * sizeof (char))) == NULL)
+ if ((out = (char *)malloc ((strlen (in) + 1) * sizeof (char))) == NULL)
{
fprintf (stderr, "Error: CleanBOMString() malloc() failed\n");
exit (1);
@@ -144,25 +144,25 @@ xyToAngle (double x, double y)
static StringList *
string_insert (char *str, StringList * list)
{
- StringList *new, *cur;
+ StringList *newlist, *cur;
- if ((new = (StringList *) malloc (sizeof (StringList))) == NULL)
+ if ((newlist = (StringList *) malloc (sizeof (StringList))) == NULL)
{
fprintf (stderr, "malloc() failed in string_insert()\n");
exit (1);
}
- new->next = NULL;
- new->str = strdup (str);
+ newlist->next = NULL;
+ newlist->str = strdup (str);
if (list == NULL)
- return (new);
+ return (newlist);
cur = list;
while (cur->next != NULL)
cur = cur->next;
- cur->next = new;
+ cur->next = newlist;
return (list);
}
@@ -170,23 +170,23 @@ string_insert (char *str, StringList * list)
static BomList *
bom_insert (char *refdes, char *descr, char *value, BomList * bom)
{
- BomList *new, *cur, *prev = NULL;
+ BomList *newlist, *cur, *prev = NULL;
if (bom == NULL)
{
/* this is the first element so automatically create an entry */
- if ((new = (BomList *) malloc (sizeof (BomList))) == NULL)
+ if ((newlist = (BomList *) malloc (sizeof (BomList))) == NULL)
{
fprintf (stderr, "malloc() failed in bom_insert()\n");
exit (1);
}
- new->next = NULL;
- new->descr = strdup (descr);
- new->value = strdup (value);
- new->num = 1;
- new->refdes = string_insert (refdes, NULL);
- return (new);
+ newlist->next = NULL;
+ newlist->descr = strdup (descr);
+ newlist->value = strdup (value);
+ newlist->num = 1;
+ newlist->refdes = string_insert (refdes, NULL);
+ return (newlist);
}
/* search and see if we already have used one of these
@@ -207,19 +207,19 @@ bom_insert (char *refdes, char *descr, char *value, BomList * bom)
if (cur == NULL)
{
- if ((new = (BomList *) malloc (sizeof (BomList))) == NULL)
+ if ((newlist...
[truncated message content] |