Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change long to size_t or int #4429

Closed
wants to merge 5 commits into from
Closed

Conversation

minggo
Copy link
Contributor

@minggo minggo commented Dec 4, 2013

  1. use size_t in ccCArray
  2. use size_t for data length, such as used in Image and Texture2D
  3. changelong to int in some places
  4. fix some warnings and hungarian

@@ -142,7 +142,7 @@ DrawNode* DrawNode::create()
return pRet;
}

void DrawNode::ensureCapacity(long count)
void DrawNode::ensureCapacity(int count)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is capacity size_t is valid.
But int is OK too in this context I guess.

@ricardoquesada
Copy link
Contributor

One more thing:

I've just realized that size_t is different than ssize_t, so I think we should replace size_t with ssize_t :-)

ssize_t means "signed size_t", and we should try to use "signed" types as much as possible.
https://github.com/cocos2d/cocos2d-x/blob/develop/docs/CODING_STYLE.md#on-unsigned-integers

So, this will also fix the issue regarding return -1 when an object is not find in getIndexOfObject

@minggo
Copy link
Contributor Author

minggo commented Dec 5, 2013

I think i have to close this pull request, since @dumganhar is implementing container in #4420. After merging #4420, Array and other container will be deprecated, many codes will use new container instead. And i will replace size_t with ssize_t.

@minggo minggo closed this Dec 5, 2013
@ricardoquesada
Copy link
Contributor

ok.

@hulefei
Copy link

hulefei commented Dec 5, 2013

Will cocos2dx replace Array with Vector?

@minggo
Copy link
Contributor Author

minggo commented Dec 5, 2013

Yep, we suggest to use cocos2d::Vector in 3.0.

@minggo minggo deleted the change-long branch December 5, 2013 06:25
@minggo
Copy link
Contributor Author

minggo commented Dec 6, 2013

New pull request for this issue is #4438.

zilongshanren pushed a commit to zilongshanren/cocos2d-x that referenced this pull request Mar 24, 2014
dumganhar pushed a commit that referenced this pull request Mar 26, 2014
closed #4429: Boolean value could not be written to specified plist file
angeltown pushed a commit to angeltown/cocos2d-x that referenced this pull request Apr 28, 2014
angeltown pushed a commit to angeltown/cocos2d-x that referenced this pull request Apr 28, 2014
closed cocos2d#4429: Boolean value could not be written to specified plist file
angeltown pushed a commit to angeltown/cocos2d-x that referenced this pull request Apr 29, 2014
angeltown pushed a commit to angeltown/cocos2d-x that referenced this pull request Apr 29, 2014
closed cocos2d#4429: Boolean value could not be written to specified plist file
angeltown pushed a commit to angeltown/cocos2d-x that referenced this pull request Apr 30, 2014
angeltown pushed a commit to angeltown/cocos2d-x that referenced this pull request Apr 30, 2014
closed cocos2d#4429: Boolean value could not be written to specified plist file
angeltown pushed a commit to angeltown/cocos2d-x that referenced this pull request Apr 30, 2014
angeltown pushed a commit to angeltown/cocos2d-x that referenced this pull request Apr 30, 2014
closed cocos2d#4429: Boolean value could not be written to specified plist file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants