summaryrefslogtreecommitdiff
path: root/lib/chef/win32/unicode.rb
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2015-09-01 11:36:25 -0700
committerClaire McQuin <claire@getchef.com>2015-09-01 13:37:53 -0700
commit12425d32e29fd612a2afaa99a1978df1b600b941 (patch)
tree0f2e3ccdcb60504f085624f35211e9c79ad5ae9b /lib/chef/win32/unicode.rb
parent3770ec1025fd09d3a3bb393ad955ee2985252a67 (diff)
downloadchef-12425d32e29fd612a2afaa99a1978df1b600b941.tar.gz
Refactor Chef::Mixin::WideString to remove implicit Windows dependency.mcquin/refactor-wstring
Diffstat (limited to 'lib/chef/win32/unicode.rb')
-rw-r--r--lib/chef/win32/unicode.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/chef/win32/unicode.rb b/lib/chef/win32/unicode.rb
index ea10dc71d0..562301a040 100644
--- a/lib/chef/win32/unicode.rb
+++ b/lib/chef/win32/unicode.rb
@@ -17,6 +17,7 @@
# limitations under the License.
#
+require 'chef/mixin/wide_string'
require 'chef/win32/api/unicode'
class Chef
@@ -30,6 +31,8 @@ end
module FFI
class Pointer
+ include Chef::Mixin::WideString
+
def read_wstring(num_wchars = nil)
if num_wchars.nil?
# Find the length of the string
@@ -43,14 +46,16 @@ module FFI
num_wchars = length
end
- Chef::ReservedNames::Win32::Unicode.wide_to_utf8(self.get_bytes(0, num_wchars*2))
+ wide_to_utf8(self.get_bytes(0, num_wchars*2))
end
end
end
class String
+ include Chef::Mixin::WideString
+
def to_wstring
- Chef::ReservedNames::Win32::Unicode.utf8_to_wide(self)
+ utf8_to_wide(self)
end
end