Преглед изворни кода

Replaced unavailable include with struct definition for Xbox One

It appears this file was including winsock2.h just to get the timeval struct definition. There are platforms, such as Xbox One, that don't use winsock but do compile with _MSC_VER set, so just drop in the struct definition we needed instead of including all of winsock. This fixes compilation of this file for Xbox One. Without this change, there were numerous `timeval` complaints such as
```
1>c:\dev\protobuf\src\google\protobuf\util\time_util.h(153): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (compiling source file C:\dev\protobuf\src\google\protobuf\util\time_util.cc)
1>c:\dev\protobuf\src\google\protobuf\util\time_util.h(153): error C2143: syntax error: missing ',' before '&' (compiling source file C:\dev\protobuf\src\google\protobuf\util\time_util.cc)
```
etc.
Parnic пре 6 година
родитељ
комит
3691c172c9
1 измењених фајлова са 7 додато и 0 уклоњено
  1. 7 0
      src/google/protobuf/util/time_util.h

+ 7 - 0
src/google/protobuf/util/time_util.h

@@ -37,7 +37,14 @@
 #include <ostream>
 #include <ostream>
 #include <string>
 #include <string>
 #ifdef _MSC_VER
 #ifdef _MSC_VER
+#ifdef _XBOX_ONE
+struct timeval {
+	long    tv_sec;         /* seconds */
+	long    tv_usec;        /* and microseconds */
+};
+#else
 #include <winsock2.h>
 #include <winsock2.h>
+#endif // _XBOX_ONE
 #else
 #else
 #include <sys/time.h>
 #include <sys/time.h>
 #endif
 #endif