Changeset c40d463d in OpenModelica


Ignore:
Timestamp:
2017-09-15T02:47:46+02:00 (7 years ago)
Author:
hudson <openmodelica@…>
Branches:
Added-citation-metadata, maintenance/v1.14, maintenance/v1.15, maintenance/v1.16, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
Children:
0c97493
Parents:
7bd4847
git-author:
Adrian Pop <adrian.pop@…> (09/15/17 02:47:46)
git-committer:
hudson <openmodelica@…> (09/15/17 02:47:46)
Message:

fix a crash in sphinxoutput

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Compiler/runtime/systemimpl.c

    r60fecddd rc40d463d  
    26442644#include "simulation_options.h"
    26452645
     2646#define SB_SIZE 8192*2
     2647#define SB_SIZE_MINUS_ONE (SB_SIZE-1)
     2648
    26462649char* System_getSimulationHelpTextSphinx(int detailed, int sphinx)
    26472650{
    2648   static char buf[8192];
     2651  static char buf[SB_SIZE];
    26492652  int i,j;
    26502653  const char **desc = detailed ? FLAG_DETAILED_DESC : FLAG_DESC;
     
    26542657  {
    26552658    if (sphinx) {
    2656       cur += snprintf(cur, 8191-(buf-cur), "\n.. _simflag-%s :\n\n", FLAG_NAME[i]);
     2659      cur += snprintf(cur, SB_SIZE_MINUS_ONE-(buf-cur), "\n.. _simflag-%s :\n\n", FLAG_NAME[i]);
    26572660    }
    26582661    if (FLAG_TYPE[i] == FLAG_TYPE_FLAG) {
    26592662      if (sphinx) {
    2660         cur += snprintf(cur, 8191-(buf-cur), ":ref:`-%s <simflag-%s>`\n%s\n", FLAG_NAME[i], FLAG_NAME[i], desc[i]);
     2663        cur += snprintf(cur, SB_SIZE_MINUS_ONE-(buf-cur), ":ref:`-%s <simflag-%s>`\n%s\n", FLAG_NAME[i], FLAG_NAME[i], desc[i]);
    26612664      } else {
    2662         cur += snprintf(cur, 8191-(buf-cur), "<-%s>\n%s\n", FLAG_NAME[i], desc[i]);
     2665        cur += snprintf(cur, SB_SIZE_MINUS_ONE-(buf-cur), "<-%s>\n%s\n", FLAG_NAME[i], desc[i]);
    26632666      }
    26642667    } else if (FLAG_TYPE[i] == FLAG_TYPE_OPTION) {
     
    26682671      const char **flagDesc;
    26692672      if (sphinx) {
    2670         cur += snprintf(cur, 8191-(buf-cur), ":ref:`-%s=value <simflag-%s>` *or* -%s value \n%s\n", FLAG_NAME[i], FLAG_NAME[i], FLAG_NAME[i], desc[i]);
     2673        cur += snprintf(cur, SB_SIZE_MINUS_ONE-(buf-cur), ":ref:`-%s=value <simflag-%s>` *or* -%s value \n%s\n", FLAG_NAME[i], FLAG_NAME[i], FLAG_NAME[i], desc[i]);
    26712674      } else {
    2672         cur += snprintf(cur, 8191-(buf-cur), "<-%s=value> or <-%s value>\n%s\n", FLAG_NAME[i], FLAG_NAME[i], desc[i]);
     2675        cur += snprintf(cur, SB_SIZE_MINUS_ONE-(buf-cur), "<-%s=value> or <-%s value>\n%s\n", FLAG_NAME[i], FLAG_NAME[i], desc[i]);
    26732676      }
    26742677
     
    27132716
    27142717      if (numExtraFlags) {
    2715         cur += snprintf(cur, 8191-(buf-cur), "\n");
     2718        cur += snprintf(cur, SB_SIZE_MINUS_ONE-(buf-cur), "\n");
    27162719        if (flagName) {
    27172720          for (j=firstExtraFlag; j<numExtraFlags; j++) {
    2718             cur += snprintf(cur, 8191-(buf-cur), "  * %s (%s)\n", flagName[j], flagDesc[j]);
     2721            cur += snprintf(cur, SB_SIZE_MINUS_ONE-(buf-cur), "  * %s (%s)\n", flagName[j], flagDesc[j]);
    27192722          }
    27202723        } else {
    27212724          for (j=firstExtraFlag; j<numExtraFlags; j++) {
    2722             cur += snprintf(cur, 8191-(buf-cur), "  * %s\n", flagDesc[j]);
     2725            cur += snprintf(cur, SB_SIZE_MINUS_ONE-(buf-cur), "  * %s\n", flagDesc[j]);
    27232726          }
    27242727        }
     
    27262729
    27272730    } else {
    2728       cur += snprintf(cur, 8191-(buf-cur), "[unknown flag-type] <-%s>\n", FLAG_NAME[i]);
     2731      cur += snprintf(cur, SB_SIZE_MINUS_ONE-(buf-cur), "[unknown flag-type] <-%s>\n", FLAG_NAME[i]);
    27292732    }
    27302733  }
Note: See TracChangeset for help on using the changeset viewer.