Changeset 4830 for nanovis/branches/1.1/Command.cpp
- Timestamp:
- Dec 9, 2014 10:32:28 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
nanovis/branches/1.1/Command.cpp
r4829 r4830 1211 1211 } 1212 1212 const char *tag = Tcl_GetString(objv[4]); 1213 Rappture::Buffer buf; 1213 1214 Rappture::Buffer buf(nbytes); 1214 1215 if (GetDataStream(interp, buf, nbytes) != TCL_OK) { 1215 1216 return TCL_ERROR; 1216 1217 } 1217 const char *bytes; 1218 size_t nBytes; 1219 1220 bytes = buf.bytes(); 1221 nBytes = buf.size(); 1218 const char *bytes = buf.bytes(); 1219 size_t nBytes = buf.size(); 1222 1220 1223 1221 TRACE("Checking header[%.20s]", bytes); … … 1227 1225 if ((nBytes > 5) && (strncmp(bytes, "<HDR>", 5) == 0)) { 1228 1226 TRACE("ZincBlende Stream loading..."); 1229 //std::stringstream fdata(std::ios_base::out|std::ios_base::in|std::ios_base::binary); 1230 //fdata.write(buf.bytes(),buf.size()); 1231 //vol = NvZincBlendeReconstructor::getInstance()->loadFromStream(fdata); 1232 1233 volume = NvZincBlendeReconstructor::getInstance()->loadFromMemory((void*) buf.bytes()); 1227 volume = NvZincBlendeReconstructor::getInstance()->loadFromMemory(buf.bytes()); 1234 1228 if (volume == NULL) { 1235 1229 Tcl_AppendResult(interp, "can't get volume instance", (char *)NULL); … … 1275 1269 } 1276 1270 TRACE("DX loading..."); 1277 std::stringstream fdata;1278 fdata.write(bytes, nBytes);1279 1271 if (nBytes <= 0) { 1280 1272 ERROR("data buffer is empty"); 1281 1273 abort(); 1282 1274 } 1275 std::stringstream fdata; 1276 fdata.write(bytes, nBytes); 1283 1277 Rappture::Outcome context; 1284 1278 volume = load_dx_volume_stream(context, tag, fdata); … … 1296 1290 volume->visible(true); 1297 1291 1298 char info[1024];1299 ssize_t nWritten;1300 1301 1292 if (Volume::updatePending) { 1302 1293 NanoVis::setVolumeRanges(); 1303 1294 } 1304 1295 1305 // FIXME: strlen(info) is the return value of sprintf 1306 sprintf(info, "nv>data tag %s min %g max %g vmin %g vmax %g\n", tag, 1307 volume->wAxis.min(), volume->wAxis.max(), 1308 Volume::valueMin, Volume::valueMax); 1309 nWritten = write(1, info, strlen(info)); 1310 assert(nWritten == (ssize_t)strlen(info)); 1296 char info[1024]; 1297 int cmdLength = 1298 sprintf(info, "nv>data tag %s min %g max %g vmin %g vmax %g\n", tag, 1299 volume->wAxis.min(), volume->wAxis.max(), 1300 Volume::valueMin, Volume::valueMax); 1301 ssize_t nWritten = write(1, info, (size_t)cmdLength); 1302 if (nWritten != (ssize_t)cmdLength) { 1303 ERROR("Short write"); 1304 return TCL_ERROR; 1305 } 1311 1306 } 1312 1307 return TCL_OK; … … 1709 1704 const char *tag = Tcl_GetString(objv[4]); 1710 1705 1711 Rappture::Buffer buf ;1706 Rappture::Buffer buf(nBytes); 1712 1707 if (GetDataStream(interp, buf, nBytes) != TCL_OK) { 1713 1708 return TCL_ERROR;
Note: See TracChangeset
for help on using the changeset viewer.