Skip to content

[fix]: correctly retrieve the fileSize on 32 bits OS #306

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

Merged
merged 4 commits into from
Jul 2, 2018

Conversation

adoussot
Copy link
Contributor

"size_t" size depends on the OS. On 32-bit system it can only hold a 32
bits variable = 4 294 967 296, which is not enough to store a big file
size (e.g: 14Go). We should use a 64-bits variable

"size_t" size depends on the OS. On 32-bit system it can only hold a 32
bits variable = 4 294 967 296, which is not enough to store a big file
size (e.g: 14Go). We should use a 64-bits variable
@@ -210,7 +210,7 @@ size_t FileProperties::getBitRate() const
return _avFormatContext->bit_rate;
}

size_t FileProperties::getFileSize() const
unsigned __int64 FileProperties::getFileSize() const
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you want me to define a new type in std namespace ?

e.g (this is pseudo-code)

// compatibility problems...
namespace std
{
#ifdef 32bit-OS // use https://stackoverflow.com/questions/1505582/determining-32-vs-64-bit-in-c to define the system type
	typedef Custom_size_t c_size_t // can hold 64-bits
#else 
	typedef ::size_t c_size_t
#endif
}

I'm not really use to c++ but doesn't it seem a bit weird ?

Copy link
Member

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just use uint64_t? It is multi-platform (#include <cstdint>) and dedicated to provide fixed size integer.

Copy link
Member

Choose a reason for hiding this comment

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

Indeed uint64_t seems to be what you are looking for (it is provided by the C library).
Did you test it @adoussot ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, i thought unsigned __int64 was cross platform (which is not). so uint64_t is correct. Thanks!

@adoussot
Copy link
Contributor Author

Is this Ok (RTM) ? Or should we still change something ?

@fabiencastan
Copy link
Contributor

Would be good to add a comment to the function , like

/**
 * @note Ensure 64 bits size even on 32 bits OS with uint64_t, so we can manage large files > 4Go.
 */

@adoussot
Copy link
Contributor Author

Since the previous PR #305 was incrementing the avtranscoder version directly in develop (and didn't merge to master) I stick to the same release policy and incremented micro version in 086d074.

If it's ok for you, could someone merge it ? Without any response, I will merge this PR by the end of the weekend. thanks

@adoussot adoussot merged commit 4a61763 into avTranscoder:develop Jul 2, 2018
valnoel added a commit to valnoel/avTranscoder that referenced this pull request Nov 22, 2019
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.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy