ICU-12793 Fixes in sample code.

X-SVN-Rev: 39803
This commit is contained in:
Yoshito Umaoka 2017-03-14 21:37:41 +00:00
parent 4868776250
commit 53c2cc2c4c
5 changed files with 16 additions and 2 deletions

View File

@ -11,6 +11,10 @@
#include "unicode/unistr.h"
#include "unicode/fmtable.h"
#ifndef UPRV_LENGTHOF
#define UPRV_LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
#endif
// Verify that a UErrorCode is successful; exit(1) if not
void check(UErrorCode& status, const char* msg);

View File

@ -30,6 +30,10 @@
#include "unicode/uiter.h"
#include "uit_len8.h"
#ifndef UPRV_LENGTHOF
#define UPRV_LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
#endif
#define log_err printf
/* UCharIterator test ------------------------------------------------------- */

View File

@ -39,7 +39,6 @@
#include <string.h>
#include <stdlib.h> /* malloc */
#include "cmemory.h"
#include "unicode/utypes.h" /* Basic ICU data types */
#include "unicode/ucnv.h" /* C Converter API */
#include "unicode/ustring.h" /* some more string fcns*/
@ -50,6 +49,9 @@
#include "flagcb.h"
/* Some utility functions */
#ifndef UPRV_LENGTHOF
#define UPRV_LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
#endif
static const UChar kNone[] = { 0x0000 };

View File

@ -64,7 +64,7 @@ sr.res : sr.txt
# Can change this to LINK.c if it is a C only program
# Can add more libraries here.
$(TARGET): $(OBJECTS)
$(CC) -o $@ $^ $(LDFLAGS)
$(CC) -o $(TARGET) $(LDFLAGS)
# Make check: simply runs the sample, logged to a file
check: $(TARGET) $(RESOURCES)

View File

@ -31,6 +31,10 @@
#include "unicode/ucnv.h"
#include "unicode/unistr.h"
#ifndef UPRV_LENGTHOF
#define UPRV_LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
#endif
// helper functions -------------------------------------------------------- ***
// default converter for the platform encoding