Ignore:
Timestamp:
Mar 25, 2008, 12:19:50 PM (17 years ago)
Author:
dkearney
Message:

code cleanups.
adjusted gague.tcl to check the length of the string it receives for integers and reals.
modified c, matlab, and octave's lib function to handle empty string for creation of empty library.
modified matlab and octave's lib result function to handle status as a parameter.
fixed core library code to deal with incorrect order of translating xml entity references.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/RpLibrary.cc

    r872 r962  
    17501750        // library doesn't exist, do nothing;
    17511751        status.error("invalid library object");
    1752         status.addContext("RpLibrary::put()");
     1752        status.addContext("RpLibrary::put() - putString");
    17531753        return *this;
    17541754    }
     
    17631763    retNode = _find(path,CREATE_PATH);
    17641764
    1765     if (retNode) {
    1766 
    1767         if (append == RPLIB_APPEND) {
    1768             if ( (contents = scew_element_contents(retNode)) ) {
    1769                 tmpVal = std::string(contents);
    1770             }
    1771             value = tmpVal + value;
    1772         }
    1773 
    1774         if (translateFlag == RPLIB_TRANSLATE) {
    1775             translatedContents = ERTranslator.encode(value.c_str(),0);
    1776         }
    1777         else {
    1778             translatedContents = value.c_str();
    1779         }
    1780 
     1765    if (retNode == NULL) {
     1766        // node not found, set error
     1767        status.error("Error while searching for node: node not found");
     1768        status.addContext("RpLibrary::put() - putString");
     1769        return *this;
     1770    }
     1771
     1772    if (translateFlag == RPLIB_TRANSLATE) {
     1773        translatedContents = ERTranslator.encode(value.c_str(),0);
    17811774        if (translatedContents == NULL) {
    17821775            // entity referene translation failed
     
    17861779        }
    17871780        else {
    1788             scew_element_set_contents(retNode,translatedContents);
     1781            value = std::string(translatedContents);
    17891782            translatedContents = NULL;
    17901783        }
    17911784    }
    1792     else {
    1793         // node not found, set error
    1794         if (!status) {
    1795             status.error("Error while searching for node: node not found");
    1796         }
    1797     }
     1785
     1786    if (append == RPLIB_APPEND) {
     1787        contents = scew_element_contents(retNode);
     1788        if (contents != NULL) {
     1789            tmpVal = std::string(contents);
     1790            value = tmpVal + value;
     1791        }
     1792    }
     1793
     1794    scew_element_set_contents(retNode,value.c_str());
    17981795
    17991796    status.addContext("RpLibrary::put() - putString");
     
    22122209    std::string hostname = "";
    22132210    char *user = NULL;
    2214     char *host = NULL;
    22152211
    22162212    if (this->root) {
Note: See TracChangeset for help on using the changeset viewer.