Click here to Skip to main content
15,886,026 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to disable copy/paste in CEdit? Pin
Erudite_Eric17-Jul-13 23:33
Erudite_Eric17-Jul-13 23:33 
Questionofstream optimization problem Pin
doug2517-Jul-13 4:43
doug2517-Jul-13 4:43 
AnswerRe: ofstream optimization problem Pin
Richard MacCutchan17-Jul-13 4:53
mveRichard MacCutchan17-Jul-13 4:53 
GeneralRe: ofstream optimization problem Pin
doug2517-Jul-13 5:06
doug2517-Jul-13 5:06 
GeneralRe: ofstream optimization problem Pin
Richard MacCutchan17-Jul-13 5:22
mveRichard MacCutchan17-Jul-13 5:22 
GeneralRe: ofstream optimization problem Pin
doug2517-Jul-13 5:48
doug2517-Jul-13 5:48 
GeneralRe: ofstream optimization problem Pin
Richard MacCutchan17-Jul-13 7:12
mveRichard MacCutchan17-Jul-13 7:12 
GeneralRe: ofstream optimization problem Pin
doug2517-Jul-13 9:38
doug2517-Jul-13 9:38 
well, it could be a mistake I've made but I've managed to find exactly where the error occurs by using #pragma optimize("g", off)
and
#pragma optimize("g", on)

it's one function, I can't see any mistakes

C++
#pragma optimize("g", off)

void AddDataObject(ID3DXFileSaveObject* xFileSave, ID3DXFileData* child, ID3DXFileSaveData* xSaveData)
{
	// Add data for this child then each of it's children
	SIZE_T nChildren = 0;
	child->GetChildren(&nChildren);

	// add child
	GUID templateid, id;
	child->GetType(&templateid);
	child->GetId(&id);
	char name[MAX_PATH];
	
	SIZE_T sz;
	child->GetName(name, &sz);

	SIZE_T dataSize;
	void* data = NULL;

	child->Lock(&dataSize, (LPCVOID*)&data);
	
	if(xSaveData)
	{
		xSaveData->AddDataObject(templateid, name, (const GUID*)&id, dataSize, data, &xSaveData);
	}
	else
	{
		xFileSave->AddDataObject(templateid, name, (const GUID*)&id, dataSize, data, &xSaveData);
	}

	child->Unlock();

	// For each child of child, add child data
	// Add data for all sub children (recurse)
	for(int i=0; i<nChildren; i++)
	{
		ID3DXFileData* ch = NULL;
		if(SUCCEEDED(child->GetChild(i, &ch)))
		{
			// Add data for children of this child (ch)
			AddDataObject(xFileSave, ch, xSaveData);
		}
	}
}

#pragma optimize("g", on)

GeneralRe: ofstream optimization problem Pin
Richard MacCutchan17-Jul-13 20:57
mveRichard MacCutchan17-Jul-13 20:57 
GeneralRe: ofstream optimization problem Pin
doug2518-Jul-13 2:48
doug2518-Jul-13 2:48 
GeneralRe: ofstream optimization problem Pin
Richard MacCutchan18-Jul-13 2:56
mveRichard MacCutchan18-Jul-13 2:56 
GeneralRe: ofstream optimization problem Pin
doug2518-Jul-13 3:16
doug2518-Jul-13 3:16 
GeneralRe: ofstream optimization problem Pin
doug2518-Jul-13 3:31
doug2518-Jul-13 3:31 
GeneralRe: ofstream optimization problem Pin
Richard MacCutchan18-Jul-13 3:50
mveRichard MacCutchan18-Jul-13 3:50 
GeneralRe: ofstream optimization problem Pin
Jochen Arndt17-Jul-13 21:08
professionalJochen Arndt17-Jul-13 21:08 
GeneralRe: ofstream optimization problem Pin
doug2518-Jul-13 2:55
doug2518-Jul-13 2:55 
QuestionWin32 ListView control doesn't display any icons Pin
Jonathan Davies16-Jul-13 7:48
Jonathan Davies16-Jul-13 7:48 
QuestionRe: Win32 ListView control doesn't display any icons Pin
Randor 16-Jul-13 13:01
professional Randor 16-Jul-13 13:01 
AnswerRe: Win32 ListView control doesn't display any icons Pin
Jonathan Davies16-Jul-13 23:49
Jonathan Davies16-Jul-13 23:49 
AnswerRe: Win32 ListView control doesn't display any icons Pin
Richard MacCutchan16-Jul-13 20:59
mveRichard MacCutchan16-Jul-13 20:59 
GeneralRe: Win32 ListView control doesn't display any icons Pin
Jonathan Davies16-Jul-13 23:24
Jonathan Davies16-Jul-13 23:24 
GeneralRe: Win32 ListView control doesn't display any icons Pin
Richard MacCutchan17-Jul-13 1:33
mveRichard MacCutchan17-Jul-13 1:33 
GeneralRe: Win32 ListView control doesn't display any icons Pin
Jonathan Davies17-Jul-13 2:27
Jonathan Davies17-Jul-13 2:27 
GeneralRe: Win32 ListView control doesn't display any icons Pin
Richard MacCutchan17-Jul-13 4:49
mveRichard MacCutchan17-Jul-13 4:49 
GeneralRe: Win32 ListView control doesn't display any icons Pin
Jonathan Davies17-Jul-13 6:42
Jonathan Davies17-Jul-13 6:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.