fix compiling error in vs project on win7.

This commit is contained in:
Dhilan007 2013-12-27 14:38:22 +08:00
parent ef6295f046
commit 861925e752
7 changed files with 28 additions and 85 deletions

View File

@ -150,7 +150,7 @@ static Data getData(const std::string& filename, bool forString)
}
DWORD sizeRead = 0;
BOOL successed = FALSE;
successed = ::ReadFile(fileHandle, buffer, *size, &sizeRead, NULL);
successed = ::ReadFile(fileHandle, buffer, size, &sizeRead, NULL);
::CloseHandle(fileHandle);
if (!successed)
@ -180,22 +180,21 @@ static Data getData(const std::string& filename, bool forString)
return ret;
}
std::string FileUtilsAndroid::getStringFromFile(const std::string& filename)
std::string FileUtilsWin32::getStringFromFile(const std::string& filename)
{
Data data = getData(filename, true);
std::string ret((const char*)data.getBytes());
return ret;
}
Data FileUtilsAndroid::getDataFromFile(const std::string& filename)
Data FileUtilsWin32::getDataFromFile(const std::string& filename)
{
return getData(filename, false);
}
unsigned char* FileUtilsWin32::getFileData(const char* filename, const char* mode, ssize_t* size)
unsigned char* FileUtilsWin32::getFileData(const std::string& filename, const char* mode, ssize_t* size)
{
unsigned char * pBuffer = NULL;
CCASSERT(filename != NULL && size != NULL && mode != NULL, "Invalid parameters.");
*size = 0;
do
{

View File

@ -58,7 +58,7 @@ protected:
* @return Upon success, a pointer to the data is returned, otherwise NULL.
* @warning Recall: you are responsible for calling delete[] on any Non-NULL pointer returned.
*/
CC_DEPRECATED_ATTRIBUTE virtual unsigned char* getFileData(const char* filename, const char* mode, ssize_t * size) override;
CC_DEPRECATED_ATTRIBUTE virtual unsigned char* getFileData(const std::string& filename, const char* mode, ssize_t * size) override;
/**
* Gets string from a file.

View File

@ -28,6 +28,7 @@
#include "CCPlatformMacros.h"
#include <stdint.h> // for ssize_t on android
#include <string> // for ssize_t on linux
#include "CCStdC.h" // for ssize_t on window
NS_CC_BEGIN

View File

@ -16,18 +16,15 @@
<ClInclude Include="..\UICheckBox.h" />
<ClInclude Include="..\UIHelper.h" />
<ClInclude Include="..\UIImageView.h" />
<ClInclude Include="..\UIInputManager.h" />
<ClInclude Include="..\UILabel.h" />
<ClInclude Include="..\UILabelAtlas.h" />
<ClInclude Include="..\UILabelBMFont.h" />
<ClInclude Include="..\UILayer.h" />
<ClInclude Include="..\UILayout.h" />
<ClInclude Include="..\UILayoutDefine.h" />
<ClInclude Include="..\UILayoutParameter.h" />
<ClInclude Include="..\UIListView.h" />
<ClInclude Include="..\UILoadingBar.h" />
<ClInclude Include="..\UIPageView.h" />
<ClInclude Include="..\UIRootWidget.h" />
<ClInclude Include="..\UIScrollInterface.h" />
<ClInclude Include="..\UIScrollView.h" />
<ClInclude Include="..\UISlider.h" />
@ -40,18 +37,15 @@
<ClCompile Include="..\UICheckBox.cpp" />
<ClCompile Include="..\UIHelper.cpp" />
<ClCompile Include="..\UIImageView.cpp" />
<ClCompile Include="..\UIInputManager.cpp" />
<ClCompile Include="..\UILabel.cpp" />
<ClCompile Include="..\UILabelAtlas.cpp" />
<ClCompile Include="..\UILabelBMFont.cpp" />
<ClCompile Include="..\UILayer.cpp" />
<ClCompile Include="..\UILayout.cpp" />
<ClCompile Include="..\UILayoutDefine.cpp" />
<ClCompile Include="..\UILayoutParameter.cpp" />
<ClCompile Include="..\UIListView.cpp" />
<ClCompile Include="..\UILoadingBar.cpp" />
<ClCompile Include="..\UIPageView.cpp" />
<ClCompile Include="..\UIRootWidget.cpp" />
<ClCompile Include="..\UIScrollView.cpp" />
<ClCompile Include="..\UISlider.cpp" />
<ClCompile Include="..\UITextField.cpp" />

View File

@ -63,18 +63,9 @@
<ClInclude Include="..\CocosGUI.h">
<Filter>System</Filter>
</ClInclude>
<ClInclude Include="..\UIInputManager.h">
<Filter>System</Filter>
</ClInclude>
<ClInclude Include="..\UILayer.h">
<Filter>System</Filter>
</ClInclude>
<ClInclude Include="..\UILayoutDefine.h">
<Filter>Layouts</Filter>
</ClInclude>
<ClInclude Include="..\UIRootWidget.h">
<Filter>BaseClasses</Filter>
</ClInclude>
<ClInclude Include="..\UIWidget.h">
<Filter>BaseClasses</Filter>
</ClInclude>
@ -128,18 +119,9 @@
<ClCompile Include="..\CocosGUI.cpp">
<Filter>System</Filter>
</ClCompile>
<ClCompile Include="..\UIInputManager.cpp">
<Filter>System</Filter>
</ClCompile>
<ClCompile Include="..\UILayer.cpp">
<Filter>System</Filter>
</ClCompile>
<ClCompile Include="..\UILayoutDefine.cpp">
<Filter>Layouts</Filter>
</ClCompile>
<ClCompile Include="..\UIRootWidget.cpp">
<Filter>BaseClasses</Filter>
</ClCompile>
<ClCompile Include="..\UIWidget.cpp">
<Filter>BaseClasses</Filter>
</ClCompile>

View File

@ -153,23 +153,20 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\websockets\prebuilt\win32\*.*" "$
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\CocosGUIScene.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIButtonTest\UIButtonTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIDragPanelTest\UIDragPanelTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UILabelAtlasTest\UILabelAtlasTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UILabelBMFontTest\UILabelBMFontTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UILabelTest\UILabelTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UILayoutTest\UILayoutTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIListViewTest\UIListViewTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UILoadingBarTest\UILoadingBarTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UINodeContainerTest\UINodeContainerTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIPageViewTest\UIPageViewTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIPanelTest\UIPanelTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIScene.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UISceneManager.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIScrollViewTest\UIScrollViewTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UISliderTest\UISliderTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UITextAreaTest\UITextAreaTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UITextButtonTest\UITextButtonTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UITextFieldTest\UITextFieldTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIWidgetAddNodeTest\UIWidgetAddNodeTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioSceneTest\SceneEditorTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlPotentiometerTest\CCControlPotentiometerTest.cpp" />
<ClCompile Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlStepperTest\CCControlStepperTest.cpp" />
@ -298,23 +295,20 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\websockets\prebuilt\win32\*.*" "$
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\CocosGUIScene.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIButtonTest\UIButtonTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIDragPanelTest\UIDragPanelTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UILabelAtlasTest\UILabelAtlasTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UILabelBMFontTest\UILabelBMFontTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UILabelTest\UILabelTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UILayoutTest\UILayoutTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIListViewTest\UIListViewTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UILoadingBarTest\UILoadingBarTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UINodeContainerTest\UINodeContainerTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIPageViewTest\UIPageViewTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIPanelTest\UIPanelTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIScene.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UISceneManager.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIScrollViewTest\UIScrollViewTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UISliderTest\UISliderTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UITextAreaTest\UITextAreaTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UITextButtonTest\UITextButtonTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UITextFieldTest\UITextFieldTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIWidgetAddNodeTest\UIWidgetAddNodeTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioSceneTest\SceneEditorTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlPotentiometerTest\CCControlPotentiometerTest.h" />
<ClInclude Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlStepperTest\CCControlStepperTest.h" />

View File

@ -250,27 +250,15 @@
<Filter Include="Classes\ExtensionsTest\CocoStudioGUITest\UITextFieldTest">
<UniqueIdentifier>{493fcd85-c749-482d-9404-905e99aa0103}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\ExtensionsTest\CocoStudioGUITest\UITextButtonTest">
<UniqueIdentifier>{5c1960de-24ba-4b72-be18-cc160dd2a50d}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\ExtensionsTest\CocoStudioGUITest\UITextAreaTest">
<UniqueIdentifier>{175b363b-a41a-4b1d-bde1-970e77e64cff}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\ExtensionsTest\CocoStudioGUITest\UISliderTest">
<UniqueIdentifier>{2e08949f-bf73-4fdc-85e8-34b8c69aa978}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\ExtensionsTest\CocoStudioGUITest\UIScrollViewTest">
<UniqueIdentifier>{c57c0453-a096-44d7-830b-1cf24c712cfd}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\ExtensionsTest\CocoStudioGUITest\UIPanelTest">
<UniqueIdentifier>{c4dbbfb3-0e91-492f-bbbf-f03fb26f3f54}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\ExtensionsTest\CocoStudioGUITest\UIPageViewTest">
<UniqueIdentifier>{01097388-e538-4081-8e16-d1ff3a86292a}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\ExtensionsTest\CocoStudioGUITest\UINodeContainerTest">
<UniqueIdentifier>{160da6f0-a0f1-4a53-8e5e-cf0a63ee82a3}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\ExtensionsTest\CocoStudioGUITest\UILoadingBarTest">
<UniqueIdentifier>{fadff96e-c19a-41f5-a755-547cf1f8a5fb}</UniqueIdentifier>
</Filter>
@ -289,9 +277,6 @@
<Filter Include="Classes\ExtensionsTest\CocoStudioGUITest\UIImageViewTest">
<UniqueIdentifier>{dedcabba-959c-40e3-9959-7ccf4e31c792}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\ExtensionsTest\CocoStudioGUITest\UIDragPanelTest">
<UniqueIdentifier>{cfc87c30-a7b4-4b6f-bc5d-da45360466b6}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\ExtensionsTest\CocoStudioGUITest\UICheckBoxTest">
<UniqueIdentifier>{5caf2179-ae22-4040-8bac-17e9f22efbf7}</UniqueIdentifier>
</Filter>
@ -310,6 +295,12 @@
<Filter Include="Classes\NewRendererTest">
<UniqueIdentifier>{688e201c-77fe-4665-931e-e508a58141f5}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\ExtensionsTest\CocoStudioGUITest\UIWidgetAddNodeTest">
<UniqueIdentifier>{160da6f0-a0f1-4a53-8e5e-cf0a63ee82a3}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\ExtensionsTest\CocoStudioGUITest\UILayoutTest">
<UniqueIdentifier>{c4dbbfb3-0e91-492f-bbbf-f03fb26f3f54}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
@ -649,9 +640,6 @@
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest.cpp">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UICheckBoxTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIDragPanelTest\UIDragPanelTest.cpp">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UIDragPanelTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest.cpp">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UIImageViewTest</Filter>
</ClCompile>
@ -670,27 +658,15 @@
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UILoadingBarTest\UILoadingBarTest.cpp">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UILoadingBarTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UINodeContainerTest\UINodeContainerTest.cpp">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UINodeContainerTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIPageViewTest\UIPageViewTest.cpp">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UIPageViewTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIPanelTest\UIPanelTest.cpp">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UIPanelTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIScrollViewTest\UIScrollViewTest.cpp">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UIScrollViewTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UISliderTest\UISliderTest.cpp">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UISliderTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UITextAreaTest\UITextAreaTest.cpp">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UITextAreaTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UITextButtonTest\UITextButtonTest.cpp">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UITextButtonTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UITextFieldTest\UITextFieldTest.cpp">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UITextFieldTest</Filter>
</ClCompile>
@ -718,6 +694,12 @@
<ClCompile Include="..\Classes\NewRendererTest\NewRendererTest.cpp">
<Filter>Classes\NewRendererTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIWidgetAddNodeTest\UIWidgetAddNodeTest.cpp">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UIWidgetAddNodeTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UILayoutTest\UILayoutTest.cpp">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UILayoutTest</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="main.h">
@ -1234,9 +1216,6 @@
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest.h">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UICheckBoxTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIDragPanelTest\UIDragPanelTest.h">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UIDragPanelTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest.h">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UIImageViewTest</Filter>
</ClInclude>
@ -1255,27 +1234,15 @@
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UILoadingBarTest\UILoadingBarTest.h">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UILoadingBarTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UINodeContainerTest\UINodeContainerTest.h">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UINodeContainerTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIPageViewTest\UIPageViewTest.h">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UIPageViewTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIPanelTest\UIPanelTest.h">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UIPanelTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIScrollViewTest\UIScrollViewTest.h">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UIScrollViewTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UISliderTest\UISliderTest.h">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UISliderTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UITextAreaTest\UITextAreaTest.h">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UITextAreaTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UITextButtonTest\UITextButtonTest.h">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UITextButtonTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UITextFieldTest\UITextFieldTest.h">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UITextFieldTest</Filter>
</ClInclude>
@ -1318,5 +1285,11 @@
<ClInclude Include="..\Classes\NewRendererTest\NewRendererTest.h">
<Filter>Classes\NewRendererTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UIWidgetAddNodeTest\UIWidgetAddNodeTest.h">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UIWidgetAddNodeTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UILayoutTest\UILayoutTest.h">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UILayoutTest</Filter>
</ClInclude>
</ItemGroup>
</Project>