virtualbox-com 0.10.7 → 0.10.8

Sign up to get free protection for your applications and to get access to all the features.
data/examples/simple.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'bundler/setup'
2
1
  require 'virtualbox-com'
3
2
 
4
3
  # Shortcut
@@ -80,6 +80,7 @@ static ID _value;
80
80
  static ID _const_get;
81
81
  static ID _new;
82
82
  static ID _call;
83
+ static ID _empty_q;
83
84
 
84
85
  static rb_encoding * _UTF8;
85
86
 
@@ -121,8 +122,11 @@ static VALUE uuid_parser_calling(VALUE arg) {
121
122
 
122
123
  static VALUE to_uuid(VALUE val) {
123
124
  int state = 0;
124
-
125
125
  StringValue(val);
126
+
127
+ if (rb_funcall(val, _empty_q, 0) == Qtrue)
128
+ return Qnil;
129
+
126
130
  if (oUUIDparser != Qnil && oUUIDparser != Qundef) {
127
131
  val = rb_protect(uuid_parser_calling, val, &state);
128
132
  if (state) {
@@ -167,7 +171,7 @@ static VALUE iid__to_s(VALUE self) {
167
171
  iid->m3[4], iid->m3[5], iid->m3[6], iid->m3[7]);
168
172
  return rb_str_new(str, IID_STR_MAX);
169
173
  }
170
- static void iid__to_raw(VALUE self) {
174
+ static VALUE iid__to_raw(VALUE self) {
171
175
  iid_t *iid = DATA_PTR(self);
172
176
  return rb_str_new((char *)iid, sizeof(iid_t));
173
177
  }
@@ -868,6 +872,7 @@ void RUBY_VBOX_INIT(void) {
868
872
  _const_get = rb_intern("const_get");
869
873
  _new = rb_intern("new");
870
874
  _call = rb_intern("call");
875
+ _empty_q = rb_intern("empty?");
871
876
 
872
877
  p15 = rb_funcall(oTwo, _pow, 1, INT2FIX(15));
873
878
  p16 = rb_funcall(oTwo, _pow, 1, INT2FIX(16));
@@ -80,6 +80,7 @@ static ID _value;
80
80
  static ID _const_get;
81
81
  static ID _new;
82
82
  static ID _call;
83
+ static ID _empty_q;
83
84
 
84
85
  static rb_encoding * _UTF8;
85
86
 
@@ -121,8 +122,11 @@ static VALUE uuid_parser_calling(VALUE arg) {
121
122
 
122
123
  static VALUE to_uuid(VALUE val) {
123
124
  int state = 0;
124
-
125
125
  StringValue(val);
126
+
127
+ if (rb_funcall(val, _empty_q, 0) == Qtrue)
128
+ return Qnil;
129
+
126
130
  if (oUUIDparser != Qnil && oUUIDparser != Qundef) {
127
131
  val = rb_protect(uuid_parser_calling, val, &state);
128
132
  if (state) {
@@ -167,7 +171,7 @@ static VALUE iid__to_s(VALUE self) {
167
171
  iid->m3[4], iid->m3[5], iid->m3[6], iid->m3[7]);
168
172
  return rb_str_new(str, IID_STR_MAX);
169
173
  }
170
- static void iid__to_raw(VALUE self) {
174
+ static VALUE iid__to_raw(VALUE self) {
171
175
  iid_t *iid = DATA_PTR(self);
172
176
  return rb_str_new((char *)iid, sizeof(iid_t));
173
177
  }
@@ -868,6 +872,7 @@ void RUBY_VBOX_INIT(void) {
868
872
  _const_get = rb_intern("const_get");
869
873
  _new = rb_intern("new");
870
874
  _call = rb_intern("call");
875
+ _empty_q = rb_intern("empty?");
871
876
 
872
877
  p15 = rb_funcall(oTwo, _pow, 1, INT2FIX(15));
873
878
  p16 = rb_funcall(oTwo, _pow, 1, INT2FIX(16));
@@ -80,6 +80,7 @@ static ID _value;
80
80
  static ID _const_get;
81
81
  static ID _new;
82
82
  static ID _call;
83
+ static ID _empty_q;
83
84
 
84
85
  static rb_encoding * _UTF8;
85
86
 
@@ -121,8 +122,11 @@ static VALUE uuid_parser_calling(VALUE arg) {
121
122
 
122
123
  static VALUE to_uuid(VALUE val) {
123
124
  int state = 0;
124
-
125
125
  StringValue(val);
126
+
127
+ if (rb_funcall(val, _empty_q, 0) == Qtrue)
128
+ return Qnil;
129
+
126
130
  if (oUUIDparser != Qnil && oUUIDparser != Qundef) {
127
131
  val = rb_protect(uuid_parser_calling, val, &state);
128
132
  if (state) {
@@ -167,7 +171,7 @@ static VALUE iid__to_s(VALUE self) {
167
171
  iid->m3[4], iid->m3[5], iid->m3[6], iid->m3[7]);
168
172
  return rb_str_new(str, IID_STR_MAX);
169
173
  }
170
- static void iid__to_raw(VALUE self) {
174
+ static VALUE iid__to_raw(VALUE self) {
171
175
  iid_t *iid = DATA_PTR(self);
172
176
  return rb_str_new((char *)iid, sizeof(iid_t));
173
177
  }
@@ -868,6 +872,7 @@ void RUBY_VBOX_INIT(void) {
868
872
  _const_get = rb_intern("const_get");
869
873
  _new = rb_intern("new");
870
874
  _call = rb_intern("call");
875
+ _empty_q = rb_intern("empty?");
871
876
 
872
877
  p15 = rb_funcall(oTwo, _pow, 1, INT2FIX(15));
873
878
  p16 = rb_funcall(oTwo, _pow, 1, INT2FIX(16));
@@ -1,5 +1,5 @@
1
1
  module VirtualBox
2
2
  module COM
3
- VERSION = "0.10.7"
3
+ VERSION = "0.10.8"
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.7
4
+ version: 0.10.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -108,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  segments:
110
110
  - 0
111
- hash: -2422062214505046562
111
+ hash: -3036680002265941423
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: -2422062214505046562
120
+ hash: -3036680002265941423
121
121
  requirements: []
122
122
  rubyforge_project:
123
123
  rubygems_version: 1.8.25