Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed imageCreateFromLazyByteString, peek from CString with specified…

… length,

to avoid recognizing zeroes in data as NULL-termination in string
  • Loading branch information...
commit 439c8d29d083cb68fd592c10468ae70101436fb1 1 parent 1d6cff7
Dmitriy Nikitinskiy authored
View
2  wxc/src/cpp/eljimage.cpp
@@ -30,6 +30,7 @@ EWXWEXPORT(size_t,wxImage_ConvertToByteString)(wxImage* self,int type,char* data
wxMemoryOutputStream out;
self->SaveFile(out, type);
size_t len = out.GetLength();
+ if( !data ) return len;
return out.CopyTo(data, len);
}
@@ -38,6 +39,7 @@ EWXWEXPORT(size_t,wxImage_ConvertToLazyByteString)(wxImage* self,int type,char*
wxMemoryOutputStream out;
self->SaveFile(out, type);
size_t len = out.GetLength();
+ if( !data ) return len;
return out.CopyTo(data, len);
}
View
4 wxcore/src/haskell/Graphics/UI/WXCore/WxcTypes.hs
@@ -723,7 +723,7 @@ withStringResult f
then return ""
else withCString (replicate (fromCInt len) ' ') $ \cstr ->
do f cstr
- peekCString cstr
+ peekCStringLen (cstr,fromCInt len)
withWStringResult :: (Ptr CWchar -> IO CInt) -> IO String
withWStringResult f
@@ -746,7 +746,7 @@ withByteStringResult f
then return $ BC.pack ""
else withCString (replicate (fromCInt len) ' ') $ \cstr ->
do f cstr
- B.packCString cstr
+ B.packCStringLen (cstr,fromCInt len)
withLazyByteStringResult :: (Ptr CChar -> IO CInt) -> IO LB.ByteString
withLazyByteStringResult f
Please sign in to comment.
Something went wrong with that request. Please try again.