Changeset 5138


Ignore:
Timestamp:
Jun 21, 2016 9:22:00 AM (6 years ago)
Author:
stefan
Message:

merge and modify r5137 from trunk: return NULL instead of false in function returning char*

Location:
stable/2.9/OS
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable/2.9/OS

  • stable/2.9/OS/src/OSParsers/OSParseosil.tab.cpp

    r5029 r5138  
    1077510775    for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
    1077610776    for(i = 0; sizeOf[i]  == *ch; i++, ch++);
    10777     if(i != 6) {  osilerror_wrapper( ch,osillineno,"incorrect sizeOf attribute in <base64BinaryData> element"); return false;}   
     10777    if(i != 6) {  osilerror_wrapper( ch,osillineno,"incorrect sizeOf attribute in <base64BinaryData> element"); return NULL;}   
    1077810778    // ch should be pointing to the first character after sizeOf
    10779     GETATTRIBUTETEXT;
     10779    for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ; \
     10780    if( *ch != '=') {  osilerror_wrapper( ch, osillineno, "found an attribute not defined"); return NULL;}  \
     10781    ch++; \
     10782    for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;   \
     10783    if(*ch == '\"'){ \
     10784       ch++; \
     10785       for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ; \
     10786       *p = ch; \
     10787       for( ; *ch != '\"'; ch++); \
     10788    }\
     10789    else{\
     10790        if(*ch == '\'') { \
     10791           ch++; \
     10792           for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ; \
     10793           *p = ch; \
     10794           for( ; *ch != '\''; ch++); \
     10795       } \
     10796       else {  osilerror_wrapper( ch, osillineno,"missing quote on attribute"); return NULL;} \
     10797    }\
     10798    numChar = ch - *p; \
     10799    attText = new char[numChar + 1]; \
     10800    for(ki = 0; ki < numChar; ki++) attText[ki] = *((*p)++); \
     10801    attText[ki] = '\0'; \
     10802    attTextEnd = &attText[ki];
    1078010803    ch++;
    1078110804    *dataSize = atoimod1( osillineno, attText, attTextEnd);
     
    1078510808    for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
    1078610809    // better have an > sign or not valid
    10787     if(*ch != '>' ) {  osilerror_wrapper( ch,osillineno,"<base64BinaryData> element does not have a proper closing >"); return false;}
     10810    if(*ch != '>' ) {  osilerror_wrapper( ch,osillineno,"<base64BinaryData> element does not have a proper closing >"); return NULL;}
    1078810811    ch++;
    1078910812    // we are now pointing start of the data
     
    1079410817    // we should be pointing to </base64BinaryData>
    1079510818    for(i = 0; endBase64BinaryData[i]  == *ch; i++, ch++);
    10796     if(i != 18) { osilerror_wrapper( ch,osillineno," problem with <base64BinaryData> element"); return false;}
     10819    if(i != 18) { osilerror_wrapper( ch,osillineno," problem with <base64BinaryData> element"); return NULL;}
    1079710820    int b64len = b64textend - b64textstart;
    1079810821    b64string = new char[ b64len + 1];
     
    1080210825    for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
    1080310826    // better have an > sign or not valid
    10804     if(*ch != '>' ) {  osilerror_wrapper( ch,osillineno,"</base64BinaryData> element does not have a proper closing >"); return false;}
     10827    if(*ch != '>' ) {  osilerror_wrapper( ch,osillineno,"</base64BinaryData> element does not have a proper closing >"); return NULL;}
    1080510828    ch++;
    1080610829    for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
  • stable/2.9/OS/src/OSParsers/OSParseosil.y

    r5029 r5138  
    72777277    for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
    72787278    for(i = 0; sizeOf[i]  == *ch; i++, ch++);
    7279     if(i != 6) {  osilerror_wrapper( ch,osillineno,"incorrect sizeOf attribute in <base64BinaryData> element"); return false;}   
     7279    if(i != 6) {  osilerror_wrapper( ch,osillineno,"incorrect sizeOf attribute in <base64BinaryData> element"); return NULL;}   
    72807280    // ch should be pointing to the first character after sizeOf
    7281     GETATTRIBUTETEXT;
     7281    ch++; \
     7282    for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;   \
     7283    if(*ch == '\"'){ \
     7284       ch++; \
     7285       for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ; \
     7286       *p = ch; \
     7287       for( ; *ch != '\"'; ch++); \
     7288    }\
     7289    else{\
     7290        if(*ch == '\'') { \
     7291           ch++; \
     7292           for(; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ; \
     7293           *p = ch; \
     7294           for( ; *ch != '\''; ch++); \
     7295       } \
     7296       else {  osilerror_wrapper( ch, osillineno,"missing quote on attribute"); return NULL;} \
     7297    }\
     7298    numChar = ch - *p; \
     7299    attText = new char[numChar + 1]; \
     7300    for(ki = 0; ki < numChar; ki++) attText[ki] = *((*p)++); \
     7301    attText[ki] = '\0'; \
     7302    attTextEnd = &attText[ki];
    72827303    ch++;
    72837304    *dataSize = atoimod1( osillineno, attText, attTextEnd);
     
    72877308    for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
    72887309    // better have an > sign or not valid
    7289     if(*ch != '>' ) {  osilerror_wrapper( ch,osillineno,"<base64BinaryData> element does not have a proper closing >"); return false;}
     7310    if(*ch != '>' ) {  osilerror_wrapper( ch,osillineno,"<base64BinaryData> element does not have a proper closing >"); return NULL;}
    72907311    ch++;
    72917312    // we are now pointing start of the data
     
    72967317    // we should be pointing to </base64BinaryData>
    72977318    for(i = 0; endBase64BinaryData[i]  == *ch; i++, ch++);
    7298     if(i != 18) { osilerror_wrapper( ch,osillineno," problem with <base64BinaryData> element"); return false;}
     7319    if(i != 18) { osilerror_wrapper( ch,osillineno," problem with <base64BinaryData> element"); return NULL;}
    72997320    int b64len = b64textend - b64textstart;
    73007321    b64string = new char[ b64len + 1];
     
    73047325    for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
    73057326    // better have an > sign or not valid
    7306     if(*ch != '>' ) {  osilerror_wrapper( ch,osillineno,"</base64BinaryData> element does not have a proper closing >"); return false;}
     7327    if(*ch != '>' ) {  osilerror_wrapper( ch,osillineno,"</base64BinaryData> element does not have a proper closing >"); return NULL;}
    73077328    ch++;
    73087329    for( ; ISWHITESPACE( *ch) || isnewline( *ch, osillineno); ch++ ) ;
Note: See TracChangeset for help on using the changeset viewer.