Menu

Looks like error in code

Help
2014-10-01
2014-10-01
  • Michail Vidiassov

    node.c++ - the increment in the "for" loop looks wrong.
    May be ++max has to be ++idx?

    void MValueToString(const MFString& value, SFString& str)
    {
        str.Empty();
    
        int max = value.Count();
        for(int idx = 0; idx < max; ++max) {
            if(idx != 0) {
                str += " ";
            }
            str += "\"";
            str += value.Get(idx)->Escape();
            str += "\"";
        }
    }
    

    BTW, what is the correct sample code to create a Text node?
    Since I have triggered this bug with me code, it seems I was doing something wrong anyway.

     

    Last edit: Alexis Wilke 2014-10-01
  • Alexis Wilke

    Alexis Wilke - 2014-10-01

    Indeed! It should have been ++idx and not ++max. I applied your fix and uploaded version 0.3. Somehow I could not get access to the SVN repository. I'll send a request to SourceForge.net to see what they say about that.

    For text, I would probably make use of a Text object. The X3D document can be found here in the libx3d:

    .../dev/html/ISO-IEC-19775-X3DAbstractSpecification/Part01/components/text.html#Text

    The documentation about the Text class is found here (after generating the docs, you can also download the .tar.gz file for that one):

    .../doc/html/base/classx3d_1_1Text.html

     

Log in to post a comment.