Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
2010-04-30 Anders Carlsson <andersca@apple.com>
        Reviewed by Timothy Hatcher.

        Next step towards fixing

        https://bugs.webkit.org/show_bug.cgi?id=20784
        move npapi.h to C99 integer types

        Use the C99 types everywhere. The "old" types are still around but will be removed
        in a subsequent commit.

        * Plugins/WebBaseNetscapePluginStream.h:
        * Plugins/WebBaseNetscapePluginStream.mm:
        (WebNetscapePluginStream::deliverData):
        * Plugins/WebNetscapePluginView.h:
        * Plugins/WebNetscapePluginView.mm:
        (-[WebNetscapePluginView saveAndSetNewPortStateForUpdate:]):
        (-[WebNetscapePluginView getAuthenticationInfoWithProtocol:host:port:scheme:realm:username:usernameLength:password:passwordLength:]):
        * Plugins/npapi.mm:
        (NPN_MemAlloc):
        (NPN_MemFlush):
        (NPN_PostURLNotify):
        (NPN_PostURL):
        (NPN_Write):
        (NPN_ScheduleTimer):
        (NPN_UnscheduleTimer):
        (NPN_GetValueForURL):
        (NPN_SetValueForURL):
        (NPN_GetAuthenticationInfo):
        (WKN_CheckIfAllowedToLoadURL):
        (WKN_CancelCheckIfAllowedToLoadURL):
2010-04-30  Anders Carlsson  <andersca@apple.com>

        Reviewed by Timothy Hatcher.

        Next step towards fixing

        https://bugs.webkit.org/show_bug.cgi?id=20784
        move npapi.h to C99 integer types

        Use the C99 types everywhere. The "old" types are still around but will be removed
        in a subsequent commit.

        * bridge/npapi.h:
        (_NPCocoaEvent::):
        * plugins/PluginPackage.h:
        * plugins/PluginStream.cpp:
        (WebCore::PluginStream::deliverData):
        * plugins/PluginStream.h:
        * plugins/PluginView.cpp:
        (WebCore::PluginView::postURLNotify):
        (WebCore::PluginView::postURL):
        (WebCore::PluginView::write):
        (WebCore::PluginView::handlePost):
        * plugins/PluginView.h:
        * plugins/PluginViewNone.cpp:
        (WebCore::PluginView::handlePostReadFile):
        * plugins/npapi.cpp:
        (NPN_MemAlloc):
        (NPN_MemFlush):
        (NPN_PostURLNotify):
        (NPN_PostURL):
        (NPN_Write):
        * plugins/npfunctions.h:
        * plugins/win/PluginPackageWin.cpp:
        (WebCore::PluginPackage::NPVersion):
        * plugins/win/PluginViewWin.cpp:
        (WebCore::PluginView::handlePostReadFile):
2010-04-30  Anders Carlsson  <andersca@apple.com>

        Reviewed by Timothy Hatcher.

        Next step towards fixing

        https://bugs.webkit.org/show_bug.cgi?id=20784
        move npapi.h to C99 integer types

        Use the C99 types everywhere. The "old" types are still around but will be removed
        in a subsequent commit.

        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp:
        (int32VariantToIdentifier):
        (doubleVariantToIdentifier):
        (testIdentifierToInt):
        (testGetIntIdentifier):
        * DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp:
        (NPP_New):
        (NPP_NewStream):
        (NPP_WriteReady):
        (NPP_Write):
        (NPP_HandleEvent):
        * DumpRenderTree/win/TestNetscapePlugin/main.cpp:
        (NPP_New):
        (NPP_NewStream):
        (NPP_WriteReady):
        (NPP_Write):
        (NPP_HandleEvent):


Canonical link: https://commits.webkit.org/49845@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@58590 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Anders Carlsson committed Apr 30, 2010
1 parent a96e252 commit 7029dd0
Show file tree
Hide file tree
Showing 22 changed files with 236 additions and 135 deletions.
38 changes: 38 additions & 0 deletions WebCore/ChangeLog
@@ -1,3 +1,41 @@
2010-04-30 Anders Carlsson <andersca@apple.com>

Reviewed by Timothy Hatcher.

Next step towards fixing

https://bugs.webkit.org/show_bug.cgi?id=20784
move npapi.h to C99 integer types

Use the C99 types everywhere. The "old" types are still around but will be removed
in a subsequent commit.

* bridge/npapi.h:
(_NPCocoaEvent::):
* plugins/PluginPackage.h:
* plugins/PluginStream.cpp:
(WebCore::PluginStream::deliverData):
* plugins/PluginStream.h:
* plugins/PluginView.cpp:
(WebCore::PluginView::postURLNotify):
(WebCore::PluginView::postURL):
(WebCore::PluginView::write):
(WebCore::PluginView::handlePost):
* plugins/PluginView.h:
* plugins/PluginViewNone.cpp:
(WebCore::PluginView::handlePostReadFile):
* plugins/npapi.cpp:
(NPN_MemAlloc):
(NPN_MemFlush):
(NPN_PostURLNotify):
(NPN_PostURL):
(NPN_Write):
* plugins/npfunctions.h:
* plugins/win/PluginPackageWin.cpp:
(WebCore::PluginPackage::NPVersion):
* plugins/win/PluginViewWin.cpp:
(WebCore::PluginView::handlePostReadFile):

2010-04-30 Peter Kasting <pkasting@google.com>

Reviewed by David Levin.
Expand Down
78 changes: 39 additions & 39 deletions WebCore/bridge/npapi.h
Expand Up @@ -176,8 +176,8 @@ typedef long int32;
#endif

typedef unsigned char NPBool;
typedef int16 NPError;
typedef int16 NPReason;
typedef int16_t NPError;
typedef int16_t NPReason;
typedef char* NPMIMEType;


Expand Down Expand Up @@ -209,8 +209,8 @@ typedef struct _NPStream
void* pdata; /* plug-in private data */
void* ndata; /* netscape private data */
const char* url;
uint32 end;
uint32 lastmodified;
uint32_t end;
uint32_t lastmodified;
void* notifyData;
const char* headers; /* Response headers from host.
* Exists only for >= NPVERS_HAS_RESPONSE_HEADERS.
Expand All @@ -227,25 +227,25 @@ typedef struct _NPStream

typedef struct _NPByteRange
{
int32 offset; /* negative offset means from the end */
uint32 length;
int32_t offset; /* negative offset means from the end */
uint32_t length;
struct _NPByteRange* next;
} NPByteRange;


typedef struct _NPSavedData
{
int32 len;
int32_t len;
void* buf;
} NPSavedData;


typedef struct _NPRect
{
uint16 top;
uint16 left;
uint16 bottom;
uint16 right;
uint16_t top;
uint16_t left;
uint16_t bottom;
uint16_t right;
} NPRect;


Expand Down Expand Up @@ -486,25 +486,25 @@ typedef struct _NPNSMenu NPNSMenu;

typedef struct _NPCocoaEvent {
NPCocoaEventType type;
uint32 version;
uint32_t version;

union {
struct {
uint32 modifierFlags;
uint32_t modifierFlags;
double pluginX;
double pluginY;
int32 buttonNumber;
int32 clickCount;
int32_t buttonNumber;
int32_t clickCount;
double deltaX;
double deltaY;
double deltaZ;
} mouse;
struct {
uint32 modifierFlags;
uint32_t modifierFlags;
NPNSString *characters;
NPNSString *charactersIgnoringModifiers;
NPBool isARepeat;
uint16 keyCode;
uint16_t keyCode;
} key;
struct {
CGContextRef context;
Expand All @@ -528,10 +528,10 @@ typedef struct _NPCocoaEvent {
typedef struct _NPWindow
{
void* window; /* Platform specific window handle */
int32 x; /* Position of top left corner relative */
int32 y; /* to a netscape page. */
uint32 width; /* Maximum window size */
uint32 height;
int32_t x; /* Position of top left corner relative */
int32_t y; /* to a netscape page. */
uint32_t width; /* Maximum window size */
uint32_t height;
NPRect clipRect; /* Clipping rectangle in port coordinates */
/* Used by MAC only. */
#if defined(XP_UNIX) || defined(XP_SYMBIAN)
Expand All @@ -558,7 +558,7 @@ typedef struct _NPEmbedPrint

typedef struct _NPPrint
{
uint16 mode; /* NP_FULL or NP_EMBED */
uint16_t mode; /* NP_FULL or NP_EMBED */
union
{
NPFullPrint fullPrint; /* if mode is NP_FULL */
Expand Down Expand Up @@ -591,7 +591,7 @@ typedef QEvent NPEvent;
#elif defined(XP_WIN)
typedef struct _NPEvent
{
uint16 event;
uint16_t event;
uintptr_t wParam;
uintptr_t lParam;
} NPEvent;
Expand Down Expand Up @@ -803,22 +803,22 @@ char* NPP_GetMIMEDescription(void);
NPError NPP_Initialize(void);
void NPP_Shutdown(void);
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
uint16 mode, int16 argc, char* argn[],
uint16_t mode, int16_t argc, char* argn[],
char* argv[], NPSavedData* saved);
NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
NPStream* stream, NPBool seekable,
uint16* stype);
uint16_t* stype);
NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
NPReason reason);
int32 NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
int32 NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset,
int32 len, void* buffer);
int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset,
int32_t len, void* buffer);
void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
const char* fname);
void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
int16 NPP_HandleEvent(NPP instance, void* event);
int16_t NPP_HandleEvent(NPP instance, void* event);
void NP_LOADDS NPP_URLNotify(NPP instance, const char* url,
NPReason reason, void* notifyData);
jref NP_LOADDS NPP_GetJavaClass(void);
Expand All @@ -838,24 +838,24 @@ NPError NPN_GetURLNotify(NPP instance, const char* url,
NPError NPN_GetURL(NPP instance, const char* url,
const char* target);
NPError NPN_PostURLNotify(NPP instance, const char* url,
const char* target, uint32 len,
const char* target, uint32_t len,
const char* buf, NPBool file,
void* notifyData);
NPError NPN_PostURL(NPP instance, const char* url,
const char* target, uint32 len,
const char* target, uint32_t len,
const char* buf, NPBool file);
NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
NPError NPN_NewStream(NPP instance, NPMIMEType type,
const char* target, NPStream** stream);
int32 NPN_Write(NPP instance, NPStream* stream, int32 len,
int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len,
void* buffer);
NPError NPN_DestroyStream(NPP instance, NPStream* stream,
NPReason reason);
void NPN_Status(NPP instance, const char* message);
const char* NPN_UserAgent(NPP instance);
void* NPN_MemAlloc(uint32 size);
void* NPN_MemAlloc(uint32_t size);
void NPN_MemFree(void* ptr);
uint32 NPN_MemFlush(uint32 size);
uint32_t NPN_MemFlush(uint32_t size);
void NPN_ReloadPlugins(NPBool reloadPages);
JRIEnv* NPN_GetJavaEnv(void);
jref NPN_GetJavaPeer(NPP instance);
Expand All @@ -869,11 +869,11 @@ void NPN_ForceRedraw(NPP instance);
void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
void NPN_PopPopupsEnabledState(NPP instance);
void NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void *), void *userData);
NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char* url, char** value, uint32* len);
NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char* url, const char* value, uint32 len);
NPError NPN_GetAuthenticationInfo(NPP instance, const char* protocol, const char* host, int32 port, const char* scheme, const char *realm, char** username, uint32* ulen, char** password, uint32* plen);
uint32 NPN_ScheduleTimer(NPP instance, uint32 interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32 timerID));
void NPN_UnscheduleTimer(NPP instance, uint32 timerID);
NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char* url, char** value, uint32_t* len);
NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char* url, const char* value, uint32_t len);
NPError NPN_GetAuthenticationInfo(NPP instance, const char* protocol, const char* host, int32_t port, const char* scheme, const char *realm, char** username, uint32_t* ulen, char** password, uint32_t* plen);
uint32_t NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
void NPN_UnscheduleTimer(NPP instance, uint32_t timerID);
NPError NPN_PopUpContextMenu(NPP instance, NPMenu* menu);
NPBool NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);

Expand Down
2 changes: 1 addition & 1 deletion WebCore/plugins/PluginPackage.h
Expand Up @@ -55,7 +55,7 @@ namespace WebCore {
const String& path() const { return m_path; }
const String& fileName() const { return m_fileName; }
const String& parentDirectory() const { return m_parentDirectory; }
uint16 NPVersion() const;
uint16_t NPVersion() const;
time_t lastModified() const { return m_lastModified; }

const MIMEToDescriptionsMap& mimeToDescriptions() const { return m_mimeToDescriptions; }
Expand Down
8 changes: 4 additions & 4 deletions WebCore/plugins/PluginStream.cpp
Expand Up @@ -336,20 +336,20 @@ void PluginStream::deliverData()
if (!m_stream.ndata || m_deliveryData->size() == 0)
return;

int32 totalBytes = m_deliveryData->size();
int32 totalBytesDelivered = 0;
int32_t totalBytes = m_deliveryData->size();
int32_t totalBytesDelivered = 0;

if (m_loader)
m_loader->setDefersLoading(true);
while (totalBytesDelivered < totalBytes) {
int32 deliveryBytes = m_pluginFuncs->writeready(m_instance, &m_stream);
int32_t deliveryBytes = m_pluginFuncs->writeready(m_instance, &m_stream);

if (deliveryBytes <= 0) {
m_delayDeliveryTimer.startOneShot(0);
break;
} else {
deliveryBytes = min(deliveryBytes, totalBytes - totalBytesDelivered);
int32 dataLength = deliveryBytes;
int32_t dataLength = deliveryBytes;
char* data = m_deliveryData->data() + totalBytesDelivered;

// Write the data
Expand Down
4 changes: 2 additions & 2 deletions WebCore/plugins/PluginStream.h
Expand Up @@ -109,8 +109,8 @@ namespace WebCore {

const NPPluginFuncs* m_pluginFuncs;
NPP m_instance;
uint16 m_transferMode;
int32 m_offset;
uint16_t m_transferMode;
int32_t m_offset;
WTF::CString m_headers;
WTF::CString m_path;
NPReason m_reason;
Expand Down
8 changes: 4 additions & 4 deletions WebCore/plugins/PluginView.cpp
Expand Up @@ -582,12 +582,12 @@ NPError PluginView::getURL(const char* url, const char* target)
return load(frameLoadRequest, false, 0);
}

NPError PluginView::postURLNotify(const char* url, const char* target, uint32 len, const char* buf, NPBool file, void* notifyData)
NPError PluginView::postURLNotify(const char* url, const char* target, uint32_t len, const char* buf, NPBool file, void* notifyData)
{
return handlePost(url, target, len, buf, file, notifyData, true, true);
}

NPError PluginView::postURL(const char* url, const char* target, uint32 len, const char* buf, NPBool file)
NPError PluginView::postURL(const char* url, const char* target, uint32_t len, const char* buf, NPBool file)
{
// As documented, only allow headers to be specified via NPP_PostURL when using a file.
return handlePost(url, target, len, buf, file, 0, false, file);
Expand All @@ -600,7 +600,7 @@ NPError PluginView::newStream(NPMIMEType type, const char* target, NPStream** st
return NPERR_GENERIC_ERROR;
}

int32 PluginView::write(NPStream* stream, int32 len, void* buffer)
int32_t PluginView::write(NPStream* stream, int32_t len, void* buffer)
{
notImplemented();
// Unsupported
Expand Down Expand Up @@ -1136,7 +1136,7 @@ static inline HTTPHeaderMap parseRFC822HeaderFields(const Vector<char>& buffer,
return headerFields;
}

NPError PluginView::handlePost(const char* url, const char* target, uint32 len, const char* buf, bool file, void* notifyData, bool sendNotification, bool allowHeaders)
NPError PluginView::handlePost(const char* url, const char* target, uint32_t len, const char* buf, bool file, void* notifyData, bool sendNotification, bool allowHeaders)
{
if (!url || !len || !buf)
return NPERR_INVALID_PARAM;
Expand Down
10 changes: 5 additions & 5 deletions WebCore/plugins/PluginView.h
Expand Up @@ -129,10 +129,10 @@ namespace WebCore {
// NPN functions
NPError getURLNotify(const char* url, const char* target, void* notifyData);
NPError getURL(const char* url, const char* target);
NPError postURLNotify(const char* url, const char* target, uint32 len, const char* but, NPBool file, void* notifyData);
NPError postURL(const char* url, const char* target, uint32 len, const char* but, NPBool file);
NPError postURLNotify(const char* url, const char* target, uint32_t len, const char* but, NPBool file, void* notifyData);
NPError postURL(const char* url, const char* target, uint32_t len, const char* but, NPBool file);
NPError newStream(NPMIMEType type, const char* target, NPStream** stream);
int32 write(NPStream* stream, int32 len, void* buffer);
int32_t write(NPStream* stream, int32_t len, void* buffer);
NPError destroyStream(NPStream* stream, NPReason reason);
const char* userAgent();
#if ENABLE(NETSCAPE_PLUGIN_API)
Expand Down Expand Up @@ -232,8 +232,8 @@ namespace WebCore {
void platformDestroy();
static void setCurrentPluginView(PluginView*);
NPError load(const FrameLoadRequest&, bool sendNotification, void* notifyData);
NPError handlePost(const char* url, const char* target, uint32 len, const char* buf, bool file, void* notifyData, bool sendNotification, bool allowHeaders);
NPError handlePostReadFile(Vector<char>& buffer, uint32 len, const char* buf);
NPError handlePost(const char* url, const char* target, uint32_t len, const char* buf, bool file, void* notifyData, bool sendNotification, bool allowHeaders);
NPError handlePostReadFile(Vector<char>& buffer, uint32_t len, const char* buf);
static void freeStringArray(char** stringArray, int length);
void setCallingPlugin(bool) const;

Expand Down
2 changes: 1 addition & 1 deletion WebCore/plugins/PluginViewNone.cpp
Expand Up @@ -62,7 +62,7 @@ void PluginView::setNPWindowRect(const IntRect&)
{
}

NPError PluginView::handlePostReadFile(Vector<char>&, uint32, const char*)
NPError PluginView::handlePostReadFile(Vector<char>&, uint32_t, const char*)
{
return 0;
}
Expand Down
10 changes: 5 additions & 5 deletions WebCore/plugins/npapi.cpp
Expand Up @@ -43,7 +43,7 @@ static PluginView* pluginViewForInstance(NPP instance)
return PluginView::currentPluginView();
}

void* NPN_MemAlloc(uint32 size)
void* NPN_MemAlloc(uint32_t size)
{
return malloc(size);
}
Expand All @@ -53,7 +53,7 @@ void NPN_MemFree(void* ptr)
free(ptr);
}

uint32 NPN_MemFlush(uint32 size)
uint32_t NPN_MemFlush(uint32_t size)
{
// Do nothing
return 0;
Expand All @@ -79,12 +79,12 @@ NPError NPN_GetURL(NPP instance, const char* url, const char* target)
return pluginViewForInstance(instance)->getURL(url, target);
}

NPError NPN_PostURLNotify(NPP instance, const char* url, const char* target, uint32 len, const char* buf, NPBool file, void* notifyData)
NPError NPN_PostURLNotify(NPP instance, const char* url, const char* target, uint32_t len, const char* buf, NPBool file, void* notifyData)
{
return pluginViewForInstance(instance)->postURLNotify(url, target, len, buf, file, notifyData);
}

NPError NPN_PostURL(NPP instance, const char* url, const char* target, uint32 len, const char* buf, NPBool file)
NPError NPN_PostURL(NPP instance, const char* url, const char* target, uint32_t len, const char* buf, NPBool file)
{
return pluginViewForInstance(instance)->postURL(url, target, len, buf, file);
}
Expand All @@ -94,7 +94,7 @@ NPError NPN_NewStream(NPP instance, NPMIMEType type, const char* target, NPStrea
return pluginViewForInstance(instance)->newStream(type, target, stream);
}

int32 NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer)
int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer)
{
return pluginViewForInstance(instance)->write(stream, len, buffer);
}
Expand Down

0 comments on commit 7029dd0

Please sign in to comment.