Internal change
PiperOrigin-RevId: 139271739
Change-Id: If41bb91b37aa7f22b207bf58ca9854dd47f13a43
diff --git a/CHANGES.md b/CHANGES.md
new file mode 100644
index 0000000..f4da4cf
--- /dev/null
+++ b/CHANGES.md
@@ -0,0 +1,2 @@
+cl/139269315 : Several adoptions for std::string and compiler error fixes for
+ Android & iOS.
diff --git a/libplatform/platform_posix.h b/libplatform/platform_posix.h
index af5901a..388a169 100644
--- a/libplatform/platform_posix.h
+++ b/libplatform/platform_posix.h
@@ -33,13 +33,14 @@
#include <stdint.h>
#include <fcntl.h>
#include <unistd.h>
+#include <functional>
#include <mp4v2/mp4v2.h>
///////////////////////////////////////////////////////////////////////////////
namespace mp4v2 { namespace platform {
- using namespace std;
+ // using namespace std;
using ::int8_t;
using ::int16_t;
diff --git a/libutil/util.h b/libutil/util.h
index 2ea7246..e373662 100644
--- a/libutil/util.h
+++ b/libutil/util.h
@@ -16,7 +16,7 @@
/// it will be moved out of this namespace.
///
namespace mp4v2 { namespace util {
- using namespace std;
+ // using namespace std;
using namespace mp4v2::impl;
}} // namespace mp4v2::util
@@ -28,6 +28,10 @@
#include "Utility.h"
#include "crc.h"
#include "other.h"
+#include <ios>
+using std::left;
+using std::right;
+using std::fixed;
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/mp4.cpp b/src/mp4.cpp
index 1016f79..80a609a 100644
--- a/src/mp4.cpp
+++ b/src/mp4.cpp
@@ -896,7 +896,7 @@
}
catch (...) {
- return MP4_INVALID_TRACK_ID;
+ return nullptr;
}
}
diff --git a/src/mp4info.cpp b/src/mp4info.cpp
index 676a5be..e850ba1 100644
--- a/src/mp4info.cpp
+++ b/src/mp4info.cpp
@@ -376,7 +376,7 @@
snprintf(levelb, 20, "unknown level %x", level);
break;
}
- if (originalFormat != NULL && originalFormat[0] != '\0')
+ if (originalFormat[0] != '\0')
snprintf(oformatbuffer, 32, "(%s) ", originalFormat);
snprintf(typebuffer, sizeof(typebuffer), "H264 %s%s@%s",
oformatbuffer, profileb, levelb);
diff --git a/src/mp4util.h b/src/mp4util.h
index 1fbbd81..b33bb44 100644
--- a/src/mp4util.h
+++ b/src/mp4util.h
@@ -33,7 +33,7 @@
#ifndef ASSERT
# define ASSERT(expr) \
if (!(expr)) { \
- throw new Exception("assert failure: "LIBMPV42_STRINGIFY((expr)), __FILE__, __LINE__, __FUNCTION__ ); \
+ throw new Exception("assert failure: " LIBMPV42_STRINGIFY((expr)), __FILE__, __LINE__, __FUNCTION__ ); \
}
#endif
diff --git a/src/rtphint.cpp b/src/rtphint.cpp
index e07309d..1eb01f5 100644
--- a/src/rtphint.cpp
+++ b/src/rtphint.cpp
@@ -339,7 +339,7 @@
pSlash = strchr(pSlash, '/');
if (pSlash != NULL) {
pSlash++;
- if (pSlash != '\0') {
+ if (*pSlash != '\0') {
length = (uint32_t)strlen(pRtpMap) - (pSlash - pRtpMap);
*ppEncodingParams = (char *)MP4Calloc(length + 1);
strncpy(*ppEncodingParams, pSlash, length);
diff --git a/src/src.h b/src/src.h
index 472d8a0..fb9018d 100644
--- a/src/src.h
+++ b/src/src.h
@@ -16,6 +16,13 @@
///////////////////////////////////////////////////////////////////////////////
+#include <ios>
+#include <fstream>
+using std::fstream;
+using std::ostringstream;
+using std::istringstream;
+using std::ios;
+
#include "text.h"
#include "enum.h"
#include "exception.h"