@@ -45,41 +45,6 @@ class nsIUnicharEncoder : public nsISupports
4545
4646NS_DEFINE_STATIC_IID_ACCESSOR (nsIUnicharEncoder, NS_IUNICHARENCODER_IID )
4747
48- //
49- // Malloc an Encoder (unicode -> charset) buffer if the
50- // result won't fit in the static buffer
51- //
52- // p = the buffer pointer (char*)
53- // e = encoder (nsIUnicodeEncoder*)
54- // s = string (char16_t*)
55- // l = string length (int32_t)
56- // sb = static buffer (char[])
57- // sbl = static buffer length (uint32_t)
58- // al = actual buffer length (int32_t)
59- //
60- #define ENCODER_BUFFER_ALLOC_IF_NEEDED (p,e,s,l,sb,sbl,al ) \
61- PR_BEGIN_MACRO \
62- if (e \
63- && NS_SUCCEEDED ((e)->GetMaxLength ((s), (l), &(al)))\
64- && ((al) > (int32_t )(sbl)) \
65- && (nullptr !=((p)=(char *)moz_xmalloc((al)+1))) \
66- ) { \
67- } \
68- else { \
69- (p) = (char *)(sb); \
70- (al) = (sbl); \
71- } \
72- PR_END_MACRO
73-
74- //
75- // Free the Encoder buffer if it was allocated
76- //
77- #define ENCODER_BUFFER_FREE_IF_NEEDED (p,sb ) \
78- PR_BEGIN_MACRO \
79- if ((p) != (char *)(sb)) \
80- free (p); \
81- PR_END_MACRO
82-
8348/* *
8449 * Interface for a Converter from Unicode into a Charset.
8550 *
@@ -156,10 +121,12 @@ class nsIUnicodeEncoder : public nsISupports
156121 * @param aSrcLength [IN] the length of source data buffer
157122 * @param aDestLength [OUT] the needed size of the destination buffer
158123 * @return NS_OK_UENC_EXACTLENGTH if an exact length was computed
124+ * NS_ERROR_OUT_OF_MEMORY if OOM
159125 * NS_OK if all we have is an approximation
160126 */
161- NS_IMETHOD GetMaxLength (const char16_t * aSrc, int32_t aSrcLength,
162- int32_t * aDestLength) = 0;
127+ MOZ_WARN_UNUSED_RESULT NS_IMETHOD GetMaxLength (const char16_t * aSrc,
128+ int32_t aSrcLength,
129+ int32_t * aDestLength) = 0;
163130
164131 /* *
165132 * Resets the charset converter so it may be recycled for a completely
0 commit comments