Index: error.hpp
===================================================================
--- error.hpp	(revision 130)
+++ error.hpp	(working copy)
@@ -76,9 +76,16 @@
          * \param  error    error number
          */
         explicit std_error(std::string const& message, int error = errno)
-            : std::runtime_error((message + ": ") + strerror(error))
+            : std::runtime_error((message + ": ") + thread_safe_strerror(error))
         {
         }
+	private:
+		static std::string thread_safe_strerror(int error_num)
+		{
+			char buf[512];
+			strerror_s(buf, error_num);
+			return std::string(buf);
+		}
     };
 
 } // namespace png
Index: generator.hpp
===================================================================
--- generator.hpp	(revision 130)
+++ generator.hpp	(working copy)
@@ -168,7 +168,7 @@
             {
                 pixel_gen->reset(pass);
 
-                for (size_t pos = 0; pos < this->get_info().get_height(); ++pos)
+                for (uint_32 pos = 0; pos < this->get_info().get_height(); ++pos)
                 {
                     wr.write_row(pixel_gen->get_next_row(pos));
                 }
Index: image.hpp
===================================================================
--- image.hpp	(revision 130)
+++ image.hpp	(working copy)
@@ -104,7 +104,7 @@
         /**
          * \brief Constructs an empty image of specified width and height.
          */
-        image(size_t width, size_t height)
+        image(uint_32 width, uint_32 height)
             : m_info(make_image_info< pixel >())
         {
             resize(width, height);
@@ -310,12 +310,12 @@
             m_pixbuf = buffer;
         }
 
-        size_t get_width() const
+		uint_32 get_width() const
         {
             return m_pixbuf.get_width();
         }
 
-        size_t get_height() const
+		uint_32 get_height() const
         {
             return m_pixbuf.get_height();
         }
@@ -323,7 +323,7 @@
         /**
          * \brief Resizes the image pixel buffer.
          */
-        void resize(size_t width, size_t height)
+        void resize(uint_32 width, uint_32 height)
         {
             m_pixbuf.resize(width, height);
             m_info.set_width(width);
@@ -336,7 +336,7 @@
          *
          * \see pixel_buffer::get_row()
          */
-        row_access get_row(size_t index)
+        row_access get_row(uint_32 index)
         {
             return m_pixbuf.get_row(index);
         }
@@ -347,7 +347,7 @@
          *
          * \see pixel_buffer::get_row()
          */
-        row_const_access get_row(size_t index) const
+        row_const_access get_row(uint_32 index) const
         {
             return m_pixbuf.get_row(index);
         }
@@ -355,7 +355,7 @@
         /**
          * \brief The non-checking version of get_row() method.
          */
-        row_access operator[](size_t index)
+        row_access operator[](uint_32 index)
         {
             return m_pixbuf[index];
         }
@@ -363,7 +363,7 @@
         /**
          * \brief The non-checking version of get_row() method.
          */
-        row_const_access operator[](size_t index) const
+        row_const_access operator[](uint_32 index) const
         {
             return m_pixbuf[index];
         }
@@ -371,7 +371,7 @@
         /**
          * \brief Returns a pixel at (x,y) position.
          */
-        pixel get_pixel(size_t x, size_t y) const
+        pixel get_pixel(uint_32 x, uint_32 y) const
         {
             return m_pixbuf.get_pixel(x, y);
         }
@@ -379,7 +379,7 @@
         /**
          * \brief Replaces a pixel at (x,y) position.
          */
-        void set_pixel(size_t x, size_t y, pixel p)
+        void set_pixel(uint_32 x, uint_32 y, pixel p)
         {
             m_pixbuf.set_pixel(x, y, p);
         }
@@ -473,7 +473,7 @@
              * \brief Returns the starting address of a \c pos-th row
              * in the image's pixel buffer.
              */
-            byte* get_next_row(size_t pos)
+            byte* get_next_row(uint_32 pos)
             {
                 typedef typename pixbuf::row_traits row_traits;
                 return reinterpret_cast< byte* >
Index: image_info.hpp
===================================================================
--- image_info.hpp	(revision 130)
+++ image_info.hpp	(working copy)
@@ -63,22 +63,22 @@
         {
         }
 
-        size_t get_width() const
+		uint_32 get_width() const
         {
             return m_width;
         }
 
-        void set_width(size_t width)
+        void set_width(uint_32 width)
         {
             m_width = width;
         }
 
-        size_t get_height() const
+		uint_32 get_height() const
         {
             return m_height;
         }
 
-        void set_height(size_t height)
+        void set_height(uint_32 height)
         {
             m_height = height;
         }
@@ -93,12 +93,12 @@
             m_color_type = color_space;
         }
 
-        size_t get_bit_depth() const
+        byte get_bit_depth() const
         {
             return m_bit_depth;
         }
 
-        void set_bit_depth(size_t bit_depth)
+        void set_bit_depth(byte bit_depth)
         {
             m_bit_depth = bit_depth;
         }
@@ -174,7 +174,7 @@
     protected:
         uint_32 m_width;
         uint_32 m_height;
-        size_t m_bit_depth;
+        byte m_bit_depth;
         color_type m_color_type;
         interlace_type m_interlace_type;
         compression_type m_compression_type;
Index: info.hpp
===================================================================
--- info.hpp	(revision 130)
+++ info.hpp	(working copy)
@@ -105,7 +105,7 @@
                 {
                     png_set_PLTE(m_png, m_info,
                                  const_cast< color* >(& m_palette[0]),
-                                 m_palette.size());
+                                 (int)m_palette.size());
                 }
                 if (! m_tRNS.empty())
                 {
@@ -112,7 +112,7 @@
 #ifdef PNG_tRNS_SUPPORTED
                     png_set_tRNS(m_png, m_info,
                                  const_cast< byte* >(& m_tRNS[0]),
-                                 m_tRNS.size(),
+                                 (int)m_tRNS.size(),
                                  NULL);
 #else
                     throw error("attempted to write tRNS chunk; recompile with PNG_tRNS_SUPPORTED");
Index: io_base.hpp
===================================================================
--- io_base.hpp	(revision 130)
+++ io_base.hpp	(working copy)
@@ -117,22 +117,22 @@
         //////////////////////////////////////////////////////////////////////
         // info accessors
         //
-        size_t get_width() const
+		uint_32 get_width() const
         {
             return m_info.get_width();
         }
 
-        void set_width(size_t width)
+        void set_width(uint_32 width)
         {
             m_info.set_width(width);
         }
 
-        size_t get_height() const
+		uint_32 get_height() const
         {
             return m_info.get_height();
         }
 
-        void set_height(size_t height)
+        void set_height(uint_32 height)
         {
             m_info.set_height(height);
         }
@@ -147,12 +147,12 @@
             m_info.set_color_type(color_space);
         }
 
-        size_t get_bit_depth() const
+		byte get_bit_depth() const
         {
             return m_info.get_bit_depth();
         }
 
-        void set_bit_depth(size_t bit_depth)
+        void set_bit_depth(byte bit_depth)
         {
             m_info.set_bit_depth(bit_depth);
         }
Index: pixel_buffer.hpp
===================================================================
--- pixel_buffer.hpp	(revision 130)
+++ pixel_buffer.hpp	(working copy)
@@ -81,7 +81,7 @@
         /**
          * \brief Constructs an empty pixel buffer object.
          */
-        basic_pixel_buffer(size_t width, size_t height)
+        basic_pixel_buffer(uint_32 width, uint_32 height)
             : m_width(0),
               m_height(0)
         {
@@ -88,15 +88,15 @@
             resize(width, height);
         }
 
-        size_t get_width() const
+		uint_32 get_width() const
         {
             return m_width;
         }
 
-        size_t get_height() const
-        {
+		uint_32 get_height() const
+	    {
             return m_height;
-        }
+	    }
 
         /**
          * \brief Resizes the pixel buffer.
@@ -104,7 +104,7 @@
          * If new width or height is greater than the original,
          * expanded pixels are filled with value of \a pixel().
          */
-        void resize(size_t width, size_t height)
+        void resize(uint_32 width, uint_32 height)
         {
             m_width = width;
             m_height = height;
@@ -125,7 +125,7 @@
          * std::out_of_range is thrown if \c index is greater than \c
          * height.
          */
-        row_access get_row(size_t index)
+        row_access get_row(uint_32 index)
         {
             return m_rows.at(index);
         }
@@ -136,7 +136,7 @@
          *
          * The checking version.
          */
-        row_const_access get_row(size_t index) const
+        row_const_access get_row(uint_32 index) const
         {
             return m_rows.at(index);
         }
@@ -144,7 +144,7 @@
         /**
          * \brief The non-checking version of get_row() method.
          */
-        row_access operator[](size_t index)
+        row_access operator[](uint_32 index)
         {
             return m_rows[index];
         }
@@ -160,7 +160,7 @@
         /**
          * \brief Replaces the row at specified index.
          */
-        void put_row(size_t index, row_type const& r)
+        void put_row(uint_32 index, row_type const& r)
         {
             assert(r.size() == m_width);
             m_rows.at(index) = r;
@@ -169,7 +169,7 @@
         /**
          * \brief Returns a pixel at (x,y) position.
          */
-        pixel get_pixel(size_t x, size_t y) const
+        pixel get_pixel(uint_32 x, uint_32 y) const
         {
             return get_row(y).at(x);
         }
@@ -177,14 +177,14 @@
         /**
          * \brief Replaces a pixel at (x,y) position.
          */
-        void set_pixel(size_t x, size_t y, pixel p)
+        void set_pixel(uint_32 x, uint_32 y, pixel p)
         {
             get_row(y).at(x) = p;
         }
 
     protected:
-        size_t m_width;
-        size_t m_height;
+		uint_32 m_width;
+		uint_32 m_height;
         typedef std::vector< row_type > row_vec;
         row_vec m_rows;
     };
@@ -218,7 +218,7 @@
         {
         }
 
-        pixel_buffer(size_t width, size_t height)
+        pixel_buffer(uint_32 width, uint_32 height)
             : basic_pixel_buffer< pixel, std::vector< pixel > >(width, height)
         {
         }
Index: pixel_traits.hpp
===================================================================
--- pixel_traits.hpp	(revision 130)
+++ pixel_traits.hpp	(working copy)
@@ -57,7 +57,7 @@
               typename component,
               color_type pixel_color_type,
               size_t channels_value = sizeof(pixel) / sizeof(component),
-              size_t bit_depth_value = std::numeric_limits< component >::digits >
+              byte bit_depth_value = (byte)std::numeric_limits< component >::digits >
     struct basic_pixel_traits
     {
         typedef pixel pixel_type;
@@ -74,8 +74,8 @@
             return channels;
         }
         
-        static const size_t bit_depth = bit_depth_value;
-        static size_t get_bit_depth()
+        static const byte bit_depth = bit_depth_value;
+        static byte get_bit_depth()
         {
             return bit_depth;
         }
