int32 NPP_Write (NPP instance, NPStream *stream, int32 offset, int32 len, void *buffer)
{   
  DWORD dwTickEnter = XP_GetTickCount();
  CPluginBase * pPlugin = NULL;
  int32 ret = len;

  if(!instance)
    goto Return;
  
  pPlugin = (CPluginBase *)instance->pdata;

Return:
  DWORD dwTickReturn = XP_GetTickCount();
  pLogger->appendToLog(action_npp_write, dwTickEnter, dwTickReturn, (DWORD)ret, 
                       (DWORD)instance, (DWORD)stream, 
                       (DWORD)offset, (DWORD)len, (DWORD)buffer);
  if (pPlugin->m_firstAction == action_npn_request_read) {
    if (stream->notifyData) {
      NPByteRange* rangeList = 	(NPByteRange*) stream->notifyData;
      NPN_RequestRead(stream, rangeList);
      stream->notifyData = 0;
    }
  }
  return ret;
}
Exemple #2
0
NPError 
NPP_NewStream(NPP instance,
			  NPMIMEType type,
			  NPStream *stream, 
			  NPBool seekable,
			  uint16 *stype)
{
	NPByteRange range;
	PluginInstance* This;

	if (instance == NULL)
		return NPERR_INVALID_INSTANCE_ERROR;

	This = (PluginInstance*) instance->pdata;

	if (seekable && This->opmode == NP_SEEK) {
		*stype = NP_SEEK;
		range.offset = 10;
		range.length = 20;
		range.next = NULL;
		NPN_RequestRead(stream, &range);
	}
	else if (This->opmode == NP_ASFILE || This->opmode == NP_ASFILEONLY)
		*stype = This->opmode;

	return NPERR_NO_ERROR;
}
Exemple #3
0
/*!
  Requests the given section of the stream be sent to the
  QNPInstance::write() function of the instance() of this stream.

  See also:
  <a href=http://developer.netscape.com/library/documentation/communicator/plugin/refpgst.htm#npnrequestread>
  Netscape: NPN_RequestRead method</a>
*/
void QNPStream::requestRead(int offset, uint length)
{
    NPByteRange range;
    range.offset = offset;
    range.length = length;
    range.next = 0; // ### Only one supported at this time
    NPN_RequestRead(stream, &range);
}