diff --git a/xmpsdk/src/ExpatAdapter.cpp b/xmpsdk/src/ExpatAdapter.cpp index d383c980..fee33853 100644 --- a/xmpsdk/src/ExpatAdapter.cpp +++ b/xmpsdk/src/ExpatAdapter.cpp @@ -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 - -// ================================================================================================= diff --git a/xmpsdk/src/ParseRDF.cpp b/xmpsdk/src/ParseRDF.cpp index 575b617d..ce12aae0 100644 --- a/xmpsdk/src/ParseRDF.cpp +++ b/xmpsdk/src/ParseRDF.cpp @@ -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 // ============ diff --git a/xmpsdk/src/XMPMeta-Parse.cpp b/xmpsdk/src/XMPMeta-Parse.cpp index 98612868..7c6ae6ff 100644 --- a/xmpsdk/src/XMPMeta-Parse.cpp +++ b/xmpsdk/src/XMPMeta-Parse.cpp @@ -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(~(kXMP_PropArrayIsOrdered | kXMP_PropArrayIsAlternate | kXMP_PropArrayIsAltText)); dcSubject->options &= keepMask; // Make sure any ordered array bits are clear. } } diff --git a/xmpsdk/src/XMPMeta-Serialize.cpp b/xmpsdk/src/XMPMeta-Serialize.cpp index 73c0d2bd..681f1861 100644 --- a/xmpsdk/src/XMPMeta-Serialize.cpp +++ b/xmpsdk/src/XMPMeta-Serialize.cpp @@ -43,11 +43,6 @@ using namespace std; static const char * kPacketHeader = ""; static const char * kPacketTrailer = ""; // ! The w/r is at [size-4]. -static const char * kPXMP_PacketStart = "(tempDate.year), static_cast(tempDate.month), static_cast(tempDate.day), static_cast(tempDate.hour), static_cast(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(tempDate.year), static_cast(tempDate.month), static_cast(tempDate.day), + static_cast(tempDate.hour), static_cast(tempDate.minute), static_cast(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(tempDate.year), static_cast(tempDate.month), static_cast(tempDate.day), + static_cast(tempDate.hour), static_cast(tempDate.minute), static_cast(tempDate.second), static_cast(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(sComposedPath->c_str()), sComposedPath->capacity(), "%s[%d]", arrayName, itemIndex ); + snprintf ( const_cast(sComposedPath->c_str()), sComposedPath->capacity(), "%s[%d]", arrayName, static_cast(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(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(tempDate.year), static_cast(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(tempDate.year), static_cast(tempDate.month), static_cast(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(tempDate.tzHour), static_cast(tempDate.tzMinute) ); // AUDIT: Using sizeof for snprintf length is safe. if ( tempDate.tzSign < 0 ) buffer[0] = '-'; *sConvertedValue += buffer; }