virtualbox-com 0.10.3 → 0.10.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -82,7 +82,12 @@ static ID _new;
82
82
  static rb_encoding * _UTF8;
83
83
 
84
84
 
85
-
85
+ static VALUE ensure_array(VALUE ary) {
86
+ ary = rb_check_array_type(ary);
87
+ if (ary == Qnil)
88
+ rb_raise(rb_eArgError, "expecting array-like object");
89
+ return ary;
90
+ }
86
91
 
87
92
  static void no_instantiation(VALUE klass) {
88
93
  rb_undef_method(rb_singleton_class(klass), "new");
@@ -363,7 +368,7 @@ static VALUE prepare_array_uint16(VALUE ary) {
363
368
  uint16_t *data = NULL;
364
369
  long len, i;
365
370
 
366
- ary = rb_check_array_type(ary);
371
+ ary = ensure_array(ary);
367
372
  len = RARRAY_LEN(ary);
368
373
  data = ALLOC_N(uint16_t, len);
369
374
  res = carray_new(len, data, Qnil);
@@ -385,7 +390,7 @@ static VALUE prepare_array_int16(VALUE ary) {
385
390
  int16_t * data = NULL;
386
391
  long len, i;
387
392
 
388
- ary = rb_check_array_type(ary);
393
+ ary = ensure_array(ary);
389
394
  len = RARRAY_LEN(ary);
390
395
  data = ALLOC_N(int16_t, len);
391
396
  res = carray_new(len, data, Qnil);
@@ -407,7 +412,7 @@ static VALUE prepare_array_uint32(VALUE ary) {
407
412
  uint32_t *data = NULL;
408
413
  long len, i;
409
414
 
410
- ary = rb_check_array_type(ary);
415
+ ary = ensure_array(ary);
411
416
  len = RARRAY_LEN(ary);
412
417
  data = ALLOC_N(uint32_t, len);
413
418
  res = carray_new(len, data, Qnil);
@@ -429,7 +434,7 @@ static VALUE prepare_array_int32(VALUE ary) {
429
434
  int32_t * data = NULL;
430
435
  long len, i;
431
436
 
432
- ary = rb_check_array_type(ary);
437
+ ary = prepare_array(ary);
433
438
  len = RARRAY_LEN(ary);
434
439
  data = ALLOC_N(int32_t, len);
435
440
  res = carray_new(len, data, Qnil);
@@ -451,7 +456,7 @@ static VALUE prepare_array_uint64(VALUE ary) {
451
456
  uint64_t *data = NULL;
452
457
  long len, i;
453
458
 
454
- ary = rb_check_array_type(ary);
459
+ ary = ensure_array(ary);
455
460
  len = RARRAY_LEN(ary);
456
461
  data = ALLOC_N(uint64_t, len);
457
462
  res = carray_new(len, data, Qnil);
@@ -473,7 +478,7 @@ static VALUE prepare_array_int64(VALUE ary) {
473
478
  int64_t * data = NULL;
474
479
  long len, i;
475
480
 
476
- ary = rb_check_array_type(ary);
481
+ ary = ensure_array(ary);
477
482
  len = RARRAY_LEN(ary);
478
483
  data = ALLOC_N(int64_t, len);
479
484
  res = carray_new(len, data, Qnil);
@@ -495,7 +500,7 @@ static VALUE prepare_array_bool(VALUE ary) {
495
500
  bool_t *data = NULL;
496
501
  long len, i;
497
502
 
498
- ary = rb_check_array_type(ary);
503
+ ary = ensure_array(ary);
499
504
  len = RARRAY_LEN(ary);
500
505
  data = ALLOC_N(bool_t, len);
501
506
  res = carray_new(len, data, Qnil);
@@ -512,7 +517,7 @@ static VALUE prepare_array_wstring(VALUE ary) {
512
517
  wstring_t *data = NULL;
513
518
  long len, i;
514
519
 
515
- ary = rb_ary_dup(rb_check_array_type(ary));
520
+ ary = rb_ary_dup(ensure_array(ary));
516
521
  len = RARRAY_LEN(ary);
517
522
  data = ALLOC_N(wstring_t, len);
518
523
  res = carray_new(len, data, ary);
@@ -531,7 +536,7 @@ static VALUE prepare_array_enum(VALUE ary, VALUE klass) {
531
536
  uint32_t *data = NULL;
532
537
  long len, i;
533
538
 
534
- ary = rb_check_array_type(ary);
539
+ ary = ensure_array(ary);
535
540
  len = RARRAY_LEN(ary);
536
541
  data = ALLOC_N(uint32_t, len);
537
542
  res = carray_new(len, data, Qnil);
@@ -548,7 +553,7 @@ static VALUE prepare_array_interface(VALUE ary, VALUE klass) {
548
553
  void * *data = NULL;
549
554
  long len, i;
550
555
 
551
- ary = rb_ary_dup(rb_check_array_type(ary));
556
+ ary = rb_ary_dup(ensure_array(ary));
552
557
  len = RARRAY_LEN(ary);
553
558
  data = (void*)ALLOC_N(uint32_t, len);
554
559
  res = carray_new(len, data, ary);
@@ -82,7 +82,12 @@ static ID _new;
82
82
  static rb_encoding * _UTF8;
83
83
 
84
84
 
85
-
85
+ static VALUE ensure_array(VALUE ary) {
86
+ ary = rb_check_array_type(ary);
87
+ if (ary == Qnil)
88
+ rb_raise(rb_eArgError, "expecting array-like object");
89
+ return ary;
90
+ }
86
91
 
87
92
  static void no_instantiation(VALUE klass) {
88
93
  rb_undef_method(rb_singleton_class(klass), "new");
@@ -363,7 +368,7 @@ static VALUE prepare_array_uint16(VALUE ary) {
363
368
  uint16_t *data = NULL;
364
369
  long len, i;
365
370
 
366
- ary = rb_check_array_type(ary);
371
+ ary = ensure_array(ary);
367
372
  len = RARRAY_LEN(ary);
368
373
  data = ALLOC_N(uint16_t, len);
369
374
  res = carray_new(len, data, Qnil);
@@ -385,7 +390,7 @@ static VALUE prepare_array_int16(VALUE ary) {
385
390
  int16_t * data = NULL;
386
391
  long len, i;
387
392
 
388
- ary = rb_check_array_type(ary);
393
+ ary = ensure_array(ary);
389
394
  len = RARRAY_LEN(ary);
390
395
  data = ALLOC_N(int16_t, len);
391
396
  res = carray_new(len, data, Qnil);
@@ -407,7 +412,7 @@ static VALUE prepare_array_uint32(VALUE ary) {
407
412
  uint32_t *data = NULL;
408
413
  long len, i;
409
414
 
410
- ary = rb_check_array_type(ary);
415
+ ary = ensure_array(ary);
411
416
  len = RARRAY_LEN(ary);
412
417
  data = ALLOC_N(uint32_t, len);
413
418
  res = carray_new(len, data, Qnil);
@@ -429,7 +434,7 @@ static VALUE prepare_array_int32(VALUE ary) {
429
434
  int32_t * data = NULL;
430
435
  long len, i;
431
436
 
432
- ary = rb_check_array_type(ary);
437
+ ary = prepare_array(ary);
433
438
  len = RARRAY_LEN(ary);
434
439
  data = ALLOC_N(int32_t, len);
435
440
  res = carray_new(len, data, Qnil);
@@ -451,7 +456,7 @@ static VALUE prepare_array_uint64(VALUE ary) {
451
456
  uint64_t *data = NULL;
452
457
  long len, i;
453
458
 
454
- ary = rb_check_array_type(ary);
459
+ ary = ensure_array(ary);
455
460
  len = RARRAY_LEN(ary);
456
461
  data = ALLOC_N(uint64_t, len);
457
462
  res = carray_new(len, data, Qnil);
@@ -473,7 +478,7 @@ static VALUE prepare_array_int64(VALUE ary) {
473
478
  int64_t * data = NULL;
474
479
  long len, i;
475
480
 
476
- ary = rb_check_array_type(ary);
481
+ ary = ensure_array(ary);
477
482
  len = RARRAY_LEN(ary);
478
483
  data = ALLOC_N(int64_t, len);
479
484
  res = carray_new(len, data, Qnil);
@@ -495,7 +500,7 @@ static VALUE prepare_array_bool(VALUE ary) {
495
500
  bool_t *data = NULL;
496
501
  long len, i;
497
502
 
498
- ary = rb_check_array_type(ary);
503
+ ary = ensure_array(ary);
499
504
  len = RARRAY_LEN(ary);
500
505
  data = ALLOC_N(bool_t, len);
501
506
  res = carray_new(len, data, Qnil);
@@ -512,7 +517,7 @@ static VALUE prepare_array_wstring(VALUE ary) {
512
517
  wstring_t *data = NULL;
513
518
  long len, i;
514
519
 
515
- ary = rb_ary_dup(rb_check_array_type(ary));
520
+ ary = rb_ary_dup(ensure_array(ary));
516
521
  len = RARRAY_LEN(ary);
517
522
  data = ALLOC_N(wstring_t, len);
518
523
  res = carray_new(len, data, ary);
@@ -531,7 +536,7 @@ static VALUE prepare_array_enum(VALUE ary, VALUE klass) {
531
536
  uint32_t *data = NULL;
532
537
  long len, i;
533
538
 
534
- ary = rb_check_array_type(ary);
539
+ ary = ensure_array(ary);
535
540
  len = RARRAY_LEN(ary);
536
541
  data = ALLOC_N(uint32_t, len);
537
542
  res = carray_new(len, data, Qnil);
@@ -548,7 +553,7 @@ static VALUE prepare_array_interface(VALUE ary, VALUE klass) {
548
553
  void * *data = NULL;
549
554
  long len, i;
550
555
 
551
- ary = rb_ary_dup(rb_check_array_type(ary));
556
+ ary = rb_ary_dup(ensure_array(ary));
552
557
  len = RARRAY_LEN(ary);
553
558
  data = (void*)ALLOC_N(uint32_t, len);
554
559
  res = carray_new(len, data, ary);
@@ -82,7 +82,12 @@ static ID _new;
82
82
  static rb_encoding * _UTF8;
83
83
 
84
84
 
85
-
85
+ static VALUE ensure_array(VALUE ary) {
86
+ ary = rb_check_array_type(ary);
87
+ if (ary == Qnil)
88
+ rb_raise(rb_eArgError, "expecting array-like object");
89
+ return ary;
90
+ }
86
91
 
87
92
  static void no_instantiation(VALUE klass) {
88
93
  rb_undef_method(rb_singleton_class(klass), "new");
@@ -363,7 +368,7 @@ static VALUE prepare_array_uint16(VALUE ary) {
363
368
  uint16_t *data = NULL;
364
369
  long len, i;
365
370
 
366
- ary = rb_check_array_type(ary);
371
+ ary = ensure_array(ary);
367
372
  len = RARRAY_LEN(ary);
368
373
  data = ALLOC_N(uint16_t, len);
369
374
  res = carray_new(len, data, Qnil);
@@ -385,7 +390,7 @@ static VALUE prepare_array_int16(VALUE ary) {
385
390
  int16_t * data = NULL;
386
391
  long len, i;
387
392
 
388
- ary = rb_check_array_type(ary);
393
+ ary = ensure_array(ary);
389
394
  len = RARRAY_LEN(ary);
390
395
  data = ALLOC_N(int16_t, len);
391
396
  res = carray_new(len, data, Qnil);
@@ -407,7 +412,7 @@ static VALUE prepare_array_uint32(VALUE ary) {
407
412
  uint32_t *data = NULL;
408
413
  long len, i;
409
414
 
410
- ary = rb_check_array_type(ary);
415
+ ary = ensure_array(ary);
411
416
  len = RARRAY_LEN(ary);
412
417
  data = ALLOC_N(uint32_t, len);
413
418
  res = carray_new(len, data, Qnil);
@@ -429,7 +434,7 @@ static VALUE prepare_array_int32(VALUE ary) {
429
434
  int32_t * data = NULL;
430
435
  long len, i;
431
436
 
432
- ary = rb_check_array_type(ary);
437
+ ary = prepare_array(ary);
433
438
  len = RARRAY_LEN(ary);
434
439
  data = ALLOC_N(int32_t, len);
435
440
  res = carray_new(len, data, Qnil);
@@ -451,7 +456,7 @@ static VALUE prepare_array_uint64(VALUE ary) {
451
456
  uint64_t *data = NULL;
452
457
  long len, i;
453
458
 
454
- ary = rb_check_array_type(ary);
459
+ ary = ensure_array(ary);
455
460
  len = RARRAY_LEN(ary);
456
461
  data = ALLOC_N(uint64_t, len);
457
462
  res = carray_new(len, data, Qnil);
@@ -473,7 +478,7 @@ static VALUE prepare_array_int64(VALUE ary) {
473
478
  int64_t * data = NULL;
474
479
  long len, i;
475
480
 
476
- ary = rb_check_array_type(ary);
481
+ ary = ensure_array(ary);
477
482
  len = RARRAY_LEN(ary);
478
483
  data = ALLOC_N(int64_t, len);
479
484
  res = carray_new(len, data, Qnil);
@@ -495,7 +500,7 @@ static VALUE prepare_array_bool(VALUE ary) {
495
500
  bool_t *data = NULL;
496
501
  long len, i;
497
502
 
498
- ary = rb_check_array_type(ary);
503
+ ary = ensure_array(ary);
499
504
  len = RARRAY_LEN(ary);
500
505
  data = ALLOC_N(bool_t, len);
501
506
  res = carray_new(len, data, Qnil);
@@ -512,7 +517,7 @@ static VALUE prepare_array_wstring(VALUE ary) {
512
517
  wstring_t *data = NULL;
513
518
  long len, i;
514
519
 
515
- ary = rb_ary_dup(rb_check_array_type(ary));
520
+ ary = rb_ary_dup(ensure_array(ary));
516
521
  len = RARRAY_LEN(ary);
517
522
  data = ALLOC_N(wstring_t, len);
518
523
  res = carray_new(len, data, ary);
@@ -531,7 +536,7 @@ static VALUE prepare_array_enum(VALUE ary, VALUE klass) {
531
536
  uint32_t *data = NULL;
532
537
  long len, i;
533
538
 
534
- ary = rb_check_array_type(ary);
539
+ ary = ensure_array(ary);
535
540
  len = RARRAY_LEN(ary);
536
541
  data = ALLOC_N(uint32_t, len);
537
542
  res = carray_new(len, data, Qnil);
@@ -548,7 +553,7 @@ static VALUE prepare_array_interface(VALUE ary, VALUE klass) {
548
553
  void * *data = NULL;
549
554
  long len, i;
550
555
 
551
- ary = rb_ary_dup(rb_check_array_type(ary));
556
+ ary = rb_ary_dup(ensure_array(ary));
552
557
  len = RARRAY_LEN(ary);
553
558
  data = (void*)ALLOC_N(uint32_t, len);
554
559
  res = carray_new(len, data, ary);
@@ -1,5 +1,5 @@
1
1
  module VirtualBox
2
2
  module COM
3
- VERSION = "0.10.3"
3
+ VERSION = "0.10.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virtualbox-com
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.10.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-15 00:00:00.000000000 Z
12
+ date: 2013-07-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -108,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  segments:
110
110
  - 0
111
- hash: -3214600469306632060
111
+ hash: -1599445118927892971
112
112
  required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  version: '0'
118
118
  segments:
119
119
  - 0
120
- hash: -3214600469306632060
120
+ hash: -1599445118927892971
121
121
  requirements: []
122
122
  rubyforge_project:
123
123
  rubygems_version: 1.8.25