mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
5ee21d6d3f
This patch was mostly generated by running the following scripts on the codebase, with some manual changes made afterwards: # static_assert.sh #!/bin/bash # Command to convert an NSPR integer type to the equivalent standard integer type function convert() { echo "Converting $1 to $2..." find . ! -wholename "*nsprpub*" \ ! -wholename "*security/nss*" \ ! -wholename "*/.hg*" \ ! -wholename "obj-ff-dbg*" \ ! -name nsXPCOMCID.h \ ! -name prtypes.h \ -type f \ \( -iname "*.cpp" \ -o -iname "*.h" \ -o -iname "*.cc" \ -o -iname "*.mm" \) | \ xargs -n 1 `dirname $0`/assert_replacer.py #sed -i -e "s/\b$1\b/$2/g" } convert MOZ_STATIC_ASSERT static_assert hg rev --no-backup mfbt/Assertions.h \ media/webrtc/signaling/src/sipcc/core/includes/ccapi.h \ modules/libmar/src/mar_private.h \ modules/libmar/src/mar.h # assert_replacer.py #!/usr/bin/python import sys import re pattern = re.compile(r"\bMOZ_STATIC_ASSERT\b") def replaceInPlace(fname): print fname f = open(fname, "rw+") lines = f.readlines() for i in range(0, len(lines)): while True: index = re.search(pattern, lines[i]) if index != None: index = index.start() lines[i] = lines[i][0:index] + "static_assert" + lines[i][index+len("MOZ_STATIC_ASSERT"):] for j in range(i + 1, len(lines)): if lines[j].find(" ", index) == index: lines[j] = lines[j][0:index] + lines[j][index+4:] else: break else: break f.seek(0, 0) f.truncate() f.write("".join(lines)) f.close() argc = len(sys.argv) for i in range(1, argc): replaceInPlace(sys.argv[i]) --HG-- extra : rebase_source : 4b4a4047d82f2c205b9fad8d56dfc3f1afc0b045
96 lines
2.6 KiB
C++
96 lines
2.6 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
* vim: sw=2 ts=8 et :
|
|
*/
|
|
/* 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/. */
|
|
|
|
#ifndef IPC_ShadowLayerUtils_h
|
|
#define IPC_ShadowLayerUtils_h
|
|
|
|
#include "ipc/IPCMessageUtils.h"
|
|
#include "GLContext.h"
|
|
#include "mozilla/WidgetUtils.h"
|
|
|
|
#if defined(MOZ_ENABLE_D3D10_LAYER)
|
|
# include "mozilla/layers/ShadowLayerUtilsD3D10.h"
|
|
#endif
|
|
|
|
#if defined(XP_MACOSX)
|
|
#define MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
|
|
#endif
|
|
|
|
#if defined(MOZ_X11)
|
|
# include "mozilla/layers/ShadowLayerUtilsX11.h"
|
|
#else
|
|
namespace mozilla { namespace layers {
|
|
struct SurfaceDescriptorX11 {
|
|
bool operator==(const SurfaceDescriptorX11&) const { return false; }
|
|
};
|
|
} }
|
|
#endif
|
|
|
|
#if defined(MOZ_WIDGET_GONK)
|
|
# include "mozilla/layers/ShadowLayerUtilsGralloc.h"
|
|
#else
|
|
namespace mozilla { namespace layers {
|
|
struct MagicGrallocBufferHandle {
|
|
bool operator==(const MagicGrallocBufferHandle&) const { return false; }
|
|
};
|
|
} }
|
|
#endif
|
|
|
|
namespace IPC {
|
|
|
|
#if !defined(MOZ_HAVE_SURFACEDESCRIPTORX11)
|
|
template <>
|
|
struct ParamTraits<mozilla::layers::SurfaceDescriptorX11> {
|
|
typedef mozilla::layers::SurfaceDescriptorX11 paramType;
|
|
static void Write(Message*, const paramType&) {}
|
|
static bool Read(const Message*, void**, paramType*) { return false; }
|
|
};
|
|
#endif // !defined(MOZ_HAVE_XSURFACEDESCRIPTORX11)
|
|
|
|
template<>
|
|
struct ParamTraits<mozilla::gl::GLContext::SharedTextureShareType>
|
|
{
|
|
typedef mozilla::gl::GLContext::SharedTextureShareType paramType;
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
{
|
|
static_assert(sizeof(paramType) <= sizeof(int32_t),
|
|
"TextureShareType assumes to be int32_t");
|
|
WriteParam(msg, int32_t(param));
|
|
}
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
{
|
|
int32_t type;
|
|
if (!ReadParam(msg, iter, &type))
|
|
return false;
|
|
|
|
*result = paramType(type);
|
|
return true;
|
|
}
|
|
};
|
|
|
|
#if !defined(MOZ_HAVE_SURFACEDESCRIPTORGRALLOC)
|
|
template <>
|
|
struct ParamTraits<mozilla::layers::MagicGrallocBufferHandle> {
|
|
typedef mozilla::layers::MagicGrallocBufferHandle paramType;
|
|
static void Write(Message*, const paramType&) {}
|
|
static bool Read(const Message*, void**, paramType*) { return false; }
|
|
};
|
|
#endif // !defined(MOZ_HAVE_XSURFACEDESCRIPTORGRALLOC)
|
|
|
|
template <>
|
|
struct ParamTraits<mozilla::ScreenRotation>
|
|
: public EnumSerializer<mozilla::ScreenRotation,
|
|
mozilla::ROTATION_0,
|
|
mozilla::ROTATION_COUNT>
|
|
{};
|
|
|
|
} // namespace IPC
|
|
|
|
#endif // IPC_ShadowLayerUtils_h
|