void Skein::Node::OverwriteBanner(CStringW& inStr) { // Does this text contain an Inform 7 banner? int i = inStr.Find(L"\nRelease "); if (i >= 0) { int release, serial, build; if (swscanf((LPCWSTR)inStr+i,L"\nRelease %d / Serial number %d / Inform 7 build %d",&release,&serial,&build) == 3) { // Replace the banner line with asterisks for (int j = i+1; j < inStr.GetLength(); j++) { if (inStr.GetAt(j) == '\n') break; inStr.SetAt(j,'*'); } } } }
// **************************************************************** // ReadShapefileIndex() // **************************************************************** // Fast reading for drawing procedure without bounds, file code, etc bool CShapefileReader::ReadShapefileIndex(CStringW filename, FILE* shpFile, CCriticalSection* readLock) { if (filename.GetLength() < 4) { return false; } // reading shape index (SHX) CStringW sFilename = filename; sFilename.SetAt(sFilename.GetLength() - 1, L'x'); FILE* shxfile = _wfopen(sFilename, L"rb"); if (!shxfile ) { _shpfile = NULL; _indexData = NULL; USES_CONVERSION; CallbackHelper::ErrorMsg(Debug::Format("Failed to open SHX file: %s", OLE2A(sFilename))); return false; } fseek (shxfile, 0, SEEK_END); int indexFileSize = ftell(shxfile); rewind(shxfile); // 100 is for header fseek(shxfile, 100, SEEK_SET); _indexData = new char[indexFileSize - 100]; long result = fread(_indexData, sizeof(char), indexFileSize - 100, shxfile); fclose(shxfile); //_shpHeader.numShapes = (indexFileSize - 100)/8; // 2 int on record _readLock = readLock; _shpfile = shpFile; rewind(shpFile); return true; }