VirtualBox

Changeset 108264 in vbox for trunk/src/libs


Ignore:
Timestamp:
Feb 17, 2025 4:39:21 PM (5 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
167586
Message:

libs/xpcom18a4/xpcom/typelib/xpidl/xpidl_header.c: Remove generating the useless implementation template which just blows up the generated headers (enclosed in #if 0 #endif in the output), bugref:10321

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/xpcom/typelib/xpidl/xpidl_header.c

    r104485 r108264  
    146146    char *className = IDL_IDENT(IDL_INTERFACE(iface).ident).str;
    147147    char *classNameUpper = NULL;
    148     char *classNameImpl = NULL;
    149148    char *cp;
    150149    gboolean ok = TRUE;
     
    481480    fputc('\n', state->file);
    482481
    483     /*
    484      * Build a sample implementation template.
    485      */
    486     if (strlen(className) >= 3 && className[2] == 'I') {
    487         classNameImpl = xpidl_strdup(className);
    488         if (!classNameImpl)
    489             FAIL;
    490         memmove(&classNameImpl[2], &classNameImpl[3], strlen(classNameImpl) - 2);
    491     } else {
    492         classNameImpl = xpidl_strdup("_MYCLASS_");
    493         if (!classNameImpl)
    494             FAIL;
    495     }
    496 
    497     fputs("#if 0\n"
    498           "/* Use the code below as a template for the "
    499           "implementation class for this interface. */\n"
    500           "\n"
    501           "/* Header file */"
    502           "\n",
    503           state->file);
    504     fprintf(state->file, "class %s : public %s\n", classNameImpl, className);
    505     fputs("{\n"
    506           "public:\n", state->file);
    507     write_indent(state->file);
    508     fputs("NS_DECL_ISUPPORTS\n", state->file);
    509     write_indent(state->file);
    510     fprintf(state->file, "NS_DECL_%s\n", classNameUpper);
    511     fputs("\n", state->file);
    512     write_indent(state->file);
    513     fprintf(state->file, "%s();\n", classNameImpl);
    514     fputs("\n"
    515           "private:\n", state->file);
    516     write_indent(state->file);
    517     fprintf(state->file, "~%s();\n", classNameImpl);
    518     fputs("\n"
    519           "protected:\n", state->file);
    520     write_indent(state->file);
    521     fputs("/* additional members */\n", state->file);
    522     fputs("};\n\n", state->file);
    523 
    524     fputs("/* Implementation file */\n", state->file);
    525 
    526     fprintf(state->file,
    527             "NS_IMPL_ISUPPORTS1(%s, %s)\n", classNameImpl, className);
    528     fputs("\n", state->file);
    529    
    530     fprintf(state->file, "%s::%s()\n", classNameImpl, classNameImpl);
    531     fputs("{\n", state->file);
    532     write_indent(state->file);
    533     fputs("/* member initializers and constructor code */\n", state->file);
    534     fputs("}\n\n", state->file);
    535    
    536     fprintf(state->file, "%s::~%s()\n", classNameImpl, classNameImpl);
    537     fputs("{\n", state->file);
    538     write_indent(state->file);
    539     fputs("/* destructor code */\n", state->file);
    540     fputs("}\n\n", state->file);
    541 
    542     for (iter = IDL_INTERFACE(state->tree).body;
    543          iter != NULL;
    544          iter = IDL_LIST(iter).next)
    545     {
    546         IDL_tree data = IDL_LIST(iter).data;
    547 
    548         switch(IDL_NODE_TYPE(data)) {
    549           case IDLN_OP_DCL:
    550             /* It would be nice to remove this state-twiddling. */
    551             orig = state->tree;
    552             state->tree = data;
    553             xpidl_write_comment(state, 0);
    554             state->tree = orig;
    555 
    556             write_method_signature(data, state->file, AS_IMPL, classNameImpl);
    557             fputs("\n{\n", state->file);
    558             write_indent(state->file);
    559             write_indent(state->file);
    560             fputs("return NS_ERROR_NOT_IMPLEMENTED;\n"
    561                   "}\n"
    562                   "\n", state->file);
    563             break;
    564 
    565           case IDLN_ATTR_DCL:
    566             /* It would be nice to remove this state-twiddling. */
    567             orig = state->tree;
    568             state->tree = data;
    569             xpidl_write_comment(state, 0);
    570             state->tree = orig;
    571            
    572             if (!write_attr_accessor(data, state->file, TRUE,
    573                                      AS_IMPL, classNameImpl))
    574                 FAIL;
    575             fputs("\n{\n", state->file);
    576             write_indent(state->file);
    577             write_indent(state->file);
    578             fputs("return NS_ERROR_NOT_IMPLEMENTED;\n"
    579                   "}\n", state->file);
    580 
    581             if (!IDL_ATTR_DCL(data).f_readonly) {
    582                 if (!write_attr_accessor(data, state->file, FALSE,
    583                                          AS_IMPL, classNameImpl))
    584                     FAIL;
    585                 fputs("\n{\n", state->file);
    586                 write_indent(state->file);
    587                 write_indent(state->file);
    588                 fputs("return NS_ERROR_NOT_IMPLEMENTED;\n"
    589                       "}\n", state->file);
    590             }
    591             fputs("\n", state->file);
    592             break;
    593 
    594           case IDLN_CONST_DCL:
    595           case IDLN_CODEFRAG:
    596               continue;
    597 
    598           default:
    599             FAIL;
    600         }
    601     }
    602 
    603     fputs("/* End of implementation class template. */\n"
    604           "#endif\n"
    605           "\n", state->file);
    606 
    607482#undef FAIL
    608483
     
    610485    if (classNameUpper)
    611486        free(classNameUpper);
    612     if (classNameImpl)
    613         free(classNameImpl);
    614487    return ok;
    615488}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette