diff --git a/source/lib/precompiled.cpp b/source/lib/precompiled.cpp index c08ca1f138..5f656a45da 100755 --- a/source/lib/precompiled.cpp +++ b/source/lib/precompiled.cpp @@ -1 +1 @@ -#include "precompiled.h" \ No newline at end of file +#include "precompiled.h" diff --git a/source/lib/precompiled.h b/source/lib/precompiled.h index 8676c0f304..fa2138c5ff 100755 --- a/source/lib/precompiled.h +++ b/source/lib/precompiled.h @@ -24,4 +24,6 @@ #ifdef _MSC_VER #pragma warning(disable:4996) // function is deprecated #pragma warning(disable:4786) // identifier truncated to 255 chars -#endif \ No newline at end of file +#endif + +#include "config.h" diff --git a/source/lib/res/file.cpp b/source/lib/res/file.cpp index 1d6382f2bd..3c514d50eb 100755 --- a/source/lib/res/file.cpp +++ b/source/lib/res/file.cpp @@ -511,7 +511,9 @@ ssize_t ll_wait_io(ll_cb* lcb, void*& p) while(aio_error(cb) == EINPROGRESS) aio_suspend(&cb, 1, NULL); - p = cb->aio_buf; + // posix has aio_buf as volatile void, and gcc doesn't like to cast it + // implicitly + p = (void *)cb->aio_buf; // return how much was actually transferred, // or -1 if the transfer failed. diff --git a/source/lib/res/file.h b/source/lib/res/file.h index a6f01275d5..ceed212078 100755 --- a/source/lib/res/file.h +++ b/source/lib/res/file.h @@ -107,4 +107,4 @@ extern ssize_t file_io(File* f, size_t ofs, size_t size, void** p, FILE_IO_CB cb = 0, uintptr_t ctx = 0); -#endif // #ifndef FILE_H \ No newline at end of file +#endif // #ifndef FILE_H diff --git a/source/lib/res/mem.cpp b/source/lib/res/mem.cpp index 158a9b9063..3aa7e8daa7 100755 --- a/source/lib/res/mem.cpp +++ b/source/lib/res/mem.cpp @@ -305,4 +305,4 @@ ssize_t mem_size(void* p) Handle hm = find_alloc(p); H_DEREF(hm, Mem, m); return (ssize_t)m->size; -} \ No newline at end of file +} diff --git a/source/lib/res/res.cpp b/source/lib/res/res.cpp index bdae50146e..3f6428348f 100755 --- a/source/lib/res/res.cpp +++ b/source/lib/res/res.cpp @@ -13,4 +13,4 @@ int res_reload(const char* const fn) // purpose of this routine (intended to be called once a frame): // file notification may come at any time. by forcing the reloads -// to take place here, we don't require everything to be thread-safe. \ No newline at end of file +// to take place here, we don't require everything to be thread-safe. diff --git a/source/lib/res/res.h b/source/lib/res/res.h index 28fb6a7050..fa2bc04d65 100755 --- a/source/lib/res/res.h +++ b/source/lib/res/res.h @@ -6,4 +6,4 @@ #include "res/file.h" #include "res/zip.h" -extern int res_reload(const char* fn); \ No newline at end of file +extern int res_reload(const char* fn); diff --git a/source/lib/res/tex.cpp b/source/lib/res/tex.cpp index e17c9a9583..b1bf8bfb9a 100755 --- a/source/lib/res/tex.cpp +++ b/source/lib/res/tex.cpp @@ -39,9 +39,13 @@ #define WINAPIV __cdecl #ifndef NO_PNG -# include -# ifdef _MSC_VER -# pragma comment(lib, "libpng10.lib") +# ifdef _WIN32 +# include +# else +# include +# ifdef _MSC_VER +# pragma comment(lib, "libpng10.lib") +# endif # endif #endif @@ -126,7 +130,7 @@ DDSURFACEDESC2; static inline bool dds_valid(const u8* ptr, size_t size) { UNUSED(size) // only need first 4 chars - + return *(u32*)ptr == FOURCC('D','D','S',' '); } diff --git a/source/lib/res/vfs.h b/source/lib/res/vfs.h index cb954a6e42..4dd19f89c7 100755 --- a/source/lib/res/vfs.h +++ b/source/lib/res/vfs.h @@ -88,4 +88,4 @@ enum }; -#endif // #ifndef __VFS_H__ \ No newline at end of file +#endif // #ifndef __VFS_H__ diff --git a/source/lib/timer.cpp b/source/lib/timer.cpp index 213d0936b3..a486dfc6f4 100755 --- a/source/lib/timer.cpp +++ b/source/lib/timer.cpp @@ -57,7 +57,7 @@ double get_time() gettimeofday(&start, 0); gettimeofday(&cur, 0); - t = (cur.tv_sec - start.tv_sec) + (cur.tv_nsec - start.tv_nsec)*1e-6; + t = (cur.tv_sec - start.tv_sec) + (cur.tv_usec - start.tv_usec)*1e-6; #else diff --git a/source/lib/types.h b/source/lib/types.h index cd270dcb6b..7669da2741 100755 --- a/source/lib/types.h +++ b/source/lib/types.h @@ -7,9 +7,12 @@ // defines instead of typedefs so we can #undef conflicting decls -#define ulong unsigned long - -#define uint unsigned int +// Workaround: GCC won't parse constructor-casts with multi-word types, while +// visual studio will. Define uint/long to a namespaced one-word typedef. +typedef unsigned long PS_ulong; +typedef unsigned int PS_uint; +#define ulong PS_ulong +#define uint PS_uint #define i8 int8_t #define i16 int16_t diff --git a/source/ps/CStr.cpp b/source/ps/CStr.cpp index dba33d1ea1..dde8dc86f5 100755 --- a/source/ps/CStr.cpp +++ b/source/ps/CStr.cpp @@ -83,7 +83,7 @@ int CStr::ToInt() const unsigned int CStr::ToUInt() const { - return unsigned int(_ttoi(m_String.c_str())); + return uint(_ttoi(m_String.c_str())); } long CStr::ToLong() const @@ -93,7 +93,7 @@ long CStr::ToLong() const unsigned long CStr::ToULong() const { - return unsigned long(_ttol(m_String.c_str())); + return ulong(_ttol(m_String.c_str())); } @@ -446,4 +446,4 @@ const u8 *CStr::Deserialize(const u8 *buffer, const u8 *bufferend) return NULL; *this=(char *)buffer; return strend+1; -} \ No newline at end of file +} diff --git a/source/ps/Encryption.h b/source/ps/Encryption.h index 7b10cc7a19..ee5856d329 100755 --- a/source/ps/Encryption.h +++ b/source/ps/Encryption.h @@ -27,4 +27,4 @@ char *EncryptData(char *Data, long DataLength, char *Key, long KeyLength); // Simple Decryption function char *DecryptData(char *Data, long DataLength, char *Key, long KeyLength); -#endif \ No newline at end of file +#endif diff --git a/source/ps/FilePacker.h b/source/ps/FilePacker.h index 140f751f88..0a0724e521 100755 --- a/source/ps/FilePacker.h +++ b/source/ps/FilePacker.h @@ -40,4 +40,4 @@ private: std::vector m_Data; }; -#endif \ No newline at end of file +#endif diff --git a/source/ps/FileUnpacker.h b/source/ps/FileUnpacker.h index 8160000a76..1a93c9efe6 100755 --- a/source/ps/FileUnpacker.h +++ b/source/ps/FileUnpacker.h @@ -53,4 +53,4 @@ private: u32 m_Version; }; -#endif \ No newline at end of file +#endif diff --git a/source/ps/LogFile.h b/source/ps/LogFile.h index acd844680b..3636e4a428 100755 --- a/source/ps/LogFile.h +++ b/source/ps/LogFile.h @@ -152,4 +152,4 @@ private: }; -#endif \ No newline at end of file +#endif diff --git a/source/ps/Prometheus.h b/source/ps/Prometheus.h index 2ae1391e1a..84b295d2f8 100755 --- a/source/ps/Prometheus.h +++ b/source/ps/Prometheus.h @@ -57,4 +57,4 @@ inline bool ErrorMechanism_Error(); #define GetError() GError.ErrorMechanism_GetError() -#endif \ No newline at end of file +#endif diff --git a/source/ps/Singleton.h b/source/ps/Singleton.h index 8e202bdabe..21d97fcf48 100755 --- a/source/ps/Singleton.h +++ b/source/ps/Singleton.h @@ -61,4 +61,4 @@ class Singleton template T* Singleton::ms_singleton = 0; -#endif \ No newline at end of file +#endif diff --git a/source/ps/Vector2D.h b/source/ps/Vector2D.h index e85f819b74..3b7f650362 100755 --- a/source/ps/Vector2D.h +++ b/source/ps/Vector2D.h @@ -96,4 +96,4 @@ public: } }; -#endif \ No newline at end of file +#endif