-Woverflow fixes
diff --git a/cpp/poppler-private.cpp b/cpp/poppler-private.cpp
index 60dff14..62940c0 100644
--- a/cpp/poppler-private.cpp
+++ b/cpp/poppler-private.cpp
@@ -106,8 +106,8 @@
     const size_t len = str.size() * 2 + 2;
     const ustring::value_type *me = str.data();
     byte_array ba(len);
-    ba[0] = 0xfe;
-    ba[1] = 0xff;
+    ba[0] = (char)0xfe;
+    ba[1] = (char)0xff;
     for (size_t i = 0; i < str.size(); ++i, ++me) {
         ba[i * 2 + 2] = ((*me >> 8) & 0xff);
         ba[i * 2 + 3] = (*me & 0xff);
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 157a048..41b6a04 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -758,8 +758,7 @@
   g_free (utf16);
 
   if (!result->hasUnicodeMarker()) {
-    result->insert(0, 0xff);
-    result->insert(0, 0xfe);
+    result->prependUnicodeMarker();
   }
 
   return result;
diff --git a/goo/GooString.cc b/goo/GooString.cc
index 12592e4..f76e7d1 100644
--- a/goo/GooString.cc
+++ b/goo/GooString.cc
@@ -917,6 +917,12 @@
   return length > 1 && (s[0] & 0xff) == 0xfe && (s[1] & 0xff) == 0xff;
 }
 
+void GooString::prependUnicodeMarker()
+{
+    insert(0, (char)0xff);
+    insert(0, (char)0xfe);
+}
+
 GooString *GooString::sanitizedName(GBool psmode)
 {
   GooString *name;
diff --git a/goo/GooString.h b/goo/GooString.h
index de70497..5d17ec8 100644
--- a/goo/GooString.h
+++ b/goo/GooString.h
@@ -161,6 +161,7 @@
   GBool endsWith(const char *suffix) const;
 
   GBool hasUnicodeMarker(void) const;
+  void prependUnicodeMarker();
   GBool hasJustUnicodeMarker(void) const { return length == 2 && hasUnicodeMarker(); }
 
   // Sanitizes the string so that it does
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 8798567..8326103 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -1398,8 +1398,7 @@
     contents = new GooString(new_content);
     //append the unicode marker <FE FF> if needed	
     if (!contents->hasUnicodeMarker()) {
-      contents->insert(0, 0xff);
-      contents->insert(0, 0xfe);
+      contents->prependUnicodeMarker();
     }
   } else {
     contents = new GooString();
@@ -1987,8 +1986,7 @@
     label = new GooString(new_label);
     //append the unicode marker <FE FF> if needed
     if (!label->hasUnicodeMarker()) {
-      label->insert(0, 0xff);
-      label->insert(0, 0xfe);
+      label->prependUnicodeMarker();
     }
   } else {
     label = new GooString();
@@ -2764,8 +2762,7 @@
     styleString = new GooString(new_string);
     //append the unicode marker <FE FF> if needed
     if (!styleString->hasUnicodeMarker()) {
-      styleString->insert(0, 0xff);
-      styleString->insert(0, 0xfe);
+      styleString->prependUnicodeMarker();
     }
   } else {
     styleString = new GooString();
diff --git a/poppler/Form.cc b/poppler/Form.cc
index 15c31e6..83bceb2 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -60,8 +60,8 @@
   char *result = new char[(*length)];
   char *cstring = orig->getCString();
   //unicode marker
-  result[0] = 0xfe;
-  result[1] = 0xff;
+  result[0] = (char)0xfe;
+  result[1] = (char)0xff;
   //convert to utf16
   for(int i=2,j=0; i<(*length); i+=2,j++) {
     Unicode u = pdfDocEncoding[(unsigned int)((unsigned char)cstring[j])]&0xffff;
@@ -918,8 +918,7 @@
   }
   
   if (unicode_encoded) {
-    full_name->insert(0, 0xff);
-    full_name->insert(0, 0xfe);
+    full_name->prependUnicodeMarker();
   }
 
   fullyQualifiedName = full_name;
@@ -1182,8 +1181,7 @@
 
     //append the unicode marker <FE FF> if needed
     if (!content->hasUnicodeMarker()) {
-      content->insert(0, 0xff);
-      content->insert(0, 0xfe);
+      content->prependUnicodeMarker();
     }
   }
 
@@ -1539,8 +1537,7 @@
 
     //append the unicode marker <FE FF> if needed
     if (!editedChoice->hasUnicodeMarker()) {
-      editedChoice->insert(0, 0xff);
-      editedChoice->insert(0, 0xfe);
+      editedChoice->prependUnicodeMarker();
     }
   }
   updateSelection();
diff --git a/qt4/src/poppler-private.cc b/qt4/src/poppler-private.cc
index 6c4d782..4ff68f9 100644
--- a/qt4/src/poppler-private.cc
+++ b/qt4/src/poppler-private.cc
@@ -132,8 +132,8 @@
     GooString *QStringToUnicodeGooString(const QString &s) {
         int len = s.length() * 2 + 2;
         char *cstring = (char *)gmallocn(len, sizeof(char));
-        cstring[0] = 0xfe;
-        cstring[1] = 0xff;
+        cstring[0] = (char)0xfe;
+        cstring[1] = (char)0xff;
         for (int i = 0; i < s.length(); ++i)
         {
             cstring[2+i*2] = s.at(i).row();
diff --git a/qt5/src/poppler-private.cc b/qt5/src/poppler-private.cc
index dced8b9..1540a66 100644
--- a/qt5/src/poppler-private.cc
+++ b/qt5/src/poppler-private.cc
@@ -132,8 +132,8 @@
     GooString *QStringToUnicodeGooString(const QString &s) {
         int len = s.length() * 2 + 2;
         char *cstring = (char *)gmallocn(len, sizeof(char));
-        cstring[0] = 0xfe;
-        cstring[1] = 0xff;
+        cstring[0] = (char)0xfe;
+        cstring[1] = (char)0xff;
         for (int i = 0; i < s.length(); ++i)
         {
             cstring[2+i*2] = s.at(i).row();