Compare commits

...

1 Commits

Author SHA1 Message Date
coah
9189867dc3 match(NWC24MsgSubject 8/12) (fz7d) (worker 8ef4fd28) 2026-10-02 10:24:14 +00:00
3 changed files with 207 additions and 12 deletions

View File

@@ -386,14 +386,14 @@ NWC24Err NWC24ReadMsgTextEx(const NWC24MsgObj* msg, char* text, u32 capacity, ch
}
static NWC24Err ReadMsgTextInternal(const NWC24MsgObj* msg, char* text, u32 capacity, char* charset, u32 charsetCapacity, NWC24Encoding* encoding) {
const NWC24MsgObjPrivate* privateMsg = (const NWC24MsgObjPrivate*)msg;
char* buffer;
NWC24MBoxType type;
NWC24File file;
NWC24Err result, closeResult;
NWC24Err overflow = NWC24_OK;
u32 length;
u32 decodedSize;
char* buffer;
const NWC24MsgObjPrivate* privateMsg = (const NWC24MsgObjPrivate*)msg;
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
return NWC24_ERR_LIB_NOT_OPENED;
if (!(privateMsg->type & 0x200))
@@ -415,8 +415,8 @@ static NWC24Err ReadMsgTextInternal(const NWC24MsgObj* msg, char* text, u32 capa
if (length == 0)
return NWC24_ERR_NULL;
if (length > capacity - 1) {
overflow = NWC24_ERR_OVERFLOW;
length = capacity - 1;
overflow = NWC24_ERR_OVERFLOW;
}
result = NWC24iMBoxOpenStoredMsg(type, privateMsg->msgId, &file);
switch (result) {
@@ -452,13 +452,16 @@ static NWC24Err ReadMsgTextInternal(const NWC24MsgObj* msg, char* text, u32 capa
result = NWC24FRead(text, length, &file);
text[length] = 0;
break;
case 2:
case 2: {
NWC24Err decodeResult;
decodedSize = 0;
result = ReadBase64Data(&file, &privateMsg->text, (u8*)text, length, &decodedSize);
if (result == NWC24_OK && decodedSize != privateMsg->textSize)
result = NWC24_ERR_FORMAT;
decodeResult = ReadBase64Data(&file, &privateMsg->text, (u8*)text, length, &decodedSize);
if (decodeResult == NWC24_OK && decodedSize != privateMsg->textSize)
decodeResult = NWC24_ERR_FORMAT;
result = decodeResult;
text[length] = 0;
break;
}
case 3:
result = ReadQPText(privateMsg, &file, text, length);
break;

View File

@@ -743,15 +743,16 @@ NWC24Err NWC24iSetMsgSubjectQP(NWC24MsgObj* msg, const u16* subject, u32 subject
u32 workSize, NWC24Charset charset, char* charsetName) {
u32 workHalf;
u32 sourceOffset;
u32 secondSize;
u32 charsetLength;
u8* second;
u32 subjectLength;
u32 lineLength;
u32 outputLength;
u32 secondSize;
u32 total;
u32 combinedLength;
u32 i;
u32 charsetLength;
u32 outputLength;
u32 firstCharsetLength;
NWC24Err result;
secondSize = workSize - (workSize >> 1);
@@ -770,8 +771,8 @@ NWC24Err NWC24iSetMsgSubjectQP(NWC24MsgObj* msg, const u16* subject, u32 subject
work[i] = ' ';
}
}
charsetLength = strlen(charsetName);
NWC24iDetectBreakPoint(&lineLength, charset, work, subjectLength, (0x38 - charsetLength) / 3);
firstCharsetLength = strlen(charsetName);
NWC24iDetectBreakPoint(&lineLength, charset, work, subjectLength, (0x38 - firstCharsetLength) / 3);
result = NWC24EncodeWord(second, secondSize, &outputLength, charsetName, 0x40, 'Q', work, lineLength);
switch (result) {
default:

File diff suppressed because one or more lines are too long