Anonymous avatar Anonymous committed 3ca7da6

fix compilation on Windows with mingw or msvc

Comments (0)

Files changed (3)

 }
 #endif
 
+#if defined(_MSC_VER)
+#define _CRT_SECURE_NO_DEPRECATE 1
+#define _CRT_NONSTDC_NO_DEPRECATE 1
+#endif
+
 
 /* Used by the INPUT typemap for char**.
  * Will convert a Perl AV* (containing strings) to a C char**.
 extern "C" {
 #endif
 
+#if defined(_MSC_VER)
+#define _CRT_SECURE_NO_DEPRECATE 1
+#define _CRT_NONSTDC_NO_DEPRECATE 1
+#endif
+
 /* perl stuff */
 #include "EXTERN.h"
 #include "perl.h"
 #include <fcntl.h>
 
 #ifndef WIN32
-#  include <unistd.h>
+#include <unistd.h>
 #endif
 
 /* libxml2 configuration properties */
                     const char * cls = "XML::LibXML::Node";
                     xmlNodePtr tnode;
                     SV * element;
-
-                    len = nodelist->nodeNr;
-                    for( j = 0 ; j < len; j++){
+                    int l = nodelist->nodeNr;
+
+                    for( j = 0 ; j < l; j++){
                         tnode = nodelist->nodeTab[j];
                         if( tnode != NULL && tnode->doc != NULL) {
                             owner = PmmOWNERPO(PmmNewNode(INT2PTR(xmlNodePtr,tnode->doc)));
         ProxyNodePtr owner = NULL;
         xmlXPathObjectPtr found = NULL;
         xmlNodeSetPtr nodelist = NULL;
-        STRLEN len = 0 ;
         xmlChar * xpath = NULL;
         xmlXPathCompExprPtr comp = NULL;
         PREINIT_SAVED_ERROR
                             const char * cls = "XML::LibXML::Node";
                             xmlNodePtr tnode;
                             SV * element;
+                            int l = nodelist->nodeNr;
 
                             owner = PmmOWNERPO(SvPROXYNODE(pnode));
-                            len = nodelist->nodeNr;
-                            for( i=0 ; i < len; i++){
+                            for( i=0 ; i < l; i++){
                                 /* we have to create a new instance of an
                                  * objectptr. and then
                                  * place the current node into the new
         ProxyNodePtr owner = NULL;
         xmlNodeSetPtr nodelist = NULL;
         SV * element = NULL ;
-        STRLEN len = 0 ;
         xmlChar * xpath = NULL ;
         xmlXPathCompExprPtr comp = NULL;
         PREINIT_SAVED_ERROR
 	    REPORT_ERROR(1);
             if ( nodelist->nodeNr > 0 ) {
                 int i;
+                int len = nodelist->nodeNr;
                 const char * cls = "XML::LibXML::Node";
                 xmlNodePtr tnode;
                 owner = PmmOWNERPO(SvPROXYNODE(pnode));
-                len = nodelist->nodeNr;
+
                 for(i=0 ; i < len; i++){
                     /* we have to create a new instance of an objectptr.
                      * and then place the current node into the new object.
         xmlXPathObjectPtr found = NULL;
         xmlNodeSetPtr nodelist = NULL;
         SV * element = NULL ;
-        STRLEN len = 0 ;
         xmlChar * xpath = NULL;
         xmlXPathCompExprPtr comp = NULL;
         PREINIT_SAVED_ERROR
                 int i;
                 const char * cls = "XML::LibXML::Node";
                 xmlNodePtr tnode;
-                len = nodelist->nodeNr;
-                for( i = 0  ; i < len; i++){
+                int l = nodelist->nodeNr;
+                for( i = 0  ; i < l; i++){
                     /* we have to create a new instance of an objectptr. 
                      * and then place the current node into the new object. 
                      * afterwards we can push the object to the array!
         ProxyNodePtr owner = NULL;
         xmlXPathObjectPtr found = NULL;
         xmlNodeSetPtr nodelist = NULL;
-        STRLEN len = 0 ;
         xmlChar * xpath = NULL;
         xmlXPathCompExprPtr comp = NULL;
         PREINIT_SAVED_ERROR
                             const char * cls = "XML::LibXML::Node";
                             xmlNodePtr tnode;
                             SV * element;
-                        
-                            len = nodelist->nodeNr;
-                            for( i = 0 ; i < len; i++){
+                            int l = nodelist->nodeNr;
+
+                            for( i = 0 ; i < l; i++){
                                 /* we have to create a new instance of an
                                  * objectptr. and then
                                  * place the current node into the new
 
 #endif /* HAVE_SCHEMAS */
 
-
 void
 _DESTROY(reader)
 	xmlTextReaderPtr reader
 /*
  * efficiently generate a string representation of the given pointer
  */
+#define _PMM_HASH_NAME_SIZE(n) n+(n>>3)+(n%8>0 ? 1 : 0)
 xmlChar *
 PmmRegistryName(void * ptr)
 {
 	unsigned long int v = (unsigned long int) ptr;
-	int HASH_NAME_SIZE = sizeof(void *) + ceil(sizeof(void *)/8);
+	int HASH_NAME_SIZE = _PMM_HASH_NAME_SIZE(sizeof(void*));
 	xmlChar * name;
 	int i;
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.