JuliaIO/LightXML.jl

Deprecation warnings

Closed this issue · 5 comments

diff --git a/src/cdata.jl b/src/cdata.jl
index d92a7f0..e24a930 100644
--- a/src/cdata.jl
+++ b/src/cdata.jl
@@ -1,6 +1,6 @@
-function new_cdatanode(xdoc::XMLDocument, txt::ASCIIString)
+function new_cdatanode(xdoc::XMLDocument, txt::Compat.ASCIIString)
         p = ccall((:xmlNewCDataBlock,libxml2), Xptr, (Xptr, Xstr, Cint), xdoc.p
         XMLNode(p)
 end

-add_cdata(xdoc::XMLDocument, x::XMLElement, txt::ASCIIString) = add_child(x, ne
+add_cdata(xdoc::XMLDocument, x::XMLElement, txt::Compat.ASCIIString) = add_chil

Some more....

diff --git a/src/LightXML.jl b/src/LightXML.jl
index 5baf6c8..b8dbb6b 100644
--- a/src/LightXML.jl
+++ b/src/LightXML.jl
@@ -16,7 +16,11 @@ end



-const libxml2 = @windows? Pkg.dir("WinRPM","deps","usr","$(Sys.ARCH)-w64-mingw32","sys-root","mingw","b
+@static if is_windows()
+    const libxml2 = Pkg.dir("WinRPM","deps","usr","$(Sys.ARCH)-w64-mingw32","sys-root","mingw","bin","l
+else
+    const libxml2 = "libxml2"
+end

 export

@@ -48,7 +52,7 @@ typealias Xptr Ptr{xmlBuffer}
 # pre-condition: p is not null
 # (After tests, it seems that free in libc instead of xmlFree
 #  should be used here.)
-_xcopystr(p::Xstr) = (r = bytestring(p); Libc.free(p); r)
+_xcopystr(p::Xstr) = (r = unsafe_string(p); Libc.free(p); r)

 include("errors.jl")

diff --git a/src/document.jl b/src/document.jl
index 02bbaa8..a09741f 100644
--- a/src/document.jl
+++ b/src/document.jl
@@ -53,8 +53,8 @@ type XMLDocument
     end
 end

-version(xdoc::XMLDocument) = bytestring(xdoc._struct.version)
-encoding(xdoc::XMLDocument) = bytestring(xdoc._struct.encoding)
+version(xdoc::XMLDocument) = unsafe_string(xdoc._struct.version)
+encoding(xdoc::XMLDocument) = unsafe_string(xdoc._struct.encoding)
 compression(xdoc::XMLDocument) = @compat Int(xdoc._struct.compression)
 standalone(xdoc::XMLDocument) = @compat Int(xdoc._struct.standalone)

diff --git a/src/nodes.jl b/src/nodes.jl
index 16d9a9a..ff0466f 100644
--- a/src/nodes.jl
+++ b/src/nodes.jl
@@ -82,7 +82,7 @@ type XMLAttr
     end
 end

-name(a::XMLAttr) = bytestring(a._struct.name)
+name(a::XMLAttr) = unsafe_string(a._struct.name)

 function value(a::XMLAttr)
     pct = ccall((:xmlNodeGetContent,libxml2), Xstr, (Xptr,), a._struct.children)
@@ -138,7 +138,7 @@ type XMLNode <: AbstractXMLNode
     end
 end

-name(nd::XMLNode) = bytestring(nd._struct.name)
+name(nd::XMLNode) = unsafe_string(nd._struct.name)
 nodetype(nd::XMLNode) = nd._struct.nodetype
 has_children(nd::XMLNode) = (nd._struct.children != C_NULL)

diff --git a/src/utils.jl b/src/utils.jl
index cd22cd6..61132d1 100644
--- a/src/utils.jl
+++ b/src/utils.jl
@@ -16,4 +16,4 @@ free(buf::XBuffer) = ccall((:xmlBufferFree,libxml2), Void, (Xptr,), buf.ptr)

 Base.length(buf::XBuffer) = int(ccall((:xmlBufferLength,libxml2), Cint, (Xptr,), buf.ptr))

-content(buf::XBuffer) = bytestring(ccall((:xmlBufferContent,libxml2), Xstr, (Xptr,), buf.ptr))
+content(buf::XBuffer) = unsafe_string(ccall((:xmlBufferContent,libxml2), Xstr, (Xptr,), buf.ptr))

FYI, please submit a PR instead of posting diffs on an issue unless you want it to be ignored.

Surely it would save everyone some time if someone who has commit access just took the patch and did:

cat | patch << EOF
-- paste patch --
EOF

What is the benefit of forking the package, applying the patch to the fork, pushing to github, creating a PR, remembering to clean up the fork later etc etc... just to do a simple rename as instructed by a dep warning ?

Surely it would save everyone some time if someone who has commit access just took the patch and did:

Not at all.

forking the package

One button click

applying the patch to the fork

Should have already been done

pushing to github

At most two commands

creating a PR

Can't be skipped, even for people with commit access. (edit: And FWIW, shouldn't be harder than opening an issue and manually paste a really long patch, especially given that clipboard and browsers are not always particularly reliable about code formatting, (trailing) whitespace etc)

remembering to clean up the fork later

Not necessary.

just to do a simple rename as instructed by a dep warning ?

It is not always simple. Especially to make sure it actually has the right behavior on all supported versions (and verify on the CI) and also to make sure the version dependencies are listed correctly.