OSDN Git Service

PATCH: [ 1979321 ] Plugins: Show processing instructions in XML files
authorKimmo Varis <kimmov@gmail.com>
Sun, 24 Aug 2008 15:49:22 +0000 (15:49 +0000)
committerKimmo Varis <kimmov@gmail.com>
Sun, 24 Aug 2008 15:49:22 +0000 (15:49 +0000)
 Submitted by Marco De Paoli
 Commit actual code changes, previous commit contained only project changes.

Docs/Users/ChangeLog.txt
Plugins/dlls/DisplayXMLFiles.dll
Plugins/src_VCPP/DisplayXMLFiles/DisplayXMLFiles.rc
Plugins/src_VCPP/DisplayXMLFiles/WinMergeScript.cpp
Plugins/src_VCPP/DisplayXMLFiles/typeinfoex.h
Src/ExpatMapLib/expat_maps.cpp

index 9c1f9b1..71095d9 100644 (file)
@@ -4,6 +4,7 @@ to Subversion revision numbers (rXXXXX). To open the tracker item, go to URL:
 http://winmerge.org/tracker/[tracker-id]
 
 WinMerge 2.11.1.5
+  Plugins: Show processing instructions in XML plugin (#1979321)
   BugFix: ClearCase checkout/commit dialog translation error (#2051069)
   Translation updates:
   - Russian (#2067785)
index c315871..a425025 100644 (file)
Binary files a/Plugins/dlls/DisplayXMLFiles.dll and b/Plugins/dlls/DisplayXMLFiles.dll differ
index 6e389ff..c374084 100644 (file)
@@ -54,8 +54,8 @@ END
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,1,0,0
- PRODUCTVERSION 1,1,0,0
+ FILEVERSION 1,1,1,0
+ PRODUCTVERSION 1,1,1,0
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -73,7 +73,7 @@ BEGIN
             VALUE "Comments", "WinMerge plugin\0"
             VALUE "CompanyName", "\0"
             VALUE "FileDescription", "DisplayXMLFiles Module\0"
-            VALUE "FileVersion", "1, 1, 0, 0\0"
+            VALUE "FileVersion", "1, 1, 1, 0\0"
             VALUE "InternalName", "DisplayXMLFiles\0"
             VALUE "LegalCopyright", "Copyright 2003-2008\0"
             VALUE "LegalTrademarks", "\0"
@@ -81,7 +81,7 @@ BEGIN
             VALUE "OriginalFilename", "DisplayXMLFiles.DLL\0"
             VALUE "PrivateBuild", "\0"
             VALUE "ProductName", "DisplayXMLFiles Module\0"
-            VALUE "ProductVersion", "1, 1, 0, 0\0"
+            VALUE "ProductVersion", "1, 1, 1, 0\0"
             VALUE "SpecialBuild", "\0"
         END
     END
index 116fdc8..b7ef373 100644 (file)
@@ -214,12 +214,26 @@ static void XMLCALL DefaultHandler(void *userData, const char *s, int len)
 static void XMLCALL ProcessingInstructionHandler(void *userData, const char *target, const char *data)
 {
        CXMLData *pData = (CXMLData*)userData;
-       // Not yet implemented
+
+       // End the previous element if needed
+       if (pData->bNeedsEnding)
+       {
+               fprintf(pData->pOutput,">\n");
+               pData->bNeedsEnding = false;
+       }
+
+       // Indent
+       for (int i = 0; i < pData->iDepth; i++)
+       {
+               fprintf(pData->pOutput,"\t");
+       }
+
+       // Output processing instruction
+       fprintf(pData->pOutput, "<?%s %s?>\n", target, data);
 }
 
 static void XMLCALL CommentHandler(void *userData, const char *data)
 {
-       int i;
        CXMLData *pData = (CXMLData*)userData;
 
        // End the previous element if needed
@@ -230,7 +244,7 @@ static void XMLCALL CommentHandler(void *userData, const char *data)
        }
 
        // Indent
-       for (i = 0; i < pData->iDepth; i++)
+       for (int i = 0; i < pData->iDepth; i++)
        {
                fprintf(pData->pOutput,"\t");
        }
@@ -285,7 +299,7 @@ STDMETHODIMP CWinMergeScript::UnpackFile(BSTR fileSrc, BSTR fileDst, VARIANT_BOO
        XML_SetUserData(parser, &oData);
        XML_SetElementHandler(parser, StartElementHandler, EndElementHandler);
        XML_SetDefaultHandler(parser, DefaultHandler);
-       //XML_SetProcessingInstructionHandler(parser, ProcessingInstructionHandler);
+       XML_SetProcessingInstructionHandler(parser, ProcessingInstructionHandler);
        XML_SetCommentHandler(parser, CommentHandler);
        XML_SetXmlDeclHandler(parser, XmlDeclHandler);
        XML_SetUnknownEncodingHandler(parser, WinMerge_Plug_UnknownEncodingHandler, this);
index edac4d1..0fc33e3 100644 (file)
@@ -89,7 +89,8 @@ public:
                        for (int i=0; i<(int)cNames; i++)
                        {
                                int n = ocslen(rgszNames[i]);
-                               for (int j=m_nCount-1; j>=0; j--)
+                               int j;
+                               for (j=m_nCount-1; j>=0; j--)
                                {
                                        if ((n == m_pMap[j].nLen) &&
                                                (memcmp(m_pMap[j].bstr, rgszNames[i], m_pMap[j].nLen * sizeof(OLECHAR)) == 0))
index 4959258..22d16a2 100644 (file)
@@ -137,7 +137,7 @@ do_maps_getMap(const XML_Char *name, XML_Encoding *info)
                }
        }
        // Lets allow any encoding at all, and provide ISO-8859-1 map
-       for (i=0; i<256; ++i)
+       for (int i=0; i<256; ++i)
        {
                // i->i gives us identity for ASCII, and ISO-8859-1 for remainder
                // because Unicode character set is numbered exactly like ISO-8859-1
@@ -158,7 +158,7 @@ populate_encoding_info(const map_info * mapinfo, XML_Encoding * info)
                info->map[i] = (i<127 ? i : 0);
        }
        // Populate code bytes as given in our map table
-       for (i=0; mapinfo->mapdata[i] != -1; i += 2)
+       for (int i=0; mapinfo->mapdata[i] != -1; i += 2)
        {
                int src = mapinfo->mapdata[i];
                int dest = mapinfo->mapdata[i+1];