Crash when reading metadata in windows build with Visual Studio

Derek Magee D.R.Magee at leeds.ac.uk
Thu Jan 16 21:21:52 EST 2014


Hi,

The latest  windows build  (and previous ones) has some issues with crashing when reading metadata on visual studio 2010 (windows 8) as illustrated by the program below. It works fine under mingw on the same setup. Interestingly if some of the sections are commented out parts of the program work (i.e. it can read one set of metadata e.g. properties or associated images, but not both/all). Reading image data works fine under visual studio.

Thanks

Derek

#include <openslide.h> // I also tried wrapping this in extern "C"{}
#include <stdio.h>
#include <stdint.h>
#include <iostream>
using namespace std ;

int main(int argc, char*argv[])
{
    bool can_open = openslide_can_open (argv[1]) ;
    if(!can_open){
        cerr << "can't open: " << argv[1] << endl ;
    }
    openslide_t *osr = openslide_open (argv[1]) ;

    // Get levels
    int n_levels = openslide_get_level_count (osr) ;
    cerr << "#Levels: " << n_levels << endl ;
    for(int i=0 ; i<n_levels ; i++){
        cerr << "Level: " << i << " downsample " << openslide_get_level_downsample (osr,i) << endl ;
    }

    // Get Dimensions
    int64_t w,h ;
    openslide_get_level0_dimensions(osr, &w,&h) ;
    cerr << "Full Size: " << w << " x " << h << endl ;

    // Get best level
    for(int i=1 ; i<=128 ; i*=2){
        cerr << "Best level for " << i << " is " << openslide_get_best_level_for_downsample (osr,i) << endl ;
    }


    const char * const* prop_names = openslide_get_property_names(osr) ;
    int pc=0 ;
    while(prop_names[pc] != NULL){
        const char* pval = openslide_get_property_value(osr, prop_names[pc]) ;
        cerr << prop_names[pc] << " : " << pval << endl ;
        cerr << prop_names[pc] << endl ;
        pc++ ;
    }

    const char* const* inames = openslide_get_associated_image_names(osr);
    int pc2=0 ;
    while(inames[pc2] != NULL){
        cerr << inames[pc2] << endl ;
        pc2++ ;
    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.andrew.cmu.edu/pipermail/openslide-users/attachments/20140117/6e8df798/attachment.html 


More information about the openslide-users mailing list