Bug 1317726 - sdp_file_parser should not depend on xpcom glue; r?drno draft
authorDan Minor <dminor@mozilla.com>
Tue, 15 Nov 2016 11:53:47 -0500
changeset 439756 dcd223477558d98a572d16ed2614c8ceb3fcedcd
parent 439149 f8ba9c9b401f57b0047ddd6932cb830190865b38
child 537241 61fbc67f521b6fdb1b336d9d17d2fafd5baa1983
push id36081
push userdminor@mozilla.com
push dateWed, 16 Nov 2016 15:30:12 +0000
reviewersdrno
bugs1317726
milestone53.0a1
Bug 1317726 - sdp_file_parser should not depend on xpcom glue; r?drno MozReview-Commit-ID: KDv3RzGurQx
media/webrtc/signaling/fuzztest/moz.build
media/webrtc/signaling/fuzztest/sdp_file_parser.cpp
media/webrtc/signaling/src/sdp/sipcc/cpr_string.c
python/mozbuild/mozbuild/frontend/emitter.py
--- a/media/webrtc/signaling/fuzztest/moz.build
+++ b/media/webrtc/signaling/fuzztest/moz.build
@@ -1,32 +1,31 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'uikit':
+if CONFIG['OS_TARGET'] == 'Linux' or CONFIG['OS_TARGET'] == 'Darwin':
     DISABLE_STL_WRAPPING = True
     DEFINES['MOZ_NO_MOZALLOC'] = True
 
     if CONFIG['OS_TARGET'] == 'Darwin':
         DEFINES['SIP_OS_OSX'] = True
     else:
         DEFINES['SIP_OS_LINUX'] = True
 
     LOCAL_INCLUDES += [
         '../..',
         '/media/mtransport',
         '/media/webrtc/signaling/src/common/browser_logging',
     ]
 
     USE_LIBS += [
         '/media/webrtc/trunk/testing/gtest_gtest/gtest',
-        'nspr'
+        'nspr',
     ]
 
     SOURCES = [
       '/media/webrtc/signaling/src/sdp/SdpAttribute.cpp',
       '/media/webrtc/signaling/src/sdp/SdpHelper.cpp',
       '/media/webrtc/signaling/src/sdp/SdpMediaSection.cpp',
       '/media/webrtc/signaling/src/sdp/sipcc/cpr_string.c',
       '/media/webrtc/signaling/src/sdp/sipcc/sdp_access.c',
@@ -40,9 +39,9 @@ if CONFIG['OS_TARGET'] != 'WINNT' and CO
       '/media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c',
       '/media/webrtc/signaling/src/sdp/SipccSdp.cpp',
       '/media/webrtc/signaling/src/sdp/SipccSdpAttributeList.cpp',
       '/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.cpp',
       '/media/webrtc/signaling/src/sdp/SipccSdpParser.cpp',
       'sdp_file_parser.cpp',
     ]
 
-    GeckoProgram('sdp_file_parser')
+    Program('sdp_file_parser')
--- a/media/webrtc/signaling/fuzztest/sdp_file_parser.cpp
+++ b/media/webrtc/signaling/fuzztest/sdp_file_parser.cpp
@@ -21,16 +21,26 @@ void CSFLog(CSFLogLevel priority, const 
   va_start(ap, format);
 
   printf("%s\n:", tag);
   vprintf(format, ap);
 
   va_end(ap);
 }
 
+extern "C" {
+void NS_DebugBreak(uint32_t aSeverity,
+                   const char* aStr, const char* aExpr,
+                   const char* aFile, int32_t aLine)
+{
+  fprintf(stderr, "NS_DebugBreak: %u %s %s %s %u", aSeverity, aStr, aExpr,
+          aFile, aLine);
+}
+} // end extern "C".
+
 namespace mozilla {
 
 enum class LogLevel {
 
 };
 
 namespace detail {
 
--- a/media/webrtc/signaling/src/sdp/sipcc/cpr_string.c
+++ b/media/webrtc/signaling/src/sdp/sipcc/cpr_string.c
@@ -5,24 +5,21 @@
 #include <stdarg.h>
 
 #include "mozilla/Assertions.h"
 #include "cpr_types.h"
 #include "cpr_string.h"
 #include "cpr_strings.h"
 
 /* From cpr_stdlib.h */
-#include "mozilla/mozalloc.h"
-
-#define cpr_malloc(a) moz_xmalloc(a)
-#define cpr_calloc(a, b) moz_xcalloc(a, b)
-#define cpr_realloc(a, b) moz_xrealloc(a, b)
+#define cpr_malloc(a) malloc(a)
+#define cpr_calloc(a, b) calloc(a, b)
+#define cpr_realloc(a, b) realloc(a, b)
 #define cpr_free(a) free(a)
 
-
 /**
  * sstrncpy
  *
  * This is Cisco's *safe* version of strncpy.  The string will always
  * be NUL terminated (which is not ANSI compliant).
  *
  * Parameters: s1  - first string
  *             s2  - second string
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -148,17 +148,16 @@ ALLOWED_XPCOM_GLUE = {
     ('TestTXMgr', 'editor/txmgr/tests'),
     ('test_IHistory', 'toolkit/components/places/tests/cpp'),
     ('testcrasher', 'toolkit/crashreporter/test'),
     ('TestStartupCache', 'startupcache/test'),
     ('jsep_session_unittest', 'media/webrtc/signaling/test'),
     ('jsep_track_unittest', 'media/webrtc/signaling/test'),
     ('mediaconduit_unittests', 'media/webrtc/signaling/test'),
     ('mediapipeline_unittest', 'media/webrtc/signaling/test'),
-    ('sdp_file_parser', 'media/webrtc/signaling/fuzztest'),
     ('sdp_unittests', 'media/webrtc/signaling/test'),
     ('signaling_unittests', 'media/webrtc/signaling/test'),
     ('TestMailCookie', 'mailnews/base/test'),
 }
 
 
 class TreeMetadataEmitter(LoggingMixin):
     """Converts the executed mozbuild files into data structures.