range check for dash attribute value
This commit is contained in:
parent
1a2500291d
commit
e73722cae9
|
|
@ -427,9 +427,10 @@ void edit_rect_property(void)
|
|||
}
|
||||
old_dash = rect[c][n].dash;
|
||||
dash = get_tok_value(rect[c][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") )
|
||||
rect[c][n].dash = atoi(dash);
|
||||
else
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
rect[c][n].dash = d >= 0? d : 0;
|
||||
} else
|
||||
rect[c][n].dash = 0;
|
||||
if(old_dash != rect[c][n].dash) {
|
||||
if(!drw) {
|
||||
|
|
@ -481,9 +482,10 @@ void edit_line_property(void)
|
|||
}
|
||||
old_dash = line[c][n].dash;
|
||||
dash = get_tok_value(line[c][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") )
|
||||
line[c][n].dash = atoi(dash);
|
||||
else
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
line[c][n].dash = d >= 0? d : 0;
|
||||
} else
|
||||
line[c][n].dash = 0;
|
||||
if(old_dash != line[c][n].dash) {
|
||||
if(!drw) {
|
||||
|
|
@ -607,9 +609,10 @@ void edit_arc_property(void)
|
|||
arc[c][i].fill =0;
|
||||
old_dash = arc[c][i].dash;
|
||||
dash = get_tok_value(arc[c][i].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") )
|
||||
arc[c][i].dash = atoi(dash);
|
||||
else
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
arc[c][i].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
arc[c][i].dash = 0;
|
||||
|
||||
|
||||
|
|
@ -673,9 +676,10 @@ void edit_polygon_property(void)
|
|||
else
|
||||
polygon[c][i].fill =0;
|
||||
dash = get_tok_value(polygon[c][i].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") )
|
||||
polygon[c][i].dash = atoi(dash);
|
||||
else
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
polygon[c][i].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
polygon[c][i].dash = 0;
|
||||
if(old_fill != polygon[c][i].fill || old_dash != polygon[c][i].dash) {
|
||||
if(!drw) {
|
||||
|
|
|
|||
40
src/save.c
40
src/save.c
|
|
@ -595,7 +595,8 @@ static void load_polygon(FILE *fd)
|
|||
ptr[i].fill =0;
|
||||
dash = get_tok_value(ptr[i].prop_ptr,"dash",0);
|
||||
if(strcmp(dash, "")) {
|
||||
ptr[i].dash = atoi(dash);
|
||||
int d = atoi(dash);
|
||||
ptr[i].dash = d >= 0 ? d : 0;
|
||||
} else {
|
||||
ptr[i].dash = 0;
|
||||
}
|
||||
|
|
@ -634,7 +635,8 @@ static void load_arc(FILE *fd)
|
|||
ptr[i].fill =0;
|
||||
dash = get_tok_value(ptr[i].prop_ptr,"dash",0);
|
||||
if(strcmp(dash, "")) {
|
||||
ptr[i].dash = atoi(dash);
|
||||
int d = atoi(dash);
|
||||
ptr[i].dash = d >= 0 ? d : 0;
|
||||
} else {
|
||||
ptr[i].dash = 0;
|
||||
}
|
||||
|
|
@ -669,7 +671,8 @@ static void load_box(FILE *fd)
|
|||
load_ascii_string( &ptr[i].prop_ptr, fd);
|
||||
dash = get_tok_value(ptr[i].prop_ptr,"dash",0);
|
||||
if(strcmp(dash, "")) {
|
||||
ptr[i].dash = atoi(dash);
|
||||
int d = atoi(dash);
|
||||
ptr[i].dash = d >= 0 ? d : 0;
|
||||
} else {
|
||||
ptr[i].dash = 0;
|
||||
}
|
||||
|
|
@ -704,7 +707,8 @@ static void load_line(FILE *fd)
|
|||
load_ascii_string( &ptr[i].prop_ptr, fd);
|
||||
dash = get_tok_value(ptr[i].prop_ptr,"dash",0);
|
||||
if(strcmp(dash, "")) {
|
||||
ptr[i].dash = atoi(dash);
|
||||
int d = atoi(dash);
|
||||
ptr[i].dash = d >= 0 ? d : 0;
|
||||
} else {
|
||||
ptr[i].dash = 0;
|
||||
}
|
||||
|
|
@ -1397,9 +1401,10 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
dbg(2, "l_d_s(): loaded line: ptr=%lx\n", (unsigned long)ll[c]);
|
||||
|
||||
dash = get_tok_value(ll[c][i].prop_ptr,"dash", 0);
|
||||
if( strcmp(dash, "") )
|
||||
ll[c][i].dash = atoi(dash);
|
||||
else
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
ll[c][i].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
ll[c][i].dash = 0;
|
||||
ll[c][i].sel = 0;
|
||||
lastl[c]++;
|
||||
|
|
@ -1440,9 +1445,10 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
pp[c][i].fill =0;
|
||||
|
||||
dash = get_tok_value(pp[c][i].prop_ptr,"dash", 0);
|
||||
if( strcmp(dash, "") )
|
||||
pp[c][i].dash = atoi(dash);
|
||||
else
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
pp[c][i].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
pp[c][i].dash = 0;
|
||||
pp[c][i].sel = 0;
|
||||
|
||||
|
|
@ -1486,9 +1492,10 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
aa[c][i].fill =0;
|
||||
|
||||
dash = get_tok_value(aa[c][i].prop_ptr,"dash", 0);
|
||||
if( strcmp(dash, "") )
|
||||
aa[c][i].dash = atoi(dash);
|
||||
else
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
aa[c][i].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
aa[c][i].dash = 0;
|
||||
aa[c][i].sel = 0;
|
||||
|
||||
|
|
@ -1520,9 +1527,10 @@ int load_sym_def(const char *name, FILE *embed_fd)
|
|||
load_ascii_string( &bb[c][i].prop_ptr, lcc[level].fd);
|
||||
dbg(2, "l_d_s(): loaded rect: ptr=%lx\n", (unsigned long)bb[c]);
|
||||
dash = get_tok_value(bb[c][i].prop_ptr,"dash", 0);
|
||||
if( strcmp(dash, "") )
|
||||
bb[c][i].dash = atoi(dash);
|
||||
else
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
bb[c][i].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
bb[c][i].dash = 0;
|
||||
bb[c][i].sel = 0;
|
||||
|
||||
|
|
|
|||
28
src/store.c
28
src/store.c
|
|
@ -175,9 +175,10 @@ void store_arc(int pos, double x, double y, double r, double a, double b,
|
|||
else
|
||||
arc[rectcolor][n].fill =0;
|
||||
dash = get_tok_value(arc[rectcolor][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") )
|
||||
arc[rectcolor][n].dash = atoi(dash);
|
||||
else
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
arc[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
arc[rectcolor][n].dash = 0;
|
||||
|
||||
lastarc[rectcolor]++;
|
||||
|
|
@ -221,9 +222,10 @@ void store_polygon(int pos, double *x, double *y, int points, unsigned int rectc
|
|||
else
|
||||
polygon[rectcolor][n].fill =0;
|
||||
dash = get_tok_value(polygon[rectcolor][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") )
|
||||
polygon[rectcolor][n].dash = atoi(dash);
|
||||
else
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
polygon[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
polygon[rectcolor][n].dash = 0;
|
||||
|
||||
|
||||
|
|
@ -259,9 +261,10 @@ void storeobject(int pos, double x1,double y1,double x2,double y2,
|
|||
my_strdup(412, &line[rectcolor][n].prop_ptr, prop_ptr);
|
||||
line[rectcolor][n].sel=sel;
|
||||
dash = get_tok_value(line[rectcolor][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") )
|
||||
line[rectcolor][n].dash = atoi(dash);
|
||||
else
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
line[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
line[rectcolor][n].dash = 0;
|
||||
lastline[rectcolor]++;
|
||||
set_modify(1);
|
||||
|
|
@ -287,9 +290,10 @@ void storeobject(int pos, double x1,double y1,double x2,double y2,
|
|||
my_strdup(413, &rect[rectcolor][n].prop_ptr, prop_ptr);
|
||||
rect[rectcolor][n].sel=sel;
|
||||
dash = get_tok_value(rect[rectcolor][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") )
|
||||
rect[rectcolor][n].dash = atoi(dash);
|
||||
else
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
rect[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
rect[rectcolor][n].dash = 0;
|
||||
lastrect[rectcolor]++;
|
||||
set_modify(1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue