From d86f713aa45bb6c81c8e43f1b1e15887f649929c Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Sun, 7 Jun 2015 12:49:19 +0300 Subject: [PATCH] Eliminate sloppy types from headers This should give identical layouts on all platforms (modulo 32/64 bit) --- include/interface/c-interface.h | 3 ++- include/library/httpreq.hpp | 4 ++-- include/library/loadlib.hpp | 8 -------- include/library/zip.hpp | 14 +++++++------- src/library/httpreq.cpp | 2 +- src/library/loadlib.cpp | 4 ++++ 6 files changed, 16 insertions(+), 19 deletions(-) diff --git a/include/interface/c-interface.h b/include/interface/c-interface.h index 51bbd399..201c2f94 100644 --- a/include/interface/c-interface.h +++ b/include/interface/c-interface.h @@ -51,6 +51,7 @@ THE SOFTWARE. * - If you only have one region, use ID of 0 for that and GET_REGION/SET_REGION are not needed. */ +#include #include #include @@ -212,7 +213,7 @@ struct lsnes_core_fontrender_req //Input: Text to render (UTF-8). const char* text; //Input: Length of text in bytes. If negative, text is null-terminated. - long text_len; + ssize_t text_len; //Input: Bytes per pixel to request. Can be 1, 2, 3 or 4. unsigned bytes_pp; //Input: Foreground color (native endian). diff --git a/include/library/httpreq.hpp b/include/library/httpreq.hpp index c6176fcb..0786b63c 100644 --- a/include/library/httpreq.hpp +++ b/include/library/httpreq.hpp @@ -119,7 +119,7 @@ public: /** * Get final code. */ - long get_http_code(); + uint32_t get_http_code(); private: static int progress(void* userdata, double dltotal, double dlnow, double ultotal, double ulnow); int _progress(double dltotal, double dlnow, double ultotal, double ulnow); @@ -145,7 +145,7 @@ struct http_async_request int64_t final_dl; //Final amount downloaded (OUTPUT). int64_t final_ul; //Final amound uploaded (OUTPUT). std::string errormsg; //Final error (OUTPUT). - long http_code; //HTTP error code (OUTPUT). + uint32_t http_code; //HTTP error code (OUTPUT). volatile bool finished; //Finished flag (semi-transient). threads::cv finished_cond; //This condition variable is fired on finish. http_request* req; //The HTTP request object (TRANSIENT). diff --git a/include/library/loadlib.hpp b/include/library/loadlib.hpp index 6f858dbe..16c98161 100644 --- a/include/library/loadlib.hpp +++ b/include/library/loadlib.hpp @@ -7,10 +7,6 @@ #include #include "threads.hpp" -#if defined(_WIN32) || defined(_WIN64) -#include -#endif - namespace loadlib { threads::lock& global_mutex(); @@ -117,11 +113,7 @@ private: void* operator[](const std::string& symbol) const throw(std::bad_alloc, std::runtime_error); internal(const internal&); internal& operator=(const internal&); -#if defined(_WIN32) || defined(_WIN64) - HMODULE handle; -#elif !defined(NO_DLFCN) void* handle; -#endif size_t refs; std::string libname; void mark(const void* obj) { marked.insert(obj); } diff --git a/include/library/zip.hpp b/include/library/zip.hpp index 153645f9..fce5c938 100644 --- a/include/library/zip.hpp +++ b/include/library/zip.hpp @@ -145,12 +145,12 @@ public: /** * This iterator iterates members of ZIP archive in forward order. */ - typedef iterator_class::iterator, std::string> iterator; + typedef iterator_class::iterator, std::string> iterator; /** * This iterator iterates members of ZIP archive in reverse order */ - typedef iterator_class::reverse_iterator, std::string> + typedef iterator_class::reverse_iterator, std::string> riterator; /** @@ -278,7 +278,7 @@ public: private: reader(reader&); reader& operator=(reader&); - std::map offsets; + std::map offsets; std::ifstream* zipstream; size_t* refcnt; }; @@ -421,10 +421,10 @@ public: private: struct file_info { - unsigned long crc; - unsigned long uncompressed_size; - unsigned long compressed_size; - unsigned long offset; + uint32_t crc; + uint32_t uncompressed_size; + uint32_t compressed_size; + uint32_t offset; }; writer(writer&); diff --git a/src/library/httpreq.cpp b/src/library/httpreq.cpp index 9b562335..f0c60264 100644 --- a/src/library/httpreq.cpp +++ b/src/library/httpreq.cpp @@ -213,7 +213,7 @@ void http_request::get_xfer_status(int64_t& dnow, int64_t& dtotal, int64_t& unow utotal = ultotal; } -long http_request::get_http_code() +uint32_t http_request::get_http_code() { long ret = 0; curl_easy_getinfo((CURL*)handle, CURLINFO_RESPONSE_CODE, &ret); diff --git a/src/library/loadlib.cpp b/src/library/loadlib.cpp index 6075ea5b..512fe6b5 100644 --- a/src/library/loadlib.cpp +++ b/src/library/loadlib.cpp @@ -3,6 +3,10 @@ #include #include +#if defined(_WIN32) || defined(_WIN64) +#include +#endif + #if !defined(NO_DLFCN) && !defined(_WIN32) && !defined(_WIN64) #include #include -- 2.11.4.GIT