Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
4837210d
Commit
4837210d
authored
Oct 15, 2007
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CArea in CArea could cause segfault, and GetXxPtr added
parent
e00648a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
25 deletions
+68
-25
wb/lib/wb/src/wb_gcg.cpp
wb/lib/wb/src/wb_gcg.cpp
+68
-25
No files found.
wb/lib/wb/src/wb_gcg.cpp
View file @
4837210d
/*
/*
* Proview $Id: wb_gcg.cpp,v 1.
5 2007-09-21 08:10:49
claes Exp $
* Proview $Id: wb_gcg.cpp,v 1.
6 2007-10-15 12:17:23
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
* Copyright (C) 2005 SSAB Oxelsund AB.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
...
@@ -565,6 +565,10 @@ static int gcg_cmanager_comp(
...
@@ -565,6 +565,10 @@ static int gcg_cmanager_comp(
static
int
gcg_reset_cmanager
(
static
int
gcg_reset_cmanager
(
gcg_ctx
gcgctx
);
gcg_ctx
gcgctx
);
static
int
gcg_check_attrref
(
gcg_ctx
gcgctx
,
vldh_t_node
node
,
char
*
attr
);
/*_Methods defined for this module_______________________________________*/
/*_Methods defined for this module_______________________________________*/
...
@@ -10791,34 +10795,41 @@ int gcg_comp_m35( gcg_ctx gcgctx, vldh_t_node node)
...
@@ -10791,34 +10795,41 @@ int gcg_comp_m35( gcg_ctx gcgctx, vldh_t_node node)
char
output_prefix
;
char
output_prefix
;
char
output_par
[
80
];
char
output_par
[
80
];
char
*
name
;
char
*
name
;
pwr_sAttrRef
*
connect_aref
;
int
size
;
pwr_tCid
cid
;
/* Check if there is a PlcConnected */
/* Check if there is a PlcConnected */
sts
=
ldh_GetObjectPar
(
gcgctx
->
ldhses
,
node
->
ln
.
oid
,
"RtBody"
,
sts
=
gcg_check_attrref
(
gcgctx
,
node
,
"PlcConnect"
);
"PlcConnect"
,
(
char
**
)
&
connect_aref
,
&
size
);
if
(
EVEN
(
sts
))
{
if
(
ODD
(
sts
))
{
gcg_error_msg
(
gcgctx
,
GSX__NOCONNECT
,
node
);
pwr_sAttrRef
aref
=
*
connect_aref
;
return
GSX__NEXTNODE
;
free
(
(
char
*
)
connect_aref
);
}
sts
=
gcg_replace_ref
(
gcgctx
,
&
aref
,
node
);
if
(
ODD
(
sts
))
{
/* Store the converted aref */
sts
=
ldh_SetObjectPar
(
gcgctx
->
ldhses
,
node
->
ln
.
oid
,
"RtBody"
,
"PlcConnect"
,
(
char
*
)
&
aref
,
sizeof
(
aref
));
}
if
(
cdh_ObjidIsNull
(
aref
.
Objid
))
{
/* Check special attrref's for som classes */
gcg_error_msg
(
gcgctx
,
GSX__NOCONNECT
,
node
);
switch
(
node
->
ln
.
cid
)
{
case
pwr_cClass_GetApPtr
:
case
pwr_cClass_StoApPtr
:
sts
=
gcg_check_attrref
(
gcgctx
,
node
,
"ApPtrObject"
);
if
(
EVEN
(
sts
))
{
gcg_error_msg
(
gcgctx
,
sts
,
node
);
return
GSX__NEXTNODE
;
return
GSX__NEXTNODE
;
}
}
break
;
// Check that object exist
case
pwr_cClass_GetDpPtr
:
sts
=
ldh_GetAttrRefOrigTid
(
gcgctx
->
ldhses
,
&
aref
,
&
cid
);
case
pwr_cClass_StoDpPtr
:
sts
=
gcg_check_attrref
(
gcgctx
,
node
,
"DpPtrObject"
);
if
(
EVEN
(
sts
))
{
if
(
EVEN
(
sts
))
{
gcg_error_msg
(
gcgctx
,
GSX__NOCONNECT
,
node
);
gcg_error_msg
(
gcgctx
,
sts
,
node
);
return
GSX__NEXTNODE
;
}
break
;
case
pwr_cClass_GetIpPtr
:
case
pwr_cClass_StoIpPtr
:
sts
=
gcg_check_attrref
(
gcgctx
,
node
,
"IpPtrObject"
);
if
(
EVEN
(
sts
))
{
gcg_error_msg
(
gcgctx
,
sts
,
node
);
return
GSX__NEXTNODE
;
return
GSX__NEXTNODE
;
}
}
break
;
default:
;
}
}
sts
=
gcg_ref_insert
(
gcgctx
,
node
->
ln
.
oid
,
GCG_PREFIX_REF
);
sts
=
gcg_ref_insert
(
gcgctx
,
node
->
ln
.
oid
,
GCG_PREFIX_REF
);
...
@@ -15813,10 +15824,11 @@ static int gcg_cmanager_find_nodes( vldh_t_wind wind, vldh_t_node mgr,
...
@@ -15813,10 +15824,11 @@ static int gcg_cmanager_find_nodes( vldh_t_wind wind, vldh_t_node mgr,
continue
;
continue
;
switch
(
n
->
ln
.
cid
)
{
switch
(
n
->
ln
.
cid
)
{
case
pwr_cClass_CArea
:
{
case
pwr_cClass_CArea
:
{
if
(
mgr
->
ln
.
x
<=
n
->
ln
.
x
+
n
->
ln
.
width
/
2
&&
if
(
(
mgr
->
ln
.
x
<=
n
->
ln
.
x
&&
n
->
ln
.
x
<=
mgr
->
ln
.
x
+
mgr
->
ln
.
width
)
&&
mgr
->
ln
.
x
+
mgr
->
ln
.
width
>=
n
->
ln
.
x
+
n
->
ln
.
width
/
2
&&
(
mgr
->
ln
.
x
<=
n
->
ln
.
x
+
n
->
ln
.
width
&&
n
->
ln
.
x
+
n
->
ln
.
width
<=
mgr
->
ln
.
x
+
mgr
->
ln
.
width
)
&&
mgr
->
ln
.
y
<=
n
->
ln
.
y
+
n
->
ln
.
height
/
2
&&
(
mgr
->
ln
.
y
<=
n
->
ln
.
y
&&
n
->
ln
.
y
<=
mgr
->
ln
.
y
+
mgr
->
ln
.
height
)
&&
mgr
->
ln
.
y
+
mgr
->
ln
.
height
>=
n
->
ln
.
y
+
n
->
ln
.
height
/
2
)
{
(
mgr
->
ln
.
y
<=
n
->
ln
.
y
+
n
->
ln
.
height
&&
n
->
ln
.
y
+
n
->
ln
.
height
<=
mgr
->
ln
.
y
+
mgr
->
ln
.
height
))
{
// Whole n inside mgr
sts
=
gcg_cmanager_find_nodes
(
wind
,
n
,
nodelist
,
node_count
);
sts
=
gcg_cmanager_find_nodes
(
wind
,
n
,
nodelist
,
node_count
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
EVEN
(
sts
))
return
sts
;
if
(
n
->
hn
.
comp_manager
==
0
)
if
(
n
->
hn
.
comp_manager
==
0
)
...
@@ -15895,5 +15907,36 @@ static int gcg_reset_cmanager(
...
@@ -15895,5 +15907,36 @@ static int gcg_reset_cmanager(
return
GSX__SUCCESS
;
return
GSX__SUCCESS
;
}
}
static
int
gcg_check_attrref
(
gcg_ctx
gcgctx
,
vldh_t_node
node
,
char
*
attr
)
{
pwr_tStatus
sts
;
int
size
;
pwr_tAttrRef
*
arefp
;
pwr_tAttrRef
aref
;
pwr_tCid
cid
;
sts
=
ldh_GetObjectPar
(
gcgctx
->
ldhses
,
node
->
ln
.
oid
,
"RtBody"
,
attr
,
(
char
**
)
&
arefp
,
&
size
);
if
(
ODD
(
sts
))
{
aref
=
*
arefp
;
free
(
(
char
*
)
arefp
);
sts
=
gcg_replace_ref
(
gcgctx
,
&
aref
,
node
);
if
(
ODD
(
sts
))
{
/* Store the converted aref */
sts
=
ldh_SetObjectPar
(
gcgctx
->
ldhses
,
node
->
ln
.
oid
,
"RtBody"
,
attr
,
(
char
*
)
&
aref
,
sizeof
(
aref
));
}
if
(
cdh_ObjidIsNull
(
aref
.
Objid
))
return
GSX__REFOBJ
;
// Check that object exist
sts
=
ldh_GetAttrRefOrigTid
(
gcgctx
->
ldhses
,
&
aref
,
&
cid
);
if
(
EVEN
(
sts
))
return
GSX__REFOBJ
;
}
return
GSX__SUCCESS
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment