Fix:Core:Fixed win32 build
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 27 Jul 2009 07:26:29 +0000 (07:26 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 27 Jul 2009 07:26:29 +0000 (07:26 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@2410 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/vehicleprofile.c

index 9b2ae2a..e887200 100644 (file)
@@ -45,14 +45,12 @@ vehicleprofile_set_attr_do(struct vehicleprofile *this_, struct attr *attr)
        case attr_route_mode:
                this_->mode=attr->u.num;
                break;
-    case attr_name:
-        if(this_->name) free(this_->name);
-
-        // Only copy the first 1024 characters. Should be enough for
-        // normal use, but still prevent ludicrous memory allocations
-        // in case of a bug somewhere.
-        this_->name = strndup(attr->u.str, 2);
-        break;
+       case attr_name:
+               if(this_->name)
+                       g_free(this_->name);
+               /* previously used strdupn not available on win32 */
+               this_->name = g_strdup(attr->u.str);
+               break;
        default:
                break;
        }