Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 372507 | Differences between
and this patch

Collapse All | Expand All

(-)common/libBuffer/include/CommonFWriteBufferFlusher.h (-2 / +4 lines)
Lines 11-17 Link Here
11
#ifndef __COMMON_FWRITEBUFFERFLUSHER_H__
11
#ifndef __COMMON_FWRITEBUFFERFLUSHER_H__
12
#define __COMMON_FWRITEBUFFERFLUSHER_H__
12
#define __COMMON_FWRITEBUFFERFLUSHER_H__
13
13
14
#define _FILE_OFFSET_BITS 64
14
#include "CommonIBufferFlusher.h"
15
#include "CommonIBufferFlusher.h"
16
#include <iostream>
15
17
16
#if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__)) || (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__))
18
#if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__)) || (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__))
17
#	include <unordered_map>
19
#	include <unordered_map>
Lines 25-31 Link Here
25
	class FWriteBufferFlusher : public IBufferFlusher
27
	class FWriteBufferFlusher : public IBufferFlusher
26
	{
28
	{
27
	private:
29
	private:
28
		typedef __int64 FilePosType;
30
		typedef long long FilePosType;
29
		typedef std::tr1::unordered_map<MarkId, FilePosType > MarkIdToFilePos;
31
		typedef std::tr1::unordered_map<MarkId, FilePosType > MarkIdToFilePos;
30
	public:
32
	public:
31
		static const size_t DEFAUL_BUFFER_SIZE = 64*1024;
33
		static const size_t DEFAUL_BUFFER_SIZE = 64*1024;
Lines 48-54 Link Here
48
50
49
	public:
51
	public:
50
		FWriteBufferFlusher( const char* fileName, size_t bufferSize = DEFAUL_BUFFER_SIZE, const char* mode="wb" );
52
		FWriteBufferFlusher( const char* fileName, size_t bufferSize = DEFAUL_BUFFER_SIZE, const char* mode="wb" );
51
		FWriteBufferFlusher( const wchar_t* fileName, size_t bufferSize = DEFAUL_BUFFER_SIZE, const wchar_t* mode=L"wb" );
53
//		FWriteBufferFlusher( const wchar_t* fileName, size_t bufferSize = DEFAUL_BUFFER_SIZE, const wchar_t* mode=L"wb" );
52
		virtual ~FWriteBufferFlusher();
54
		virtual ~FWriteBufferFlusher();
53
55
54
		/** The error code of fopen_s.*/
56
		/** The error code of fopen_s.*/
(-)common/libBuffer/src/CommonFWriteBufferFlusher.cpp (-6 / +7 lines)
Lines 9-15 Link Here
9
*/
9
*/
10
10
11
#include "CommonFWriteBufferFlusher.h"
11
#include "CommonFWriteBufferFlusher.h"
12
12
#include <cstdio>
13
#include <errno.h>
13
14
14
namespace Common
15
namespace Common
15
{
16
{
Lines 32-38 Link Here
32
		}
33
		}
33
	}
34
	}
34
	//-----------------------------------------------------------------------
35
	//-----------------------------------------------------------------------
35
	FWriteBufferFlusher::FWriteBufferFlusher( const wchar_t* fileName, size_t bufferSize, const wchar_t* mode/*=L"wb"*/ )
36
/*	FWriteBufferFlusher::FWriteBufferFlusher( const wchar_t* fileName, size_t bufferSize, const wchar_t* mode/*=L"wb"*//* )
36
		: mBufferSize(bufferSize)
37
		: mBufferSize(bufferSize)
37
		, mBuffer( new char[bufferSize] )
38
		, mBuffer( new char[bufferSize] )
38
#ifdef _WIN32
39
#ifdef _WIN32
Lines 48-54 Link Here
48
		{
49
		{
49
			mError = ( setvbuf( mStream , mBuffer, _IOFBF, mBufferSize ) != 0 );
50
			mError = ( setvbuf( mStream , mBuffer, _IOFBF, mBufferSize ) != 0 );
50
		}
51
		}
51
	}
52
	}*/
52
	//--------------------------------------------------------------------
53
	//--------------------------------------------------------------------
53
	FWriteBufferFlusher::~FWriteBufferFlusher()
54
	FWriteBufferFlusher::~FWriteBufferFlusher()
54
	{
55
	{
Lines 83-89 Link Here
83
	void FWriteBufferFlusher::startMark()
84
	void FWriteBufferFlusher::startMark()
84
	{
85
	{
85
		// store the current file position
86
		// store the current file position
86
		__int64 currentPos = _ftelli64( mStream);
87
		long long currentPos = ftello( mStream);
87
		
88
		
88
		mLastMarkId++;
89
		mLastMarkId++;
89
		mMarkIds.insert(std::make_pair(mLastMarkId, currentPos));		
90
		mMarkIds.insert(std::make_pair(mLastMarkId, currentPos));		
Lines 100-106 Link Here
100
	{
101
	{
101
		if ( markId == END_OF_STREAM )
102
		if ( markId == END_OF_STREAM )
102
		{
103
		{
103
			return (_fseeki64(mStream, 0, SEEK_END) == 0);
104
			return (fseeko(mStream, 0, SEEK_END) == 0);
104
		}
105
		}
105
		else
106
		else
106
		{
107
		{
Lines 112-118 Link Here
112
			else
113
			else
113
			{
114
			{
114
				FilePosType pos = markIdIt->second;
115
				FilePosType pos = markIdIt->second;
115
				bool success = (_fseeki64(mStream, pos, SEEK_SET) == 0);
116
				bool success = (fseeko(mStream, pos, SEEK_SET) == 0);
116
				if ( !keepMarkId )
117
				if ( !keepMarkId )
117
				{
118
				{
118
					mMarkIds.erase(markIdIt);
119
					mMarkIds.erase(markIdIt);
(-)common/libBuffer/include/CommonIBufferFlusher.h (+2 lines)
Lines 11-16 Link Here
11
#ifndef __COMMON_IBUFFERFLUSHER_H__
11
#ifndef __COMMON_IBUFFERFLUSHER_H__
12
#define __COMMON_IBUFFERFLUSHER_H__
12
#define __COMMON_IBUFFERFLUSHER_H__
13
13
14
#include <stddef.h>
15
14
namespace Common
16
namespace Common
15
{
17
{
16
	/** Derived classes of this interface are used by Buffer.*/
18
	/** Derived classes of this interface are used by Buffer.*/

Return to bug 372507