Skip to content

Commit

Permalink
change for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
tmizu23 committed May 20, 2015
1 parent 75f71d4 commit 215ecb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tools/ctb-extents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ printTile(ofstream& stream, const GridIterator &iter) {
/// Output the tile extent for a particular zoom level
static bool
writeBoundsForZoom(ofstream &geojson, const string &dirname, GridIterator &iter, i_zoom zoom) {
const string filename = dirname + static_cast<ostringstream*>( &(ostringstream() << zoom << ".geojson") )->str();
const string filename = dirname + (ostringstream() << zoom << ".geojson").str();
cout << "creating " << filename << endl;

geojson.open(filename.c_str(), ofstream::trunc);
Expand Down
13 changes: 5 additions & 8 deletions tools/ctb-tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,19 +214,16 @@ static string
getTileFilename(const TileCoordinate *coord, const string dirname, const char *extension) {
static mutex mutex;
VSIStatBufL stat;
string filename = dirname + static_cast<ostringstream*>
(
&(ostringstream()
string filename = dirname + (ostringstream()
<< coord->zoom
<< osDirSep
<< coord->x)
)->str();
<< coord->x).str();

lock_guard<std::mutex> lock(mutex);

// Check whether the `{zoom}/{x}` directory exists or not
if (VSIStatExL(filename.c_str(), &stat, VSI_STAT_EXISTS_FLAG | VSI_STAT_NATURE_FLAG)) {
filename = dirname + static_cast<ostringstream*>(&(ostringstream() << coord->zoom))->str();
filename = dirname + (ostringstream() << coord->zoom).str();

// Check whether the `{zoom}` directory exists or not
if (VSIStatExL(filename.c_str(), &stat, VSI_STAT_EXISTS_FLAG | VSI_STAT_NATURE_FLAG)) {
Expand All @@ -239,7 +236,7 @@ getTileFilename(const TileCoordinate *coord, const string dirname, const char *e
}

// Create the `{zoom}/{x}` directory
filename += static_cast<ostringstream*>(&(ostringstream() << osDirSep << coord->x))->str();
filename += (ostringstream() << osDirSep << coord->x).str();
if (VSIMkdir(filename.c_str(), 0755))
throw CTBException("Could not create the x level directory");

Expand All @@ -248,7 +245,7 @@ getTileFilename(const TileCoordinate *coord, const string dirname, const char *e
}

// Create the filename itself, adding the extension if required
filename += static_cast<ostringstream*>(&(ostringstream() << osDirSep << coord->y))->str();
filename += (ostringstream() << osDirSep << coord->y).str();
if (extension != NULL) {
filename += ".";
filename += extension;
Expand Down

0 comments on commit 215ecb2

Please sign in to comment.