Skip to content

Commit

Permalink
ICU-21694 ubidi.h sample code would not compile
Browse files Browse the repository at this point in the history
  • Loading branch information
litherum committed Aug 4, 2021
1 parent b03b8be commit e2fafa5
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions icu4c/source/common/unicode/ubidi.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
*
* <pre>
* \code
*#include "unicode/ubidi.h"
*#include <unicode/ubidi.h>
*
*typedef enum {
* styleNormal=0, styleSelected=1,
Expand Down Expand Up @@ -136,11 +136,11 @@
* int styleLimit;
*
* for(i=0; i<styleRunCount; ++i) {
* styleLimit=styleRun[i].limit;
* styleLimit=styleRuns[i].limit;
* if(start<styleLimit) {
* if(styleLimit>limit) { styleLimit=limit; }
* renderRun(text, start, styleLimit,
* direction, styleRun[i].style);
* direction, styleRuns[i].style);
* if(styleLimit==limit) { break; }
* start=styleLimit;
* }
Expand All @@ -150,14 +150,14 @@
*
* for(i=styleRunCount-1; i>=0; --i) {
* if(i>0) {
* styleStart=styleRun[i-1].limit;
* styleStart=styleRuns[i-1].limit;
* } else {
* styleStart=0;
* }
* if(limit>=styleStart) {
* if(styleStart<start) { styleStart=start; }
* renderRun(text, styleStart, limit,
* direction, styleRun[i].style);
* direction, styleRuns[i].style);
* if(styleStart==start) { break; }
* limit=styleStart;
* }
Expand All @@ -168,7 +168,8 @@
* // the line object represents text[start..limit-1]
* void renderLine(UBiDi *line, const UChar *text,
* int32_t start, int32_t limit,
* const StyleRun *styleRuns, int styleRunCount) {
* const StyleRun *styleRuns, int styleRunCount,
* UErrorCode *pErrorCode) {
* UBiDiDirection direction=ubidi_getDirection(line);
* if(direction!=UBIDI_MIXED) {
* // unidirectional
Expand All @@ -183,14 +184,14 @@
* int32_t count, i, length;
* UBiDiLevel level;
*
* count=ubidi_countRuns(para, pErrorCode);
* count=ubidi_countRuns(line, pErrorCode);
* if(U_SUCCESS(*pErrorCode)) {
* if(styleRunCount<=1) {
* Style style=styleRuns[0].style;
*
* // iterate over directional runs
* for(i=0; i<count; ++i) {
* direction=ubidi_getVisualRun(para, i, &start, &length);
* direction=ubidi_getVisualRun(line, i, &start, &length);
* renderRun(text, start, start+length, direction, style);
* }
* } else {
Expand Down Expand Up @@ -244,7 +245,7 @@
* startLine(paraLevel, width);
*
* renderLine(para, text, 0, length,
* styleRuns, styleRunCount);
* styleRuns, styleRunCount, pErrorCode);
* } else {
* UBiDi *line;
*
Expand All @@ -268,7 +269,7 @@
*
* renderLine(line, text, start, limit,
* styleRuns+styleRunStart,
* styleRunLimit-styleRunStart);
* styleRunLimit-styleRunStart, pErrorCode);
* }
* if(limit==length) { break; }
* start=limit;
Expand Down

0 comments on commit e2fafa5

Please sign in to comment.