Revision 74aa41ba src/image/Image.cc

View differences:

src/image/Image.cc
459 459
/* ------------------------------------------------------------------------ */
460 460
/* ------------------------------------------------------------------------ */
461 461

  
462
void Image::disk_attribute(VectorAttribute ** disk, int index)
462
void Image::disk_attribute(VectorAttribute * disk, int index)
463 463
{
464 464
    string  overwrite;
465 465
    string  saveas;
466 466
    string  name;
467 467
    string  bus;
468 468

  
469
    name      = (*disk)->vector_value("NAME");
470
    overwrite = (*disk)->vector_value("OVERWRITE");
471
    saveas    = (*disk)->vector_value("SAVE_AS");
472
    bus       = (*disk)->vector_value("BUS");
469
    name      = disk->vector_value("NAME");
470
    overwrite = disk->vector_value("OVERWRITE");
471
    saveas    = disk->vector_value("SAVE_AS");
472
    bus       = disk->vector_value("BUS");
473 473

  
474 474
    string template_bus;
475 475
    string prefix;
......
480 480
   //---------------------------------------------------------------------------
481 481
   //                       NEW DISK ATTRIBUTES
482 482
   //---------------------------------------------------------------------------
483
    VectorAttribute * new_disk = new VectorAttribute("DISK");
484 483

  
485
    new_disk->replace("NAME",name);
486
    new_disk->replace("OVERWRITE",overwrite);
487
    new_disk->replace("SAVE_AS",saveas);
484
    map<string,string> new_disk;
488 485

  
489
    new_disk->replace("SOURCE", source);
486
    new_disk.insert(make_pair("NAME",name));
487
    new_disk.insert(make_pair("OVERWRITE",overwrite));
488
    new_disk.insert(make_pair("SAVE_AS",saveas));
489

  
490
    new_disk.insert(make_pair("SOURCE", source));
490 491

  
491 492
    if (bus.empty())
492 493
    {
493 494
        if (!template_bus.empty())
494 495
        {
495
            new_disk->replace("BUS",template_bus);
496
            new_disk.insert(make_pair("BUS",template_bus));
496 497
        }
497 498
    }
498 499
    else
499 500
    {
500
        new_disk->replace("BUS",bus);
501
        new_disk.insert(make_pair("BUS",bus));
501 502
    }
502 503

  
503 504
   //---------------------------------------------------------------------------
......
511 512
    {
512 513
        case OS:
513 514
        case DATABLOCK:
514
          new_disk->replace("TYPE","DISK");
515
          new_disk->replace("READONLY","NO");
515
          new_disk.insert(make_pair("TYPE","DISK"));
516
          new_disk.insert(make_pair("READONLY","NO"));
516 517

  
517 518
          if (overwrite == "YES")
518 519
          {
519
              new_disk->replace("CLONE","NO");
520
              new_disk->replace("SAVE","YES");
520
              new_disk.insert(make_pair("CLONE","NO"));
521
              new_disk.insert(make_pair("SAVE","YES"));
521 522
          }
522 523
          else if (saveas == "YES")
523 524
          {
524
              new_disk->replace("CLONE","YES");
525
              new_disk->replace("SAVE","YES");
525
              new_disk.insert(make_pair("CLONE","YES"));
526
              new_disk.insert(make_pair("SAVE","YES"));
526 527
          }
527 528
          else
528 529
          {
529
              new_disk->replace("CLONE","YES");
530
              new_disk->replace("SAVE","NO");
530
              new_disk.insert(make_pair("CLONE","YES"));
531
              new_disk.insert(make_pair("SAVE","NO"));
531 532
          }
532 533
        break;
533 534

  
534 535
        case CDROM:
535
          new_disk->replace("TYPE","CDROM");
536
          new_disk->replace("READONLY","YES");
536
          new_disk.insert(make_pair("TYPE","CDROM"));
537
          new_disk.insert(make_pair("READONLY","YES"));
537 538

  
538
          new_disk->replace("CLONE","YES");
539
          new_disk->replace("SAVE","NO");
539
          new_disk.insert(make_pair("CLONE","YES"));
540
          new_disk.insert(make_pair("SAVE","NO"));
540 541
        break;
541 542
    }
542 543

  
......
559 560
        break;
560 561

  
561 562
    }
563
    new_disk.insert(make_pair("TARGET", prefix));
562 564

  
563
    new_disk->replace("TARGET", prefix);
564

  
565
    delete (*disk);
566
    (*disk) = new_disk;
565
    disk->replace(new_disk);
567 566
}
568 567

  
569 568
/* ------------------------------------------------------------------------ */

Also available in: Unified diff