Changeset 5302 for nanovis


Ignore:
Timestamp:
Apr 24, 2015, 7:28:43 PM (4 years ago)
Author:
ldelgass
Message:

Don't abort on bad number of bytes, just return an error

Location:
nanovis/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • nanovis/trunk/Command.cpp

    r4936 r5302  
    12811281    const char *tag = Tcl_GetString(objv[4]);
    12821282
     1283    if (nbytes <= 0) {
     1284        Tcl_AppendResult(interp, "bad # bytes request \"",
     1285                         Tcl_GetString(objv[3]), "\" for \"data follows\"", (char *)NULL);
     1286        ERROR("Bad nbytes %d", nBytes);
     1287        return TCL_ERROR;
     1288    }
     1289
    12831290    Rappture::Buffer buf(nbytes);
    12841291    if (GetDataStream(interp, buf, nbytes) != TCL_OK) {
     
    13111318    } else if ((nBytes > 14) && (strncmp(bytes, "# vtk DataFile", 14) == 0)) {
    13121319        TRACE("VTK loading...");
    1313         if (nBytes <= 0) {
    1314             ERROR("data buffer is empty");
    1315             abort();
    1316         }
    13171320#ifdef USE_VTK
    13181321        volume = load_vtk_volume_stream(tag, bytes, nBytes);
     
    13371340        }
    13381341        TRACE("DX loading...");
    1339         if (nBytes <= 0) {
    1340             ERROR("data buffer is empty");
    1341             abort();
    1342         }
    13431342        std::stringstream fdata;
    13441343        fdata.write(bytes, nBytes);
  • nanovis/trunk/FlowCmd.cpp

    r4895 r5302  
    210210    } else if ((length > 14) && (strncmp(bytes, "# vtk DataFile", 14) == 0)) {
    211211        TRACE("VTK loading...");
    212         if (length <= 0) {
    213             ERROR("data buffer is empty");
    214             abort();
    215         }
    216212#ifdef USE_VTK
    217213        volume = load_vtk_volume_stream(flow->name(), bytes, length);
Note: See TracChangeset for help on using the changeset viewer.