summaryrefslogtreecommitdiff
path: root/winrt/mupdfwinrt
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2013-05-16 20:42:13 +0200
committerRobin Watts <robin.watts@artifex.com>2013-05-16 19:47:59 +0100
commitbd608dea4271ae256bad7dacee6acc605c2d6580 (patch)
tree3305952b198f66a2a877f1fc33f6efc0289543b8 /winrt/mupdfwinrt
parent0451cf6d814f172f6370b46553865c66d0933c14 (diff)
downloadmupdf-bd608dea4271ae256bad7dacee6acc605c2d6580.tar.xz
winrt: Strip trailing whitespace.
Diffstat (limited to 'winrt/mupdfwinrt')
-rw-r--r--winrt/mupdfwinrt/ContentItem.h2
-rw-r--r--winrt/mupdfwinrt/Links.h4
-rw-r--r--winrt/mupdfwinrt/muctx.cpp26
-rw-r--r--winrt/mupdfwinrt/muctx.h14
-rw-r--r--winrt/mupdfwinrt/mudocument.cpp26
-rw-r--r--winrt/mupdfwinrt/mudocument.h12
6 files changed, 42 insertions, 42 deletions
diff --git a/winrt/mupdfwinrt/ContentItem.h b/winrt/mupdfwinrt/ContentItem.h
index ec2e2121..90069459 100644
--- a/winrt/mupdfwinrt/ContentItem.h
+++ b/winrt/mupdfwinrt/ContentItem.h
@@ -24,7 +24,7 @@ namespace mupdfwinrt {
void set(int value)
{
if (value < 0)
- throw ref new Platform::InvalidArgumentException();
+ throw ref new Platform::InvalidArgumentException();
page = value;
}
}
diff --git a/winrt/mupdfwinrt/Links.h b/winrt/mupdfwinrt/Links.h
index 00a08f73..bb5b87bb 100644
--- a/winrt/mupdfwinrt/Links.h
+++ b/winrt/mupdfwinrt/Links.h
@@ -13,7 +13,7 @@ namespace mupdfwinrt
Point upper_left;
Point lower_right;
Windows::Foundation::Uri ^uri;
- int page_num;
+ int page_num;
public:
Links(void);
@@ -27,7 +27,7 @@ namespace mupdfwinrt
void set(int value)
{
if (value > NOT_SET)
- throw ref new Platform::InvalidArgumentException();
+ throw ref new Platform::InvalidArgumentException();
type = value;
}
}
diff --git a/winrt/mupdfwinrt/muctx.cpp b/winrt/mupdfwinrt/muctx.cpp
index 8651ffa5..f855e1b3 100644
--- a/winrt/mupdfwinrt/muctx.cpp
+++ b/winrt/mupdfwinrt/muctx.cpp
@@ -52,10 +52,10 @@ static void win_seek_file(fz_stream *stm, int offset, int whence)
unsigned long long length = Stream->Size;
unsigned long long n;
- if (whence == SEEK_END)
+ if (whence == SEEK_END)
{
n = length + offset;
- }
+ }
else if (whence == SEEK_CUR)
{
n = curr_pos + offset;
@@ -63,7 +63,7 @@ static void win_seek_file(fz_stream *stm, int offset, int whence)
else if (whence == SEEK_SET)
{
n = offset;
- }
+ }
Stream->Seek(n);
curr_pos = Stream->Position;
stm->pos = n;
@@ -174,7 +174,7 @@ HRESULT muctx::InitializeStream(IRandomAccessStream^ readStream, char *ext)
this->mu_stream = fz_new_stream(mu_ctx, 0, win_read_file, win_close_file);
this->mu_stream->seek = win_seek_file;
this->mu_stream->state = reinterpret_cast <void*> (&win_stream);
-
+
/* Now lets see if we can open the file */
mu_doc = fz_open_document_with_stream(mu_ctx, ext, this->mu_stream);
@@ -223,7 +223,7 @@ Point muctx::MeasurePage(fz_page *page)
return pageSize;
}
-void muctx::FlattenOutline(fz_outline *outline, int level,
+void muctx::FlattenOutline(fz_outline *outline, int level,
sh_vector_content contents_vec)
{
char indent[8*4+1];
@@ -246,7 +246,7 @@ void muctx::FlattenOutline(fz_outline *outline, int level,
sh_content content_item(new content_t());
content_item->page = page;
content_item->string_orig = char_to_String(outline->title);
- content_item->string_margin =
+ content_item->string_margin =
str_indent->Concat(indent_str, content_item->string_orig);
contents_vec->push_back(content_item);
}
@@ -262,7 +262,7 @@ int muctx::GetContents(sh_vector_content contents_vec)
fz_context *ctx_clone = NULL;
int has_content = 0;
- if (mu_cookie->abort == 1)
+ if (mu_cookie->abort == 1)
return has_content;
ctx_clone = fz_clone_context(mu_ctx);
@@ -303,13 +303,13 @@ int muctx::GetTextSearch(int page_num, char* needle, sh_vector_text texts_vec)
int hit_count = 0;
int k;
- if (mu_cookie->abort == 1)
+ if (mu_cookie->abort == 1)
return hit_count;
ctx_clone = fz_clone_context(mu_ctx);
fz_var(page);
- fz_var(sheet);
+ fz_var(sheet);
fz_var(dev);
fz_try(ctx_clone)
{
@@ -369,7 +369,7 @@ int muctx::GetLinks(int page_num, sh_vector_link links_vec)
int k = 0;
int num_links = 0;
- if (mu_cookie->abort == 1)
+ if (mu_cookie->abort == 1)
return num_links;
ctx_clone = fz_clone_context(mu_ctx);
@@ -444,7 +444,7 @@ int muctx::GetLinks(int page_num, sh_vector_link links_vec)
}
/* Render page_num to size width by height into bmp_data buffer */
-HRESULT muctx::RenderPage(int page_num, int width, int height,
+HRESULT muctx::RenderPage(int page_num, int width, int height,
unsigned char *bmp_data)
{
fz_device *dev = NULL;
@@ -454,7 +454,7 @@ HRESULT muctx::RenderPage(int page_num, int width, int height,
Point page_size;
fz_context *ctx_clone = NULL;
- if (mu_cookie->abort == 1)
+ if (mu_cookie->abort == 1)
return S_OK;
ctx_clone = fz_clone_context(mu_ctx);
@@ -525,7 +525,7 @@ String^ muctx::GetHTML(int page_num)
fz_buffer *buf = NULL;
String^ html;
- if (mu_cookie->abort == 1)
+ if (mu_cookie->abort == 1)
return nullptr;
ctx_clone = fz_clone_context(mu_ctx);
diff --git a/winrt/mupdfwinrt/muctx.h b/winrt/mupdfwinrt/muctx.h
index c43c7404..c2a49ae1 100644
--- a/winrt/mupdfwinrt/muctx.h
+++ b/winrt/mupdfwinrt/muctx.h
@@ -20,7 +20,7 @@ extern "C" {
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
+/* These are the std objects used to interface to muctx. We do use windows
String and Point types however */
/* Links */
@@ -33,7 +33,7 @@ typedef struct document_link_s
int page_num;
} document_link_t;
#define sh_link std::shared_ptr<document_link_t>
-#define sh_vector_link std::shared_ptr<std::vector<sh_link>>
+#define sh_vector_link std::shared_ptr<std::vector<sh_link>>
/* Text Search */
typedef struct text_search_s
@@ -42,7 +42,7 @@ typedef struct text_search_s
Point 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>>
+#define sh_vector_text std::shared_ptr<std::vector<sh_text>>
/* Content Results */
typedef struct content_s
@@ -52,10 +52,10 @@ typedef struct content_s
String^ string_margin;
} content_t;
#define sh_content std::shared_ptr<content_t>
-#define sh_vector_content std::shared_ptr<std::vector<sh_content>>
+#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>>
+#define sh_vector_char std::shared_ptr<std::vector<char>>
/* Needed for file handling */
using namespace Windows::Storage::Streams;
@@ -78,7 +78,7 @@ private:
fz_rect mu_hit_bbox[MAX_SEARCH];
fz_cookie *mu_cookie;
fz_stream *mu_stream;
- void FlattenOutline(fz_outline *outline, int level,
+ void FlattenOutline(fz_outline *outline, int level,
sh_vector_content contents_vec);
public:
@@ -86,7 +86,7 @@ public:
~muctx(void);
void CleanUp(void);
HRESULT InitializeStream(IRandomAccessStream^ readStream, char *ext);
- int GetPageCount();
+ int GetPageCount();
HRESULT InitializeContext();
HRESULT RenderPage(int page_num, int width, int height, unsigned char *bmp_data);
Point MeasurePage(int page_num);
diff --git a/winrt/mupdfwinrt/mudocument.cpp b/winrt/mupdfwinrt/mudocument.cpp
index ec661b27..2779bb25 100644
--- a/winrt/mupdfwinrt/mudocument.cpp
+++ b/winrt/mupdfwinrt/mudocument.cpp
@@ -1,7 +1,7 @@
// mudocument.cpp
-/* This file contains the interface between the muctx class, which
- implements the mupdf calls and the WinRT objects enabling calling from
+/* This file contains the interface between the muctx class, which
+ implements the mupdf calls and the WinRT objects enabling calling from
C#, C++, Visual Basic, JavaScript applications */
#include "pch.h"
@@ -38,7 +38,7 @@ int mudocument::GetNumPages()
}
Point mudocument::GetPageSize(int page_num)
-{
+{
std::lock_guard<std::mutex> lock(mutex_lock);
return this->mu_object.MeasurePage(page_num);
}
@@ -56,14 +56,14 @@ Windows::Foundation::IAsyncAction^ mudocument::OpenFileAsync(StorageFile^ file)
char *ext = strrchr(name, '.');
auto t = create_task(file->OpenAsync(FileAccessMode::Read));
-
+
return t.then([this, file, ext](task<IRandomAccessStream^> task)
{
try
{
IRandomAccessStream^ readStream = task.get();
UINT64 const size = readStream->Size;
-
+
if (size <= MAXUINT32)
{
HRESULT code = this->mu_object.InitializeStream(readStream, ext);
@@ -71,7 +71,7 @@ Windows::Foundation::IAsyncAction^ mudocument::OpenFileAsync(StorageFile^ file)
}
else
{
- delete readStream;
+ delete readStream;
return;
}
}
@@ -158,7 +158,7 @@ Windows::Foundation::IAsyncOperationWithProgress<int, double>^
}
/* Pack the page into a bmp stream */
-Windows::Foundation::IAsyncOperation<InMemoryRandomAccessStream^>^
+Windows::Foundation::IAsyncOperation<InMemoryRandomAccessStream^>^
mudocument::RenderPageAsync(int page_num, int width, int height)
{
return create_async([this, width, height, page_num](cancellation_token ct) -> InMemoryRandomAccessStream^
@@ -171,12 +171,12 @@ Windows::Foundation::IAsyncOperation<InMemoryRandomAccessStream^>^
/* Go ahead and write our header data into the memory stream */
Prepare_bmp(width, height, dw);
-
+
std::lock_guard<std::mutex> lock(mutex_lock);
/* Get raster bitmap stream */
- HRESULT code = mu_object.RenderPage(page_num, width, height, &(bmp_data[0]));
- if (code != S_OK)
+ HRESULT code = mu_object.RenderPage(page_num, width, height, &(bmp_data[0]));
+ if (code != S_OK)
{
throw ref new FailureException("Page Rendering Failed");
}
@@ -204,7 +204,7 @@ int mudocument::ComputeLinks(int page_num)
this->links = ref new Platform::Collections::Vector<Links^>();
for (int k = 0; k < num_items; k++)
{
- auto new_link = ref new Links();
+ auto new_link = ref new Links();
sh_link muctx_link = link_smart_ptr_vec->at(k);
new_link->LowerRight = muctx_link->lower_right;
new_link->UpperLeft = muctx_link->upper_left;
@@ -243,7 +243,7 @@ int mudocument::ComputeTextSearch(String^ text, int page_num)
this->textsearch = ref new Platform::Collections::Vector<Links^>();
for (int k = 0; k < num_items; k++)
{
- auto new_link = ref new Links();
+ auto new_link = ref new Links();
sh_text muctx_text = text_smart_ptr_vec->at(k);
new_link->LowerRight = muctx_text->lower_right;
new_link->UpperLeft = muctx_text->upper_left;
@@ -289,7 +289,7 @@ int mudocument::ComputeContents()
for (int k = 0; k < num_items; k++)
{
- auto new_content = ref new ContentItem();
+ auto new_content = ref new ContentItem();
sh_content muctx_content = content_smart_ptr_vec->at(k);
new_content->Page = muctx_content->page;
new_content->StringMargin = muctx_content->string_margin;
diff --git a/winrt/mupdfwinrt/mudocument.h b/winrt/mupdfwinrt/mudocument.h
index d9bd7c1f..9f4911f5 100644
--- a/winrt/mupdfwinrt/mudocument.h
+++ b/winrt/mupdfwinrt/mudocument.h
@@ -1,7 +1,7 @@
#pragma once
-/* This file contains the interface between the muctx class, which
- implements the mupdf calls and the WinRT objects enabling calling from
+/* This file contains the interface between the muctx class, which
+ implements the mupdf calls and the WinRT objects enabling calling from
C#, C++, and JavaScript applications */
#include "muctx.h"
@@ -26,7 +26,7 @@ namespace mupdfwinrt
{
private:
muctx mu_object;
- std::mutex mutex_lock;
+ std::mutex mutex_lock;
Platform::Collections::Vector<Links^>^ links;
Platform::Collections::Vector<Links^>^ textsearch;
Platform::Collections::Vector<ContentItem^>^ contents;
@@ -36,11 +36,11 @@ namespace mupdfwinrt
Windows::Foundation::IAsyncAction^ OpenFileAsync(StorageFile^ file);
int GetNumPages(void);
Point GetPageSize(int page_num);
- Windows::Foundation::IAsyncOperation<InMemoryRandomAccessStream^>^
+ Windows::Foundation::IAsyncOperation<InMemoryRandomAccessStream^>^
RenderPageAsync(int page_num, int width, int height);
- Windows::Foundation::IAsyncOperationWithProgress<int, double>^
+ Windows::Foundation::IAsyncOperationWithProgress<int, double>^
SearchDocumentWithProgressAsync(String^ textToFind, int dir, int start_page);
- String^ ComputeHTML(int page_num);
+ String^ ComputeHTML(int page_num);
int ComputeTextSearch(String^ text, int page_num);
Links^ GetTextSearch(int k);
int TextSearchCount(void);