Fixed more g++ warnings.
This commit is contained in:
parent
523fdc3e10
commit
b2d16d343f
@ -43,8 +43,6 @@ static void EndCdataSectionHandler ( void * userData );
|
||||
static void ProcessingInstructionHandler ( void * userData, XMP_StringPtr target, XMP_StringPtr data );
|
||||
static void CommentHandler ( void * userData, XMP_StringPtr comment );
|
||||
|
||||
static void DefaultHandler ( void * userData, XMP_StringPtr data, int len );
|
||||
|
||||
// =================================================================================================
|
||||
// =================================================================================================
|
||||
|
||||
@ -438,28 +436,3 @@ static void CommentHandler ( void * userData, XMP_StringPtr comment )
|
||||
} // CommentHandler
|
||||
|
||||
// =================================================================================================
|
||||
|
||||
static void DefaultHandler ( void * userData, XMP_StringPtr data, int len )
|
||||
{
|
||||
IgnoreParam(userData);
|
||||
|
||||
#if XMP_DebugBuild & DumpXMLParseEvents // Avoid unused variable warning.
|
||||
ExpatAdapter * thiz = (ExpatAdapter*)userData;
|
||||
#endif
|
||||
|
||||
if ( (data == 0) || (len == 0) ) { data = ""; len = 0; }
|
||||
|
||||
#if XMP_DebugBuild & DumpXMLParseEvents
|
||||
if ( thiz->parseLog != 0 ) {
|
||||
PrintIndent ( thiz->parseLog, thiz->nesting );
|
||||
fprintf ( thiz->parseLog, ">>default<<: \"" );
|
||||
for ( ; len > 0; --len, ++data ) fprintf ( thiz->parseLog, "%c", *data );
|
||||
fprintf ( thiz->parseLog, "\"\n" );
|
||||
}
|
||||
#endif
|
||||
|
||||
// *** Ignore for now. Complain if not whitespace?
|
||||
|
||||
} // DefaultHandler
|
||||
|
||||
// =================================================================================================
|
||||
|
||||
@ -317,21 +317,6 @@ IsCoreSyntaxTerm ( RDFTermKind term )
|
||||
|
||||
} // IsCoreSyntaxTerm
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// IsSyntaxTerm
|
||||
// ------------
|
||||
//
|
||||
// 7.2.3 syntaxTerms
|
||||
// coreSyntaxTerms | rdf:Description | rdf:li
|
||||
|
||||
static bool
|
||||
IsSyntaxTerm ( RDFTermKind term )
|
||||
{
|
||||
|
||||
if ( (kRDFTerm_FirstSyntax <= term) && (term <= kRDFTerm_LastSyntax) ) return true;
|
||||
return false;
|
||||
|
||||
} // IsSyntaxTerm
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// IsOldTerm
|
||||
@ -349,22 +334,6 @@ IsOldTerm ( RDFTermKind term )
|
||||
|
||||
} // IsOldTerm
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// IsNodeElementName
|
||||
// -----------------
|
||||
//
|
||||
// 7.2.5 nodeElementURIs
|
||||
// anyURI - ( coreSyntaxTerms | rdf:li | oldTerms )
|
||||
|
||||
static bool
|
||||
IsNodeElementName ( RDFTermKind term )
|
||||
{
|
||||
|
||||
if ( (term == kRDFTerm_li) || IsOldTerm ( term ) ) return false;
|
||||
return (! IsCoreSyntaxTerm ( term ));
|
||||
|
||||
} // IsNodeElementName
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// IsPropertyElementName
|
||||
// ---------------------
|
||||
@ -381,23 +350,6 @@ IsPropertyElementName ( RDFTermKind term )
|
||||
|
||||
} // IsPropertyElementName
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// IsPropertyAttributeName
|
||||
// -----------------------
|
||||
//
|
||||
// 7.2.7 propertyAttributeURIs
|
||||
// anyURI - ( coreSyntaxTerms | rdf:Description | rdf:li | oldTerms )
|
||||
|
||||
static bool
|
||||
IsPropertyAttributeName ( RDFTermKind term )
|
||||
{
|
||||
|
||||
if ( (term == kRDFTerm_Description) || (term == kRDFTerm_li) || IsOldTerm ( term ) ) return false;
|
||||
return (! IsCoreSyntaxTerm ( term ));
|
||||
|
||||
} // IsPropertyAttributeName
|
||||
|
||||
|
||||
// =================================================================================================
|
||||
// AddChildNode
|
||||
// ============
|
||||
|
||||
@ -707,7 +707,7 @@ TouchUpDataModel ( XMPMeta * xmp )
|
||||
// Do a special case fix for dc:subject, make sure it is an unordered array.
|
||||
XMP_Node * dcSubject = FindChildNode ( currSchema, "dc:subject", kXMP_ExistingOnly );
|
||||
if ( dcSubject != 0 ) {
|
||||
XMP_OptionBits keepMask = ~(kXMP_PropArrayIsOrdered | kXMP_PropArrayIsAlternate | kXMP_PropArrayIsAltText);
|
||||
XMP_OptionBits keepMask = static_cast<XMP_OptionBits>(~(kXMP_PropArrayIsOrdered | kXMP_PropArrayIsAlternate | kXMP_PropArrayIsAltText));
|
||||
dcSubject->options &= keepMask; // Make sure any ordered array bits are clear.
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,11 +43,6 @@ using namespace std;
|
||||
static const char * kPacketHeader = "<?xpacket begin=\"\xEF\xBB\xBF\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>";
|
||||
static const char * kPacketTrailer = "<?xpacket end=\"w\"?>"; // ! The w/r is at [size-4].
|
||||
|
||||
static const char * kPXMP_PacketStart = "<pxmp:XMP_Packet";
|
||||
static const char * kPXMP_PacketEnd = "</pxmp:XMP_Packet>";
|
||||
|
||||
static const char * kPXMP_SchemaGroup = "XMP_SchemaGroup";
|
||||
|
||||
static const char * kRDF_XMPMetaStart = "<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"";
|
||||
static const char * kRDF_XMPMetaEnd = "</x:xmpmeta>";
|
||||
|
||||
@ -61,19 +56,10 @@ static const char * kRDF_StructStart = "<rdf:Description>";
|
||||
static const char * kRDF_StructEnd = "</rdf:Description>";
|
||||
|
||||
static const char * kRDF_BagStart = "<rdf:Bag>";
|
||||
static const char * kRDF_BagEnd = "</rdf:Bag>";
|
||||
|
||||
static const char * kRDF_SeqStart = "<rdf:Seq>";
|
||||
static const char * kRDF_SeqEnd = "</rdf:Seq>";
|
||||
|
||||
static const char * kRDF_AltStart = "<rdf:Alt>";
|
||||
static const char * kRDF_AltEnd = "</rdf:Alt>";
|
||||
|
||||
static const char * kRDF_ItemStart = "<rdf:li>";
|
||||
static const char * kRDF_ItemEnd = "</rdf:li>";
|
||||
|
||||
static const char * kRDF_ValueStart = "<rdf:value>";
|
||||
static const char * kRDF_ValueEnd = "</rdf:value>";
|
||||
|
||||
|
||||
// =================================================================================================
|
||||
|
||||
@ -389,21 +389,21 @@ static void FormatFullDateTime ( XMP_DateTime & tempDate, char * buffer, size_t
|
||||
|
||||
// Output YYYY-MM-DDThh:mmTZD.
|
||||
snprintf ( buffer, bufferLen, "%.4d-%02d-%02dT%02d:%02d", // AUDIT: Callers pass sizeof(buffer).
|
||||
tempDate.year, tempDate.month, tempDate.day, tempDate.hour, tempDate.minute );
|
||||
static_cast<int>(tempDate.year), static_cast<int>(tempDate.month), static_cast<int>(tempDate.day), static_cast<int>(tempDate.hour), static_cast<int>(tempDate.minute) );
|
||||
|
||||
} else if ( tempDate.nanoSecond == 0 ) {
|
||||
|
||||
// Output YYYY-MM-DDThh:mm:ssTZD.
|
||||
snprintf ( buffer, bufferLen, "%.4d-%02d-%02dT%02d:%02d:%02d", // AUDIT: Callers pass sizeof(buffer).
|
||||
tempDate.year, tempDate.month, tempDate.day,
|
||||
tempDate.hour, tempDate.minute, tempDate.second );
|
||||
static_cast<int>(tempDate.year), static_cast<int>(tempDate.month), static_cast<int>(tempDate.day),
|
||||
static_cast<int>(tempDate.hour), static_cast<int>(tempDate.minute), static_cast<int>(tempDate.second) );
|
||||
|
||||
} else {
|
||||
|
||||
// Output YYYY-MM-DDThh:mm:ss.sTZD.
|
||||
snprintf ( buffer, bufferLen, "%.4d-%02d-%02dT%02d:%02d:%02d.%09d", // AUDIT: Callers pass sizeof(buffer).
|
||||
tempDate.year, tempDate.month, tempDate.day,
|
||||
tempDate.hour, tempDate.minute, tempDate.second, tempDate.nanoSecond );
|
||||
static_cast<int>(tempDate.year), static_cast<int>(tempDate.month), static_cast<int>(tempDate.day),
|
||||
static_cast<int>(tempDate.hour), static_cast<int>(tempDate.minute), static_cast<int>(tempDate.second), static_cast<int>(tempDate.nanoSecond) );
|
||||
for ( size_t i = strlen(buffer)-1; buffer[i] == '0'; --i ) buffer[i] = 0; // Trim excess digits.
|
||||
|
||||
}
|
||||
@ -600,7 +600,7 @@ static size_t MoveLargestProperty ( XMPMeta & stdXMP, XMPMeta * extXMP, PropSize
|
||||
printf ( " Move %s, %d bytes\n", propName, propSize );
|
||||
#endif
|
||||
|
||||
bool moved = MoveOneProperty ( stdXMP, extXMP, schemaURI, propName );
|
||||
bool moved = MoveOneProperty ( stdXMP, extXMP, schemaURI, propName );
|
||||
XMP_Assert ( moved );
|
||||
|
||||
propSizes.erase ( lastPos );
|
||||
@ -703,7 +703,7 @@ XMPUtils::ComposeArrayItemPath ( XMP_StringPtr schemaNS,
|
||||
|
||||
if ( itemIndex != kXMP_ArrayLastItem ) {
|
||||
// AUDIT: Using string->capacity() for the snprintf length is safe.
|
||||
snprintf ( const_cast<char*>(sComposedPath->c_str()), sComposedPath->capacity(), "%s[%d]", arrayName, itemIndex );
|
||||
snprintf ( const_cast<char*>(sComposedPath->c_str()), sComposedPath->capacity(), "%s[%d]", arrayName, static_cast<int>(itemIndex) );
|
||||
} else {
|
||||
*sComposedPath = arrayName;
|
||||
*sComposedPath += "[last()] ";
|
||||
@ -1063,7 +1063,7 @@ XMPUtils::ConvertFromDate ( const XMP_DateTime & binValue,
|
||||
if ( (tempDate.day == 0) && (tempDate.hour == 0) && (tempDate.minute == 0) &&
|
||||
(tempDate.second == 0) && (tempDate.nanoSecond == 0) &&
|
||||
(tempDate.tzSign == 0) && (tempDate.tzHour == 0) && (tempDate.tzMinute == 0) ) {
|
||||
snprintf ( buffer, sizeof(buffer), "%.4d", tempDate.year ); // AUDIT: Using sizeof for snprintf length is safe.
|
||||
snprintf ( buffer, sizeof(buffer), "%.4d", static_cast<int>(tempDate.year) ); // AUDIT: Using sizeof for snprintf length is safe.
|
||||
} else if ( (tempDate.year == 0) && (tempDate.day == 0) ) {
|
||||
FormatFullDateTime ( tempDate, buffer, sizeof(buffer) );
|
||||
addTimeZone = true;
|
||||
@ -1080,7 +1080,7 @@ XMPUtils::ConvertFromDate ( const XMP_DateTime & binValue,
|
||||
(tempDate.tzSign != 0) || (tempDate.tzHour != 0) || (tempDate.tzMinute != 0) ) {
|
||||
XMP_Throw ( "Invalid partial date, non-zeros after zero month and day", kXMPErr_BadParam);
|
||||
}
|
||||
snprintf ( buffer, sizeof(buffer), "%.4d-%02d", tempDate.year, tempDate.month ); // AUDIT: Using sizeof for snprintf length is safe.
|
||||
snprintf ( buffer, sizeof(buffer), "%.4d-%02d", static_cast<int>(tempDate.year), static_cast<int>(tempDate.month) ); // AUDIT: Using sizeof for snprintf length is safe.
|
||||
|
||||
} else if ( (tempDate.hour == 0) && (tempDate.minute == 0) &&
|
||||
(tempDate.second == 0) && (tempDate.nanoSecond == 0) &&
|
||||
@ -1089,7 +1089,7 @@ XMPUtils::ConvertFromDate ( const XMP_DateTime & binValue,
|
||||
// Output YYYY-MM-DD.
|
||||
if ( (tempDate.month < 1) || (tempDate.month > 12) ) XMP_Throw ( "Month is out of range", kXMPErr_BadParam);
|
||||
if ( (tempDate.day < 1) || (tempDate.day > 31) ) XMP_Throw ( "Day is out of range", kXMPErr_BadParam);
|
||||
snprintf ( buffer, sizeof(buffer), "%.4d-%02d-%02d", tempDate.year, tempDate.month, tempDate.day ); // AUDIT: Using sizeof for snprintf length is safe.
|
||||
snprintf ( buffer, sizeof(buffer), "%.4d-%02d-%02d", static_cast<int>(tempDate.year), static_cast<int>(tempDate.month), static_cast<int>(tempDate.day) ); // AUDIT: Using sizeof for snprintf length is safe.
|
||||
|
||||
} else {
|
||||
|
||||
@ -1113,7 +1113,7 @@ XMPUtils::ConvertFromDate ( const XMP_DateTime & binValue,
|
||||
if ( tempDate.tzSign == 0 ) {
|
||||
*sConvertedValue += 'Z';
|
||||
} else {
|
||||
snprintf ( buffer, sizeof(buffer), "+%02d:%02d", tempDate.tzHour, tempDate.tzMinute ); // AUDIT: Using sizeof for snprintf length is safe.
|
||||
snprintf ( buffer, sizeof(buffer), "+%02d:%02d", static_cast<int>(tempDate.tzHour), static_cast<int>(tempDate.tzMinute) ); // AUDIT: Using sizeof for snprintf length is safe.
|
||||
if ( tempDate.tzSign < 0 ) buffer[0] = '-';
|
||||
*sConvertedValue += buffer;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user