static HRESULT writeroutput_flush_stream(xmlwriteroutput *output) { struct output_buffer *buffer; ULONG written, offset = 0; HRESULT hr; if (!output || !output->stream) return S_OK; buffer = &output->buffer; /* It will loop forever until everything is written or an error occurred. */ do { written = 0; hr = ISequentialStream_Write(output->stream, buffer->data + offset, buffer->written, &written); if (FAILED(hr)) { WARN("write to stream failed (0x%08x)\n", hr); buffer->written = 0; return hr; } offset += written; buffer->written -= written; } while (buffer->written > 0); return S_OK; }
_DECLARE_H_THIS_FILE #endif /*--------------------------------- * Utility and debugging functions *--------------------------------- */ /* * Write a string to debugging output (if it's been configured). * * Parameters: * - phd = Pointer to the HEAPDATA block. * - sz = String to be written. * * Returns: * Nothing. */ void _HeapDbgWrite(PHEAPDATA phd, PCSTR sz) { if (phd->pDebugStream) ISequentialStream_Write(phd->pDebugStream, sz, StrLength8(sz), NULL); }
/* * Internal function called to write formatted output to the debugging output stream. * * Parameters: * - ppvArg = Pointer argument to StrFormatV8 (actually the ISequentialStream pointer). * - pchData = Pointer to data to be written. * - cbData = Number of characters to be written. * * Returns: * Standard HRESULT success/failure indicator. */ static HRESULT heap_printf_func(PPVOID ppvArg, PCCHAR pchData, UINT32 cbData) { return ISequentialStream_Write(((PSEQUENTIALSTREAM)ppvArg), pchData, cbData, NULL); }