/[zanavi_public1]/navit/navit/attr.c
ZANavi

Diff of /navit/navit/attr.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 26 Revision 27
1/**
2 * ZANavi, Zoff Android Navigation system.
3 * Copyright (C) 2011-2012 Zoff <zoff@zoff.cc>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
1/** 20/**
2 * Navit, a modular navigation system. 21 * Navit, a modular navigation system.
3 * Copyright (C) 2005-2008 Navit Team 22 * Copyright (C) 2005-2008 Navit Team
4 * 23 *
5 * This program is free software; you can redistribute it and/or 24 * This program is free software; you can redistribute it and/or
232 if (flags & AF_TOLL) ret=g_strconcat_printf(ret,"%sAF_TOLL",ret?"|":""); 251 if (flags & AF_TOLL) ret=g_strconcat_printf(ret,"%sAF_TOLL",ret?"|":"");
233 if (flags & AF_SEASONAL) ret=g_strconcat_printf(ret,"%sAF_SEASONAL",ret?"|":""); 252 if (flags & AF_SEASONAL) ret=g_strconcat_printf(ret,"%sAF_SEASONAL",ret?"|":"");
234 if (flags & AF_UNPAVED) ret=g_strconcat_printf(ret,"%sAF_UNPAVED",ret?"|":""); 253 if (flags & AF_UNPAVED) ret=g_strconcat_printf(ret,"%sAF_UNPAVED",ret?"|":"");
235 if (flags & AF_FORD) ret=g_strconcat_printf(ret,"%sAF_FORD",ret?"|":""); 254 if (flags & AF_FORD) ret=g_strconcat_printf(ret,"%sAF_FORD",ret?"|":"");
236 if (flags & AF_UNDERGROUND) ret=g_strconcat_printf(ret,"%sAF_UNDERGROUND",ret?"|":""); 255 if (flags & AF_UNDERGROUND) ret=g_strconcat_printf(ret,"%sAF_UNDERGROUND",ret?"|":"");
256 if (flags & AF_BRIDGE) ret=g_strconcat_printf(ret,"%sAF_BRIDGE",ret?"|":"");
237 if (flags & AF_DANGEROUS_GOODS) ret=g_strconcat_printf(ret,"%sAF_DANGEROUS_GOODS",ret?"|":""); 257 if (flags & AF_DANGEROUS_GOODS) ret=g_strconcat_printf(ret,"%sAF_DANGEROUS_GOODS",ret?"|":"");
238 if ((flags & AF_ALL) == AF_ALL) 258 if ((flags & AF_ALL) == AF_ALL)
239 return g_strconcat_printf(ret,"%sAF_ALL",ret?"|":""); 259 return g_strconcat_printf(ret,"%sAF_ALL",ret?"|":"");
240 if ((flags & AF_ALL) == AF_MOTORIZED_FAST) 260 if ((flags & AF_ALL) == AF_MOTORIZED_FAST)
241 return g_strconcat_printf(ret,"%sAF_MOTORIZED_FAST",ret?"|":""); 261 return g_strconcat_printf(ret,"%sAF_MOTORIZED_FAST",ret?"|":"");
575} 595}
576 596
577void 597void
578attr_dup_content(struct attr *src, struct attr *dst) 598attr_dup_content(struct attr *src, struct attr *dst)
579{ 599{
600 // dbg(0,"enter\n");
580 int size; 601 int size;
581 dst->type=src->type; 602 dst->type=src->type;
582 if (src->type >= attr_type_int_begin && src->type <= attr_type_int_end) 603 if (src->type >= attr_type_int_begin && src->type <= attr_type_int_end)
583 dst->u.num=src->u.num; 604 dst->u.num=src->u.num;
584 else if (src->type >= attr_type_object_begin && src->type <= attr_type_object_end) 605 else if (src->type >= attr_type_object_begin && src->type <= attr_type_object_end)
588 if (size) { 609 if (size) {
589 dst->u.data=g_malloc(size); 610 dst->u.data=g_malloc(size);
590 memcpy(dst->u.data, src->u.data, size); 611 memcpy(dst->u.data, src->u.data, size);
591 } 612 }
592 } 613 }
614 // dbg(0,"leave\n");
593} 615}
594 616
595struct attr * 617struct attr *
596attr_dup(struct attr *attr) 618attr_dup(struct attr *attr)
597{ 619{
615{ 637{
616 struct attr **ret=attrs; 638 struct attr **ret=attrs;
617 int i,count=0; 639 int i,count=0;
618 640
619 while (attrs[count]) 641 while (attrs[count])
642 {
620 count++; 643 count++;
644 }
621 ret=g_new0(struct attr *, count+1); 645 ret=g_new0(struct attr *, count+1);
622 for (i = 0 ; i < count ; i++) 646 for (i = 0 ; i < count ; i++)
647 {
623 ret[i]=attr_dup(attrs[i]); 648 ret[i]=attr_dup(attrs[i]);
649 }
624 return ret; 650 return ret;
625} 651}
626 652
627 653
628int 654int

Legend:
Removed from v.26  
changed lines
  Added in v.27

   
Visit the ZANavi Wiki