summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2014-01-15 10:10:47 -0800
committerMichael Vrhel <michael.vrhel@artifex.com>2014-01-15 10:11:37 -0800
commit9a83c56291d358b497a6603b0cd20f28c27d23da (patch)
tree1a63d5b0bf3f950cd6a41a4398397cc2246a150d
parentc9161e3c56149e960c68ec504807ae0612dc6c18 (diff)
downloadmupdf-9a83c56291d358b497a6603b0cd20f28c27d23da.tar.xz
Clearer division in WinRT vs std C++ code
To share as much code as possible between the Windows 8 app, windows phone app and Windows desktop app, remove dependencies of Platform and Windows::Foundation in files that interface to mupdf and replace with C/C++ std methods.
-rw-r--r--platform/win32/mupdf.sln64
-rw-r--r--platform/winrt/mupdfwinrt/muctx.cpp88
-rw-r--r--platform/winrt/mupdfwinrt/muctx.h44
-rw-r--r--platform/winrt/mupdfwinrt/mudocument.cpp33
-rw-r--r--platform/winrt/mupdfwinrt/utils.cpp2
-rw-r--r--platform/winrt/mupdfwinrt/utils.h2
6 files changed, 103 insertions, 130 deletions
diff --git a/platform/win32/mupdf.sln b/platform/win32/mupdf.sln
index b8de7e2a..7ef3c70f 100644
--- a/platform/win32/mupdf.sln
+++ b/platform/win32/mupdf.sln
@@ -1,63 +1,31 @@

-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupdf", "mupdf.vcproj", "{E74F29F0-FA43-4ADC-B92C-6AFA08E4A417}"
- ProjectSection(ProjectDependencies) = postProject
- {EC81A9F3-88A6-4170-B7B4-C41CB789A7F6} = {EC81A9F3-88A6-4170-B7B4-C41CB789A7F6}
- {5EDCF4FD-0291-4FB9-8D96-D58957CA5E3C} = {5EDCF4FD-0291-4FB9-8D96-D58957CA5E3C}
- EndProjectSection
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+VisualStudioVersion = 12.0.21005.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupdf", "mupdf.vcxproj", "{E74F29F0-FA43-4ADC-B92C-6AFA08E4A417}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libthirdparty", "libthirdparty.vcproj", "{5EDCF4FD-0291-4FB9-8D96-D58957CA5E3C}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libthirdparty", "libthirdparty.vcxproj", "{5EDCF4FD-0291-4FB9-8D96-D58957CA5E3C}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmupdf", "libmupdf.vcproj", "{5F615F91-DFF8-4F05-BF48-6222B7D86519}"
- ProjectSection(ProjectDependencies) = postProject
- {A5053AA7-02E5-4903-B596-04F17AEB1526} = {A5053AA7-02E5-4903-B596-04F17AEB1526}
- EndProjectSection
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmupdf", "libmupdf.vcxproj", "{5F615F91-DFF8-4F05-BF48-6222B7D86519}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mudraw", "mudraw.vcproj", "{0B51171B-B10E-4EAC-8FFA-19226A1828A3}"
- ProjectSection(ProjectDependencies) = postProject
- {EC81A9F3-88A6-4170-B7B4-C41CB789A7F6} = {EC81A9F3-88A6-4170-B7B4-C41CB789A7F6}
- {5EDCF4FD-0291-4FB9-8D96-D58957CA5E3C} = {5EDCF4FD-0291-4FB9-8D96-D58957CA5E3C}
- EndProjectSection
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mudraw", "mudraw.vcxproj", "{0B51171B-B10E-4EAC-8FFA-19226A1828A3}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mutool", "mutool.vcproj", "{00811970-815B-4F64-BC9D-219078B1F3AA}"
- ProjectSection(ProjectDependencies) = postProject
- {EC81A9F3-88A6-4170-B7B4-C41CB789A7F6} = {EC81A9F3-88A6-4170-B7B4-C41CB789A7F6}
- {5EDCF4FD-0291-4FB9-8D96-D58957CA5E3C} = {5EDCF4FD-0291-4FB9-8D96-D58957CA5E3C}
- EndProjectSection
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mutool", "mutool.vcxproj", "{00811970-815B-4F64-BC9D-219078B1F3AA}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "generated", "generated.vcproj", "{A5053AA7-02E5-4903-B596-04F17AEB1526}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "generated", "generated.vcxproj", "{A5053AA7-02E5-4903-B596-04F17AEB1526}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmupdf-js-v8", "libmupdf-js-v8.vcproj", "{2E5DAFDB-A060-4011-B760-32F6A3A4BC9D}"
- ProjectSection(ProjectDependencies) = postProject
- {5F615F91-DFF8-4F05-BF48-6222B7D86519} = {5F615F91-DFF8-4F05-BF48-6222B7D86519}
- EndProjectSection
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmupdf-js-v8", "libmupdf-js-v8.vcxproj", "{2E5DAFDB-A060-4011-B760-32F6A3A4BC9D}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupdf-v8", "mupdf-v8.vcproj", "{9035A4F3-4219-45A5-985D-FBF4D9609713}"
- ProjectSection(ProjectDependencies) = postProject
- {5EDCF4FD-0291-4FB9-8D96-D58957CA5E3C} = {5EDCF4FD-0291-4FB9-8D96-D58957CA5E3C}
- {2E5DAFDB-A060-4011-B760-32F6A3A4BC9D} = {2E5DAFDB-A060-4011-B760-32F6A3A4BC9D}
- EndProjectSection
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupdf-v8", "mupdf-v8.vcxproj", "{9035A4F3-4219-45A5-985D-FBF4D9609713}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mujstest-v8", "mujstest-v8.vcproj", "{21E28758-E4D2-4B84-8EC5-B631CEE66B30}"
- ProjectSection(ProjectDependencies) = postProject
- {2E5DAFDB-A060-4011-B760-32F6A3A4BC9D} = {2E5DAFDB-A060-4011-B760-32F6A3A4BC9D}
- {5EDCF4FD-0291-4FB9-8D96-D58957CA5E3C} = {5EDCF4FD-0291-4FB9-8D96-D58957CA5E3C}
- EndProjectSection
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mujstest-v8", "mujstest-v8.vcxproj", "{21E28758-E4D2-4B84-8EC5-B631CEE66B30}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmupdf-js-none", "libmupdf-js-none.vcproj", "{EC81A9F3-88A6-4170-B7B4-C41CB789A7F6}"
- ProjectSection(ProjectDependencies) = postProject
- {5F615F91-DFF8-4F05-BF48-6222B7D86519} = {5F615F91-DFF8-4F05-BF48-6222B7D86519}
- EndProjectSection
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmupdf-js-none", "libmupdf-js-none.vcxproj", "{EC81A9F3-88A6-4170-B7B4-C41CB789A7F6}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcurl", "..\..\thirdparty\curl\vs\vc8\lib\vc8libcurl.vcproj", "{87EE9DA4-DE1E-4448-8324-183C98DCA588}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcurl", "..\..\thirdparty\curl\vs\vc8\lib\vc8libcurl.vcxproj", "{87EE9DA4-DE1E-4448-8324-183C98DCA588}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupdf-curl", "mupdf-curl.vcproj", "{27B53E5C-ACAB-423C-854E-BECE56D73544}"
- ProjectSection(ProjectDependencies) = postProject
- {87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
- {EC81A9F3-88A6-4170-B7B4-C41CB789A7F6} = {EC81A9F3-88A6-4170-B7B4-C41CB789A7F6}
- {5EDCF4FD-0291-4FB9-8D96-D58957CA5E3C} = {5EDCF4FD-0291-4FB9-8D96-D58957CA5E3C}
- EndProjectSection
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupdf-curl", "mupdf-curl.vcxproj", "{27B53E5C-ACAB-423C-854E-BECE56D73544}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/platform/winrt/mupdfwinrt/muctx.cpp b/platform/winrt/mupdfwinrt/muctx.cpp
index 4e8a4ad2..cc3feff3 100644
--- a/platform/winrt/mupdfwinrt/muctx.cpp
+++ b/platform/winrt/mupdfwinrt/muctx.cpp
@@ -6,13 +6,8 @@
/* This class interfaces to mupdf API with minimal windows objects
* (other than the file streaming stuff) */
-/* File streaming set up for mupdf */
-
-/* win_read_file etc. Reading of windows managed stream. This is
- * not ideal as I have to read into a managed buffer and then transfer
- * to the actual buffer I want. I would like a more direct approach.
- * Alternate approach is to push this off outside the winrt and read
- * from a memory buffer. */
+#ifdef _WINRT_DLL
+/* File streaming set up for WinRT */
static int win_read_file(fz_stream *stm, unsigned char *buf, int len)
{
void *temp = stm->state;
@@ -80,6 +75,30 @@ static void win_close_file(fz_context *ctx, void *state)
delete stream;
}
+status_t muctx::InitializeStream(IRandomAccessStream^ readStream, char *ext)
+{
+ win_stream.stream = readStream;
+ fz_stream *mu_stream = fz_new_stream(mu_ctx, 0, win_read_file, win_close_file, NULL);
+ mu_stream->seek = win_seek_file;
+ mu_stream->state = reinterpret_cast <void*> (&win_stream);
+
+ /* Now lets see if we can open the file */
+ fz_try(mu_ctx)
+ {
+ mu_doc = fz_open_document_with_stream(mu_ctx, ext, mu_stream);
+ }
+ fz_always(mu_ctx)
+ {
+ fz_close(mu_stream);
+ }
+ fz_catch(mu_ctx)
+ {
+ return E_FAILURE;
+ }
+ return S_ISOK;
+}
+#endif
+
/* mutext functions see mupdf readme for details */
static void lock_mutex(void *user, int lock)
{
@@ -156,30 +175,6 @@ muctx::~muctx(void)
page_cache = NULL;
}
-/* Set up the stream access */
-status_t muctx::InitializeStream(IRandomAccessStream^ readStream, char *ext)
-{
- win_stream.stream = readStream;
- fz_stream *mu_stream = fz_new_stream(mu_ctx, 0, win_read_file, win_close_file, NULL);
- mu_stream->seek = win_seek_file;
- mu_stream->state = reinterpret_cast <void*> (&win_stream);
-
- /* Now lets see if we can open the file */
- fz_try(mu_ctx)
- {
- mu_doc = fz_open_document_with_stream(mu_ctx, ext, mu_stream);
- }
- fz_always(mu_ctx)
- {
- fz_close(mu_stream);
- }
- fz_catch(mu_ctx)
- {
- return E_FAILURE;
- }
- return S_ISOK;
-}
-
/* Return the documents page count */
int muctx::GetPageCount()
{
@@ -190,7 +185,7 @@ int muctx::GetPageCount()
}
/* Get page size */
-int muctx::MeasurePage(int page_num, Point *size)
+int muctx::MeasurePage(int page_num, point_t *size)
{
fz_rect rect;
fz_page *page;
@@ -211,9 +206,9 @@ int muctx::MeasurePage(int page_num, Point *size)
}
/* Get page size */
-Point muctx::MeasurePage(fz_page *page)
+point_t muctx::MeasurePage(fz_page *page)
{
- Point pageSize;
+ point_t pageSize;
fz_rect rect;
fz_rect *bounds;
@@ -233,8 +228,8 @@ void muctx::FlattenOutline(fz_outline *outline, int level,
memset(indent, ' ', level * 4);
indent[level * 4] = 0;
- String^ indent_str = char_to_String(indent);
- String^ str_indent;
+ std::string indent_str = indent;
+ std::string str_indent;
while (outline)
{
@@ -246,9 +241,10 @@ void muctx::FlattenOutline(fz_outline *outline, int level,
/* Add to the contents std:vec */
sh_content content_item(new content_t());
content_item->page = page;
- content_item->string_orig = char_to_String(outline->title);
- content_item->string_margin =
- str_indent->Concat(indent_str, content_item->string_orig);
+ content_item->string_orig = outline->title;
+ str_indent = content_item->string_orig;
+ str_indent.insert(0, indent_str);
+ content_item->string_margin = str_indent;
contents_vec->push_back(content_item);
}
}
@@ -403,7 +399,7 @@ fz_display_list * muctx::CreateDisplayList(int page_num, int *width, int *height
{
fz_device *dev = NULL;
fz_page *page = NULL;
- Point page_size;
+ point_t page_size;
/* First see if we have this one in the cache */
fz_display_list *dlist = page_cache->Use(page_num, width, height, mu_ctx);
@@ -445,8 +441,8 @@ fz_display_list * muctx::CreateDisplayList(int page_num, int *width, int *height
/* Render display list bmp_data buffer. No lock needed for this operation */
status_t muctx::RenderPageMT(void *dlist, int page_width, int page_height,
unsigned char *bmp_data, int bmp_width, int bmp_height,
- float scale, bool flipy, bool tile, Point top_left,
- Point bottom_right)
+ float scale, bool flipy, bool tile, point_t top_left,
+ point_t bottom_right)
{
fz_device *dev = NULL;
fz_pixmap *pix = NULL;
@@ -505,7 +501,7 @@ status_t muctx::RenderPage(int page_num, unsigned char *bmp_data, int bmp_width,
fz_pixmap *pix = NULL;
fz_page *page = NULL;
fz_matrix ctm, *pctm = &ctm;
- Point page_size;
+ point_t page_size;
fz_var(dev);
fz_var(pix);
@@ -551,7 +547,7 @@ bool muctx::ApplyPassword(char* password)
return fz_authenticate_password(mu_doc, password) != 0;
}
-String^ muctx::GetHTML(int page_num)
+std::string muctx::GetHTML(int page_num)
{
fz_output *out = NULL;
fz_device *dev = NULL;
@@ -559,7 +555,7 @@ String^ muctx::GetHTML(int page_num)
fz_text_sheet *sheet = NULL;
fz_text_page *text = NULL;
fz_buffer *buf = NULL;
- String^ html;
+ std::string html;
fz_var(dev);
fz_var(page);
@@ -579,7 +575,7 @@ String^ muctx::GetHTML(int page_num)
buf = fz_new_buffer(mu_ctx, 256);
out = fz_new_output_with_buffer(mu_ctx, buf);
fz_print_text_page_html(mu_ctx, out, text);
- html = char_to_String((char*) buf->data);
+ html = std::string(((char*) buf->data));
}
fz_always(mu_ctx)
{
diff --git a/platform/winrt/mupdfwinrt/muctx.h b/platform/winrt/mupdfwinrt/muctx.h
index 80d165ed..0a27af52 100644
--- a/platform/winrt/mupdfwinrt/muctx.h
+++ b/platform/winrt/mupdfwinrt/muctx.h
@@ -5,7 +5,6 @@
#include <vector>
#include <windows.h>
#include <mutex>
-#include "utils.h"
#include "Cache.h"
#include "status.h"
@@ -15,18 +14,18 @@ extern "C" {
#define MAX_SEARCH 500
-using namespace Platform; /* For String */
-using namespace Windows::Foundation; /* For Point */
-
-/* These are the std objects used to interface to muctx. We do use windows
- String and Point types however */
+typedef struct point_s
+{
+ double X;
+ double Y;
+} point_t;
/* Links */
typedef struct document_link_s
{
link_t type;
- Point upper_left;
- Point lower_right;
+ point_t upper_left;
+ point_t lower_right;
std::unique_ptr<char[]> uri;
int page_num;
} document_link_t;
@@ -36,8 +35,8 @@ typedef struct document_link_s
/* Text Search */
typedef struct text_search_s
{
- Point upper_left;
- Point lower_right;
+ point_t upper_left;
+ point_t lower_right;
} text_search_t;
#define sh_text std::shared_ptr<text_search_t>
#define sh_vector_text std::shared_ptr<std::vector<sh_text>>
@@ -46,16 +45,13 @@ typedef struct text_search_s
typedef struct content_s
{
int page;
- String^ string_orig;
- String^ string_margin;
+ std::string string_orig;
+ std::string string_margin;
} content_t;
#define sh_content std::shared_ptr<content_t>
#define sh_vector_content std::shared_ptr<std::vector<sh_content>>
-/* Used for HTML return */
-#define sh_vector_char std::shared_ptr<std::vector<char>>
-
-/* Needed for file handling */
+#ifdef _WINRT_DLL
using namespace Windows::Storage::Streams;
using namespace Windows::Foundation;
@@ -63,6 +59,7 @@ typedef struct win_stream_struct_s
{
IRandomAccessStream^ stream;
} win_stream_struct;
+#endif
class muctx
{
@@ -82,22 +79,25 @@ public:
muctx(void);
~muctx(void);
void CleanUp(void);
- status_t InitializeStream(IRandomAccessStream^ readStream, char *ext);
int GetPageCount();
status_t InitializeContext();
status_t RenderPage(int page_num, unsigned char *bmp_data, int bmp_width,
int bmp_height, float scale, bool flipy);
status_t RenderPageMT(void *dlist, int page_width, int page_height,
unsigned char *bmp_data, int bmp_width, int bmp_height,
- float scale, bool flipy, bool tile, Point top_left,
- Point bottom_right);
+ float scale, bool flipy, bool tile, point_t top_left,
+ point_t bottom_right);
fz_display_list* CreateDisplayList(int page_num, int *width, int *height);
- int MeasurePage(int page_num, Point *size);
- Point MeasurePage(fz_page *page);
+ int MeasurePage(int page_num, point_t *size);
+ point_t MeasurePage(fz_page *page);
unsigned int GetLinks(int page_num, sh_vector_link links_vec);
int GetTextSearch(int page_num, char* needle, sh_vector_text texts_vec);
int GetContents(sh_vector_content contents_vec);
- String^ GetHTML(int page_num);
+ std::string GetHTML(int page_num);
bool RequiresPassword(void);
bool ApplyPassword(char* password);
+#ifdef _WINRT_DLL
+ status_t InitializeStream(IRandomAccessStream^ readStream, char *ext);
+#endif
+
};
diff --git a/platform/winrt/mupdfwinrt/mudocument.cpp b/platform/winrt/mupdfwinrt/mudocument.cpp
index b37b45aa..d73a5ed0 100644
--- a/platform/winrt/mupdfwinrt/mudocument.cpp
+++ b/platform/winrt/mupdfwinrt/mudocument.cpp
@@ -7,6 +7,7 @@
#include "pch.h"
#include "mudocument.h"
#include "status.h"
+#include "utils.h"
using namespace mupdfwinrt;
using namespace concurrency;
@@ -43,14 +44,18 @@ int mudocument::GetNumPages()
Point mudocument::GetPageSize(int page_num)
{
- Point size;
+ Point size_out;
+ point_t size;
mutex_lock.lock();
int code = this->mu_object.MeasurePage(page_num, &size);
mutex_lock.unlock();
if (code < 0)
throw ref new Exception(code, ref new String(L"Get Page Size Failed"));
- return size;
+
+ size_out.X = size.X;
+ size_out.Y = size.Y;
+ return size_out;
}
Windows::Foundation::IAsyncOperation<int>^ mudocument::OpenFileAsync(StorageFile^ file)
@@ -208,7 +213,8 @@ int mudocument::RenderPageBitmapSync(int page_num, int bmp_width, int bmp_height
}
code = mu_object.RenderPageMT(dlist, page_width, page_height,
&(bmp_data[0]), bmp_width, bmp_height,
- scale, flipy, tile, top_left, bottom_right);
+ scale, flipy, tile, { top_left.X, top_left.Y },
+ { bottom_right.X, bottom_right.Y });
}
else
{
@@ -323,8 +329,8 @@ unsigned int mudocument::ComputeLinks(int page_num)
return 0;
}
sh_link muctx_link = link_smart_ptr_vec->at(k);
- new_link->LowerRight = muctx_link->lower_right;
- new_link->UpperLeft = muctx_link->upper_left;
+ new_link->LowerRight = { (float) muctx_link->lower_right.X, (float) muctx_link->lower_right.Y };
+ new_link->UpperLeft = { (float) muctx_link->upper_left.X, (float) muctx_link->upper_left.Y };
new_link->PageNum = muctx_link->page_num;
new_link->Type = muctx_link->type;
if (new_link->Type == LINK_URI)
@@ -377,8 +383,8 @@ int mudocument::ComputeTextSearch(String^ text, int page_num)
return 0;
}
sh_text muctx_text = text_smart_ptr_vec->at(k);
- new_link->LowerRight = muctx_text->lower_right;
- new_link->UpperLeft = muctx_text->upper_left;
+ new_link->LowerRight = { (float) muctx_text->lower_right.X, (float) muctx_text->lower_right.Y };
+ new_link->UpperLeft = { (float) muctx_text->upper_left.X, (float) muctx_text->upper_left.Y };
new_link->Type = TEXTBOX;
this->textsearch->Append(new_link);
}
@@ -416,7 +422,7 @@ unsigned int mudocument::ComputeContents()
if (!has_content)
return 0;
- /* Pack into winRT type*/
+ /* Pack into winRT type */
this->contents = ref new Platform::Collections::Vector<ContentItem^>();
if (this->contents == nullptr)
return 0;
@@ -432,8 +438,8 @@ unsigned int mudocument::ComputeContents()
}
sh_content muctx_content = content_smart_ptr_vec->at(k);
new_content->Page = muctx_content->page;
- new_content->StringMargin = muctx_content->string_margin;
- new_content->StringOrig = muctx_content->string_orig;
+ new_content->StringMargin = char_to_String(muctx_content->string_margin.c_str());
+ new_content->StringOrig = char_to_String(muctx_content->string_orig.c_str());
this->contents->Append(new_content);
}
return num_items;
@@ -448,10 +454,13 @@ ContentItem^ mudocument::GetContent(unsigned int k)
String^ mudocument::ComputeHTML(int page_num)
{
- String^ html;
+ String^ html = nullptr;
+ std::string html_cstr;
mutex_lock.lock();
- html = mu_object.GetHTML(page_num);
+ html_cstr = mu_object.GetHTML(page_num);
mutex_lock.unlock();
+
+ html = char_to_String(html_cstr.c_str());
return html;
}
diff --git a/platform/winrt/mupdfwinrt/utils.cpp b/platform/winrt/mupdfwinrt/utils.cpp
index 38e11ada..9c20c620 100644
--- a/platform/winrt/mupdfwinrt/utils.cpp
+++ b/platform/winrt/mupdfwinrt/utils.cpp
@@ -2,7 +2,7 @@
#include "utils.h"
/* Window string hurdles.... */
-String^ char_to_String(char *char_in)
+String^ char_to_String(const char *char_in)
{
size_t size = MultiByteToWideChar(CP_UTF8, 0, char_in, -1, NULL, 0);
wchar_t *pw;
diff --git a/platform/winrt/mupdfwinrt/utils.h b/platform/winrt/mupdfwinrt/utils.h
index 6ffc7e20..78f4dbc4 100644
--- a/platform/winrt/mupdfwinrt/utils.h
+++ b/platform/winrt/mupdfwinrt/utils.h
@@ -3,5 +3,5 @@
#include "Windows.h"
using namespace Platform;
-String^ char_to_String(char *char_in);
+String^ char_to_String(const char *char_in);
char* String_to_char(String^ text);