Skip to content

Commit

Permalink
removed compiler warnings #155
Browse files Browse the repository at this point in the history
  • Loading branch information
danielweck committed Jan 27, 2015
1 parent 0bf92fb commit f8618c4
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 24 deletions.
4 changes: 2 additions & 2 deletions ePub3/ePub/filter_chain_byte_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ ByteStream::size_type FilterChainByteStream::FilterBytes(void* bytes, size_type

streamPos = _input->Position();

byteRange.Location(streamPos - result);
byteRange.Length(result);
byteRange.Location((uint32_t)(streamPos - result));
byteRange.Length((uint32_t)result);
}
filterContextRange->GetByteRange() = byteRange;
filterContextRange->SetSeekableByteStream(_input.get());
Expand Down
2 changes: 1 addition & 1 deletion ePub3/ePub/filter_chain_byte_stream_range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ ByteStream::size_type FilterChainByteStreamRange::ReadBytes(void *bytes, size_ty

if (filteredLen > len)
{
ByteStream::size_type toCache = filteredLen - len;
//ByteStream::size_type toCache = filteredLen - len;

//TODO cache remainder bytes for use next time round...
// (e.g. when decrypted bytes are greater than original request?)
Expand Down
2 changes: 0 additions & 2 deletions ePub3/ePub/font_obfuscation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ EPUB3_BEGIN_NAMESPACE
const char * const FontObfuscator::FontObfuscationAlgorithmID = "http://www.idpf.org/2008/embedding";
#endif

const char * const kBytesFiltered = "FontObfuscator::bytesFiltered";

const REGEX_NS::regex FontObfuscator::TypeCheck("(?:font/.*|application/(?:x-font-.*|font-.*|vnd.ms-(?:opentype|fontobject)))");

void * FontObfuscator::FilterData(FilterContext* context, void *data, size_t len, size_t *outputLen)
Expand Down
8 changes: 4 additions & 4 deletions ePub3/ePub/media-overlays_smil_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ EPUB3_BEGIN_NAMESPACE
return false;
}

for (int i = 0; i < _children.size(); i++)
for (shared_vector<const TimeContainer>::size_type i = 0; i < _children.size(); i++)
{
auto container = _children[i];
if (container->IsParallel())
Expand Down Expand Up @@ -220,7 +220,7 @@ EPUB3_BEGIN_NAMESPACE

uint32_t offset = 0;

for (int i = 0; i < _children.size(); i++)
for (shared_vector<const TimeContainer>::size_type i = 0; i < _children.size(); i++)
{
uint32_t timeAdjusted = timeMilliseconds - offset;

Expand Down Expand Up @@ -267,7 +267,7 @@ EPUB3_BEGIN_NAMESPACE

shared_ptr<const Parallel> NthParallel(uint32_t index, uint32_t & count) const
{
for (int i = 0; i < _children.size(); i++)
for (shared_vector<const TimeContainer>::size_type i = 0; i < _children.size(); i++)
{
auto container = _children[i];
if (container->IsParallel())
Expand Down Expand Up @@ -377,7 +377,7 @@ EPUB3_BEGIN_NAMESPACE

uint32_t total = 0;

for (int i = 0; i < _children.size(); i++)
for (shared_vector<const TimeContainer>::size_type i = 0; i < _children.size(); i++)
{
auto container = _children[i];
if (container->IsParallel())
Expand Down
22 changes: 11 additions & 11 deletions ePub3/ePub/media-overlays_smil_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ class Timer
_totalDuration = SmilClockValuesParser::ToWholeMilliseconds(durationStr);
//printf("Media Overlays TOTAL DURATION (milliseconds): %ld\n", (long) _totalDuration);
}
catch (const std::invalid_argument & exc)
catch (const std::invalid_argument & error)
{
HandleError(EPUBError::MediaOverlayInvalidSmilClockValue, _Str("OPF package -- media:duration=", durationStr, " => invalid SMIL Clock Value syntax"));
HandleError(EPUBError::MediaOverlayInvalidSmilClockValue, _Str("OPF package -- media:duration=", durationStr, " => invalid SMIL Clock Value syntax (", error.what(), ")"));
}
//catch (...)
//{
Expand Down Expand Up @@ -299,14 +299,14 @@ class Timer

accumulatedDurationMilliseconds += durationWholeMilliseconds;
}
catch (const std::invalid_argument & exc)
catch (const std::invalid_argument & error)
{
allFake = false;

const std::shared_ptr<SMILData> smilData = std::make_shared<class SMILData>(sharedMe, item, spineItem, 0);
_smilDatas.push_back(smilData); // creates a *copy* of the shared smart pointer (reference count++)

HandleError(EPUBError::MediaOverlayInvalidSmilClockValue, _Str(item->Href(), " -- media:duration=", itemDurationStr, " => invalid SMIL Clock Value syntax"));
HandleError(EPUBError::MediaOverlayInvalidSmilClockValue, _Str(item->Href(), " -- media:duration=", itemDurationStr, " => invalid SMIL Clock Value syntax (", error.what(), ")"));
}
//catch (...)
//{
Expand Down Expand Up @@ -486,7 +486,7 @@ class Timer

shared_ptr<SMILData> smilData = nullptr;
string id = item->Identifier();
for (int i = 0; i < _smilDatas.size(); i++)
for (shared_vector<SMILData>::size_type i = 0; i < _smilDatas.size(); i++)
{
const std::shared_ptr<SMILData> data = _smilDatas.at(i); // does not make a copy of the smart pointer (NO reference count++)

Expand Down Expand Up @@ -561,7 +561,7 @@ class Timer

const char * str = iri.c_str();
size_t size = strlen(str);
for (int j = 0; j < size; j++)
for (size_t j = 0; j < size; j++)
{
char c = str[j];
if (c == '#')
Expand Down Expand Up @@ -908,9 +908,9 @@ class Timer
{
clipBeginMilliseconds = SmilClockValuesParser::ToWholeMilliseconds(clipBeginStr);
}
catch (const std::invalid_argument & exc)
catch (const std::invalid_argument & error)
{
HandleError(EPUBError::MediaOverlayInvalidSmilClockValue, _Str(item->Href().c_str(), " -- clipBegin=", clipBeginStr, " => invalid SMIL Clock Value syntax"));
HandleError(EPUBError::MediaOverlayInvalidSmilClockValue, _Str(item->Href().c_str(), " -- clipBegin=", clipBeginStr, " => invalid SMIL Clock Value syntax (", error.what(), ")"));
}
//catch (...)
//{
Expand All @@ -925,9 +925,9 @@ class Timer
{
clipEndMilliseconds = SmilClockValuesParser::ToWholeMilliseconds(clipEndStr);
}
catch (const std::invalid_argument & exc)
catch (const std::invalid_argument & error)
{
HandleError(EPUBError::MediaOverlayInvalidSmilClockValue, _Str(item->Href().c_str(), " -- clipEnd=", clipEndStr, " => invalid SMIL Clock Value syntax"));
HandleError(EPUBError::MediaOverlayInvalidSmilClockValue, _Str(item->Href().c_str(), " -- clipEnd=", clipEndStr, " => invalid SMIL Clock Value syntax (", error.what(), ")"));
}
//catch (...)
//{
Expand Down Expand Up @@ -1081,7 +1081,7 @@ class Timer
{
uint32_t offset = 0;

for (int i = 0; i < _smilDatas.size(); i++)
for (shared_vector<SMILData>::size_type i = 0; i < _smilDatas.size(); i++)
{
const std::shared_ptr<SMILData> data = _smilDatas.at(i); // does not make a copy of the smart pointer (NO reference count++)
uint32_t timeAdjusted = timeMilliseconds - offset;
Expand Down
2 changes: 1 addition & 1 deletion ePub3/ePub/package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ ConstManifestItemPtr PackageBase::ManifestItemAtRelativePath(const string& path)

// THIS IS FOR DEBUGGING, SEE COMMENT BELOW ...
const char * absChars = absolute.c_str();
int absLength_STRLEN = strlen(absChars);
int absLength_STRLEN = (int)strlen(absChars);
int absLength_SIZE = static_cast<int>(absolute.size());
int absLength_UTF8SIZE = static_cast<int>(absolute.utf8_size());
if (absLength_STRLEN != absLength_SIZE || absLength_STRLEN != absLength_UTF8SIZE || absLength_SIZE != absLength_UTF8SIZE)
Expand Down
6 changes: 3 additions & 3 deletions ePub3/xml/utilities/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int InputBuffer::read_cb(void *context, char *buffer, int len)
uint8_t* buf = reinterpret_cast<uint8_t*>(buffer);

size_t res = 0;
if (p->_encodingCheck == "utf-8" && len >= 3)
if (p->_encodingCheck != NULL && (std::strcmp(p->_encodingCheck, "utf-8") == 0) && len >= 3)
{
res = p->read(buf, 3);

Expand Down Expand Up @@ -135,7 +135,7 @@ bool StreamInputBuffer::close()
size_t StreamInputBuffer::size() const
{
std::istream::pos_type pos = _input.tellg();
size_t result = _input.seekg(0, std::ios::end).tellg();
size_t result = (size_t)_input.seekg(0, std::ios::end).tellg();
_input.seekg(pos);
return result;
}
Expand All @@ -155,7 +155,7 @@ bool StreamOutputBuffer::close()
size_t StreamOutputBuffer::size() const
{
std::ostream::pos_type pos = _output.tellp();
size_t result = _output.seekp(0, std::ios::end).tellp();
size_t result = (size_t)_output.seekp(0, std::ios::end).tellp();
_output.seekp(pos);
return result;
}
Expand Down

0 comments on commit f8618c4

Please sign in to comment.