Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » MSVC 10 to Upp conversion
Re: MSVC 10 to Upp conversion [message #32662 is a reply to message #32660] Wed, 01 June 2011 02:59 Go to previous messageGo to previous message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Finally got around to starting the changes to iterate through the files and noticed that has all ready been done with findfirst/findnext.
I used the original tilepack.cpp and tinkered with these without any luck.

#ifdef WIN32
#else
#endif

Does Upp treat these differently?

#ifdef WIN32
void ScanDatasetR(const char *path) {
    struct _finddata_t c_file;
    long hFile;
    int l, x, y;
    string s;
    string filespec;

    filespec = string(path) + "\\*.*";

    hFile = _findfirst( filespec.c_str(), &c_file );  // _findfirst
    if( hFile == -1L )
        return;
    do { 
        if ((c_file.attrib & _A_SUBDIR) && (c_file.name[0] != '.')) 
            ScanDatasetR((string(path) + string(c_file.name) + "\\").c_str());
        else if (c_file.attrib & _A_NORMAL) {
            s = c_file.name;
            if (sscanf(s.substr(0, 2).c_str(), "%x", &l) && sscanf(s.substr(2, 8).c_str(), "%x", &x) && sscanf(s.substr(10, 8).c_str(), "%x", &y)) {
		bm[(static_cast<unsigned __int64>(l) << 50) + (static_cast<unsigned __int64>(y >> 7) << 25) + (x >> 7)].push_back((x & 0x7f) + ((y & 0x7f) << 7));
            }
        }
    } while( _findnext( hFile, &c_file) == 0 );  // _findnext
    _findclose( hFile );
}
#else
void ScanDatasetR(const char *path) {
    DIR *d;
    struct dirent *de;
    int l, x, y;
    string s;

    d = opendir(path);  // opendir
    if (!d) return;
    while (de = readdir(d)) {
        if ((de->d_type == DT_DIR) && (de->d_name[0] != '.')) ScanDatasetR((string(path) + string(de->d_name) + "/").c_str());
        if (de->d_type == DT_REG) {
            s = de->d_name;
            if (sscanf(s.substr(0, 2).c_str(), "%x", &l) && sscanf(s.substr(2, 8).c_str(), "%x", &x) && sscanf(s.substr(10, 8).c_str(), "%x", &y)) {
		bm[(static_cast<unsigned __int64>(l) << 50) + (static_cast<unsigned __int64>(y >> 7) << 25) + (x >> 7)].push_back((x & 0x7f) + ((y & 0x7f) << 7));
            }
        }
    }
    closedir(d);
}
#endif


edit: I did a search in the package for WIN32
Other than in tilepack.cpp the only other is in the main (GUItiler.cpp)
#ifndef WIN32
  • Attachment: tilepack.cpp
    (Size: 4.15KB, Downloaded 353 times)

[Updated on: Wed, 01 June 2011 05:20]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Please recommend a scripting language
Next Topic: String to std::string conversion
Goto Forum:
  


Current Time: Sat Jul 05 16:17:13 CEST 2025

Total time taken to generate the page: 0.03726 seconds