Fix a few more -Wreorder warnings.
[pdfium.git] / fpdfsdk / src / fpdfdoc.cpp
index 4fa6ba2..e974ffb 100644 (file)
@@ -36,7 +36,8 @@ DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_W
        CPDF_Document* pDoc = (CPDF_Document*)document;
        CPDF_BookmarkTree tree(pDoc);
 
-       CFX_WideString wstr = CFX_WideString::FromUTF16LE(title);
+       FX_STRSIZE len = CFX_WideString::WStringLength(title);
+       CFX_WideString wstr = CFX_WideString::FromUTF16LE(title, len);
        return FindBookmark(tree, NULL, wstr);
 }
 
@@ -249,7 +250,7 @@ DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, FPDF_BYTESTR
        // Use UTF-16LE encoding
        CFX_ByteString bstr = text.UTF16LE_Encode();
        unsigned long len = bstr.GetLength();
-       if (buffer != NULL || buflen >= len+2) {
+       if (buffer != NULL && buflen >= len+2) {
                FXSYS_memcpy(buffer, (FX_LPCSTR)bstr, len);
                // use double zero as trailer
                ((FX_BYTE*)buffer)[len] = ((FX_BYTE*)buffer)[len+1] = 0;