Changeset 6290

Show
Ignore:
Timestamp:
07/10/07 16:42:50 (1 year ago)
Author:
Assefa
Message:

backport fixes related to large xml outputs (#1938, #2146)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/branch-4-10/mapserver/HISTORY.TXT

    r6245 r6290  
    1616- Fixed size of output buffer in msGetEncodedString() (#2132) 
    1717 
     18- SOS : backport fixes related to large xml outputs (#1938, #2146) 
    1819 
    1920Version 4.10.2 (2007-05-07) 
  • branches/branch-4-10/mapserver/mapogcsos.c

    r5491 r6290  
    939939    int *panOfferingLayers = NULL; 
    940940     
     941     msIOContext *context = NULL; 
    941942     
    942943    psDoc = xmlNewDoc("1.0"); 
     
    13741375    /*xmlSaveFile("c:/msapps/reseau_sos/test.xml",psDoc);*/ 
    13751376 
     1377     if ( msIO_needBinaryStdout() == MS_FAILURE ) 
     1378       return MS_FAILURE; 
     1379 
    13761380     msIO_printf("Content-type: text/xml%c%c",10,10); 
    13771381     
     
    13821386                             "ISO-8859-1"); 
    13831387    */ 
    1384     xmlDocDumpFormatMemoryEnc(psDoc, &buffer, &size, "ISO-8859-1", 1); 
    1385      
    1386     msIO_printf("%s", buffer); 
     1388 
     1389     context = msIO_getHandler(stdout); 
     1390 
     1391     xmlDocDumpFormatMemoryEnc(psDoc, &buffer, &size, "ISO-8859-1", 1); 
     1392     msIO_contextWrite(context, buffer, size); 
     1393     xmlFree(buffer); 
     1394     
    13871395 
    13881396    /*free buffer and the document */ 
    1389     xmlFree(buffer); 
    13901397    xmlFreeDoc(psDoc); 
    13911398 
     
    14391446    int nSize = 0; 
    14401447    int iIndice = 0; 
     1448    msIOContext *context = NULL; 
    14411449 
    14421450    sBbox = map->extent; 
     
    19001908    /* output results */     
    19011909     msIO_printf("Content-type: text/xml%c%c",10,10); 
     1910 
     1911     context = msIO_getHandler(stdout); 
    19021912     xmlDocDumpFormatMemoryEnc(psDoc, &buffer, &size, "ISO-8859-1", 1); 
    1903  
    1904      nSize = sizeof(workbuffer); 
    1905      if (size > sizeof(workbuffer)) 
    1906      { 
    1907          iIndice = 0; 
    1908          while ((iIndice + nSize) <= size) 
    1909          { 
    1910              snprintf(workbuffer, (sizeof(workbuffer)-1), "%s", buffer+iIndice ); 
    1911              workbuffer[sizeof(workbuffer)-1] = '\0'; 
    1912              msIO_printf("%s", workbuffer); 
    1913  
    1914              iIndice +=nSize; 
    1915          } 
    1916          if (iIndice < size) 
    1917          { 
    1918               sprintf(workbuffer, "%s", buffer+iIndice ); 
    1919               msIO_printf("%s", workbuffer); 
    1920          } 
    1921      } 
    1922      else 
    1923      { 
    1924        //msIO_printf("size: %d",size); 
    1925        msIO_printf("%s", buffer); 
    1926      } 
    1927  
    1928     /*free buffer and the document */ 
     1913     msIO_contextWrite(context, buffer, size); 
    19291914     xmlFree(buffer); 
     1915 
     1916    /*free the document */ 
    19301917     xmlFreeDoc(psDoc); 
    19311918     /*