File unrar_378_385.patch of Package php5-rar
x
1
diff -uNr unrar/archive.cpp unrar/archive.cpp
2
--- unrar/archive.cpp 2008-02-26 14:28:59.000000000 +0100
3
+++ unrar/archive.cpp 2008-10-24 06:44:47.000000000 +0200
4
5
if (!IsArchive(EnableBroken))
6
{
7
Log(FileName,St(MBadArc),FileName);
8
- ErrHandler.Exit(RAR_FATAL_ERROR);
9
+ ErrHandler.Exit(FATAL_ERROR);
10
}
11
}
12
#endif
13
14
#ifdef RARDLL
15
Cmd->DllError=ERAR_UNKNOWN_FORMAT;
16
#else
17
- ErrHandler.SetErrorCode(RAR_WARNING);
18
+ ErrHandler.SetErrorCode(WARNING);
19
#if !defined(SILENT) && !defined(SFX_MODULE)
20
Log(FileName,St(MUnknownMeth),FileName);
21
Log(FileName,St(MVerRequired),NewMhd.EncryptVer/10,NewMhd.EncryptVer%10);
22
diff -uNr unrar/archive.hpp unrar/archive.hpp
23
--- unrar/archive.hpp 2008-02-26 14:28:59.000000000 +0100
24
+++ unrar/archive.hpp 2008-10-24 06:44:48.000000000 +0200
25
26
void ConvertNameCase(wchar *Name);
27
void ConvertUnknownHeader();
28
int ReadOldHeader();
29
- void PrepareExtraTime(FileHeader *hd,EXTTIME_MODE etm,EXTTIME_MODE etc,EXTTIME_MODE eta,EXTTIME_MODE etarc,Array<byte> &TimeData);
30
31
#if !defined(SHELL_EXT) && !defined(NOCRYPT)
32
CryptData HeadersCrypt;
33
diff -uNr unrar/arcread.cpp unrar/arcread.cpp
34
--- unrar/arcread.cpp 2008-02-26 14:28:59.000000000 +0100
35
+++ unrar/arcread.cpp 2008-10-24 06:44:47.000000000 +0200
36
37
if (*Cmd->Password==0)
38
#ifdef RARDLL
39
if (Cmd->Callback==NULL ||
40
- Cmd->Callback(UCM_NEEDPASSWORD,Cmd->UserData,(LONG)Cmd->Password,sizeof(Cmd->Password))==-1)
41
+ Cmd->Callback(UCM_NEEDPASSWORD,Cmd->UserData,(LPARAM)Cmd->Password,sizeof(Cmd->Password))==-1)
42
{
43
Close();
44
- ErrHandler.Exit(RAR_USER_BREAK);
45
+ ErrHandler.Exit(USER_BREAK);
46
}
47
48
#else
49
if (!GetPassword(PASSWORD_ARCHIVE,FileName,Cmd->Password,sizeof(Cmd->Password)))
50
{
51
Close();
52
- ErrHandler.Exit(RAR_USER_BREAK);
53
+ ErrHandler.Exit(USER_BREAK);
54
}
55
#endif
56
HeadersCrypt.SetCryptKeys(Cmd->Password,HeadersSalt,false,false,NewMhd.EncryptVer>=36);
57
58
#ifndef SHELL_EXT
59
Log(FileName,St(MLogUnexpEOF));
60
#endif
61
- ErrHandler.SetErrorCode(RAR_WARNING);
62
+ ErrHandler.SetErrorCode(WARNING);
63
}
64
return(0);
65
}
66
67
Log(FileName,St(MLogFileHead),"???");
68
#endif
69
BrokenFileHeader=true;
70
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
71
+ ErrHandler.SetErrorCode(CRC_ERROR);
72
return(0);
73
}
74
75
76
if (hd->HeadType==NEWSUB_HEAD)
77
strcat(hd->FileName,"- ???");
78
BrokenFileHeader=true;
79
- ErrHandler.SetErrorCode(RAR_WARNING);
80
+ ErrHandler.SetErrorCode(WARNING);
81
#ifndef SHELL_EXT
82
Log(Archive::FileName,St(MLogFileHead),IntNameToExt(hd->FileName));
83
Alarm();
84
85
bool Recovered=false;
86
if (ShortBlock.HeadType==ENDARC_HEAD && (EndArcHead.Flags & EARC_REVSPACE)!=0)
87
{
88
+ // Last 7 bytes of recovered volume can contain zeroes, because
89
+ // REV files store its own information (volume number, etc.) here.
90
SaveFilePos SavePos(*this);
91
Int64 Length=Tell();
92
Seek(Length-7,SEEK_SET);
93
94
Close();
95
96
BrokenFileHeader=true;
97
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
98
+ ErrHandler.SetErrorCode(CRC_ERROR);
99
return(0);
100
-// ErrHandler.Exit(RAR_CRC_ERROR);
101
+// ErrHandler.Exit(CRC_ERROR);
102
}
103
}
104
}
105
106
Log(FileName,St(MLogFileHead),"???");
107
#endif
108
BrokenFileHeader=true;
109
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
110
+ ErrHandler.SetErrorCode(CRC_ERROR);
111
return(0);
112
}
113
return(Raw.Size());
114
115
if ((byte)*s<32 || (byte)*s>127)
116
*s='_';
117
#endif
118
+
119
+#if defined(_WIN_32) || defined(_EMX)
120
+ // ':' in file names is allowed in Unix, but not in Windows.
121
+ // Even worse, file data will be written to NTFS stream on NTFS,
122
+ // so automatic name correction on file create error in extraction
123
+ // routine does not work. In Windows and DOS versions we better
124
+ // replace ':' now.
125
+ if (*s==':')
126
+ *s='_';
127
+#endif
128
+
129
}
130
+
131
for (wchar *s=NewLhd.FileNameW;*s!=0;s++)
132
+ {
133
if (*s=='/' || *s=='\\')
134
*s=CPATHDIVIDER;
135
+
136
+#if defined(_WIN_32) || defined(_EMX)
137
+ // ':' in file names is allowed in Unix, but not in Windows.
138
+ // Even worse, file data will be written to NTFS stream on NTFS,
139
+ // so automatic name correction on file create error in extraction
140
+ // routine does not work. In Windows and DOS versions we better
141
+ // replace ':' now.
142
+ if (*s==':')
143
+ *s='_';
144
+#endif
145
+ }
146
}
147
148
149
150
#ifndef SHELL_EXT
151
Log(FileName,St(MSubHeadCorrupt));
152
#endif
153
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
154
+ ErrHandler.SetErrorCode(CRC_ERROR);
155
return(false);
156
}
157
if (SubHead.Method<0x30 || SubHead.Method>0x35 || SubHead.UnpVer>/*PACK_VER*/36)
158
159
#ifndef SHELL_EXT
160
Log(FileName,St(MSubHeadDataCRC),SubHead.FileName);
161
#endif
162
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
163
+ ErrHandler.SetErrorCode(CRC_ERROR);
164
if (UnpData!=NULL)
165
UnpData->Reset();
166
return(false);
167
diff -uNr unrar/beosea.cpp unrar/beosea.cpp
168
--- unrar/beosea.cpp 2008-02-26 14:28:59.000000000 +0100
169
+++ unrar/beosea.cpp 2008-10-24 06:44:47.000000000 +0200
170
171
if (Arc.HeaderCRC!=Arc.EAHead.HeadCRC)
172
{
173
Log(Arc.FileName,St(MEABroken),FileName);
174
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
175
+ ErrHandler.SetErrorCode(CRC_ERROR);
176
return;
177
}
178
if (Arc.EAHead.Method<0x31 || Arc.EAHead.Method>0x35 || Arc.EAHead.UnpVer>PACK_VER)
179
180
if (Arc.EAHead.EACRC!=~DataIO.UnpFileCRC)
181
{
182
Log(Arc.FileName,St(MEABroken),FileName);
183
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
184
+ ErrHandler.SetErrorCode(CRC_ERROR);
185
return;
186
}
187
int fd = open(FileName,O_WRONLY);
188
if (fd==-1)
189
{
190
Log(Arc.FileName,St(MCannotSetEA),FileName);
191
- ErrHandler.SetErrorCode(RAR_WARNING);
192
+ ErrHandler.SetErrorCode(WARNING);
193
return;
194
}
195
196
197
if (NameSize>=sizeof(Name))
198
{
199
Log(Arc.FileName,St(MCannotSetEA),FileName);
200
- ErrHandler.SetErrorCode(RAR_WARNING);
201
+ ErrHandler.SetErrorCode(WARNING);
202
break;
203
}
204
memcpy(Name,CurItem+10,NameSize);
205
206
if (fs_write_attr(fd,Name,Type,0,CurItem+10+NameSize,Size)==-1)
207
{
208
Log(Arc.FileName,St(MCannotSetEA),FileName);
209
- ErrHandler.SetErrorCode(RAR_WARNING);
210
+ ErrHandler.SetErrorCode(WARNING);
211
break;
212
}
213
AttrPos+=10+NameSize+Size;
214
215
if (fd==-1)
216
{
217
Log(Arc.FileName,St(MCannotSetEA),FileName);
218
- ErrHandler.SetErrorCode(RAR_WARNING);
219
+ ErrHandler.SetErrorCode(WARNING);
220
return;
221
}
222
223
224
if (NameSize>=sizeof(Name))
225
{
226
Log(Arc.FileName,St(MCannotSetEA),FileName);
227
- ErrHandler.SetErrorCode(RAR_WARNING);
228
+ ErrHandler.SetErrorCode(WARNING);
229
break;
230
}
231
memcpy(Name,CurItem+10,NameSize);
232
233
if (fs_write_attr(fd,Name,Type,0,CurItem+10+NameSize,Size)==-1)
234
{
235
Log(Arc.FileName,St(MCannotSetEA),FileName);
236
- ErrHandler.SetErrorCode(RAR_WARNING);
237
+ ErrHandler.SetErrorCode(WARNING);
238
break;
239
}
240
AttrPos+=10+NameSize+Size;
241
diff -uNr unrar/cmddata.cpp unrar/cmddata.cpp
242
--- unrar/cmddata.cpp 2008-02-26 14:28:59.000000000 +0100
243
+++ unrar/cmddata.cpp 2008-10-24 06:44:47.000000000 +0200
244
245
if (Arg[1]=='-')
246
NoMoreSwitches=true;
247
else
248
- ProcessSwitch(&Arg[1]);
249
+ ProcessSwitch(&Arg[1],(ArgW!=NULL && *ArgW!=0 ? &ArgW[1]:NULL));
250
else
251
if (*Command==0)
252
{
253
254
}
255
else
256
{
257
- int Length=strlen(Arg);
258
- char EndChar=Arg[Length-1];
259
+ size_t Length=strlen(Arg);
260
+ char EndChar=Length==0 ? 0:Arg[Length-1];
261
char CmdChar=etoupper(*Command);
262
bool Add=strchr("AFUM",CmdChar)!=NULL;
263
bool Extract=CmdChar=='X' || CmdChar=='E';
264
265
Charset=RCH_OEM;
266
#endif
267
268
- ReadTextFile(Arg+1,FileArgs,false,true,Charset,true,true);
269
+ ReadTextFile(Arg+1,FileArgs,false,true,Charset,true,true,true);
270
}
271
else
272
if (Found && FileData.IsDir && Extract && *ExtrPath==0)
273
274
275
276
#if !defined(SFX_MODULE)
277
-void CommandData::ProcessSwitch(char *Switch)
278
+void CommandData::ProcessSwitch(char *Switch,wchar *SwitchW)
279
{
280
281
switch(etoupper(Switch[0]))
282
283
break;
284
case 'P':
285
strcpy(ArcPath,Switch+2);
286
+ if (SwitchW!=NULL && *SwitchW!=0)
287
+ strcpyw(ArcPathW,SwitchW+2);
288
break;
289
case 'S':
290
SyncFiles=true;
291
292
case '-':
293
Overwrite=OVERWRITE_NONE;
294
break;
295
+ case 0:
296
+ Overwrite=OVERWRITE_FORCE_ASK;
297
+ break;
298
case 'R':
299
Overwrite=OVERWRITE_AUTORENAME;
300
break;
301
302
Charset=RCH_OEM;
303
#endif
304
305
- ReadTextFile(Switch+2,Args,false,true,Charset,true,true);
306
+ ReadTextFile(Switch+2,Args,false,true,Charset,true,true,true);
307
}
308
else
309
Args->AddString(Switch+1);
310
311
break;
312
case 'C':
313
{
314
- RAR_CHARSET rch;
315
+ RAR_CHARSET rch=RCH_DEFAULT;
316
switch(etoupper(Switch[2]))
317
{
318
case 'A':
319
320
void CommandData::BadSwitch(char *Switch)
321
{
322
mprintf(St(MUnknownOption),Switch);
323
- ErrHandler.Exit(RAR_USER_ERROR);
324
+ ErrHandler.Exit(USER_ERROR);
325
}
326
#endif
327
328
329
#endif
330
331
332
+inline bool CmpMSGID(MSGID i1,MSGID i2)
333
+{
334
+#ifdef MSGID_INT
335
+ return(i1==i2);
336
+#else
337
+ // If MSGID is const char*, we cannot compare pointers only.
338
+ // Pointers to different instances of same strings can differ,
339
+ // so we need to compare complete strings.
340
+ return(strcmp(i1,i2)==0);
341
+#endif
342
+}
343
+
344
void CommandData::OutHelp()
345
{
346
#if !defined(GUI) && !defined(SILENT)
347
348
#ifdef SFX_MODULE
349
MCHelpCmd,MSHelpCmdE,MSHelpCmdT,MSHelpCmdV
350
#elif defined(UNRAR)
351
- MUNRARTitle1,MRARTitle2,MCHelpCmd,MCHelpCmdE,MCHelpCmdL,MCHelpCmdP,
352
- MCHelpCmdT,MCHelpCmdV,MCHelpCmdX,MCHelpSw,MCHelpSwm,MCHelpSwAC,MCHelpSwAD,
353
- MCHelpSwAP,MCHelpSwAVm,MCHelpSwCm,MCHelpSwCFGm,MCHelpSwCL,MCHelpSwCU,
354
+ MUNRARTitle1,MRARTitle2,MCHelpCmd,MCHelpCmdE,MCHelpCmdL,
355
+ MCHelpCmdP,MCHelpCmdT,MCHelpCmdV,MCHelpCmdX,MCHelpSw,
356
+ MCHelpSwm,MCHelpSwAC,MCHelpSwAD,MCHelpSwAP,
357
+ MCHelpSwCm,MCHelpSwCFGm,MCHelpSwCL,MCHelpSwCU,
358
MCHelpSwDH,MCHelpSwEP,MCHelpSwEP3,MCHelpSwF,MCHelpSwIDP,MCHelpSwIERR,
359
MCHelpSwINUL,MCHelpSwIOFF,MCHelpSwKB,MCHelpSwN,MCHelpSwNa,MCHelpSwNal,
360
- MCHelpSwOp,MCHelpSwOm,MCHelpSwOC,MCHelpSwOR,MCHelpSwOW,MCHelpSwP,
361
+ MCHelpSwO,MCHelpSwOC,MCHelpSwOR,MCHelpSwOW,MCHelpSwP,
362
MCHelpSwPm,MCHelpSwR,MCHelpSwRI,MCHelpSwSL,MCHelpSwSM,MCHelpSwTA,
363
MCHelpSwTB,MCHelpSwTN,MCHelpSwTO,MCHelpSwTS,MCHelpSwU,MCHelpSwVUnr,
364
MCHelpSwVER,MCHelpSwVP,MCHelpSwX,MCHelpSwXa,MCHelpSwXal,MCHelpSwY
365
366
MCHelpCmdRN,MCHelpCmdRR,MCHelpCmdRV,MCHelpCmdS,MCHelpCmdT,MCHelpCmdU,
367
MCHelpCmdV,MCHelpCmdX,MCHelpSw,MCHelpSwm,MCHelpSwAC,MCHelpSwAD,MCHelpSwAG,
368
MCHelpSwAO,MCHelpSwAP,MCHelpSwAS,MCHelpSwAV,MCHelpSwAVm,MCHelpSwCm,
369
- MCHelpSwCFGm,MCHelpSwCL,MCHelpSwCU,MCHelpSwDF,MCHelpSwDH,MCHelpSwDS,
370
- MCHelpSwEa,MCHelpSwED,MCHelpSwEE,MCHelpSwEN,MCHelpSwEP,MCHelpSwEP1,
371
- MCHelpSwEP2,MCHelpSwEP3,MCHelpSwF,MCHelpSwHP,MCHelpSwIDP,
372
- MCHelpSwIEML,MCHelpSwIERR,MCHelpSwILOG,MCHelpSwINUL,MCHelpSwIOFF,
373
- MCHelpSwISND,MCHelpSwK,MCHelpSwKB,MCHelpSwMn,MCHelpSwMC,MCHelpSwMD,
374
- MCHelpSwMS,MCHelpSwMT,MCHelpSwN,MCHelpSwNa,MCHelpSwNal,MCHelpSwOp,
375
- MCHelpSwOm,MCHelpSwOC,MCHelpSwOL,MCHelpSwOR,MCHelpSwOS,MCHelpSwOW,
376
+ MCHelpSwCFGm,MCHelpSwCL,MCHelpSwCU,MCHelpSwDF,MCHelpSwDH,MCHelpSwDR,
377
+ MCHelpSwDS,MCHelpSwDW,MCHelpSwEa,MCHelpSwED,MCHelpSwEE,MCHelpSwEN,
378
+ MCHelpSwEP,MCHelpSwEP1,MCHelpSwEP2,MCHelpSwEP3,MCHelpSwF,MCHelpSwHP,
379
+ MCHelpSwIDP,MCHelpSwIEML,MCHelpSwIERR,MCHelpSwILOG,MCHelpSwINUL,
380
+ MCHelpSwIOFF,MCHelpSwISND,MCHelpSwK,MCHelpSwKB,MCHelpSwMn,MCHelpSwMC,
381
+ MCHelpSwMD,MCHelpSwMS,MCHelpSwMT,MCHelpSwN,MCHelpSwNa,MCHelpSwNal,
382
+ MCHelpSwO,MCHelpSwOC,MCHelpSwOL,MCHelpSwOR,MCHelpSwOS,MCHelpSwOW,
383
MCHelpSwP,MCHelpSwPm,MCHelpSwR,MCHelpSwR0,MCHelpSwRI,MCHelpSwRR,
384
MCHelpSwRV,MCHelpSwS,MCHelpSwSm,MCHelpSwSC,MCHelpSwSFX,MCHelpSwSI,
385
MCHelpSwSL,MCHelpSwSM,MCHelpSwT,MCHelpSwTA,MCHelpSwTB,MCHelpSwTK,
386
387
#ifndef _WIN_32
388
static MSGID Win32Only[]={
389
MCHelpSwIEML,MCHelpSwVD,MCHelpSwAO,MCHelpSwOS,MCHelpSwIOFF,
390
- MCHelpSwEP2,MCHelpSwOC
391
+ MCHelpSwEP2,MCHelpSwOC,MCHelpSwDR,MCHelpSwRI
392
};
393
bool Found=false;
394
for (int J=0;J<sizeof(Win32Only)/sizeof(Win32Only[0]);J++)
395
- if (Help[I]==Win32Only[J])
396
+ if (CmpMSGID(Help[I],Win32Only[J]))
397
{
398
Found=true;
399
break;
400
401
continue;
402
#endif
403
#if !defined(_UNIX) && !defined(_WIN_32)
404
- if (Help[I]==MCHelpSwOW)
405
+ if (CmpMSGID(Help[I],MCHelpSwOW))
406
continue;
407
#endif
408
#if !defined(_WIN_32) && !defined(_EMX)
409
- if (Help[I]==MCHelpSwAC)
410
+ if (CmpMSGID(Help[I],MCHelpSwAC))
411
continue;
412
#endif
413
#ifndef SAVE_LINKS
414
- if (Help[I]==MCHelpSwOL)
415
- continue;
416
-#endif
417
-#ifndef _WIN_32
418
- if (Help[I]==MCHelpSwRI)
419
+ if (CmpMSGID(Help[I],MCHelpSwOL))
420
continue;
421
#endif
422
#ifndef PACK_SMP
423
- if (Help[I]==MCHelpSwMT)
424
+ if (CmpMSGID(Help[I],MCHelpSwMT))
425
continue;
426
#endif
427
#ifndef _BEOS
428
- if (Help[I]==MCHelpSwEE)
429
+ if (CmpMSGID(Help[I],MCHelpSwEE))
430
{
431
#if defined(_EMX) && !defined(_DJGPP)
432
if (_osmode != OS2_MODE)
433
434
mprintf(St(Help[I]));
435
}
436
mprintf("\n");
437
- ErrHandler.Exit(RAR_USER_ERROR);
438
+ ErrHandler.Exit(USER_ERROR);
439
#endif
440
}
441
442
diff -uNr unrar/cmddata.hpp unrar/cmddata.hpp
443
--- unrar/cmddata.hpp 2008-02-26 14:28:59.000000000 +0100
444
+++ unrar/cmddata.hpp 2008-10-24 06:44:48.000000000 +0200
445
446
{
447
private:
448
void ProcessSwitchesString(char *Str);
449
- void ProcessSwitch(char *Switch);
450
+ void ProcessSwitch(char *Switch,wchar *SwitchW=NULL);
451
void BadSwitch(char *Switch);
452
bool ExclCheckArgs(StringList *Args,char *CheckName,bool CheckFullPath,int MatchMode);
453
uint GetExclAttr(char *Str);
454
diff -uNr unrar/consio.cpp unrar/consio.cpp
455
--- unrar/consio.cpp 2008-02-26 14:28:59.000000000 +0100
456
+++ unrar/consio.cpp 2008-10-24 06:44:47.000000000 +0200
457
458
#include "log.cpp"
459
#endif
460
461
+static int KbdAnsi(char *Addr,int Size);
462
+
463
#if !defined(GUI) && !defined(SILENT)
464
static void RawPrint(char *Msg,MESSAGE_TYPE MessageType);
465
+static uint GetKey();
466
#endif
467
468
static MESSAGE_TYPE MsgStream=MSG_STDOUT;
469
470
#endif
471
472
473
-#if !defined(GUI) && !defined(SILENT)
474
-unsigned int GetKey()
475
-{
476
-#ifdef SILENT
477
- return(0);
478
-#else
479
- char Str[80];
480
-#ifdef __GNUC__
481
- fgets(Str,sizeof(Str),stdin);
482
- return(Str[0]);
483
-#else
484
- File SrcFile;
485
- SrcFile.SetHandleType(FILE_HANDLESTD);
486
- SrcFile.Read(Str,sizeof(Str));
487
- return(Str[0]);
488
-#endif
489
-#endif
490
-}
491
-#endif
492
-
493
-
494
#ifndef SILENT
495
bool GetPassword(PASSWORD_TYPE Type,const char *FileName,char *Password,int MaxLength)
496
{
497
498
499
500
#if !defined(GUI) && !defined(SILENT)
501
+uint GetKey()
502
+{
503
+ char Str[80];
504
+ bool EndOfFile;
505
+#if defined(__GNUC__) || defined(sun)
506
+ EndOfFile=(fgets(Str,sizeof(Str),stdin)==NULL);
507
+#else
508
+ File SrcFile;
509
+ SrcFile.SetHandleType(FILE_HANDLESTD);
510
+ EndOfFile=(SrcFile.Read(Str,sizeof(Str))==0);
511
+#endif
512
+ if (EndOfFile)
513
+ {
514
+ // Looks like stdin is a null device. We can enter to infinite loop
515
+ // calling Ask(), so let's better exit.
516
+ ErrHandler.Exit(USER_BREAK);
517
+ }
518
+ return(Str[0]);
519
+}
520
+#endif
521
+
522
+
523
+#if !defined(GUI) && !defined(SILENT)
524
int Ask(const char *AskStr)
525
{
526
const int MaxItems=10;
527
diff -uNr unrar/consio.hpp unrar/consio.hpp
528
--- unrar/consio.hpp 2008-02-26 14:28:59.000000000 +0100
529
+++ unrar/consio.hpp 2008-10-24 06:44:48.000000000 +0200
530
531
void eprintf(const char *fmt,...);
532
void Alarm();
533
void GetPasswordText(char *Str,int MaxLength);
534
-unsigned int GetKey();
535
bool GetPassword(PASSWORD_TYPE Type,const char *FileName,char *Password,int MaxLength);
536
int Ask(const char *AskStr);
537
#endif
538
539
-int KbdAnsi(char *Addr,int Size);
540
void OutComment(char *Comment,int Size);
541
542
#ifdef SILENT
543
diff -uNr unrar/crc.cpp unrar/crc.cpp
544
--- unrar/crc.cpp 2008-02-26 14:28:59.000000000 +0100
545
+++ unrar/crc.cpp 2008-10-24 06:44:47.000000000 +0200
546
547
}
548
549
550
-uint CRC(uint StartCRC,const void *Addr,uint Size)
551
+uint CRC(uint StartCRC,const void *Addr,size_t Size)
552
{
553
if (CRCTab[1]==0)
554
InitCRC();
555
byte *Data=(byte *)Addr;
556
#if defined(LITTLE_ENDIAN) && defined(PRESENT_INT32) && defined(ALLOW_NOT_ALIGNED_INT)
557
+
558
+#ifdef _MSC_VER
559
+ // avoid a warning about 'Data' pointer truncation in 64 bit mode
560
+ #pragma warning( disable : 4311 )
561
+#endif
562
+
563
while (Size>0 && ((long)Data & 7))
564
{
565
StartCRC=CRCTab[(byte)(StartCRC^Data[0])]^(StartCRC>>8);
566
567
Size-=8;
568
}
569
#endif
570
- for (int I=0;I<Size;I++)
571
+ for (size_t I=0;I<Size;I++)
572
StartCRC=CRCTab[(byte)(StartCRC^Data[I])]^(StartCRC>>8);
573
return(StartCRC);
574
}
575
576
#ifndef SFX_MODULE
577
-ushort OldCRC(ushort StartCRC,const void *Addr,uint Size)
578
+ushort OldCRC(ushort StartCRC,const void *Addr,size_t Size)
579
{
580
byte *Data=(byte *)Addr;
581
- for (int I=0;I<Size;I++)
582
+ for (size_t I=0;I<Size;I++)
583
{
584
StartCRC=(StartCRC+Data[I])&0xffff;
585
StartCRC=((StartCRC<<1)|(StartCRC>>15))&0xffff;
586
diff -uNr unrar/crc.hpp unrar/crc.hpp
587
--- unrar/crc.hpp 2008-02-26 14:28:59.000000000 +0100
588
+++ unrar/crc.hpp 2008-10-24 06:44:48.000000000 +0200
589
590
extern uint CRCTab[256];
591
592
void InitCRC();
593
-uint CRC(uint StartCRC,const void *Addr,uint Size);
594
-ushort OldCRC(ushort StartCRC,const void *Addr,uint Size);
595
+uint CRC(uint StartCRC,const void *Addr,size_t Size);
596
+ushort OldCRC(ushort StartCRC,const void *Addr,size_t Size);
597
598
#endif
599
diff -uNr unrar/dll.cpp unrar/dll.cpp
600
--- unrar/dll.cpp 2008-02-26 14:28:59.000000000 +0100
601
+++ unrar/dll.cpp 2008-10-24 06:44:47.000000000 +0200
602
603
try
604
{
605
Data->Cmd.DllError=0;
606
- if (Data->OpenMode==RAR_OM_LIST || Operation==RAR_SKIP && !Data->Arc.Solid)
607
+ if (Data->OpenMode==RAR_OM_LIST || Data->OpenMode==RAR_OM_LIST_INCSPLIT ||
608
+ Operation==RAR_SKIP && !Data->Arc.Solid)
609
{
610
- if (/*Data->OpenMode==RAR_OM_LIST && */Data->Arc.Volume &&
611
+ if (Data->Arc.Volume &&
612
Data->Arc.GetHeaderType()==FILE_HEAD &&
613
(Data->Arc.NewLhd.Flags & LHD_SPLIT_AFTER)!=0)
614
if (MergeArchive(Data->Arc,NULL,false,'L'))
615
616
strncpyw(Data->Cmd.ExtrPathW,NullToEmpty(DestPathW),NM-2);
617
AddEndSlash(Data->Cmd.ExtrPathW);
618
strncpyw(Data->Cmd.DllDestNameW,NullToEmpty(DestNameW),NM-1);
619
+
620
+ if (*Data->Cmd.DllDestNameW!=0 && *Data->Cmd.DllDestName==0)
621
+ WideToChar(Data->Cmd.DllDestNameW,Data->Cmd.DllDestName);
622
}
623
else
624
{
625
626
}
627
628
629
-void PASCAL RARSetCallback(HANDLE hArcData,UNRARCALLBACK Callback,LONG UserData)
630
+void PASCAL RARSetCallback(HANDLE hArcData,UNRARCALLBACK Callback,LPARAM UserData)
631
{
632
DataSet *Data=(DataSet *)hArcData;
633
Data->Cmd.Callback=Callback;
634
635
{
636
switch(ErrCode)
637
{
638
- case RAR_FATAL_ERROR:
639
+ case FATAL_ERROR:
640
return(ERAR_EREAD);
641
- case RAR_CRC_ERROR:
642
+ case CRC_ERROR:
643
return(ERAR_BAD_DATA);
644
- case RAR_WRITE_ERROR:
645
+ case WRITE_ERROR:
646
return(ERAR_EWRITE);
647
- case RAR_OPEN_ERROR:
648
+ case OPEN_ERROR:
649
return(ERAR_EOPEN);
650
- case RAR_CREATE_ERROR:
651
+ case CREATE_ERROR:
652
return(ERAR_ECREATE);
653
- case RAR_MEMORY_ERROR:
654
+ case MEMORY_ERROR:
655
return(ERAR_NO_MEMORY);
656
- case RAR_SUCCESS:
657
+ case SUCCESS:
658
return(0);
659
default:
660
return(ERAR_UNKNOWN);
661
diff -uNr unrar/dll.hpp unrar/dll.hpp
662
--- unrar/dll.hpp 2008-02-26 14:28:59.000000000 +0100
663
+++ unrar/dll.hpp 2008-10-24 06:44:48.000000000 +0200
664
665
#define ERAR_UNKNOWN 21
666
#define ERAR_MISSING_PASSWORD 22
667
668
-#define RAR_OM_LIST 0
669
-#define RAR_OM_EXTRACT 1
670
+#define RAR_OM_LIST 0
671
+#define RAR_OM_EXTRACT 1
672
+#define RAR_OM_LIST_INCSPLIT 2
673
674
#define RAR_SKIP 0
675
#define RAR_TEST 1
676
677
#define PASCAL
678
#define LONG long
679
#define HANDLE void *
680
+#define LPARAM long
681
#define UINT unsigned int
682
#endif
683
684
685
UCM_CHANGEVOLUME,UCM_PROCESSDATA,UCM_NEEDPASSWORD
686
};
687
688
-typedef int (CALLBACK *UNRARCALLBACK)(UINT msg,LONG UserData,LONG P1,LONG P2);
689
+typedef int (CALLBACK *UNRARCALLBACK)(UINT msg,LPARAM UserData,LPARAM P1,LPARAM P2);
690
691
typedef int (PASCAL *CHANGEVOLPROC)(char *ArcName,int Mode);
692
typedef int (PASCAL *PROCESSDATAPROC)(unsigned char *Addr,int Size);
693
694
int PASCAL RARReadHeaderEx(HANDLE hArcData,struct RARHeaderDataEx *HeaderData);
695
int PASCAL RARProcessFile(HANDLE hArcData,int Operation,char *DestPath,char *DestName);
696
int PASCAL RARProcessFileW(HANDLE hArcData,int Operation,wchar_t *DestPath,wchar_t *DestName);
697
-void PASCAL RARSetCallback(HANDLE hArcData,UNRARCALLBACK Callback,LONG UserData);
698
+void PASCAL RARSetCallback(HANDLE hArcData,UNRARCALLBACK Callback,LPARAM UserData);
699
void PASCAL RARSetChangeVolProc(HANDLE hArcData,CHANGEVOLPROC ChangeVolProc);
700
void PASCAL RARSetProcessDataProc(HANDLE hArcData,PROCESSDATAPROC ProcessDataProc);
701
void PASCAL RARSetPassword(HANDLE hArcData,char *Password);
702
diff -uNr unrar/errhnd.cpp unrar/errhnd.cpp
703
--- unrar/errhnd.cpp 2008-02-26 14:28:59.000000000 +0100
704
+++ unrar/errhnd.cpp 2008-10-24 06:44:47.000000000 +0200
705
706
707
void ErrorHandler::Clean()
708
{
709
- ExitCode=RAR_SUCCESS;
710
+ ExitCode=SUCCESS;
711
ErrCount=0;
712
EnableBreak=true;
713
Silent=false;
714
715
void ErrorHandler::MemoryError()
716
{
717
MemoryErrorMsg();
718
- Throw(RAR_MEMORY_ERROR);
719
+ Throw(MEMORY_ERROR);
720
}
721
722
723
724
{
725
#ifndef SILENT
726
OpenErrorMsg(FileName);
727
- Throw(RAR_OPEN_ERROR);
728
+ Throw(OPEN_ERROR);
729
#endif
730
}
731
732
733
}
734
#endif
735
#if !defined(SILENT) || defined(RARDLL)
736
- Throw(RAR_FATAL_ERROR);
737
+ Throw(FATAL_ERROR);
738
#endif
739
}
740
741
742
ReadErrorMsg(NULL,FileName);
743
#endif
744
#if !defined(SILENT) || defined(RARDLL)
745
- Throw(RAR_FATAL_ERROR);
746
+ Throw(FATAL_ERROR);
747
#endif
748
}
749
750
751
WriteErrorMsg(ArcName,FileName);
752
#endif
753
#if !defined(SILENT) || defined(RARDLL)
754
- Throw(RAR_WRITE_ERROR);
755
+ Throw(WRITE_ERROR);
756
#endif
757
}
758
759
760
ErrMsg(NULL,St(MNTFSRequired),FileName);
761
#endif
762
#if !defined(SILENT) && !defined(SFX_MODULE) || defined(RARDLL)
763
- Throw(RAR_WRITE_ERROR);
764
+ Throw(WRITE_ERROR);
765
#endif
766
}
767
#endif
768
769
}
770
#endif
771
#if !defined(SILENT) || defined(RARDLL)
772
- Throw(RAR_FATAL_ERROR);
773
+ Throw(FATAL_ERROR);
774
#endif
775
}
776
777
778
{
779
switch(Code)
780
{
781
- case RAR_WARNING:
782
- case RAR_USER_BREAK:
783
- if (ExitCode==RAR_SUCCESS)
784
+ case WARNING:
785
+ case USER_BREAK:
786
+ if (ExitCode==SUCCESS)
787
ExitCode=Code;
788
break;
789
- case RAR_FATAL_ERROR:
790
- if (ExitCode==RAR_SUCCESS || ExitCode==RAR_WARNING)
791
- ExitCode=RAR_FATAL_ERROR;
792
+ case FATAL_ERROR:
793
+ if (ExitCode==SUCCESS || ExitCode==WARNING)
794
+ ExitCode=FATAL_ERROR;
795
break;
796
default:
797
ExitCode=Code;
798
799
#if defined(USE_RC) && !defined(SFX_MODULE) && !defined(_WIN_CE)
800
ExtRes.UnloadDLL();
801
#endif
802
- exit(RAR_USER_BREAK);
803
-#ifdef _WIN_32
804
+ exit(USER_BREAK);
805
+#if defined(_WIN_32) && !defined(_MSC_VER)
806
+ // never reached, just to avoid a compiler warning
807
return(TRUE);
808
#endif
809
}
810
811
812
void ErrorHandler::Throw(int Code)
813
{
814
- if (Code==RAR_USER_BREAK && !EnableBreak)
815
+ if (Code==USER_BREAK && !EnableBreak)
816
return;
817
ErrHandler.SetErrorCode(Code);
818
#ifdef ALLOW_EXCEPTIONS
819
diff -uNr unrar/errhnd.hpp unrar/errhnd.hpp
820
--- unrar/errhnd.hpp 2008-02-26 14:28:59.000000000 +0100
821
+++ unrar/errhnd.hpp 2008-10-24 06:44:48.000000000 +0200
822
823
#define rarrealloc realloc
824
#define rarfree free
825
#define rarstrdup strdup
826
+#define rarstrdupw strdupw
827
828
829
830
-enum { RAR_SUCCESS,RAR_WARNING,RAR_FATAL_ERROR,RAR_CRC_ERROR,RAR_LOCK_ERROR,RAR_WRITE_ERROR,
831
- RAR_OPEN_ERROR,RAR_USER_ERROR,RAR_MEMORY_ERROR,RAR_CREATE_ERROR,RAR_USER_BREAK=255};
832
+enum { SUCCESS,WARNING,FATAL_ERROR,CRC_ERROR,LOCK_ERROR,WRITE_ERROR,
833
+ OPEN_ERROR,USER_ERROR,MEMORY_ERROR,CREATE_ERROR,USER_BREAK=255};
834
835
class ErrorHandler
836
{
837
diff -uNr unrar/extract.cpp unrar/extract.cpp
838
--- unrar/extract.cpp 2008-02-26 14:28:59.000000000 +0100
839
+++ unrar/extract.cpp 2008-10-24 06:44:47.000000000 +0200
840
841
while (Cmd->GetArcName(ArcName,ArcNameW,sizeof(ArcName)))
842
if (FindFile::FastFind(ArcName,ArcNameW,&FD))
843
DataIO.TotalArcSize+=FD.Size;
844
+
845
Cmd->ArcNames->Rewind();
846
while (Cmd->GetArcName(ArcName,ArcNameW,sizeof(ArcName)))
847
{
848
849
850
EXTRACT_ARC_CODE Code=ExtractArchive(Cmd);
851
852
-/*
853
- restore Cmd->Password which could be changed in IsArchive() call
854
- for next header encrypted archive
855
-*/
856
+ // restore Cmd->Password which could be changed in IsArchive() call
857
+ // for next header encrypted archive
858
strcpy(Cmd->Password,PrevCmdPassword);
859
860
if (Code!=EXTRACT_ARC_REPEAT)
861
862
{
863
mprintf(St(MExtrNoFiles));
864
}
865
- ErrHandler.SetErrorCode(RAR_WARNING);
866
+ ErrHandler.SetErrorCode(WARNING);
867
}
868
#ifndef GUI
869
else
870
871
SignatureFound=false;
872
AllMatchesExact=true;
873
ReconstructDone=false;
874
+
875
+ StartTime.SetCurrentTime();
876
}
877
878
879
880
Archive Arc(Cmd);
881
if (!Arc.WOpen(ArcName,ArcNameW))
882
{
883
- ErrHandler.SetErrorCode(RAR_OPEN_ERROR);
884
+ ErrHandler.SetErrorCode(OPEN_ERROR);
885
return(EXTRACT_ARC_NEXT);
886
}
887
888
889
mprintf(St(MNotRAR),ArcName);
890
#endif
891
if (CmpExt(ArcName,"rar"))
892
- ErrHandler.SetErrorCode(RAR_WARNING);
893
+ ErrHandler.SetErrorCode(WARNING);
894
return(EXTRACT_ARC_NEXT);
895
}
896
897
+ // archive with corrupt encrypted header can be closed in IsArchive() call
898
if (!Arc.IsOpened())
899
return(EXTRACT_ARC_NEXT);
900
901
902
if (Arc.Volume && Arc.NotFirstVolume)
903
{
904
char FirstVolName[NM];
905
-
906
VolNameToFirstName(ArcName,FirstVolName,(Arc.NewMhd.Flags & MHD_NEWNUMBERING));
907
+
908
+ // If several volume names from same volume set are specified
909
+ // and current volume is not first in set and first volume is present
910
+ // and specified too, let's skip the current volume.
911
if (stricomp(ArcName,FirstVolName)!=0 && FileExist(FirstVolName) &&
912
Cmd->ArcNames->Search(FirstVolName,NULL,false))
913
return(EXTRACT_ARC_NEXT);
914
}
915
#endif
916
+
917
+ if (Arc.Volume)
918
+ {
919
+ // Calculate the total size of all accessible volumes.
920
+ // This size is necessary to display the correct total progress indicator.
921
+
922
+ char NextName[NM];
923
+ wchar NextNameW[NM];
924
+
925
+ strcpy(NextName,Arc.FileName);
926
+ strcpyw(NextNameW,Arc.FileNameW);
927
+
928
+ while (true)
929
+ {
930
+ // First volume is already added to DataIO.TotalArcSize
931
+ // in initial TotalArcSize calculation in DoExtract.
932
+ // So we skip it and start from second volume.
933
+ NextVolumeName(NextName,NextNameW,ASIZE(NextName),(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
934
+ struct FindData FD;
935
+ if (FindFile::FastFind(NextName,NextNameW,&FD))
936
+ DataIO.TotalArcSize+=FD.Size;
937
+ else
938
+ break;
939
+ }
940
+ }
941
+
942
ExtractArchiveInit(Cmd,Arc);
943
944
if (*Cmd->Command=='T' || *Cmd->Command=='I')
945
946
#ifdef NOVOLUME
947
return(false);
948
#else
949
- if (!MergeArchive(Arc,NULL,false,Command))
950
+ if (!MergeArchive(Arc,&DataIO,false,Command))
951
{
952
- ErrHandler.SetErrorCode(RAR_WARNING);
953
+ ErrHandler.SetErrorCode(WARNING);
954
return(false);
955
}
956
SignatureFound=false;
957
958
if (Arc.EndArcHead.Flags & EARC_NEXT_VOLUME)
959
{
960
#ifndef NOVOLUME
961
- if (!MergeArchive(Arc,NULL,false,Command))
962
+ if (!MergeArchive(Arc,&DataIO,false,Command))
963
{
964
- ErrHandler.SetErrorCode(RAR_WARNING);
965
+ ErrHandler.SetErrorCode(WARNING);
966
return(false);
967
}
968
SignatureFound=false;
969
970
#ifdef RARDLL
971
Cmd->DllError=ERAR_BAD_DATA;
972
#endif
973
- ErrHandler.SetErrorCode(RAR_WARNING);
974
+ ErrHandler.SetErrorCode(OPEN_ERROR);
975
}
976
ExactMatch=false;
977
}
978
979
#ifdef RARDLL
980
if (*Cmd->Password==0)
981
if (Cmd->Callback==NULL ||
982
- Cmd->Callback(UCM_NEEDPASSWORD,Cmd->UserData,(LONG)Cmd->Password,sizeof(Cmd->Password))==-1)
983
+ Cmd->Callback(UCM_NEEDPASSWORD,Cmd->UserData,(LPARAM)Cmd->Password,sizeof(Cmd->Password))==-1)
984
return(false);
985
strcpy(Password,Cmd->Password);
986
987
988
switch(Cmd->AllYes ? 1:Ask(St(MYesNoAll)))
989
{
990
case -1:
991
- ErrHandler.Exit(RAR_USER_BREAK);
992
+ ErrHandler.Exit(USER_BREAK);
993
case 2:
994
if (!GetPassword(PASSWORD_FILE,ArcFileName,Password,sizeof(Password)))
995
{
996
997
if (Length>0)
998
{
999
wchar ArcPathW[NM];
1000
- CharToWide(Cmd->ArcPath,ArcPathW);
1001
+ GetWideName(Cmd->ArcPath,Cmd->ArcPathW,ArcPathW);
1002
Length=strlenw(ArcPathW);
1003
}
1004
ExtrNameW+=Length;
1005
1006
if (FindFile::FastFind(DestFileName,DestNameW,&FD))
1007
{
1008
if (FD.mtime >= Arc.NewLhd.mtime)
1009
- ExtrFile=false;
1010
+ {
1011
+ // If directory already exists and its modification time is newer
1012
+ // than start of extraction, it is likely it was created
1013
+ // when creating a path to one of already extracted items.
1014
+ // In such case we'll better update its time even if archived
1015
+ // directory is older.
1016
+
1017
+ if (!FD.IsDir || FD.mtime<StartTime)
1018
+ ExtrFile=false;
1019
+ }
1020
}
1021
else
1022
if (Cmd->FreshFiles)
1023
1024
// skip encrypted file if no password is specified
1025
if ((Arc.NewLhd.Flags & LHD_PASSWORD)!=0 && *Password==0)
1026
{
1027
- ErrHandler.SetErrorCode(RAR_WARNING);
1028
+ ErrHandler.SetErrorCode(WARNING);
1029
#ifdef RARDLL
1030
Cmd->DllError=ERAR_MISSING_PASSWORD;
1031
#endif
1032
1033
#endif
1034
#endif
1035
ExtrFile=false;
1036
- ErrHandler.SetErrorCode(RAR_WARNING);
1037
+ ErrHandler.SetErrorCode(WARNING);
1038
#ifdef RARDLL
1039
Cmd->DllError=ERAR_UNKNOWN_FORMAT;
1040
#endif
1041
1042
#ifdef RARDLL
1043
Cmd->DllError=ERAR_ECREATE;
1044
#endif
1045
- ErrHandler.SetErrorCode(RAR_CREATE_ERROR);
1046
+ ErrHandler.SetErrorCode(CREATE_ERROR);
1047
}
1048
if (PrevExtracted)
1049
{
1050
#if defined(_WIN_32) && !defined(_WIN_CE) && !defined(SFX_MODULE)
1051
if (Cmd->SetCompressedAttr &&
1052
(Arc.NewLhd.FileAttr & FILE_ATTRIBUTE_COMPRESSED)!=0 && WinNT())
1053
- SetFileCompression(DestFileName,DestFileNameW,true);
1054
+ SetFileCompression(DestFileName,DestNameW,true);
1055
#endif
1056
- SetDirTime(DestFileName,
1057
+ SetDirTime(DestFileName,DestNameW,
1058
Cmd->xmtime==EXTTIME_NONE ? NULL:&Arc.NewLhd.mtime,
1059
Cmd->xctime==EXTTIME_NONE ? NULL:&Arc.NewLhd.ctime,
1060
Cmd->xatime==EXTTIME_NONE ? NULL:&Arc.NewLhd.atime);
1061
1062
if (!UserReject)
1063
{
1064
ErrHandler.CreateErrorMsg(Arc.FileName,DestFileName);
1065
- ErrHandler.SetErrorCode(RAR_CREATE_ERROR);
1066
+ ErrHandler.SetErrorCode(CREATE_ERROR);
1067
#ifdef RARDLL
1068
Cmd->DllError=ERAR_ECREATE;
1069
#endif
1070
1071
Log(BadArcName,St(MCRCFailed),ArcFileName);
1072
}
1073
BrokenFile=true;
1074
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
1075
+ ErrHandler.SetErrorCode(CRC_ERROR);
1076
#ifdef RARDLL
1077
Cmd->DllError=ERAR_BAD_DATA;
1078
#endif
1079
diff -uNr unrar/extract.hpp unrar/extract.hpp
1080
--- unrar/extract.hpp 2008-02-26 14:28:59.000000000 +0100
1081
+++ unrar/extract.hpp 2008-10-24 06:44:48.000000000 +0200
1082
1083
{
1084
private:
1085
EXTRACT_ARC_CODE ExtractArchive(CommandData *Cmd);
1086
+ RarTime StartTime; // time when extraction started
1087
1088
ComprDataIO DataIO;
1089
Unpack *Unp;
1090
diff -uNr unrar/filcreat.cpp unrar/filcreat.cpp
1091
--- unrar/filcreat.cpp 2008-02-26 14:28:59.000000000 +0100
1092
+++ unrar/filcreat.cpp 2008-10-24 06:44:47.000000000 +0200
1093
1094
#endif
1095
if (Cmd->AllYes || Mode==OVERWRITE_ALL)
1096
break;
1097
- if (Mode==OVERWRITE_ASK)
1098
+ if (Mode==OVERWRITE_DEFAULT || Mode==OVERWRITE_FORCE_ASK)
1099
{
1100
eprintf(St(MFileExists),Name);
1101
int Choice=Ask(St(MYesNoAllRenQ));
1102
1103
continue;
1104
}
1105
if (Choice==6)
1106
- ErrHandler.Exit(RAR_USER_BREAK);
1107
+ ErrHandler.Exit(USER_BREAK);
1108
}
1109
if (Mode==OVERWRITE_AUTORENAME)
1110
{
1111
1112
*NameW=0;
1113
}
1114
else
1115
- Mode=OVERWRITE_ASK;
1116
+ Mode=OVERWRITE_DEFAULT;
1117
continue;
1118
}
1119
}
1120
diff -uNr unrar/file.cpp unrar/file.cpp
1121
--- unrar/file.cpp 2008-02-26 14:28:59.000000000 +0100
1122
+++ unrar/file.cpp 2008-10-24 06:44:47.000000000 +0200
1123
1124
void File::TOpen(const char *Name,const wchar *NameW)
1125
{
1126
if (!WOpen(Name,NameW))
1127
- ErrHandler.Exit(RAR_OPEN_ERROR);
1128
+ ErrHandler.Exit(OPEN_ERROR);
1129
}
1130
#endif
1131
1132
1133
}
1134
1135
1136
-bool File::Create(const char *Name,const wchar *NameW)
1137
+bool File::Create(const char *Name,const wchar *NameW,bool ShareRead)
1138
{
1139
#ifdef _WIN_32
1140
+ DWORD ShareMode=(ShareRead || File::OpenShared) ? FILE_SHARE_READ:0;
1141
if (WinNT() && NameW!=NULL && *NameW!=0)
1142
- hFile=CreateFileW(NameW,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ,NULL,
1143
+ hFile=CreateFileW(NameW,GENERIC_READ|GENERIC_WRITE,ShareMode,NULL,
1144
CREATE_ALWAYS,0,NULL);
1145
else
1146
- hFile=CreateFile(Name,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ,NULL,
1147
+ hFile=CreateFile(Name,GENERIC_READ|GENERIC_WRITE,ShareMode,NULL,
1148
CREATE_ALWAYS,0,NULL);
1149
#else
1150
hFile=fopen(Name,CREATEBINARY);
1151
1152
1153
1154
#if !defined(SHELL_EXT) && !defined(SFX_MODULE)
1155
-void File::TCreate(const char *Name,const wchar *NameW)
1156
+void File::TCreate(const char *Name,const wchar *NameW,bool ShareRead)
1157
{
1158
- if (!WCreate(Name,NameW))
1159
- ErrHandler.Exit(RAR_FATAL_ERROR);
1160
+ if (!WCreate(Name,NameW,ShareRead))
1161
+ ErrHandler.Exit(FATAL_ERROR);
1162
}
1163
#endif
1164
1165
1166
-bool File::WCreate(const char *Name,const wchar *NameW)
1167
+bool File::WCreate(const char *Name,const wchar *NameW,bool ShareRead)
1168
{
1169
- if (Create(Name,NameW))
1170
+ if (Create(Name,NameW,ShareRead))
1171
return(true);
1172
- ErrHandler.SetErrorCode(RAR_CREATE_ERROR);
1173
+ ErrHandler.SetErrorCode(CREATE_ERROR);
1174
ErrHandler.CreateErrorMsg(Name);
1175
return(false);
1176
}
1177
1178
}
1179
1180
1181
-bool File::Rename(const char *NewName)
1182
+bool File::Rename(const char *NewName,const wchar *NewNameW)
1183
{
1184
+ // we do not need to rename if names are already same
1185
bool Success=strcmp(FileName,NewName)==0;
1186
+ if (Success && *FileNameW!=0 && *NullToEmpty(NewNameW)!=0)
1187
+ Success=strcmpw(FileNameW,NewNameW)==0;
1188
+
1189
if (!Success)
1190
- Success=rename(FileName,NewName)==0;
1191
+ Success=RenameFile(FileName,FileNameW,NewName,NewNameW);
1192
+
1193
if (Success)
1194
{
1195
+ // renamed successfully, storing the new name
1196
strcpy(FileName,NewName);
1197
- *FileNameW=0;
1198
+ strcpyw(FileNameW,NullToEmpty(NewNameW));
1199
}
1200
return(Success);
1201
}
1202
1203
#endif
1204
while (1)
1205
{
1206
- bool Success;
1207
+ bool Success=false;
1208
#ifdef _WIN_32
1209
- DWORD Written;
1210
+ DWORD Written=0;
1211
if (HandleType!=FILE_HANDLENORMAL)
1212
{
1213
+ // writing to stdout can fail in old Windows if data block is too large
1214
const int MaxSize=0x4000;
1215
for (int I=0;I<Size;I+=MaxSize)
1216
if (!(Success=WriteFile(hFile,(byte *)Data+I,Min(Size-I,MaxSize),&Written,NULL)))
1217
1218
1219
int File::Read(void *Data,int Size)
1220
{
1221
- Int64 FilePos;
1222
+ Int64 FilePos=0; //initialized only to suppress some compilers warning
1223
+
1224
if (IgnoreReadErrors)
1225
FilePos=Tell();
1226
int ReadSize;
1227
diff -uNr unrar/filefn.cpp unrar/filefn.cpp
1228
--- unrar/filefn.cpp 2008-02-26 14:28:59.000000000 +0100
1229
+++ unrar/filefn.cpp 2008-10-24 06:44:47.000000000 +0200
1230
1231
return(errno==ENOENT ? MKDIR_BADPATH:MKDIR_ERROR);
1232
#endif
1233
#ifdef _UNIX
1234
- int prevmask=umask(0);
1235
+// int prevmask=umask(0);
1236
int ErrCode=Name==NULL ? -1:mkdir(Name,(mode_t)Attr);
1237
- umask(prevmask);
1238
+// umask(prevmask);
1239
if (ErrCode==-1)
1240
return(errno==ENOENT ? MKDIR_BADPATH:MKDIR_ERROR);
1241
return(MKDIR_SUCCESS);
1242
1243
}
1244
1245
1246
-void SetDirTime(const char *Name,RarTime *ftm,RarTime *ftc,RarTime *fta)
1247
+void SetDirTime(const char *Name,const wchar *NameW,RarTime *ftm,RarTime *ftc,RarTime *fta)
1248
{
1249
#ifdef _WIN_32
1250
if (!WinNT())
1251
1252
bool sc=ftc!=NULL && ftc->IsSet();
1253
bool sa=fta!=NULL && fta->IsSet();
1254
1255
- unsigned int DirAttr=GetFileAttr(Name);
1256
+ unsigned int DirAttr=GetFileAttr(Name,NameW);
1257
bool ResetAttr=(DirAttr!=0xffffffff && (DirAttr & FA_RDONLY)!=0);
1258
if (ResetAttr)
1259
- SetFileAttr(Name,NULL,0);
1260
- HANDLE hFile=CreateFile(Name,GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,
1261
+ SetFileAttr(Name,NameW,0);
1262
+
1263
+ wchar DirNameW[NM];
1264
+ GetWideName(Name,NameW,DirNameW);
1265
+ HANDLE hFile=CreateFileW(DirNameW,GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,
1266
NULL,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,NULL);
1267
if (hFile==INVALID_HANDLE_VALUE)
1268
return;
1269
1270
SetFileTime(hFile,sc ? &fc:NULL,sa ? &fa:NULL,sm ? &fm:NULL);
1271
CloseHandle(hFile);
1272
if (ResetAttr)
1273
- SetFileAttr(Name,NULL,DirAttr);
1274
+ SetFileAttr(Name,NameW,DirAttr);
1275
#endif
1276
#if defined(_UNIX) || defined(_EMX)
1277
File::SetCloseFileTimeByName(Name,ftm,fta);
1278
1279
#ifndef SFX_MODULE
1280
char *MkTemp(char *Name)
1281
{
1282
- int Length=strlen(Name);
1283
+ size_t Length=strlen(Name);
1284
if (Length<=6)
1285
return(NULL);
1286
int Random=clock();
1287
1288
}
1289
1290
1291
-#if defined(_WIN_32) && !defined(_WIN_CE)
1292
+#if defined(_WIN_32) && !defined(_WIN_CE) && !defined(SFX_MODULE)
1293
bool SetFileCompression(char *Name,wchar *NameW,bool State)
1294
{
1295
wchar FileNameW[NM];
1296
1297
return(RetCode!=0);
1298
}
1299
#endif
1300
+
1301
+
1302
+
1303
+
1304
+
1305
+
1306
diff -uNr unrar/filefn.hpp unrar/filefn.hpp
1307
--- unrar/filefn.hpp 2008-02-26 14:28:59.000000000 +0100
1308
+++ unrar/filefn.hpp 2008-10-24 06:44:48.000000000 +0200
1309
1310
1311
MKDIR_CODE MakeDir(const char *Name,const wchar *NameW,uint Attr);
1312
bool CreatePath(const char *Path,const wchar *PathW,bool SkipLastName);
1313
-void SetDirTime(const char *Name,RarTime *ftm,RarTime *ftc,RarTime *fta);
1314
+void SetDirTime(const char *Name,const wchar *NameW,RarTime *ftm,RarTime *ftc,RarTime *fta);
1315
bool IsRemovable(const char *Name);
1316
Int64 GetFreeDisk(const char *Name);
1317
bool FileExist(const char *Name,const wchar *NameW=NULL);
1318
1319
bool SetFileCompression(char *Name,wchar *NameW,bool State);
1320
#endif
1321
1322
+
1323
+
1324
+
1325
#endif
1326
diff -uNr unrar/file.hpp unrar/file.hpp
1327
--- unrar/file.hpp 2008-02-26 14:28:59.000000000 +0100
1328
+++ unrar/file.hpp 2008-10-24 06:44:48.000000000 +0200
1329
1330
bool Open(const char *Name,const wchar *NameW=NULL,bool OpenShared=false,bool Update=false);
1331
void TOpen(const char *Name,const wchar *NameW=NULL);
1332
bool WOpen(const char *Name,const wchar *NameW=NULL);
1333
- bool Create(const char *Name,const wchar *NameW=NULL);
1334
- void TCreate(const char *Name,const wchar *NameW=NULL);
1335
- bool WCreate(const char *Name,const wchar *NameW=NULL);
1336
+ bool Create(const char *Name,const wchar *NameW=NULL,bool ShareRead=true);
1337
+ void TCreate(const char *Name,const wchar *NameW=NULL,bool ShareRead=true);
1338
+ bool WCreate(const char *Name,const wchar *NameW=NULL,bool ShareRead=true);
1339
bool Close();
1340
void Flush();
1341
bool Delete();
1342
- bool Rename(const char *NewName);
1343
+ bool Rename(const char *NewName,const wchar *NewNameW=NULL);
1344
void Write(const void *Data,int Size);
1345
int Read(void *Data,int Size);
1346
int DirectRead(void *Data,int Size);
1347
diff -uNr unrar/filestr.cpp unrar/filestr.cpp
1348
--- unrar/filestr.cpp 2008-02-26 14:28:59.000000000 +0100
1349
+++ unrar/filestr.cpp 2008-10-24 06:44:47.000000000 +0200
1350
1351
static bool IsUnicode(byte *Data,int Size);
1352
1353
bool ReadTextFile(char *Name,StringList *List,bool Config,bool AbortOnError,
1354
- RAR_CHARSET SrcCharset,bool Unquote,bool SkipComments)
1355
+ RAR_CHARSET SrcCharset,bool Unquote,bool SkipComments,
1356
+ bool ExpandEnvStr)
1357
{
1358
char FileName[NM];
1359
if (Config)
1360
1361
if (!OpenCode)
1362
{
1363
if (AbortOnError)
1364
- ErrHandler.Exit(RAR_OPEN_ERROR);
1365
+ ErrHandler.Exit(OPEN_ERROR);
1366
return(false);
1367
}
1368
}
1369
1370
CurStr++;
1371
}
1372
WideToChar(CurStr,&AnsiName[0],AnsiName.Size());
1373
- List->AddString(&AnsiName[0],CurStr);
1374
+
1375
+ bool Expanded=false;
1376
+#if defined(_WIN_32) && !defined(_WIN_CE)
1377
+ if (ExpandEnvStr && *CurStr=='%')
1378
+ {
1379
+ // expanding environment variables in Windows version
1380
+
1381
+ char ExpName[NM];
1382
+ wchar ExpNameW[NM];
1383
+ *ExpNameW=0;
1384
+ int ret,retw=1;
1385
+ ret=ExpandEnvironmentStrings(&AnsiName[0],ExpName,ASIZE(ExpName));
1386
+ if (ret!=0 && WinNT())
1387
+ retw=ExpandEnvironmentStringsW(CurStr,ExpNameW,ASIZE(ExpNameW));
1388
+ Expanded=ret!=0 && ret<ASIZE(ExpName) &&
1389
+ retw!=0 && retw<ASIZE(ExpNameW);
1390
+ if (Expanded)
1391
+ List->AddString(ExpName,ExpNameW);
1392
+ }
1393
+#endif
1394
+ if (!Expanded)
1395
+ List->AddString(&AnsiName[0],CurStr);
1396
}
1397
CurStr=NextStr+1;
1398
while (*CurStr=='\r' || *CurStr=='\n')
1399
1400
{
1401
if (Unquote && *CurStr=='\"')
1402
{
1403
- int Length=strlen(CurStr);
1404
+ size_t Length=strlen(CurStr);
1405
if (CurStr[Length-1]=='\"')
1406
{
1407
CurStr[Length-1]=0;
1408
1409
if (SrcCharset==RCH_OEM)
1410
OemToChar(CurStr,CurStr);
1411
#endif
1412
- List->AddString(CurStr);
1413
+
1414
+ bool Expanded=false;
1415
+#if defined(_WIN_32) && !defined(_WIN_CE)
1416
+ if (ExpandEnvStr && *CurStr=='%')
1417
+ {
1418
+ // expanding environment variables in Windows version
1419
+
1420
+ char ExpName[NM];
1421
+ int ret=ExpandEnvironmentStrings(CurStr,ExpName,ASIZE(ExpName));
1422
+ Expanded=ret!=0 && ret<ASIZE(ExpName);
1423
+ if (Expanded)
1424
+ List->AddString(ExpName);
1425
+ }
1426
+#endif
1427
+ if (!Expanded)
1428
+ List->AddString(CurStr);
1429
}
1430
CurStr=NextStr+1;
1431
while (*CurStr=='\r' || *CurStr=='\n')
1432
diff -uNr unrar/filestr.hpp unrar/filestr.hpp
1433
--- unrar/filestr.hpp 2008-02-26 14:28:59.000000000 +0100
1434
+++ unrar/filestr.hpp 2008-10-24 06:44:48.000000000 +0200
1435
1436
1437
bool ReadTextFile(char *Name,StringList *List,bool Config,
1438
bool AbortOnError=false,RAR_CHARSET SrcCharset=RCH_DEFAULT,
1439
- bool Unquote=false,bool SkipComments=false);
1440
+ bool Unquote=false,bool SkipComments=false,
1441
+ bool ExpandEnvStr=false);
1442
1443
#endif
1444
diff -uNr unrar/find.cpp unrar/find.cpp
1445
--- unrar/find.cpp 2008-02-26 14:28:59.000000000 +0100
1446
+++ unrar/find.cpp 2008-10-24 06:44:47.000000000 +0200
1447
1448
{
1449
*FindMask=0;
1450
*FindMaskW=0;
1451
- FirstCall=TRUE;
1452
+ FirstCall=true;
1453
#ifdef _WIN_32
1454
hFind=INVALID_HANDLE_VALUE;
1455
#else
1456
1457
strcpy(FindFile::FindMask,FindMask);
1458
if (*FindMaskW==0)
1459
CharToWide(FindMask,FindMaskW);
1460
- FirstCall=TRUE;
1461
+ FirstCall=true;
1462
}
1463
1464
1465
1466
strcpyw(FindFile::FindMaskW,FindMaskW);
1467
if (*FindMask==0)
1468
WideToChar(FindMaskW,FindMask);
1469
- FirstCall=TRUE;
1470
+ FirstCall=true;
1471
}
1472
1473
1474
1475
CharToWide(fd->Name,fd->NameW);
1476
#endif
1477
#endif
1478
+ fd->Flags=0;
1479
fd->IsDir=IsDir(fd->FileAttr);
1480
- FirstCall=FALSE;
1481
+ FirstCall=false;
1482
char *Name=PointToName(fd->Name);
1483
if (strcmp(Name,".")==0 || strcmp(Name,"..")==0)
1484
return(Next(fd));
1485
1486
CharToWide(fd->Name,fd->NameW);
1487
#endif
1488
#endif
1489
+ fd->Flags=0;
1490
fd->IsDir=IsDir(fd->FileAttr);
1491
return(true);
1492
}
1493
1494
}
1495
}
1496
#endif
1497
+ fd->Flags=0;
1498
return(hFind);
1499
}
1500
#endif
1501
diff -uNr unrar/find.hpp unrar/find.hpp
1502
--- unrar/find.hpp 2008-02-26 14:28:59.000000000 +0100
1503
+++ unrar/find.hpp 2008-10-24 06:44:48.000000000 +0200
1504
1505
#ifndef _RAR_FINDDATA_
1506
#define _RAR_FINDDATA_
1507
1508
+enum FINDDATA_FLAGS {
1509
+ FDDF_SECONDDIR=1 // second entry of directory in SCAN_GETDIRSTWICE ScanTree mode
1510
+};
1511
+
1512
struct FindData
1513
{
1514
char Name[NM];
1515
1516
FILETIME ftLastAccessTime;
1517
FILETIME ftLastWriteTime;
1518
#endif
1519
+ uint Flags;
1520
bool Error;
1521
};
1522
1523
1524
1525
char FindMask[NM];
1526
wchar FindMaskW[NM];
1527
- int FirstCall;
1528
+ bool FirstCall;
1529
#ifdef _WIN_32
1530
HANDLE hFind;
1531
#else
1532
diff -uNr unrar/headers.hpp unrar/headers.hpp
1533
--- unrar/headers.hpp 2008-02-26 14:28:59.000000000 +0100
1534
+++ unrar/headers.hpp 2008-10-24 06:44:48.000000000 +0200
1535
1536
#define LONG_BLOCK 0x8000
1537
1538
#define EARC_NEXT_VOLUME 0x0001 // not last volume
1539
-#define EARC_DATACRC 0x0002
1540
-#define EARC_REVSPACE 0x0004
1541
-#define EARC_VOLNUMBER 0x0008
1542
+#define EARC_DATACRC 0x0002 // store CRC32 of RAR archive (now used only in volumes)
1543
+#define EARC_REVSPACE 0x0004 // reserve space for end of REV file 7 byte record
1544
+#define EARC_VOLNUMBER 0x0008 // store a number of current volume
1545
1546
enum HEADER_TYPE {
1547
MARK_HEAD=0x72,MAIN_HEAD=0x73,FILE_HEAD=0x74,COMM_HEAD=0x75,AV_HEAD=0x76,
1548
1549
1550
struct EndArcHeader:BaseBlock
1551
{
1552
- uint ArcDataCRC;
1553
- ushort VolNumber;
1554
+ uint ArcDataCRC; // optional archive CRC32
1555
+ ushort VolNumber; // optional current volume number
1556
};
1557
1558
1559
+// SubBlockHeader and its successors were used in RAR 2.x format.
1560
+// RAR 3.x uses FileHeader with NEWSUB_HEAD HeadType for subblocks.
1561
struct SubBlockHeader:BlockHeader
1562
{
1563
ushort SubType;
1564
diff -uNr unrar/license.txt unrar/license.txt
1565
--- unrar/license.txt 1970-01-01 01:00:00.000000000 +0100
1566
+++ unrar/license.txt 2006-04-04 19:13:44.000000000 +0200
1567
1568
+ ****** ***** ****** UnRAR - free utility for RAR archives
1569
+ ** ** ** ** ** ** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1570
+ ****** ******* ****** License for use and distribution of
1571
+ ** ** ** ** ** ** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1572
+ ** ** ** ** ** ** FREE portable version
1573
+ ~~~~~~~~~~~~~~~~~~~~~
1574
+
1575
+ The source code of UnRAR utility is freeware. This means:
1576
+
1577
+ 1. All copyrights to RAR and the utility UnRAR are exclusively
1578
+ owned by the author - Alexander Roshal.
1579
+
1580
+ 2. The UnRAR sources may be used in any software to handle RAR
1581
+ archives without limitations free of charge, but cannot be used
1582
+ to re-create the RAR compression algorithm, which is proprietary.
1583
+ Distribution of modified UnRAR sources in separate form or as a
1584
+ part of other software is permitted, provided that it is clearly
1585
+ stated in the documentation and source comments that the code may
1586
+ not be used to develop a RAR (WinRAR) compatible archiver.
1587
+
1588
+ 3. The UnRAR utility may be freely distributed. It is allowed
1589
+ to distribute UnRAR inside of other software packages.
1590
+
1591
+ 4. THE RAR ARCHIVER AND THE UnRAR UTILITY ARE DISTRIBUTED "AS IS".
1592
+ NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. YOU USE AT
1593
+ YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS,
1594
+ DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING
1595
+ OR MISUSING THIS SOFTWARE.
1596
+
1597
+ 5. Installing and using the UnRAR utility signifies acceptance of
1598
+ these terms and conditions of the license.
1599
+
1600
+ 6. If you don't agree with terms of the license you must remove
1601
+ UnRAR files from your storage devices and cease to use the
1602
+ utility.
1603
+
1604
+ Thank you for your interest in RAR and UnRAR.
1605
+
1606
+
1607
+ Alexander L. Roshal
1608
\ Kein Zeilenumbruch am Dateiende.
1609
diff -uNr unrar/LICENSE.txt unrar/LICENSE.txt
1610
--- unrar/LICENSE.txt 2008-02-26 14:28:59.000000000 +0100
1611
+++ unrar/LICENSE.txt 1970-01-01 01:00:00.000000000 +0100
1612
1613
- ****** ***** ****** unRAR - free utility for RAR archives
1614
- ** ** ** ** ** ** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1615
- ****** ******* ****** License for use and distribution of
1616
- ** ** ** ** ** ** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1617
- ** ** ** ** ** ** FREE portable version
1618
- ~~~~~~~~~~~~~~~~~~~~~
1619
-
1620
- The source code of unRAR utility is freeware. This means:
1621
-
1622
- 1. All copyrights to RAR and the utility unRAR are exclusively
1623
- owned by the author - Eugene Roshal.
1624
-
1625
- 2. The unRAR sources may be used in any software to handle RAR
1626
- archives without limitations free of charge, but cannot be used
1627
- to re-create the RAR compression algorithm, which is proprietary.
1628
- Distribution of modified unRAR sources in separate form or as a
1629
- part of other software is permitted, provided that it is clearly
1630
- stated in the documentation and source comments that the code may
1631
- not be used to develop a RAR (WinRAR) compatible archiver.
1632
-
1633
- 3. The unRAR utility may be freely distributed. No person or company
1634
- may charge a fee for the distribution of unRAR without written
1635
- permission from the copyright holder.
1636
-
1637
- 4. THE RAR ARCHIVER AND THE UNRAR UTILITY ARE DISTRIBUTED "AS IS".
1638
- NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. YOU USE AT
1639
- YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS,
1640
- DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING
1641
- OR MISUSING THIS SOFTWARE.
1642
-
1643
- 5. Installing and using the unRAR utility signifies acceptance of
1644
- these terms and conditions of the license.
1645
-
1646
- 6. If you don't agree with terms of the license you must remove
1647
- unRAR files from your storage devices and cease to use the
1648
- utility.
1649
-
1650
- Thank you for your interest in RAR and unRAR.
1651
-
1652
-
1653
- Eugene Roshal
1654
\ Kein Zeilenumbruch am Dateiende.
1655
diff -uNr unrar/list.cpp unrar/list.cpp
1656
--- unrar/list.cpp 2008-02-26 14:28:59.000000000 +0100
1657
+++ unrar/list.cpp 2008-10-24 06:44:47.000000000 +0200
1658
1659
void ListSymLink(Archive &Arc)
1660
{
1661
if (Arc.NewLhd.HostOS==HOST_UNIX && (Arc.NewLhd.FileAttr & 0xF000)==0xA000)
1662
- {
1663
- char FileName[NM];
1664
- int DataSize=Min(Arc.NewLhd.PackSize,sizeof(FileName)-1);
1665
- Arc.Read(FileName,DataSize);
1666
- FileName[DataSize]=0;
1667
- mprintf("\n%22s %s","-->",FileName);
1668
- }
1669
+ if ((Arc.NewLhd.Flags & LHD_PASSWORD)==0)
1670
+ {
1671
+ char FileName[NM];
1672
+ int DataSize=Min(Arc.NewLhd.PackSize,sizeof(FileName)-1);
1673
+ Arc.Read(FileName,DataSize);
1674
+ FileName[DataSize]=0;
1675
+ mprintf("\n%22s %s","-->",FileName);
1676
+ }
1677
+ else
1678
+ {
1679
+ // Link data are encrypted. We would need to ask for password
1680
+ // and initialize decryption routine to display the link target.
1681
+ mprintf("\n%22s %s","-->","*<-?->");
1682
+ }
1683
}
1684
1685
1686
diff -uNr unrar/loclang.hpp unrar/loclang.hpp
1687
--- unrar/loclang.hpp 2008-02-26 14:28:59.000000000 +0100
1688
+++ unrar/loclang.hpp 2008-10-24 06:44:48.000000000 +0200
1689
1690
#define MYesNo "_Yes_No"
1691
#define MYesNoAll "_Yes_No_All"
1692
+#define MYesNoAllQ "_Yes_No_All_nEver_Quit"
1693
#define MYesNoAllRenQ "_Yes_No_All_nEver_Rename_Quit"
1694
#define MContinueQuit "_Continue_Quit"
1695
#define MRetryAbort "_Retry_Abort"
1696
1697
#define MCHelpSwCU "\n cu Convert names to upper case"
1698
#define MCHelpSwDF "\n df Delete files after archiving"
1699
#define MCHelpSwDH "\n dh Open shared files"
1700
+#define MCHelpSwDR "\n dr Delete files to Recycle Bin"
1701
#define MCHelpSwDS "\n ds Disable name sort for solid archive"
1702
+#define MCHelpSwDW "\n dw Wipe files after archiving"
1703
#define MCHelpSwEa "\n e[+]<attr> Set file exclude and include attributes"
1704
#define MCHelpSwED "\n ed Do not add empty directories"
1705
#define MCHelpSwEE "\n ee Do not save and extract extended attributes"
1706
1707
#define MCHelpSwN "\n n<file> Include only specified file"
1708
#define MCHelpSwNa "\n n@ Read file names to include from stdin"
1709
#define MCHelpSwNal "\n n@<list> Include files in specified list file"
1710
-#define MCHelpSwOp "\n o+ Overwrite existing files"
1711
-#define MCHelpSwOm "\n o- Do not overwrite existing files"
1712
+#define MCHelpSwO "\n o[+|-] Set the overwrite mode"
1713
#define MCHelpSwOC "\n oc Set NTFS Compressed attribute"
1714
#define MCHelpSwOL "\n ol Save symbolic links as the link instead of the file"
1715
#define MCHelpSwOR "\n or Rename files automatically"
1716
1717
#define MCannotDelete "\nCannot delete %s"
1718
#define MCalcCRC "\nCalculating the control sum"
1719
#define MTooLargeSFXArc "\nWARNING: Too large SFX archive. Windows cannot run the executable file exceeding 4 GB."
1720
+#define MCalcCRCAllVol "\nCalculating control sums of all volumes."
1721
diff -uNr unrar/makefile.bcc unrar/makefile.bcc
1722
--- unrar/makefile.bcc 1970-01-01 01:00:00.000000000 +0100
1723
+++ unrar/makefile.bcc 2007-06-30 21:00:38.000000000 +0200
1724
1725
+.AUTODEPEND
1726
+
1727
+basepath = $(BASEPATHCC)
1728
+binpath = $(basepath)\bin
1729
+libpath = $(basepath)\lib
1730
+rarpath = .
1731
+incpath = $(basepath)\include;$(rarpath)
1732
+
1733
+cc = $(binpath)\bcc32
1734
+link = $(binpath)\ilink32
1735
+
1736
+objpath = .
1737
+guiopt = -WC -H=$(objpath)\rar.csm
1738
+
1739
+!ifndef RARDLL
1740
+!ifndef GUI
1741
+guiopt=$(guiopt) -x-
1742
+!endif
1743
+!ifdef SFX_MODULE
1744
+guiopt=$(guiopt) -x-
1745
+!endif
1746
+!endif
1747
+
1748
+!ifdef DEBUG
1749
+optdeb=-Od -k -vi- -DDEBUG
1750
+!else
1751
+# -O is not safe to use with -pr and int64 return values, so let's turn it off
1752
+optdeb=-O1 -O- -k-
1753
+#optdeb=-Ob -Oe -Og -Oi -Ol -Om -Op -OS -Ov -Z -Oc
1754
+!endif
1755
+
1756
+
1757
+optunrar=-DUNRAR
1758
+linkdest=unrar.exe
1759
+
1760
+!ifdef SFX_MODULE
1761
+optunrar=-DUNRAR -DSFX_MODULE
1762
+linkdest=sfx.exe
1763
+!endif
1764
+
1765
+linkopt = -L$(libpath) -ap -c -v -s -V4.0 -Gn
1766
+compopt = -P -c -I$(incpath) -R -v -vi -w-pch -w-par -K -f-\
1767
+ -ff- -a4 -pr -RT- $(optdeb) $(guiopt) $(optunrar) -d -w-8072
1768
+
1769
+!ifdef RARDLL
1770
+SILENT=true
1771
+linkdest=unrar.dll
1772
+linkopt=$(linkopt) -Tpd
1773
+compopt=$(compopt) -DRARDLL
1774
+!else
1775
+linkopt=$(linkopt) -Tpe -B:0x400000
1776
+!endif
1777
+
1778
+!ifdef SILENT
1779
+compopt=$(compopt) -DSILENT
1780
+!endif
1781
+
1782
+
1783
+rar: $(linkdest)
1784
+
1785
+Dep_SFX= \
1786
+ $(objpath)\strlist.obj\
1787
+ $(objpath)\strfn.obj\
1788
+ $(objpath)\pathfn.obj\
1789
+ $(objpath)\cmddata.obj\
1790
+ $(objpath)\consio.obj\
1791
+ $(objpath)\int64.obj\
1792
+ $(objpath)\savepos.obj\
1793
+ $(objpath)\file.obj\
1794
+ $(objpath)\filefn.obj\
1795
+ $(objpath)\filcreat.obj\
1796
+ $(objpath)\sha1.obj\
1797
+ $(objpath)\archive.obj\
1798
+ $(objpath)\arcread.obj\
1799
+ $(objpath)\unicode.obj\
1800
+ $(objpath)\system.obj\
1801
+ $(objpath)\isnt.obj\
1802
+ $(objpath)\crc.obj\
1803
+ $(objpath)\crypt.obj\
1804
+ $(objpath)\rijndael.obj\
1805
+ $(objpath)\rawread.obj\
1806
+ $(objpath)\encname.obj\
1807
+ $(objpath)\resource.obj\
1808
+ $(objpath)\match.obj\
1809
+ $(objpath)\find.obj\
1810
+ $(objpath)\timefn.obj\
1811
+ $(objpath)\getbits.obj\
1812
+ $(objpath)\rarvm.obj\
1813
+ $(objpath)\rdwrfn.obj\
1814
+ $(objpath)\options.obj\
1815
+ $(objpath)\ulinks.obj\
1816
+ $(objpath)\errhnd.obj\
1817
+ $(objpath)\volume.obj\
1818
+ $(objpath)\rs.obj\
1819
+ $(objpath)\recvol.obj\
1820
+ $(objpath)\extinfo.obj\
1821
+ $(objpath)\extract.obj\
1822
+ $(objpath)\unpack.obj\
1823
+ $(objpath)\rar.obj\
1824
+ $(objpath)\global.obj
1825
+
1826
+Dep_Unrar = \
1827
+ $(objpath)\filestr.obj\
1828
+ $(objpath)\scantree.obj
1829
+
1830
+Dep_Dll = \
1831
+ $(objpath)\dll.obj
1832
+
1833
+#Dep_SFXOnly = $(objpath)\rtl.obj
1834
+
1835
+!ifndef GUI
1836
+!ifndef SILENT
1837
+Dep_Console = \
1838
+ $(objpath)\list.obj
1839
+!endif
1840
+!endif
1841
+
1842
+!ifdef SFX_MODULE
1843
+Dep = $(Dep_SFX) $(Dep_SFXOnly)
1844
+!else
1845
+Dep = $(Dep_SFX) $(Dep_Unrar)
1846
+!endif
1847
+
1848
+!ifndef GUI
1849
+Dep = $(Dep) $(Dep_Console)
1850
+!endif
1851
+
1852
+!ifdef RARDLL
1853
+Dep = $(Dep) $(Dep_Dll)
1854
+!endif
1855
+
1856
+!ifdef GUI
1857
+$(linkdest) : $(Dep)
1858
+ echo Done
1859
+!else
1860
+$(linkdest) : $(Dep)
1861
+ $(link) @&&|
1862
+ $(linkopt) +
1863
+#!ifdef SFX_MODULE
1864
+#$(objpath)\dummy.obj+
1865
+#$(objpath)\ll.obj+
1866
+#$(objpath)\rtl.obj+
1867
+#!else
1868
+!ifdef RARDLL
1869
+$(libpath)\c0d32.obj+
1870
+!else
1871
+$(libpath)\c0x32.obj+
1872
+!endif
1873
+#!endif
1874
+$(objpath)\strlist.obj+
1875
+$(objpath)\strfn.obj+
1876
+$(objpath)\pathfn.obj+
1877
+$(objpath)\int64.obj+
1878
+$(objpath)\savepos.obj+
1879
+$(objpath)\global.obj+
1880
+$(objpath)\file.obj+
1881
+$(objpath)\filefn.obj+
1882
+$(objpath)\filcreat.obj+
1883
+$(objpath)\sha1.obj+
1884
+$(objpath)\archive.obj+
1885
+$(objpath)\arcread.obj+
1886
+$(objpath)\unicode.obj+
1887
+$(objpath)\system.obj+
1888
+$(objpath)\isnt.obj+
1889
+$(objpath)\crc.obj+
1890
+$(objpath)\crypt.obj+
1891
+$(objpath)\rijndael.obj+
1892
+$(objpath)\rawread.obj+
1893
+$(objpath)\encname.obj+
1894
+$(objpath)\resource.obj+
1895
+$(objpath)\match.obj+
1896
+$(objpath)\find.obj+
1897
+!ifndef SFX_MODULE
1898
+$(objpath)\filestr.obj+
1899
+$(objpath)\scantree.obj+
1900
+!endif
1901
+$(objpath)\timefn.obj+
1902
+$(objpath)\getbits.obj+
1903
+$(objpath)\rarvm.obj+
1904
+$(objpath)\rdwrfn.obj+
1905
+$(objpath)\consio.obj+
1906
+$(objpath)\cmddata.obj+
1907
+$(objpath)\options.obj+
1908
+$(objpath)\ulinks.obj+
1909
+$(objpath)\volume.obj+
1910
+$(objpath)\extinfo.obj+
1911
+$(objpath)\extract.obj+
1912
+$(objpath)\rs.obj+
1913
+$(objpath)\recvol.obj+
1914
+!ifndef SILENT
1915
+!ifndef GUI
1916
+$(objpath)\list.obj+
1917
+!endif
1918
+!endif
1919
+!ifdef RARDLL
1920
+$(objpath)\dll.obj+
1921
+!endif
1922
+$(objpath)\errhnd.obj+
1923
+$(objpath)\unpack.obj+
1924
+$(objpath)\rar.obj
1925
+$<,$*
1926
+$(libpath)\cw32.lib+
1927
+$(libpath)\import32.lib
1928
+!ifdef RARDLL
1929
+$(rarpath)\dll.def
1930
+!else
1931
+
1932
+!endif
1933
+|
1934
+!endif
1935
+
1936
+$(objpath)\rar.obj : $(rarpath)\rar.cpp
1937
+ $(cc) -q @&&|
1938
+ $(compopt) -o$@ $(rarpath)\rar.cpp
1939
+|
1940
+
1941
+$(objpath)\strlist.obj : $(rarpath)\strlist.cpp
1942
+ $(cc) -q @&&|
1943
+ $(compopt) -o$@ $(rarpath)\strlist.cpp
1944
+|
1945
+
1946
+$(objpath)\strfn.obj : $(rarpath)\strfn.cpp
1947
+ $(cc) -q @&&|
1948
+ $(compopt) -o$@ $(rarpath)\strfn.cpp
1949
+|
1950
+
1951
+$(objpath)\pathfn.obj : $(rarpath)\pathfn.cpp
1952
+ $(cc) -q @&&|
1953
+ $(compopt) -o$@ $(rarpath)\pathfn.cpp
1954
+|
1955
+
1956
+$(objpath)\int64.obj : $(rarpath)\int64.cpp
1957
+ $(cc) -q @&&|
1958
+ $(compopt) -o$@ $(rarpath)\int64.cpp
1959
+|
1960
+
1961
+$(objpath)\savepos.obj : $(rarpath)\savepos.cpp
1962
+ $(cc) -q @&&|
1963
+ $(compopt) -o$@ $(rarpath)\savepos.cpp
1964
+|
1965
+
1966
+$(objpath)\global.obj : $(rarpath)\global.cpp
1967
+ $(cc) -q @&&|
1968
+ $(compopt) -H- -o$@ $(rarpath)\global.cpp
1969
+|
1970
+
1971
+$(objpath)\file.obj : $(rarpath)\file.cpp
1972
+ $(cc) -q @&&|
1973
+ $(compopt) -o$@ $(rarpath)\file.cpp
1974
+|
1975
+
1976
+$(objpath)\filefn.obj : $(rarpath)\filefn.cpp
1977
+ $(cc) -q @&&|
1978
+ $(compopt) -o$@ $(rarpath)\filefn.cpp
1979
+|
1980
+
1981
+$(objpath)\filestr.obj : $(rarpath)\filestr.cpp
1982
+ $(cc) -q @&&|
1983
+ $(compopt) -o$@ $(rarpath)\filestr.cpp
1984
+|
1985
+
1986
+$(objpath)\filcreat.obj : $(rarpath)\filcreat.cpp
1987
+ $(cc) -q @&&|
1988
+ $(compopt) -o$@ $(rarpath)\filcreat.cpp
1989
+|
1990
+
1991
+$(objpath)\sha1.obj : $(rarpath)\sha1.cpp
1992
+ $(cc) -q @&&|
1993
+ $(compopt) -o$@ $(rarpath)\sha1.cpp
1994
+|
1995
+
1996
+$(objpath)\ec.obj : $(rarpath)\ec.cpp
1997
+ $(cc) -q @&&|
1998
+ $(compopt) -o$@ $(rarpath)\ec.cpp
1999
+|
2000
+
2001
+$(objpath)\av.obj : $(rarpath)\av.cpp
2002
+ $(cc) -q @&&|
2003
+ $(compopt) -o$@ $(rarpath)\av.cpp
2004
+|
2005
+
2006
+$(objpath)\archive.obj : $(rarpath)\archive.cpp
2007
+ $(cc) -q @&&|
2008
+ $(compopt) -o$@ $(rarpath)\archive.cpp
2009
+|
2010
+
2011
+$(objpath)\arcread.obj : $(rarpath)\arcread.cpp
2012
+ $(cc) -q @&&|
2013
+ $(compopt) -o$@ $(rarpath)\arcread.cpp
2014
+|
2015
+
2016
+$(objpath)\unicode.obj : $(rarpath)\unicode.cpp
2017
+ $(cc) -q @&&|
2018
+ $(compopt) -o$@ $(rarpath)\unicode.cpp
2019
+|
2020
+
2021
+$(objpath)\system.obj : $(rarpath)\system.cpp
2022
+ $(cc) -q @&&|
2023
+ $(compopt) -o$@ $(rarpath)\system.cpp
2024
+|
2025
+
2026
+$(objpath)\isnt.obj : $(rarpath)\isnt.cpp
2027
+ $(cc) -q @&&|
2028
+ $(compopt) -o$@ $(rarpath)\isnt.cpp
2029
+|
2030
+
2031
+$(objpath)\crc.obj : $(rarpath)\crc.cpp
2032
+ $(cc) -q @&&|
2033
+ $(compopt) -o$@ $(rarpath)\crc.cpp
2034
+|
2035
+
2036
+$(objpath)\crypt.obj : $(rarpath)\crypt.cpp
2037
+ $(cc) -q @&&|
2038
+ $(compopt) -o$@ $(rarpath)\crypt.cpp
2039
+|
2040
+
2041
+$(objpath)\rijndael.obj : $(rarpath)\rijndael.cpp
2042
+ $(cc) -q @&&|
2043
+ $(compopt) -o$@ $(rarpath)\rijndael.cpp
2044
+|
2045
+
2046
+$(objpath)\rawread.obj : $(rarpath)\rawread.cpp
2047
+ $(cc) -q @&&|
2048
+ $(compopt) -o$@ $(rarpath)\rawread.cpp
2049
+|
2050
+
2051
+$(objpath)\rawwrite.obj : $(rarpath)\rawwrite.cpp
2052
+ $(cc) -q @&&|
2053
+ $(compopt) -o$@ $(rarpath)\rawwrite.cpp
2054
+|
2055
+
2056
+$(objpath)\encname.obj : $(rarpath)\encname.cpp
2057
+ $(cc) -q @&&|
2058
+ $(compopt) -o$@ $(rarpath)\encname.cpp
2059
+|
2060
+
2061
+$(objpath)\resource.obj : $(rarpath)\resource.cpp
2062
+ $(cc) -q @&&|
2063
+ $(compopt) -o$@ $(rarpath)\resource.cpp
2064
+|
2065
+
2066
+$(objpath)\match.obj : $(rarpath)\match.cpp
2067
+ $(cc) -q @&&|
2068
+ $(compopt) -o$@ $(rarpath)\match.cpp
2069
+|
2070
+
2071
+$(objpath)\find.obj : $(rarpath)\find.cpp
2072
+ $(cc) -q @&&|
2073
+ $(compopt) -o$@ $(rarpath)\find.cpp
2074
+|
2075
+
2076
+$(objpath)\scantree.obj : $(rarpath)\scantree.cpp
2077
+ $(cc) -q @&&|
2078
+ $(compopt) -o$@ $(rarpath)\scantree.cpp
2079
+|
2080
+
2081
+$(objpath)\timefn.obj : $(rarpath)\timefn.cpp
2082
+ $(cc) -q @&&|
2083
+ $(compopt) -o$@ $(rarpath)\timefn.cpp
2084
+|
2085
+
2086
+$(objpath)\getbits.obj : $(rarpath)\getbits.cpp
2087
+ $(cc) -q @&&|
2088
+ $(compopt) -o$@ $(rarpath)\getbits.cpp
2089
+|
2090
+
2091
+$(objpath)\rarvm.obj : $(rarpath)\rarvm.cpp
2092
+ $(cc) -q @&&|
2093
+ $(compopt) -o$@ $(rarpath)\rarvm.cpp
2094
+|
2095
+
2096
+$(objpath)\putbits.obj : $(rarpath)\putbits.cpp
2097
+ $(cc) -q @&&|
2098
+ $(compopt) -o$@ $(rarpath)\putbits.cpp
2099
+|
2100
+
2101
+$(objpath)\pack.obj : $(rarpath)\pack.cpp
2102
+ $(cc) -q @&&|
2103
+ $(compopt) -o$@ $(rarpath)\pack.cpp
2104
+|
2105
+
2106
+$(objpath)\packbord.obj : $(rarpath)\packbord.cpp
2107
+ $(cc) -q @&&|
2108
+ $(compopt) -o$@ $(rarpath)\packbord.cpp
2109
+|
2110
+
2111
+$(objpath)\packanlz.obj : $(rarpath)\packanlz.cpp
2112
+ $(cc) -q @&&|
2113
+ $(compopt) -o$@ $(rarpath)\packanlz.cpp
2114
+|
2115
+
2116
+$(objpath)\cblock.obj : $(rarpath)\cblock.cpp
2117
+ $(cc) -q @&&|
2118
+ $(compopt) -o$@ $(rarpath)\cblock.cpp
2119
+|
2120
+
2121
+$(objpath)\add.obj : $(rarpath)\add.cpp
2122
+ $(cc) -q @&&|
2123
+ $(compopt) -o$@ $(rarpath)\add.cpp
2124
+|
2125
+
2126
+$(objpath)\addlist.obj : $(rarpath)\addlist.cpp
2127
+ $(cc) -q @&&|
2128
+ $(compopt) -o$@ $(rarpath)\addlist.cpp
2129
+|
2130
+
2131
+$(objpath)\procarc.obj : $(rarpath)\procarc.cpp
2132
+ $(cc) -q @&&|
2133
+ $(compopt) -o$@ $(rarpath)\procarc.cpp
2134
+|
2135
+
2136
+$(objpath)\sfx.obj : $(rarpath)\sfx.cpp
2137
+ $(cc) -q @&&|
2138
+ $(compopt) -o$@ $(rarpath)\sfx.cpp
2139
+|
2140
+
2141
+$(objpath)\comment.obj : $(rarpath)\comment.cpp
2142
+ $(cc) -q @&&|
2143
+ $(compopt) -o$@ $(rarpath)\comment.cpp
2144
+|
2145
+
2146
+$(objpath)\rs.obj : $(rarpath)\rs.cpp
2147
+ $(cc) -q @&&|
2148
+ $(compopt) -o$@ $(rarpath)\rs.cpp
2149
+|
2150
+
2151
+$(objpath)\recvol.obj : $(rarpath)\recvol.cpp
2152
+ $(cc) -q @&&|
2153
+ $(compopt) -o$@ $(rarpath)\recvol.cpp
2154
+|
2155
+
2156
+$(objpath)\repair.obj : $(rarpath)\repair.cpp
2157
+ $(cc) -q @&&|
2158
+ $(compopt) -o$@ $(rarpath)\repair.cpp
2159
+|
2160
+
2161
+$(objpath)\rdwrfn.obj : $(rarpath)\rdwrfn.cpp
2162
+ $(cc) -q @&&|
2163
+ $(compopt) -o$@ $(rarpath)\rdwrfn.cpp
2164
+|
2165
+
2166
+$(objpath)\consio.obj : $(rarpath)\consio.cpp
2167
+ $(cc) -q @&&|
2168
+ $(compopt) -o$@ $(rarpath)\consio.cpp
2169
+|
2170
+
2171
+$(objpath)\cmddata.obj : $(rarpath)\cmddata.cpp
2172
+ $(cc) -q @&&|
2173
+ $(compopt) -o$@ $(rarpath)\cmddata.cpp
2174
+|
2175
+
2176
+$(objpath)\options.obj : $(rarpath)\options.cpp
2177
+ $(cc) -q @&&|
2178
+ $(compopt) -o$@ $(rarpath)\options.cpp
2179
+|
2180
+
2181
+$(objpath)\ulinks.obj : $(rarpath)\ulinks.cpp
2182
+ $(cc) -q @&&|
2183
+ $(compopt) -o$@ $(rarpath)\ulinks.cpp
2184
+|
2185
+
2186
+$(objpath)\errhnd.obj : $(rarpath)\errhnd.cpp
2187
+ $(cc) -q @&&|
2188
+ $(compopt) -o$@ $(rarpath)\errhnd.cpp
2189
+|
2190
+
2191
+$(objpath)\volume.obj : $(rarpath)\volume.cpp
2192
+ $(cc) -q @&&|
2193
+ $(compopt) -o$@ $(rarpath)\volume.cpp
2194
+|
2195
+
2196
+$(objpath)\extinfo.obj : $(rarpath)\extinfo.cpp
2197
+ $(cc) -q @&&|
2198
+ $(compopt) -o$@ $(rarpath)\extinfo.cpp
2199
+|
2200
+
2201
+
2202
+$(objpath)\extract.obj : $(rarpath)\extract.cpp
2203
+ $(cc) -q @&&|
2204
+ $(compopt) -o$@ $(rarpath)\extract.cpp
2205
+|
2206
+
2207
+$(objpath)\list.obj : $(rarpath)\list.cpp
2208
+ $(cc) -q @&&|
2209
+ $(compopt) -o$@ $(rarpath)\list.cpp
2210
+|
2211
+
2212
+$(objpath)\rtl.obj : $(rarpath)\rtl.cpp
2213
+ $(cc) -q @&&|
2214
+ $(compopt) -o$@ $(rarpath)\rtl.cpp
2215
+|
2216
+
2217
+$(objpath)\unpack.obj : $(rarpath)\unpack.cpp
2218
+ $(cc) -q @&&|
2219
+ $(compopt) -o$@ $(rarpath)\unpack.cpp
2220
+|
2221
+
2222
+$(objpath)\dll.obj : $(rarpath)\dll.cpp
2223
+ $(cc) -q @&&|
2224
+ $(compopt) -o$@ $(rarpath)\dll.cpp
2225
+|
2226
\ Kein Zeilenumbruch am Dateiende.
2227
diff -uNr unrar/makefile.cygmin unrar/makefile.cygmin
2228
--- unrar/makefile.cygmin 1970-01-01 01:00:00.000000000 +0100
2229
+++ unrar/makefile.cygmin 2007-03-05 06:59:50.000000000 +0100
2230
2231
+#
2232
+# Makefile for cygmin/mingw - unrar
2233
+#
2234
+# Note: you have to 'make clean' before you can build
2235
+# the sfx module
2236
+#
2237
+
2238
+# POSIX using Cygmin GCC 3.3.1
2239
+#CXX = g++
2240
+#CXXFLAGS = -O2 -Wno-deprecated
2241
+#DEFINES = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DLITTLE_ENDIAN
2242
+
2243
+# Win32 using Cygmin GCC 3.3.1
2244
+CXX = g++ -mno-cygwin
2245
+CXXFLAGS = -O2 -Wno-deprecated
2246
+DEFINES = -D_MSC_VER -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
2247
+
2248
+# Win32 using Mingw32 GCC 3.3.2
2249
+#CXX = g++
2250
+#CXXFLAGS = -O2 -Wno-deprecated
2251
+#DEFINES = -D_MSC_VER -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
2252
+
2253
+##########################
2254
+
2255
+COMPILE=$(CXX) $(CXXFLAGS) $(DEFINES)
2256
+LINK=$(CXX)
2257
+
2258
+UNRAR_OBJ=filestr.o recvol.o rs.o scantree.o
2259
+
2260
+OBJECTS=rar.o strlist.o strfn.o pathfn.o int64.o savepos.o global.o \
2261
+ file.o filefn.o filcreat.o archive.o arcread.o unicode.o \
2262
+ system.o isnt.o crypt.o crc.o rawread.o encname.o \
2263
+ resource.o match.o timefn.o rdwrfn.o consio.o options.o \
2264
+ ulinks.o errhnd.o rarvm.o rijndael.o getbits.o sha1.o \
2265
+ extinfo.o extract.o volume.o list.o find.o unpack.o cmddata.o
2266
+
2267
+.cpp.o:
2268
+ $(COMPILE) -D$(WHAT) -c $<
2269
+
2270
+all: unrar
2271
+
2272
+clean:
2273
+ @rm -f *.o *.bak *~
2274
+
2275
+unrar: WHAT=UNRAR
2276
+unrar: $(OBJECTS) $(UNRAR_OBJ)
2277
+ @rm -f makeunrar
2278
+ $(LINK) -Wl,-s -o unrar $(LDFLAGS) $(OBJECTS) $(UNRAR_OBJ) $(LIBS)
2279
+
2280
+sfx: WHAT=SFX_MODULE
2281
+sfx: $(OBJECTS)
2282
+ @rm -f default.sfx
2283
+ $(LINK) -Wl,-s -o default.sfx $(LDFLAGS) $(OBJECTS) -DSFX_MODULE
2284
+
2285
diff -uNr unrar/makefile.dj unrar/makefile.dj
2286
--- unrar/makefile.dj 1970-01-01 01:00:00.000000000 +0100
2287
+++ unrar/makefile.dj 2007-09-10 12:27:02.000000000 +0200
2288
2289
+#
2290
+# Makefile for DJGPP - unrar
2291
+#
2292
+# Note: you have to 'make clean' before you can build
2293
+# the sfx module
2294
+#
2295
+
2296
+# DOS32 using DJGPP 2.03 Patchlevel 2 and GCC 2.95.3
2297
+CXX = gpp
2298
+CXXFLAGS = -O2 -Wno-deprecated
2299
+#DEFINES = -D_MSC_VER -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
2300
+
2301
+##########################
2302
+
2303
+.PHONY: all clean veryclean
2304
+
2305
+COMPILE=$(CXX) $(CXXFLAGS) $(DEFINES)
2306
+LINK=$(CXX)
2307
+
2308
+UNRAR_OBJ=filestr.o recvol.o rs.o scantree.o
2309
+
2310
+OBJECTS=rar.o strlist.o strfn.o pathfn.o int64.o savepos.o global.o \
2311
+ file.o filefn.o filcreat.o archive.o arcread.o unicode.o \
2312
+ system.o isnt.o crypt.o crc.o rawread.o encname.o \
2313
+ resource.o match.o timefn.o rdwrfn.o consio.o options.o \
2314
+ ulinks.o errhnd.o rarvm.o rijndael.o getbits.o sha1.o \
2315
+ extinfo.o extract.o volume.o list.o find.o unpack.o cmddata.o
2316
+
2317
+.cpp.o:
2318
+ $(COMPILE) -D$(WHAT) -c $<
2319
+
2320
+all: unrar
2321
+
2322
+unrar: WHAT=UNRAR
2323
+unrar: $(OBJECTS) $(UNRAR_OBJ)
2324
+ $(LINK) -Wl,-s -o unrar.exe $(LDFLAGS) $(OBJECTS) $(UNRAR_OBJ) $(LIBS)
2325
+ exe2coff unrar.exe
2326
+ cp -u $(DJDIR)/bin/cwsdstub.exe .
2327
+ copy /b cwsdstub.exe+unrar unrar.exe
2328
+ -upx --ultra-brute unrar.exe
2329
+
2330
+sfx: WHAT=SFX_MODULE
2331
+sfx: $(OBJECTS)
2332
+ $(LINK) -Wl,-s -o default.sfx $(LDFLAGS) $(OBJECTS) -DSFX_MODULE
2333
+
2334
+clean:
2335
+ $(RM) $(OBJECTS) $(UNRAR_OBJ)
2336
+
2337
+veryclean: clean
2338
+ $(RM) unrar.exe default.sfx cwsdstub.exe unrar
2339
diff -uNr unrar/makefile.dmc unrar/makefile.dmc
2340
--- unrar/makefile.dmc 1970-01-01 01:00:00.000000000 +0100
2341
+++ unrar/makefile.dmc 2005-01-22 16:22:54.000000000 +0100
2342
2343
+# Makefile for Digital Mars C++ Compiler
2344
+# http://www.rarlab.com
2345
+# http://www.digitalmars.com
2346
+#
2347
+# DEFINES: UNRAR RARDLL GUI SFX_MODULE SILENT
2348
+
2349
+NAME = unrar
2350
+EXT = exe
2351
+
2352
+CPP = dmc
2353
+
2354
+LINK = link
2355
+
2356
+# --------------
2357
+# Release Build
2358
+# --------------
2359
+DEFINES = -DNDEBUG -D_MSC_VER -DUNRAR
2360
+CPPFLAGS = -o+all -ff -Nc -g- -Ae
2361
+LNKFLAGS = /EXETYPE:NT /MACHINE:i386 /SUBSYSTEM:CONSOLE /NOLOGO /NODEBUG /NOCODEVIEW /PACKFUNCTIONS
2362
+
2363
+# --------------
2364
+# Debug Build
2365
+# --------------
2366
+#DEFINES = -D_DEBUG -D_MSC_VER -DUNRAR
2367
+#CPPFLAGS = -o+none -Nc -S -gf -Ae
2368
+#LNKFLAGS = /EXETYPE:NT /MACHINE:i386 /SUBSYSTEM:CONSOLE /NOLOGO /DEBUG
2369
+
2370
+OBJ = rar.obj strlist.obj strfn.obj pathfn.obj int64.obj savepos.obj global.obj \
2371
+ file.obj filefn.obj filcreat.obj archive.obj arcread.obj unicode.obj \
2372
+ system.obj isnt.obj crypt.obj crc.obj rawread.obj encname.obj \
2373
+ resource.obj match.obj timefn.obj rdwrfn.obj consio.obj options.obj \
2374
+ ulinks.obj errhnd.obj rarvm.obj rijndael.obj getbits.obj sha1.obj \
2375
+ extinfo.obj extract.obj volume.obj find.obj unpack.obj cmddata.obj \
2376
+ filestr.obj recvol.obj rs.obj scantree.obj \
2377
+ list.obj \
2378
+# dll.obj \
2379
+
2380
+LIB = kernel32.lib+user32.lib+advapi32.lib
2381
+
2382
+#DEF = dll.def
2383
+
2384
+link: $(OBJ)
2385
+ $(LINK) $(LNKFLAGS) $(OBJ), $(NAME).$(EXT), $(NAME).map, $(LIB), $(DEF)
2386
+
2387
+.c.obj:
2388
+ $(CPP) $(CPPFLAGS) $(DEFINES) -c $< -o $@
2389
+
2390
+.cpp.obj:
2391
+ $(CPP) $(CPPFLAGS) $(DEFINES) -c $< -o $@
2392
+
2393
+clean:
2394
+ del $(OBJ)
2395
+ del $(NAME).$(EXT)
2396
+ del $(NAME).map
2397
diff -uNr unrar/makefile.msc unrar/makefile.msc
2398
--- unrar/makefile.msc 1970-01-01 01:00:00.000000000 +0100
2399
+++ unrar/makefile.msc 2002-03-15 20:34:16.000000000 +0100
2400
2401
+# Microsoft Developer Studio Generated NMAKE File, Based on unrar.dsp
2402
+!IF "$(CFG)" == ""
2403
+CFG=unrar - Win32 Release
2404
+!MESSAGE No configuration specified. Defaulting to unrar - Win32 Release.
2405
+!ENDIF
2406
+
2407
+!IF "$(CFG)" != "unrar - Win32 Release" && "$(CFG)" != "unrar - Win32 Debug"
2408
+!MESSAGE Invalid configuration "$(CFG)" specified.
2409
+!MESSAGE You can specify a configuration when running NMAKE
2410
+!MESSAGE by defining the macro CFG on the command line. For example:
2411
+!MESSAGE
2412
+!MESSAGE NMAKE /f "unrar.mak" CFG="unrar - Win32 Debug"
2413
+!MESSAGE
2414
+!MESSAGE Possible choices for configuration are:
2415
+!MESSAGE
2416
+!MESSAGE "unrar - Win32 Release" (based on "Win32 (x86) Console Application")
2417
+!MESSAGE "unrar - Win32 Debug" (based on "Win32 (x86) Console Application")
2418
+!MESSAGE
2419
+!ERROR An invalid configuration is specified.
2420
+!ENDIF
2421
+
2422
+!IF "$(OS)" == "Windows_NT"
2423
+NULL=
2424
+!ELSE
2425
+NULL=nul
2426
+!ENDIF
2427
+
2428
+CPP=cl.exe
2429
+RSC=rc.exe
2430
+
2431
+!IF "$(CFG)" == "unrar - Win32 Release"
2432
+
2433
+OUTDIR=.\Release
2434
+INTDIR=.\Release
2435
+# Begin Custom Macros
2436
+OutDir=.\Release
2437
+# End Custom Macros
2438
+
2439
+ALL : "$(OUTDIR)\unrar.exe"
2440
+
2441
+
2442
+CLEAN :
2443
+ -@erase "$(INTDIR)\archive.obj"
2444
+ -@erase "$(INTDIR)\arcread.obj"
2445
+ -@erase "$(INTDIR)\cmddata.obj"
2446
+ -@erase "$(INTDIR)\consio.obj"
2447
+ -@erase "$(INTDIR)\crc.obj"
2448
+ -@erase "$(INTDIR)\crypt.obj"
2449
+ -@erase "$(INTDIR)\encname.obj"
2450
+ -@erase "$(INTDIR)\errhnd.obj"
2451
+ -@erase "$(INTDIR)\extinfo.obj"
2452
+ -@erase "$(INTDIR)\extract.obj"
2453
+ -@erase "$(INTDIR)\filcreat.obj"
2454
+ -@erase "$(INTDIR)\file.obj"
2455
+ -@erase "$(INTDIR)\filefn.obj"
2456
+ -@erase "$(INTDIR)\filestr.obj"
2457
+ -@erase "$(INTDIR)\find.obj"
2458
+ -@erase "$(INTDIR)\getbits.obj"
2459
+ -@erase "$(INTDIR)\global.obj"
2460
+ -@erase "$(INTDIR)\int64.obj"
2461
+ -@erase "$(INTDIR)\isnt.obj"
2462
+ -@erase "$(INTDIR)\list.obj"
2463
+ -@erase "$(INTDIR)\match.obj"
2464
+ -@erase "$(INTDIR)\options.obj"
2465
+ -@erase "$(INTDIR)\pathfn.obj"
2466
+ -@erase "$(INTDIR)\rar.obj"
2467
+ -@erase "$(INTDIR)\rarvm.obj"
2468
+ -@erase "$(INTDIR)\rawread.obj"
2469
+ -@erase "$(INTDIR)\rdwrfn.obj"
2470
+ -@erase "$(INTDIR)\recvol.obj"
2471
+ -@erase "$(INTDIR)\resource.obj"
2472
+ -@erase "$(INTDIR)\rijndael.obj"
2473
+ -@erase "$(INTDIR)\rs.obj"
2474
+ -@erase "$(INTDIR)\savepos.obj"
2475
+ -@erase "$(INTDIR)\scantree.obj"
2476
+ -@erase "$(INTDIR)\sha1.obj"
2477
+ -@erase "$(INTDIR)\strfn.obj"
2478
+ -@erase "$(INTDIR)\strlist.obj"
2479
+ -@erase "$(INTDIR)\system.obj"
2480
+ -@erase "$(INTDIR)\timefn.obj"
2481
+ -@erase "$(INTDIR)\ulinks.obj"
2482
+ -@erase "$(INTDIR)\unicode.obj"
2483
+ -@erase "$(INTDIR)\unpack.obj"
2484
+ -@erase "$(INTDIR)\vc60.idb"
2485
+ -@erase "$(INTDIR)\volume.obj"
2486
+ -@erase "$(OUTDIR)\unrar.exe"
2487
+ -@erase "$(OUTDIR)\unrar.map"
2488
+
2489
+"$(OUTDIR)" :
2490
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
2491
+
2492
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "UNRAR" /Fp"$(INTDIR)\unrar.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
2493
+BSC32=bscmake.exe
2494
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\unrar.bsc"
2495
+BSC32_SBRS= \
2496
+
2497
+LINK32=link.exe
2498
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\unrar.pdb" /map:"$(INTDIR)\unrar.map" /machine:I386 /out:"$(OUTDIR)\unrar.exe"
2499
+LINK32_OBJS= \
2500
+ "$(INTDIR)\rar.obj" \
2501
+ "$(INTDIR)\strlist.obj" \
2502
+ "$(INTDIR)\strfn.obj" \
2503
+ "$(INTDIR)\pathfn.obj" \
2504
+ "$(INTDIR)\int64.obj" \
2505
+ "$(INTDIR)\savepos.obj" \
2506
+ "$(INTDIR)\global.obj" \
2507
+ "$(INTDIR)\file.obj" \
2508
+ "$(INTDIR)\filefn.obj" \
2509
+ "$(INTDIR)\filcreat.obj" \
2510
+ "$(INTDIR)\archive.obj" \
2511
+ "$(INTDIR)\arcread.obj" \
2512
+ "$(INTDIR)\unicode.obj" \
2513
+ "$(INTDIR)\system.obj" \
2514
+ "$(INTDIR)\isnt.obj" \
2515
+ "$(INTDIR)\crypt.obj" \
2516
+ "$(INTDIR)\crc.obj" \
2517
+ "$(INTDIR)\rawread.obj" \
2518
+ "$(INTDIR)\encname.obj" \
2519
+ "$(INTDIR)\resource.obj" \
2520
+ "$(INTDIR)\match.obj" \
2521
+ "$(INTDIR)\timefn.obj" \
2522
+ "$(INTDIR)\rdwrfn.obj" \
2523
+ "$(INTDIR)\consio.obj" \
2524
+ "$(INTDIR)\options.obj" \
2525
+ "$(INTDIR)\ulinks.obj" \
2526
+ "$(INTDIR)\errhnd.obj" \
2527
+ "$(INTDIR)\rarvm.obj" \
2528
+ "$(INTDIR)\rijndael.obj" \
2529
+ "$(INTDIR)\getbits.obj" \
2530
+ "$(INTDIR)\sha1.obj" \
2531
+ "$(INTDIR)\extinfo.obj" \
2532
+ "$(INTDIR)\extract.obj" \
2533
+ "$(INTDIR)\volume.obj" \
2534
+ "$(INTDIR)\list.obj" \
2535
+ "$(INTDIR)\find.obj" \
2536
+ "$(INTDIR)\unpack.obj" \
2537
+ "$(INTDIR)\cmddata.obj" \
2538
+ "$(INTDIR)\filestr.obj" \
2539
+ "$(INTDIR)\recvol.obj" \
2540
+ "$(INTDIR)\rs.obj" \
2541
+ "$(INTDIR)\scantree.obj"
2542
+
2543
+"$(OUTDIR)\unrar.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
2544
+ $(LINK32) @<<
2545
+ $(LINK32_FLAGS) $(LINK32_OBJS)
2546
+<<
2547
+
2548
+!ELSEIF "$(CFG)" == "unrar - Win32 Debug"
2549
+
2550
+OUTDIR=.\Debug
2551
+INTDIR=.\Debug
2552
+# Begin Custom Macros
2553
+OutDir=.\Debug
2554
+# End Custom Macros
2555
+
2556
+ALL : "$(OUTDIR)\unrar.exe"
2557
+
2558
+
2559
+CLEAN :
2560
+ -@erase "$(INTDIR)\archive.obj"
2561
+ -@erase "$(INTDIR)\arcread.obj"
2562
+ -@erase "$(INTDIR)\cmddata.obj"
2563
+ -@erase "$(INTDIR)\consio.obj"
2564
+ -@erase "$(INTDIR)\crc.obj"
2565
+ -@erase "$(INTDIR)\crypt.obj"
2566
+ -@erase "$(INTDIR)\encname.obj"
2567
+ -@erase "$(INTDIR)\errhnd.obj"
2568
+ -@erase "$(INTDIR)\extinfo.obj"
2569
+ -@erase "$(INTDIR)\extract.obj"
2570
+ -@erase "$(INTDIR)\filcreat.obj"
2571
+ -@erase "$(INTDIR)\file.obj"
2572
+ -@erase "$(INTDIR)\filefn.obj"
2573
+ -@erase "$(INTDIR)\filestr.obj"
2574
+ -@erase "$(INTDIR)\find.obj"
2575
+ -@erase "$(INTDIR)\getbits.obj"
2576
+ -@erase "$(INTDIR)\global.obj"
2577
+ -@erase "$(INTDIR)\int64.obj"
2578
+ -@erase "$(INTDIR)\isnt.obj"
2579
+ -@erase "$(INTDIR)\list.obj"
2580
+ -@erase "$(INTDIR)\match.obj"
2581
+ -@erase "$(INTDIR)\options.obj"
2582
+ -@erase "$(INTDIR)\pathfn.obj"
2583
+ -@erase "$(INTDIR)\rar.obj"
2584
+ -@erase "$(INTDIR)\rarvm.obj"
2585
+ -@erase "$(INTDIR)\rawread.obj"
2586
+ -@erase "$(INTDIR)\rdwrfn.obj"
2587
+ -@erase "$(INTDIR)\recvol.obj"
2588
+ -@erase "$(INTDIR)\resource.obj"
2589
+ -@erase "$(INTDIR)\rijndael.obj"
2590
+ -@erase "$(INTDIR)\rs.obj"
2591
+ -@erase "$(INTDIR)\savepos.obj"
2592
+ -@erase "$(INTDIR)\scantree.obj"
2593
+ -@erase "$(INTDIR)\sha1.obj"
2594
+ -@erase "$(INTDIR)\strfn.obj"
2595
+ -@erase "$(INTDIR)\strlist.obj"
2596
+ -@erase "$(INTDIR)\system.obj"
2597
+ -@erase "$(INTDIR)\timefn.obj"
2598
+ -@erase "$(INTDIR)\ulinks.obj"
2599
+ -@erase "$(INTDIR)\unicode.obj"
2600
+ -@erase "$(INTDIR)\unpack.obj"
2601
+ -@erase "$(INTDIR)\vc60.idb"
2602
+ -@erase "$(INTDIR)\vc60.pdb"
2603
+ -@erase "$(INTDIR)\volume.obj"
2604
+ -@erase "$(OUTDIR)\unrar.exe"
2605
+ -@erase "$(OUTDIR)\unrar.ilk"
2606
+ -@erase "$(OUTDIR)\unrar.pdb"
2607
+
2608
+"$(OUTDIR)" :
2609
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
2610
+
2611
+CPP_PROJ=/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "UNRAR" /Fp"$(INTDIR)\unrar.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
2612
+BSC32=bscmake.exe
2613
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\unrar.bsc"
2614
+BSC32_SBRS= \
2615
+
2616
+LINK32=link.exe
2617
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\unrar.pdb" /debug /machine:I386 /out:"$(OUTDIR)\unrar.exe" /pdbtype:sept
2618
+LINK32_OBJS= \
2619
+ "$(INTDIR)\rar.obj" \
2620
+ "$(INTDIR)\strlist.obj" \
2621
+ "$(INTDIR)\strfn.obj" \
2622
+ "$(INTDIR)\pathfn.obj" \
2623
+ "$(INTDIR)\int64.obj" \
2624
+ "$(INTDIR)\savepos.obj" \
2625
+ "$(INTDIR)\global.obj" \
2626
+ "$(INTDIR)\file.obj" \
2627
+ "$(INTDIR)\filefn.obj" \
2628
+ "$(INTDIR)\filcreat.obj" \
2629
+ "$(INTDIR)\archive.obj" \
2630
+ "$(INTDIR)\arcread.obj" \
2631
+ "$(INTDIR)\unicode.obj" \
2632
+ "$(INTDIR)\system.obj" \
2633
+ "$(INTDIR)\isnt.obj" \
2634
+ "$(INTDIR)\crypt.obj" \
2635
+ "$(INTDIR)\crc.obj" \
2636
+ "$(INTDIR)\rawread.obj" \
2637
+ "$(INTDIR)\encname.obj" \
2638
+ "$(INTDIR)\resource.obj" \
2639
+ "$(INTDIR)\match.obj" \
2640
+ "$(INTDIR)\timefn.obj" \
2641
+ "$(INTDIR)\rdwrfn.obj" \
2642
+ "$(INTDIR)\consio.obj" \
2643
+ "$(INTDIR)\options.obj" \
2644
+ "$(INTDIR)\ulinks.obj" \
2645
+ "$(INTDIR)\errhnd.obj" \
2646
+ "$(INTDIR)\rarvm.obj" \
2647
+ "$(INTDIR)\rijndael.obj" \
2648
+ "$(INTDIR)\getbits.obj" \
2649
+ "$(INTDIR)\sha1.obj" \
2650
+ "$(INTDIR)\extinfo.obj" \
2651
+ "$(INTDIR)\extract.obj" \
2652
+ "$(INTDIR)\volume.obj" \
2653
+ "$(INTDIR)\list.obj" \
2654
+ "$(INTDIR)\find.obj" \
2655
+ "$(INTDIR)\unpack.obj" \
2656
+ "$(INTDIR)\cmddata.obj" \
2657
+ "$(INTDIR)\filestr.obj" \
2658
+ "$(INTDIR)\recvol.obj" \
2659
+ "$(INTDIR)\rs.obj" \
2660
+ "$(INTDIR)\scantree.obj"
2661
+
2662
+"$(OUTDIR)\unrar.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
2663
+ $(LINK32) @<<
2664
+ $(LINK32_FLAGS) $(LINK32_OBJS)
2665
+<<
2666
+
2667
+!ENDIF
2668
+
2669
+.c{$(INTDIR)}.obj::
2670
+ $(CPP) @<<
2671
+ $(CPP_PROJ) $<
2672
+<<
2673
+
2674
+.cpp{$(INTDIR)}.obj::
2675
+ $(CPP) @<<
2676
+ $(CPP_PROJ) $<
2677
+<<
2678
+
2679
+.cxx{$(INTDIR)}.obj::
2680
+ $(CPP) @<<
2681
+ $(CPP_PROJ) $<
2682
+<<
2683
+
2684
+.c{$(INTDIR)}.sbr::
2685
+ $(CPP) @<<
2686
+ $(CPP_PROJ) $<
2687
+<<
2688
+
2689
+.cpp{$(INTDIR)}.sbr::
2690
+ $(CPP) @<<
2691
+ $(CPP_PROJ) $<
2692
+<<
2693
+
2694
+.cxx{$(INTDIR)}.sbr::
2695
+ $(CPP) @<<
2696
+ $(CPP_PROJ) $<
2697
+<<
2698
+
2699
+
2700
+!IF "$(NO_EXTERNAL_DEPS)" != "1"
2701
+!IF EXISTS("msc.dep")
2702
+!INCLUDE "msc.dep"
2703
+!ELSE
2704
+!MESSAGE Warning: cannot find "msc.dep"
2705
+!ENDIF
2706
+!ENDIF
2707
+
2708
+
2709
+!IF "$(CFG)" == "unrar - Win32 Release" || "$(CFG)" == "unrar - Win32 Debug"
2710
+SOURCE=.\archive.cpp
2711
+
2712
+"$(INTDIR)\archive.obj" : $(SOURCE) "$(INTDIR)"
2713
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2714
+
2715
+
2716
+SOURCE=.\arcread.cpp
2717
+
2718
+"$(INTDIR)\arcread.obj" : $(SOURCE) "$(INTDIR)"
2719
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2720
+
2721
+
2722
+SOURCE=.\cmddata.cpp
2723
+
2724
+"$(INTDIR)\cmddata.obj" : $(SOURCE) "$(INTDIR)"
2725
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2726
+
2727
+
2728
+SOURCE=.\consio.cpp
2729
+
2730
+"$(INTDIR)\consio.obj" : $(SOURCE) "$(INTDIR)"
2731
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2732
+
2733
+
2734
+SOURCE=.\crc.cpp
2735
+
2736
+"$(INTDIR)\crc.obj" : $(SOURCE) "$(INTDIR)"
2737
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2738
+
2739
+
2740
+SOURCE=.\crypt.cpp
2741
+
2742
+"$(INTDIR)\crypt.obj" : $(SOURCE) "$(INTDIR)"
2743
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2744
+
2745
+
2746
+SOURCE=.\encname.cpp
2747
+
2748
+"$(INTDIR)\encname.obj" : $(SOURCE) "$(INTDIR)"
2749
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2750
+
2751
+
2752
+SOURCE=.\errhnd.cpp
2753
+
2754
+"$(INTDIR)\errhnd.obj" : $(SOURCE) "$(INTDIR)"
2755
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2756
+
2757
+
2758
+SOURCE=.\extinfo.cpp
2759
+
2760
+"$(INTDIR)\extinfo.obj" : $(SOURCE) "$(INTDIR)"
2761
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2762
+
2763
+
2764
+SOURCE=.\extract.cpp
2765
+
2766
+"$(INTDIR)\extract.obj" : $(SOURCE) "$(INTDIR)"
2767
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2768
+
2769
+
2770
+SOURCE=.\filcreat.cpp
2771
+
2772
+"$(INTDIR)\filcreat.obj" : $(SOURCE) "$(INTDIR)"
2773
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2774
+
2775
+
2776
+SOURCE=.\file.cpp
2777
+
2778
+"$(INTDIR)\file.obj" : $(SOURCE) "$(INTDIR)"
2779
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2780
+
2781
+
2782
+SOURCE=.\filefn.cpp
2783
+
2784
+"$(INTDIR)\filefn.obj" : $(SOURCE) "$(INTDIR)"
2785
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2786
+
2787
+
2788
+SOURCE=.\filestr.cpp
2789
+
2790
+"$(INTDIR)\filestr.obj" : $(SOURCE) "$(INTDIR)"
2791
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2792
+
2793
+
2794
+SOURCE=.\find.cpp
2795
+
2796
+"$(INTDIR)\find.obj" : $(SOURCE) "$(INTDIR)"
2797
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2798
+
2799
+
2800
+SOURCE=.\getbits.cpp
2801
+
2802
+"$(INTDIR)\getbits.obj" : $(SOURCE) "$(INTDIR)"
2803
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2804
+
2805
+
2806
+SOURCE=.\global.cpp
2807
+
2808
+"$(INTDIR)\global.obj" : $(SOURCE) "$(INTDIR)"
2809
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2810
+
2811
+
2812
+SOURCE=.\int64.cpp
2813
+
2814
+"$(INTDIR)\int64.obj" : $(SOURCE) "$(INTDIR)"
2815
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2816
+
2817
+
2818
+SOURCE=.\isnt.cpp
2819
+
2820
+"$(INTDIR)\isnt.obj" : $(SOURCE) "$(INTDIR)"
2821
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2822
+
2823
+
2824
+SOURCE=.\list.cpp
2825
+
2826
+"$(INTDIR)\list.obj" : $(SOURCE) "$(INTDIR)"
2827
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2828
+
2829
+
2830
+SOURCE=.\match.cpp
2831
+
2832
+"$(INTDIR)\match.obj" : $(SOURCE) "$(INTDIR)"
2833
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2834
+
2835
+
2836
+SOURCE=.\options.cpp
2837
+
2838
+"$(INTDIR)\options.obj" : $(SOURCE) "$(INTDIR)"
2839
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2840
+
2841
+
2842
+SOURCE=.\pathfn.cpp
2843
+
2844
+"$(INTDIR)\pathfn.obj" : $(SOURCE) "$(INTDIR)"
2845
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2846
+
2847
+
2848
+SOURCE=.\rar.cpp
2849
+
2850
+"$(INTDIR)\rar.obj" : $(SOURCE) "$(INTDIR)"
2851
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2852
+
2853
+
2854
+SOURCE=.\rarvm.cpp
2855
+
2856
+"$(INTDIR)\rarvm.obj" : $(SOURCE) "$(INTDIR)"
2857
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2858
+
2859
+
2860
+SOURCE=.\rawread.cpp
2861
+
2862
+"$(INTDIR)\rawread.obj" : $(SOURCE) "$(INTDIR)"
2863
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2864
+
2865
+
2866
+SOURCE=.\rdwrfn.cpp
2867
+
2868
+"$(INTDIR)\rdwrfn.obj" : $(SOURCE) "$(INTDIR)"
2869
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2870
+
2871
+
2872
+SOURCE=.\recvol.cpp
2873
+
2874
+"$(INTDIR)\recvol.obj" : $(SOURCE) "$(INTDIR)"
2875
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2876
+
2877
+
2878
+SOURCE=.\resource.cpp
2879
+
2880
+"$(INTDIR)\resource.obj" : $(SOURCE) "$(INTDIR)"
2881
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2882
+
2883
+
2884
+SOURCE=.\rijndael.cpp
2885
+
2886
+"$(INTDIR)\rijndael.obj" : $(SOURCE) "$(INTDIR)"
2887
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2888
+
2889
+
2890
+SOURCE=.\rs.cpp
2891
+
2892
+"$(INTDIR)\rs.obj" : $(SOURCE) "$(INTDIR)"
2893
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2894
+
2895
+
2896
+SOURCE=.\savepos.cpp
2897
+
2898
+"$(INTDIR)\savepos.obj" : $(SOURCE) "$(INTDIR)"
2899
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2900
+
2901
+
2902
+SOURCE=.\scantree.cpp
2903
+
2904
+"$(INTDIR)\scantree.obj" : $(SOURCE) "$(INTDIR)"
2905
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2906
+
2907
+
2908
+SOURCE=.\sha1.cpp
2909
+
2910
+"$(INTDIR)\sha1.obj" : $(SOURCE) "$(INTDIR)"
2911
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2912
+
2913
+
2914
+SOURCE=.\strfn.cpp
2915
+
2916
+"$(INTDIR)\strfn.obj" : $(SOURCE) "$(INTDIR)"
2917
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2918
+
2919
+
2920
+SOURCE=.\strlist.cpp
2921
+
2922
+"$(INTDIR)\strlist.obj" : $(SOURCE) "$(INTDIR)"
2923
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2924
+
2925
+
2926
+SOURCE=.\system.cpp
2927
+
2928
+"$(INTDIR)\system.obj" : $(SOURCE) "$(INTDIR)"
2929
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2930
+
2931
+
2932
+SOURCE=.\timefn.cpp
2933
+
2934
+"$(INTDIR)\timefn.obj" : $(SOURCE) "$(INTDIR)"
2935
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2936
+
2937
+
2938
+SOURCE=.\ulinks.cpp
2939
+
2940
+"$(INTDIR)\ulinks.obj" : $(SOURCE) "$(INTDIR)"
2941
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2942
+
2943
+
2944
+SOURCE=.\unicode.cpp
2945
+
2946
+"$(INTDIR)\unicode.obj" : $(SOURCE) "$(INTDIR)"
2947
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2948
+
2949
+
2950
+SOURCE=.\unpack.cpp
2951
+
2952
+"$(INTDIR)\unpack.obj" : $(SOURCE) "$(INTDIR)"
2953
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2954
+
2955
+
2956
+SOURCE=.\volume.cpp
2957
+
2958
+"$(INTDIR)\volume.obj" : $(SOURCE) "$(INTDIR)"
2959
+ $(CPP) $(CPP_PROJ) $(SOURCE)
2960
+
2961
+
2962
+
2963
+!ENDIF
2964
+
2965
diff -uNr unrar/makefile.unix unrar/makefile.unix
2966
--- unrar/makefile.unix 1970-01-01 01:00:00.000000000 +0100
2967
+++ unrar/makefile.unix 2008-10-09 15:43:06.000000000 +0200
2968
2969
+#
2970
+# Makefile for UNIX - unrar
2971
+#
2972
+# Note: you have to 'make clean' before you can build
2973
+# the sfx module
2974
+#
2975
+
2976
+# Linux using GCC
2977
+#CXX=g++
2978
+#CXXFLAGS=-O2
2979
+DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
2980
+STRIP=strip
2981
+DESTDIR=/usr
2982
+
2983
+# Linux using LCC
2984
+#CXX=lcc
2985
+#CXXFLAGS=-O2
2986
+#DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
2987
+#STRIP=strip
2988
+#DESTDIR=/usr
2989
+
2990
+# HP UX using aCC
2991
+#CXX=aCC
2992
+#CXXFLAGS=-AA +O2 +Onolimit
2993
+#DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
2994
+#STRIP=strip
2995
+#DESTDIR=/usr
2996
+
2997
+# IRIX using GCC
2998
+#CXX=g++
2999
+#CXXFLAGS=-O2
3000
+#DEFINES=-DBIG_ENDIAN -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_BSD_COMPAT -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1
3001
+#STRIP=strip
3002
+#DESTDIR=/usr
3003
+
3004
+# IRIX using MIPSPro (experimental)
3005
+#CXX=CC
3006
+#CXXFLAGS=-O2 -mips3 -woff 1234,1156,3284 -LANG:std
3007
+#DEFINES=-DBIG_ENDIAN -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_BSD_COMPAT -DNATIVE_INT64 -DInt64=int64_t
3008
+#STRIP=strip
3009
+#DESTDIR=/usr
3010
+
3011
+# AIX using xlC (IBM VisualAge C++ 5.0)
3012
+#CXX=xlC
3013
+#CXXFLAGS=-O -qinline -qro -qroconst -qmaxmem=16384 -qcpluscmt
3014
+#DEFINES=-D_LARGE_FILES -D_LARGE_FILE_API
3015
+#LIBS=-lbsd
3016
+#STRIP=strip
3017
+#DESTDIR=/usr
3018
+
3019
+# Solaris using CC (SUN Forte Developer 7 C++)
3020
+#CXX=CC
3021
+#CXXFLAGS=-xO2 -xbuiltin=%all -xinline=%auto
3022
+#DEFINES=-DBIG_ENDIAN -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
3023
+#STRIP=strip
3024
+#DESTDIR=/usr
3025
+
3026
+# Solaris using GCC (optimized for UltraSPARC 1 CPU)
3027
+#CXX=g++
3028
+#CXXFLAGS=-O3 -mcpu=v9 -mtune=ultrasparc -m32
3029
+#DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
3030
+#STRIP=/usr/ccs/bin/strip
3031
+#DESTDIR=/usr
3032
+
3033
+# Tru64 5.1B using GCC3
3034
+#CXX=g++
3035
+#CXXFLAGS=-O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_XOPEN_SOURCE=500
3036
+#STRIP=strip
3037
+#LDFLAGS=-rpath /usr/local/gcc/lib
3038
+#DESTDIR=/usr
3039
+
3040
+# Tru64 5.1B using DEC C++
3041
+#CXX=cxx
3042
+#CXXFLAGS=-O4 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNATIVE_INT64 -DInt64=long
3043
+#STRIP=strip
3044
+#LDFLAGS=
3045
+#DESTDIR=/usr
3046
+
3047
+# QNX 6.x using GCC
3048
+#CXX=g++
3049
+#CXXFLAGS=-O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fexceptions
3050
+#STRIP=strip
3051
+#LDFLAGS=-fexceptions
3052
+#DESTDIR=/usr
3053
+
3054
+# Cross-compile
3055
+# Linux using arm-linux-g++
3056
+#CXX=arm-linux-g++
3057
+#CXXFLAGS=-O2
3058
+#DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
3059
+#STRIP=arm-linux-strip
3060
+#LDFLAGS=-static
3061
+#DESTDIR=/usr
3062
+
3063
+##########################
3064
+
3065
+COMPILE=$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES)
3066
+LINK=$(CXX)
3067
+
3068
+WHAT=UNRAR
3069
+
3070
+UNRAR_OBJ=filestr.o recvol.o rs.o scantree.o
3071
+LIB_OBJ=filestr.o scantree.o dll.o
3072
+
3073
+OBJECTS=rar.o strlist.o strfn.o pathfn.o int64.o savepos.o global.o file.o filefn.o filcreat.o \
3074
+ archive.o arcread.o unicode.o system.o isnt.o crypt.o crc.o rawread.o encname.o \
3075
+ resource.o match.o timefn.o rdwrfn.o consio.o options.o ulinks.o errhnd.o rarvm.o \
3076
+ rijndael.o getbits.o sha1.o extinfo.o extract.o volume.o list.o find.o unpack.o cmddata.o
3077
+
3078
+.cpp.o:
3079
+ $(COMPILE) -D$(WHAT) -c $<
3080
+
3081
+all: unrar
3082
+
3083
+install: install-unrar
3084
+
3085
+uninstall: uninstall-unrar
3086
+
3087
+clean:
3088
+ @rm -f *.o *.bak *~
3089
+
3090
+unrar: $(OBJECTS) $(UNRAR_OBJ)
3091
+ @rm -f unrar
3092
+ $(LINK) -o unrar $(LDFLAGS) $(OBJECTS) $(UNRAR_OBJ) $(LIBS)
3093
+ $(STRIP) unrar
3094
+
3095
+sfx: WHAT=SFX_MODULE
3096
+sfx: $(OBJECTS)
3097
+ @rm -f default.sfx
3098
+ $(LINK) -o default.sfx $(LDFLAGS) $(OBJECTS)
3099
+ $(STRIP) default.sfx
3100
+
3101
+lib: WHAT=RARDLL
3102
+lib: $(OBJECTS) $(LIB_OBJ)
3103
+ @rm -f libunrar.so
3104
+ $(LINK) -shared -o libunrar.so $(LDFLAGS) $(OBJECTS) $(LIB_OBJ)
3105
+
3106
+install-unrar:
3107
+ install unrar $(DESTDIR)/bin
3108
+
3109
+uninstall-unrar:
3110
+ rm -f $(DESTDIR)/bunrar
3111
+
3112
+install-lib:
3113
+ install libunrar.so $(DESTDIR)/lib
3114
+
3115
+uninstall-lib:
3116
+ rm -f $(DESTDIR)/lib/libunrar.so
3117
diff -uNr unrar/match.cpp unrar/match.cpp
3118
--- unrar/match.cpp 2008-02-26 14:28:59.000000000 +0100
3119
+++ unrar/match.cpp 2008-10-24 06:44:47.000000000 +0200
3120
3121
3122
static int mstricompc(const char *Str1,const char *Str2,bool ForceCase);
3123
static int mstricompcw(const wchar *Str1,const wchar *Str2,bool ForceCase);
3124
-static int mstrnicompc(const char *Str1,const char *Str2,int N,bool ForceCase);
3125
-static int mstrnicompcw(const wchar *Str1,const wchar *Str2,int N,bool ForceCase);
3126
+static int mstrnicompc(const char *Str1,const char *Str2,size_t N,bool ForceCase);
3127
+static int mstrnicompcw(const wchar *Str1,const wchar *Str2,size_t N,bool ForceCase);
3128
3129
inline uint toupperc(byte ch,bool ForceCase)
3130
{
3131
if (ForceCase)
3132
return(ch);
3133
#ifdef _WIN_32
3134
- return((uint)CharUpper((LPTSTR)(ch)));
3135
+ return((uint)(LPARAM)CharUpper((LPTSTR)(ch)));
3136
#elif defined(_UNIX)
3137
return(ch);
3138
#else
3139
3140
3141
if (CmpPath!=MATCH_NAMES)
3142
{
3143
- int WildLength=strlen(Wildcard);
3144
+ size_t WildLength=strlen(Wildcard);
3145
if (CmpPath!=MATCH_EXACTPATH && mstrnicompc(Wildcard,Name,WildLength,ForceCase)==0)
3146
{
3147
char NextCh=Name[WildLength];
3148
3149
}
3150
char *Name1=PointToName(Wildcard);
3151
char *Name2=PointToName(Name);
3152
+
3153
+ // always return false for RAR temporary files to exclude them
3154
+ // from archiving operations
3155
if (mstrnicompc("__rar_",Name2,6,false)==0)
3156
return(false);
3157
+
3158
return(match(Name1,Name2,ForceCase));
3159
}
3160
3161
3162
3163
if (CmpPath!=MATCH_NAMES)
3164
{
3165
- int WildLength=strlenw(Wildcard);
3166
+ size_t WildLength=strlenw(Wildcard);
3167
if (CmpPath!=MATCH_EXACTPATH && mstrnicompcw(Wildcard,Name,WildLength,ForceCase)==0)
3168
{
3169
wchar NextCh=Name[WildLength];
3170
3171
}
3172
wchar *Name1=PointToName(Wildcard);
3173
wchar *Name2=PointToName(Name);
3174
+
3175
+ // always return false for RAR temporary files to exclude them
3176
+ // from archiving operations
3177
if (mstrnicompcw(L"__rar_",Name2,6,false)==0)
3178
return(false);
3179
+
3180
return(match(Name1,Name2,ForceCase));
3181
}
3182
#endif
3183
3184
#endif
3185
3186
3187
-int mstrnicompc(const char *Str1,const char *Str2,int N,bool ForceCase)
3188
+int mstrnicompc(const char *Str1,const char *Str2,size_t N,bool ForceCase)
3189
{
3190
if (ForceCase)
3191
return(strncmp(Str1,Str2,N));
3192
3193
3194
3195
#ifndef SFX_MODULE
3196
-int mstrnicompcw(const wchar *Str1,const wchar *Str2,int N,bool ForceCase)
3197
+int mstrnicompcw(const wchar *Str1,const wchar *Str2,size_t N,bool ForceCase)
3198
{
3199
if (ForceCase)
3200
return(strncmpw(Str1,Str2,N));
3201
diff -uNr unrar/match.hpp unrar/match.hpp
3202
--- unrar/match.hpp 2008-02-26 14:28:59.000000000 +0100
3203
+++ unrar/match.hpp 2008-10-24 06:44:48.000000000 +0200
3204
3205
#ifndef _RAR_MATCH_
3206
#define _RAR_MATCH_
3207
3208
-enum {MATCH_NAMES,MATCH_PATH,MATCH_EXACTPATH,MATCH_SUBPATH,MATCH_WILDSUBPATH};
3209
+enum {
3210
+ MATCH_NAMES, // Compare names only.
3211
+
3212
+ MATCH_PATH, // Compares names and paths. Both must match exactly.
3213
+ // Unlike MATCH_EXACTPATH, also matches names if
3214
+ // mask contains path only and this path is a part
3215
+ // of name path.
3216
+
3217
+ MATCH_EXACTPATH, // Compares names and paths. Both must match exactly.
3218
+
3219
+ MATCH_SUBPATH, // Names must be the same, but path in mask is allowed
3220
+ // to be only a part of name path.
3221
+
3222
+ MATCH_WILDSUBPATH // Works as MATCH_SUBPATH if mask contains wildcards
3223
+ // and as MATCH_PATH otherwise.
3224
+};
3225
3226
#define MATCH_MODEMASK 0x0000ffff
3227
#define MATCH_FORCECASESENSITIVE 0x80000000
3228
diff -uNr unrar/options.cpp unrar/options.cpp
3229
--- unrar/options.cpp 2008-02-26 14:28:59.000000000 +0100
3230
+++ unrar/options.cpp 2008-10-24 06:44:47.000000000 +0200
3231
3232
{
3233
memset(this,0,sizeof(RAROptions));
3234
WinSize=0x400000;
3235
- Overwrite=OVERWRITE_ASK;
3236
+ Overwrite=OVERWRITE_DEFAULT;
3237
Method=3;
3238
MsgStream=MSG_STDOUT;
3239
ConvertNames=NAMES_ORIGINALCASE;
3240
diff -uNr unrar/options.hpp unrar/options.hpp
3241
--- unrar/options.hpp 2008-02-26 14:28:59.000000000 +0100
3242
+++ unrar/options.hpp 2008-10-24 06:44:48.000000000 +0200
3243
3244
};
3245
enum {NAMES_ORIGINALCASE,NAMES_UPPERCASE,NAMES_LOWERCASE};
3246
enum MESSAGE_TYPE {MSG_STDOUT,MSG_STDERR,MSG_ERRONLY,MSG_NULL};
3247
+
3248
enum OVERWRITE_MODE {
3249
- OVERWRITE_ASK,OVERWRITE_ALL,OVERWRITE_NONE,OVERWRITE_AUTORENAME
3250
+ OVERWRITE_DEFAULT, // ask for extraction, silently overwrite for archiving
3251
+ OVERWRITE_ALL,
3252
+ OVERWRITE_NONE,
3253
+ OVERWRITE_AUTORENAME,
3254
+ OVERWRITE_FORCE_ASK
3255
};
3256
3257
enum RAR_CHARSET { RCH_DEFAULT=0,RCH_ANSI,RCH_OEM,RCH_UNICODE };
3258
3259
RAR_CHARSET CommentCharset;
3260
RAR_CHARSET FilelistCharset;
3261
char ArcPath[NM];
3262
+ wchar ArcPathW[NM];
3263
char Password[MAXPASSWORD];
3264
bool EncryptHeaders;
3265
char LogName[NM];
3266
3267
wchar DllDestNameW[NM];
3268
int DllOpMode;
3269
int DllError;
3270
- LONG UserData;
3271
+ LPARAM UserData;
3272
UNRARCALLBACK Callback;
3273
CHANGEVOLPROC ChangeVolProc;
3274
PROCESSDATAPROC ProcessDataProc;
3275
diff -uNr unrar/os2ea.cpp unrar/os2ea.cpp
3276
--- unrar/os2ea.cpp 2008-02-26 14:28:59.000000000 +0100
3277
+++ unrar/os2ea.cpp 2008-10-24 06:44:47.000000000 +0200
3278
3279
if (Arc.HeaderCRC!=Arc.EAHead.HeadCRC)
3280
{
3281
Log(Arc.FileName,St(MEABroken),FileName);
3282
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
3283
+ ErrHandler.SetErrorCode(CRC_ERROR);
3284
return;
3285
}
3286
3287
if (Arc.EAHead.Method<0x31 || Arc.EAHead.Method>0x35 || Arc.EAHead.UnpVer>PACK_VER)
3288
{
3289
Log(Arc.FileName,St(MEAUnknHeader),FileName);
3290
- ErrHandler.SetErrorCode(RAR_WARNING);
3291
+ ErrHandler.SetErrorCode(WARNING);
3292
return;
3293
}
3294
3295
3296
if (Arc.EAHead.EACRC!=~DataIO.UnpFileCRC)
3297
{
3298
Log(Arc.FileName,St(MEABroken),FileName);
3299
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
3300
+ ErrHandler.SetErrorCode(CRC_ERROR);
3301
return;
3302
}
3303
3304
3305
if (DosSetPathInfo((unsigned char *)FileName,2,&EAOP2,sizeof(EAOP2),0x10)!=0)
3306
{
3307
Log(Arc.FileName,St(MCannotSetEA),FileName);
3308
- ErrHandler.SetErrorCode(RAR_WARNING);
3309
+ ErrHandler.SetErrorCode(WARNING);
3310
}
3311
File::SetCloseFileTimeByName(FileName,&Arc.NewLhd.mtime,&Arc.NewLhd.atime);
3312
mprintf(St(MShowEA));
3313
3314
if (DosSetPathInfo((unsigned char *)FileName,2,&EAOP2,sizeof(EAOP2),0x10)!=0)
3315
{
3316
Log(Arc.FileName,St(MCannotSetEA),FileName);
3317
- ErrHandler.SetErrorCode(RAR_WARNING);
3318
+ ErrHandler.SetErrorCode(WARNING);
3319
}
3320
File::SetCloseFileTimeByName(FileName,&Arc.NewLhd.mtime,&Arc.NewLhd.atime);
3321
mprintf(St(MShowEA));
3322
diff -uNr unrar/os.hpp unrar/os.hpp
3323
--- unrar/os.hpp 2008-02-26 14:28:59.000000000 +0100
3324
+++ unrar/os.hpp 2008-10-24 06:44:48.000000000 +0200
3325
3326
#include <prsht.h>
3327
3328
#ifndef _WIN_CE
3329
+ #include <shellapi.h>
3330
#include <shlobj.h>
3331
#include <winioctl.h>
3332
#endif
3333
3334
3335
#endif
3336
3337
-typedef const char* MSGID;
3338
+ typedef const char* MSGID;
3339
3340
#define safebuf static
3341
3342
diff -uNr unrar/pathfn.cpp unrar/pathfn.cpp
3343
--- unrar/pathfn.cpp 2008-02-26 14:28:59.000000000 +0100
3344
+++ unrar/pathfn.cpp 2008-10-24 06:44:47.000000000 +0200
3345
3346
}
3347
3348
3349
+
3350
+
3351
char* ConvertPath(const char *SrcPath,char *DestPath)
3352
{
3353
const char *DestPtr=SrcPath;
3354
3355
#endif
3356
3357
3358
+#if defined(_WIN_32) && !defined(_WIN_CE) && !defined(SFX_MODULE)
3359
+void GetRarDataPath(char *Path)
3360
+{
3361
+ *Path=0;
3362
+
3363
+ HKEY hKey;
3364
+ if (RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\WinRAR\\Paths",0,
3365
+ KEY_QUERY_VALUE,&hKey)==ERROR_SUCCESS)
3366
+ {
3367
+ DWORD DataSize=NM,Type;
3368
+ RegQueryValueEx(hKey,"AppData",0,&Type,(BYTE *)Path,&DataSize);
3369
+ RegCloseKey(hKey);
3370
+ }
3371
+
3372
+ if (*Path==0 || !FileExist(Path))
3373
+ GetAppDataPath(Path);
3374
+}
3375
+#endif
3376
+
3377
+
3378
#ifndef SFX_MODULE
3379
bool EnumConfigPaths(char *Path,int Number)
3380
{
3381
3382
RemoveNameFromPath(Path);
3383
return(true);
3384
#elif defined(_UNIX)
3385
+ static const char *AltPath[]={
3386
+ "/etc","/etc/rar","/usr/lib","/usr/local/lib","/usr/local/etc"
3387
+ };
3388
if (Number==0)
3389
{
3390
char *EnvStr=getenv("HOME");
3391
- if (EnvStr==NULL)
3392
- return(false);
3393
- strncpy(Path,EnvStr,NM-1);
3394
+ strncpy(Path, (EnvStr==NULL) ? AltPath[0] : EnvStr, NM-1);
3395
Path[NM-1]=0;
3396
return(true);
3397
}
3398
- static const char *AltPath[]={
3399
- "/etc","/etc/rar","/usr/lib","/usr/local/lib","/usr/local/etc"
3400
- };
3401
Number--;
3402
if (Number<0 || Number>=sizeof(AltPath)/sizeof(AltPath[0]))
3403
return(false);
3404
3405
if (Number<0 || Number>1)
3406
return(false);
3407
if (Number==0)
3408
- GetAppDataPath(Path);
3409
+ GetRarDataPath(Path);
3410
else
3411
{
3412
GetModuleFileName(NULL,Path,NM);
3413
3414
#ifndef SFX_MODULE
3415
void GetConfigName(const char *Name,char *FullName,bool CheckExist)
3416
{
3417
+ *FullName=0;
3418
for (int I=0;EnumConfigPaths(FullName,I);I++)
3419
{
3420
AddEndSlash(FullName);
3421
3422
#endif
3423
3424
3425
-// returns a pointer to rightmost digit of volume number
3426
+// Returns a pointer to rightmost digit of volume number.
3427
char* GetVolNumPart(char *ArcName)
3428
{
3429
+ // Pointing to last name character.
3430
char *ChPtr=ArcName+strlen(ArcName)-1;
3431
+
3432
+ // Skipping the archive extension.
3433
while (!isdigit(*ChPtr) && ChPtr>ArcName)
3434
ChPtr--;
3435
+
3436
+ // Skipping the numeric part of name.
3437
char *NumPtr=ChPtr;
3438
while (isdigit(*NumPtr) && NumPtr>ArcName)
3439
NumPtr--;
3440
+
3441
+ // Searching for first numeric part in names like name.part##of##.rar.
3442
+ // Stop search on the first dot.
3443
while (NumPtr>ArcName && *NumPtr!='.')
3444
{
3445
if (isdigit(*NumPtr))
3446
{
3447
+ // Validate the first numeric part only if it has a dot somwhere
3448
+ // before it.
3449
char *Dot=strchrd(PointToName(ArcName),'.');
3450
if (Dot!=NULL && Dot<NumPtr)
3451
ChPtr=NumPtr;
3452
3453
}
3454
3455
3456
-void NextVolumeName(char *ArcName,bool OldNumbering)
3457
+void NextVolumeName(char *ArcName,wchar *ArcNameW,uint MaxLength,bool OldNumbering)
3458
{
3459
char *ChPtr;
3460
if ((ChPtr=GetExt(ArcName))==NULL)
3461
3462
ChPtr--;
3463
}
3464
}
3465
+ if (ArcNameW!=NULL && *ArcNameW!=0)
3466
+ {
3467
+ // Copy incremented trailing low ASCII volume name part to Unicode name.
3468
+ // It is simpler than implementing Unicode version of entire function.
3469
+ char *NumPtr=GetVolNumPart(ArcName);
3470
+
3471
+ // moving to first digit in volume number
3472
+ while (NumPtr>ArcName && isdigit(*NumPtr) && isdigit(*(NumPtr-1)))
3473
+ NumPtr--;
3474
+
3475
+ // also copy the first character before volume number,
3476
+ // because it can be changed when going from .r99 to .s00
3477
+ if (NumPtr>ArcName)
3478
+ NumPtr--;
3479
+
3480
+ int CharsToCopy=strlen(ArcName)-(NumPtr-ArcName);
3481
+ int DestPos=strlenw(ArcNameW)-CharsToCopy;
3482
+ if (DestPos>=0)
3483
+ {
3484
+ CharToWide(NumPtr,ArcNameW+DestPos,MaxLength-DestPos-1);
3485
+ ArcNameW[MaxLength-1]=0;
3486
+ }
3487
+ }
3488
}
3489
3490
3491
3492
{
3493
char PathOnly[NM];
3494
GetFilePath(Path,PathOnly,ASIZE(PathOnly));
3495
- if (IsWildcard(PathOnly))
3496
+ if (IsWildcard(PathOnly,NULL))
3497
+ return(true);
3498
+#if defined(_WIN_32) || defined(_EMX)
3499
+ return(Path[0]=='\\' && Path[1]=='\\' ||
3500
+ IsDiskLetter(Path) && IsPathDiv(Path[2]));
3501
+#else
3502
+ return(IsPathDiv(Path[0]));
3503
+#endif
3504
+}
3505
+
3506
+
3507
+bool IsFullPath(const wchar *Path)
3508
+{
3509
+ wchar PathOnly[NM];
3510
+ GetFilePath(Path,PathOnly,ASIZE(PathOnly));
3511
+ if (IsWildcard(NULL,PathOnly))
3512
return(true);
3513
#if defined(_WIN_32) || defined(_EMX)
3514
return(Path[0]=='\\' && Path[1]=='\\' ||
3515
3516
}
3517
3518
3519
+bool IsDiskLetter(const wchar *Path)
3520
+{
3521
+ int Letter=etoupper(Path[0]);
3522
+ return(Letter>='A' && Letter<='Z' && IsDriveDiv(Path[1]));
3523
+}
3524
+
3525
+
3526
void GetPathRoot(const char *Path,char *Root)
3527
{
3528
*Root=0;
3529
3530
const char *Slash=strchr(Path+2,'\\');
3531
if (Slash!=NULL)
3532
{
3533
- int Length;
3534
+ size_t Length;
3535
if ((Slash=strchr(Slash+1,'\\'))!=NULL)
3536
Length=Slash-Path+1;
3537
else
3538
diff -uNr unrar/pathfn.hpp unrar/pathfn.hpp
3539
--- unrar/pathfn.hpp 2008-02-26 14:28:59.000000000 +0100
3540
+++ unrar/pathfn.hpp 2008-10-24 06:44:48.000000000 +0200
3541
3542
void RemoveNameFromPath(char *Path);
3543
void RemoveNameFromPath(wchar *Path);
3544
void GetAppDataPath(char *Path);
3545
+void GetRarDataPath(char *Path);
3546
bool EnumConfigPaths(char *Path,int Number);
3547
void GetConfigName(const char *Name,char *FullName,bool CheckExist);
3548
char* GetVolNumPart(char *ArcName);
3549
-void NextVolumeName(char *ArcName,bool OldNumbering);
3550
+void NextVolumeName(char *ArcName,wchar *ArcNameW,uint MaxLength,bool OldNumbering);
3551
bool IsNameUsable(const char *Name);
3552
void MakeNameUsable(char *Name,bool Extended);
3553
char* UnixSlashToDos(char *SrcName,char *DestName=NULL,uint MaxLength=NM);
3554
char* DosSlashToUnix(char *SrcName,char *DestName=NULL,uint MaxLength=NM);
3555
wchar* UnixSlashToDos(wchar *SrcName,wchar *DestName=NULL,uint MaxLength=NM);
3556
bool IsFullPath(const char *Path);
3557
+bool IsFullPath(const wchar *Path);
3558
bool IsDiskLetter(const char *Path);
3559
+bool IsDiskLetter(const wchar *Path);
3560
void GetPathRoot(const char *Path,char *Root);
3561
int ParseVersionFileName(char *Name,wchar *NameW,bool Truncate);
3562
char* VolNameToFirstName(const char *VolName,char *FirstName,bool NewNumbering);
3563
diff -uNr unrar/rar.cpp unrar/rar.cpp
3564
--- unrar/rar.cpp 2008-02-26 14:28:59.000000000 +0100
3565
+++ unrar/rar.cpp 2008-10-24 06:44:47.000000000 +0200
3566
3567
#ifdef ENABLE_BAD_ALLOC
3568
catch (bad_alloc)
3569
{
3570
- ErrHandler.SetErrorCode(RAR_MEMORY_ERROR);
3571
+ ErrHandler.SetErrorCode(MEMORY_ERROR);
3572
}
3573
#endif
3574
catch (...)
3575
{
3576
- ErrHandler.SetErrorCode(RAR_FATAL_ERROR);
3577
+ ErrHandler.SetErrorCode(FATAL_ERROR);
3578
}
3579
#endif
3580
File::RemoveCreated();
3581
diff -uNr unrar/rarvm.cpp unrar/rarvm.cpp
3582
--- unrar/rarvm.cpp 2008-02-26 14:28:59.000000000 +0100
3583
+++ unrar/rarvm.cpp 2008-10-24 06:44:47.000000000 +0200
3584
3585
while (1)
3586
{
3587
#ifndef NORARVM
3588
+ // Get addresses to quickly access operands.
3589
uint *Op1=GetOperand(&Cmd->Op1);
3590
uint *Op2=GetOperand(&Cmd->Op2);
3591
#endif
3592
3593
InitBitInput();
3594
memcpy(InBuf,Code,Min(CodeSize,BitInput::MAX_SIZE));
3595
3596
+ // Calculate the single byte XOR checksum to check validity of VM code.
3597
byte XorSum=0;
3598
for (int I=1;I<CodeSize;I++)
3599
XorSum^=Code[I];
3600
3601
faddbits(8);
3602
3603
Prg->CmdCount=0;
3604
- if (XorSum==Code[0])
3605
+ if (XorSum==Code[0]) // VM code is valid if equal.
3606
{
3607
#ifdef VM_STANDARDFILTERS
3608
VM_StandardFilters FilterType=IsStandardFilter(Code,CodeSize);
3609
if (FilterType!=VMSF_NONE)
3610
{
3611
+ // VM code is found among standard filters.
3612
Prg->Cmd.Add(1);
3613
VM_PreparedCommand *CurCmd=&Prg->Cmd[Prg->CmdCount++];
3614
CurCmd->OpCode=VM_STANDARD;
3615
3616
uint DataFlag=fgetbits();
3617
faddbits(1);
3618
3619
-/* Read static data contained in DB operators. This data cannot be changed,
3620
- it is a part of VM code, not a filter parameter.
3621
-*/
3622
+ // Read static data contained in DB operators. This data cannot be
3623
+ // changed, it is a part of VM code, not a filter parameter.
3624
+
3625
if (DataFlag&0x8000)
3626
{
3627
int DataSize=ReadData(*this)+1;
3628
3629
CurCmd->Op1.Addr=CurCmd->Op2.Addr=NULL;
3630
if (OpNum>0)
3631
{
3632
- DecodeArg(CurCmd->Op1,CurCmd->ByteMode);
3633
+ DecodeArg(CurCmd->Op1,CurCmd->ByteMode); // reading the first operand
3634
if (OpNum==2)
3635
- DecodeArg(CurCmd->Op2,CurCmd->ByteMode);
3636
+ DecodeArg(CurCmd->Op2,CurCmd->ByteMode); // reading the second operand
3637
else
3638
{
3639
if (CurCmd->Op1.Type==VM_OPINT && (VM_CmdFlags[CurCmd->OpCode]&(VMCF_JUMP|VMCF_PROC)))
3640
{
3641
+ // Calculating jump distance.
3642
int Distance=CurCmd->Op1.Data;
3643
if (Distance>=256)
3644
Distance-=256;
3645
3646
Prg->CmdCount++;
3647
}
3648
}
3649
+
3650
+ // Adding RET command at the end of program.
3651
Prg->Cmd.Add(1);
3652
VM_PreparedCommand *CurCmd=&Prg->Cmd[Prg->CmdCount++];
3653
CurCmd->OpCode=VM_RET;
3654
3655
CurCmd->Op2.Addr=&CurCmd->Op2.Data;
3656
CurCmd->Op1.Type=CurCmd->Op2.Type=VM_OPNONE;
3657
3658
+ // If operand 'Addr' field has not been set by DecodeArg calls above,
3659
+ // let's set it to point to operand 'Data' field. It is necessary for
3660
+ // VM_OPINT type operands (usual integers) or maybe if something was
3661
+ // not set properly for other operands. 'Addr' field is required
3662
+ // for quicker addressing of operand data.
3663
for (int I=0;I<Prg->CmdCount;I++)
3664
{
3665
VM_PreparedCommand *Cmd=&Prg->Cmd[I];
3666
3667
uint Data=fgetbits();
3668
if (Data & 0x8000)
3669
{
3670
- Op.Type=VM_OPREG;
3671
- Op.Data=(Data>>12)&7;
3672
- Op.Addr=&R[Op.Data];
3673
- faddbits(4);
3674
+ Op.Type=VM_OPREG; // Operand is register (R[0]..R[7])
3675
+ Op.Data=(Data>>12)&7; // Register number
3676
+ Op.Addr=&R[Op.Data]; // Register address
3677
+ faddbits(4); // 1 flag bit and 3 register number bits
3678
}
3679
else
3680
if ((Data & 0xc000)==0)
3681
{
3682
- Op.Type=VM_OPINT;
3683
+ Op.Type=VM_OPINT; // Operand is integer
3684
if (ByteMode)
3685
{
3686
- Op.Data=(Data>>6) & 0xff;
3687
+ Op.Data=(Data>>6) & 0xff; // Byte integer.
3688
faddbits(10);
3689
}
3690
else
3691
{
3692
faddbits(2);
3693
- Op.Data=ReadData(*this);
3694
+ Op.Data=ReadData(*this); // 32 bit integer.
3695
}
3696
}
3697
else
3698
{
3699
+ // Operand is data addressed by register data, base address or both.
3700
Op.Type=VM_OPREGMEM;
3701
if ((Data & 0x2000)==0)
3702
{
3703
+ // Base address is zero, just use the address from register.
3704
Op.Data=(Data>>10)&7;
3705
Op.Addr=&R[Op.Data];
3706
Op.Base=0;
3707
3708
{
3709
if ((Data & 0x1000)==0)
3710
{
3711
+ // Use both register and base address.
3712
Op.Data=(Data>>9)&7;
3713
Op.Addr=&R[Op.Data];
3714
faddbits(7);
3715
}
3716
else
3717
{
3718
+ // Use base address only. Access memory by fixed address.
3719
Op.Data=0;
3720
faddbits(4);
3721
}
3722
- Op.Base=ReadData(*this);
3723
+ Op.Base=ReadData(*this); // Read base address.
3724
}
3725
}
3726
}
3727
3728
for (int I=0;I<CodeSize;I++)
3729
{
3730
VM_PreparedCommand *Cmd=Code+I;
3731
+
3732
+ // Replace universal opcodes with faster byte or word only processing
3733
+ // opcodes.
3734
switch(Cmd->OpCode)
3735
{
3736
case VM_MOV:
3737
3738
}
3739
if ((VM_CmdFlags[Cmd->OpCode] & VMCF_CHFLAGS)==0)
3740
continue;
3741
+
3742
+ // If we do not have jump commands between the current operation
3743
+ // and next command which will modify processor flags, we can replace
3744
+ // the current command with faster version which does not need to
3745
+ // modify flags.
3746
bool FlagsRequired=false;
3747
for (int J=I+1;J<CodeSize;J++)
3748
{
3749
3750
if (Flags & VMCF_CHFLAGS)
3751
break;
3752
}
3753
+
3754
+ // Below we'll replace universal opcodes with faster byte or word only
3755
+ // processing opcodes, which also do not modify processor flags to
3756
+ // provide better performance.
3757
if (FlagsRequired)
3758
continue;
3759
switch(Cmd->OpCode)
3760
3761
int Length;
3762
uint CRC;
3763
VM_StandardFilters Type;
3764
- } StdList[]={
3765
+ } static StdList[]={
3766
53, 0xad576887, VMSF_E8,
3767
57, 0x3cd7e57e, VMSF_E8E9,
3768
120, 0x3769893f, VMSF_ITANIUM,
3769
3770
if (DataSize>=VM_GLOBALMEMADDR/2)
3771
break;
3772
3773
-// bytes from same channels are grouped to continual data blocks,
3774
-// so we need to place them back to their interleaving positions
3775
-
3776
+ // Bytes from same channels are grouped to continual data blocks,
3777
+ // so we need to place them back to their interleaving positions.
3778
for (int CurChannel=0;CurChannel<Channels;CurChannel++)
3779
{
3780
byte PrevByte=0;
3781
diff -uNr unrar/rdwrfn.cpp unrar/rdwrfn.cpp
3782
--- unrar/rdwrfn.cpp 2008-02-26 14:28:59.000000000 +0100
3783
+++ unrar/rdwrfn.cpp 2008-10-24 06:44:47.000000000 +0200
3784
3785
RetCode=SrcFile->Read(ReadAddr,ReadSize);
3786
FileHeader *hd=SubHead!=NULL ? SubHead:&SrcArc->NewLhd;
3787
if (hd->Flags & LHD_SPLIT_AFTER)
3788
- PackedCRC=CRC(PackedCRC,ReadAddr,ReadSize);
3789
+ PackedCRC=CRC(PackedCRC,ReadAddr,RetCode);
3790
}
3791
CurUnpRead+=RetCode;
3792
TotalRead+=RetCode;
3793
#ifndef NOVOLUME
3794
- // these variable are not used below in NOVOLUME mode, so it is better
3795
- // to exclude these commands to avoid compiler warnings
3796
+ // These variable are not used in NOVOLUME mode, so it is better
3797
+ // to exclude commands below to avoid compiler warnings.
3798
ReadAddr+=RetCode;
3799
Count-=RetCode;
3800
#endif
3801
3802
if (Cmd->DllOpMode!=RAR_SKIP)
3803
{
3804
if (Cmd->Callback!=NULL &&
3805
- Cmd->Callback(UCM_PROCESSDATA,Cmd->UserData,(LONG)Addr,Count)==-1)
3806
- ErrHandler.Exit(RAR_USER_BREAK);
3807
+ Cmd->Callback(UCM_PROCESSDATA,Cmd->UserData,(LPARAM)Addr,Count)==-1)
3808
+ ErrHandler.Exit(USER_BREAK);
3809
if (Cmd->ProcessDataProc!=NULL)
3810
{
3811
#if defined(_WIN_32) && !defined(_MSC_VER) && !defined(__MINGW32__)
3812
3813
_ESP=_EBX;
3814
#endif
3815
if (RetCode==0)
3816
- ErrHandler.Exit(RAR_USER_BREAK);
3817
+ ErrHandler.Exit(USER_BREAK);
3818
}
3819
}
3820
#endif
3821
3822
{
3823
if (ShowProgress && SrcFile!=NULL)
3824
{
3825
- Archive *SrcArc=(Archive *)SrcFile;
3826
- RAROptions *Cmd=SrcArc->GetRAROptions();
3827
if (TotalArcSize!=0)
3828
+ {
3829
+ // important when processing several archives or multivolume archive
3830
ArcSize=TotalArcSize;
3831
- ArcPos+=ProcessedArcSize;
3832
- if (!SrcArc->Volume)
3833
+ ArcPos+=ProcessedArcSize;
3834
+ }
3835
+
3836
+ Archive *SrcArc=(Archive *)SrcFile;
3837
+ RAROptions *Cmd=SrcArc->GetRAROptions();
3838
+
3839
+ int CurPercent=ToPercent(ArcPos,ArcSize);
3840
+ if (!Cmd->DisablePercentage && CurPercent!=LastPercent)
3841
{
3842
- int CurPercent=ToPercent(ArcPos,ArcSize);
3843
- if (!Cmd->DisablePercentage && CurPercent!=LastPercent)
3844
- {
3845
- mprintf("\b\b\b\b%3d%%",CurPercent);
3846
- LastPercent=CurPercent;
3847
- }
3848
+ mprintf("\b\b\b\b%3d%%",CurPercent);
3849
+ LastPercent=CurPercent;
3850
}
3851
}
3852
}
3853
diff -uNr unrar/rdwrfn.hpp unrar/rdwrfn.hpp
3854
--- unrar/rdwrfn.hpp 2008-02-26 14:28:59.000000000 +0100
3855
+++ unrar/rdwrfn.hpp 2008-10-24 06:44:48.000000000 +0200
3856
3857
Int64 TotalPackRead;
3858
Int64 UnpArcSize;
3859
Int64 CurPackRead,CurPackWrite,CurUnpRead,CurUnpWrite;
3860
- Int64 ProcessedArcSize,TotalArcSize;
3861
+
3862
+ // Size of already processed archives.
3863
+ // Used to calculate the total operation progress.
3864
+ Int64 ProcessedArcSize;
3865
+
3866
+ Int64 TotalArcSize;
3867
3868
uint PackFileCRC,UnpFileCRC,PackedCRC;
3869
3870
diff -uNr unrar/readme.txt unrar/readme.txt
3871
--- unrar/readme.txt 1970-01-01 01:00:00.000000000 +0100
3872
+++ unrar/readme.txt 2007-09-10 13:40:10.000000000 +0200
3873
3874
+
3875
+ Portable UnRAR version
3876
+
3877
+
3878
+ 1. General
3879
+
3880
+ This package includes freeware Unrar C++ source and a few makefiles
3881
+ (makefile.bcc, makefile.msc+msc.dep, makefile.unix). Unrar source
3882
+ is subset of RAR and generated from RAR source automatically,
3883
+ by a small program removing blocks like '#ifndef UNRAR ... #endif'.
3884
+ Such method is not perfect and you may find some RAR related
3885
+ stuff unnecessary in Unrar, especially in header files.
3886
+
3887
+ If you wish to port Unrar to a new platform, you may need to edit
3888
+ '#define LITTLE_ENDIAN' in os.hpp and data type definitions
3889
+ in rartypes.hpp.
3890
+
3891
+ if computer architecture does not allow not aligned data access,
3892
+ you need to undefine ALLOW_NOT_ALIGNED_INT and define
3893
+ STRICT_ALIGNMENT_REQUIRED in os.h. Note that it will increase memory
3894
+ requirements.
3895
+
3896
+ If you use Borland C++ makefile (makefile.bcc), you need to define
3897
+ BASEPATHCC environment (or makefile) variable containing
3898
+ the path to Borland C++ installation.
3899
+
3900
+ Makefile.unix contains numerous compiler option sets.
3901
+ GCC Linux is selected by default. If you need to compile Unrar
3902
+ for other platforms, uncomment corresponding lines.
3903
+
3904
+
3905
+ 2. Unrar binaries
3906
+
3907
+ If you compiled Unrar for OS, which is not present in "Downloads"
3908
+ and "RAR extras" on www.rarlab.com, we will appreciate if you send
3909
+ us the compiled executable to place it to our site.
3910
+
3911
+
3912
+ 3. Acknowledgements
3913
+
3914
+ This source includes parts of code written by the following authors:
3915
+
3916
+ Dmitry Shkarin PPMII v.H text compression
3917
+ Dmitry Subbotin Carryless rangecoder
3918
+ Szymon Stefanek AES encryption
3919
+ Brian Gladman AES encryption
3920
+ Steve Reid SHA-1 hash function
3921
+ Marcus Herbert makefile.unix file
3922
+ Tomasz Klim fixes for libunrar.so
3923
+ Robert Riebisch makefile.dj and patches for DJGPP
3924
+
3925
+
3926
+ 4. Legal stuff
3927
+
3928
+ Unrar source may be used in any software to handle RAR archives
3929
+ without limitations free of charge, but cannot be used to re-create
3930
+ the RAR compression algorithm, which is proprietary. Distribution
3931
+ of modified Unrar source in separate form or as a part of other
3932
+ software is permitted, provided that it is clearly stated in
3933
+ the documentation and source comments that the code may not be used
3934
+ to develop a RAR (WinRAR) compatible archiver.
3935
+
3936
+ More detailed license text is available in license.txt.
3937
diff -uNr unrar/README.txt unrar/README.txt
3938
--- unrar/README.txt 2008-02-26 14:28:59.000000000 +0100
3939
+++ unrar/README.txt 1970-01-01 01:00:00.000000000 +0100
3940
3941
-
3942
- Portable UnRAR version
3943
-
3944
-
3945
- 1. General
3946
-
3947
- This package includes freeware Unrar C++ source and a few makefiles
3948
- (makefile.bcc, makefile.msc+msc.dep, makefile.unix). Unrar source
3949
- is subset of RAR and generated from RAR source automatically,
3950
- by a small program removing blocks like '#ifndef UNRAR ... #endif'.
3951
- Such method is not perfect and you may find some RAR related
3952
- stuff unnecessary in Unrar, especially in header files.
3953
-
3954
- If you wish to port Unrar to a new platform, you may need to edit
3955
- '#define LITTLE_ENDIAN' in os.hpp and data type definitions
3956
- in rartypes.hpp.
3957
-
3958
- It is important to provide 1 byte alignment for structures
3959
- in model.hpp. Now it contains '#pragma pack(1)' directive,
3960
- but your compiler may require something else. Though Unrar
3961
- should work with other model.hpp alignments, its memory
3962
- requirements may increase significantly. Alignment in other
3963
- modules is not important.
3964
-
3965
- If you use Borland C++ makefile (makefile.bcc), you need to define
3966
- BASEPATHCC environment (or makefile) variable containing
3967
- the path to Borland C++ installation.
3968
-
3969
- Makefile.unix contains both Linux and IRIX compiler option sets.
3970
- Linux is selected by default. If you need to compile Unrar for IRIX,
3971
- just uncomment corresponding lines.
3972
-
3973
-
3974
- 2. Unrar binaries
3975
-
3976
- If you compiled Unrar for OS, which is not present in "Downloads"
3977
- and "RAR extras" on www.rarlab.com, we will appreciate if you send
3978
- us the compiled executable to place it to our site.
3979
-
3980
-
3981
- 3. Acknowledgements
3982
-
3983
- This source includes parts of code written by the following authors:
3984
-
3985
- Dmitry Shkarin PPMII text compression
3986
- Dmitry Subbotin Carryless rangecoder
3987
- Szymon Stefanek AES encryption
3988
- Brian Gladman AES encryption
3989
- Steve Reid SHA-1 hash function
3990
- Marcus Herbert makefile.unix file
3991
- Tomasz Klim fixes for libunrar.so
3992
-
3993
-
3994
- 4. Legal stuff
3995
-
3996
- Unrar source may be used in any software to handle RAR archives
3997
- without limitations free of charge, but cannot be used to re-create
3998
- the RAR compression algorithm, which is proprietary. Distribution
3999
- of modified Unrar source in separate form or as a part of other
4000
- software is permitted, provided that it is clearly stated in
4001
- the documentation and source comments that the code may not be used
4002
- to develop a RAR (WinRAR) compatible archiver.
4003
-
4004
- More detailed license text is available in license.txt.
4005
diff -uNr unrar/recvol.cpp unrar/recvol.cpp
4006
--- unrar/recvol.cpp 2008-02-26 14:28:59.000000000 +0100
4007
+++ unrar/recvol.cpp 2008-10-24 06:44:48.000000000 +0200
4008
4009
#ifndef SILENT
4010
Int64 RecFileSize=0;
4011
#endif
4012
+
4013
+#ifndef SILENT
4014
+ mprintf(St(MCalcCRCAllVol));
4015
+#endif
4016
+
4017
FindFile Find;
4018
Find.SetMask(RecVolMask);
4019
struct FindData RecData;
4020
4021
#endif
4022
}
4023
SrcFile[CurArcNum]=(File*)NewFile;
4024
- NextVolumeName(ArcName,!NewNumbering);
4025
+ NextVolumeName(ArcName,ArcNameW,ASIZE(ArcName),!NewNumbering);
4026
}
4027
4028
#ifndef SILENT
4029
diff -uNr unrar/scantree.cpp unrar/scantree.cpp
4030
--- unrar/scantree.cpp 2008-02-26 14:28:59.000000000 +0100
4031
+++ unrar/scantree.cpp 2008-10-24 06:44:47.000000000 +0200
4032
4033
ScanTree::GetLinks=GetLinks;
4034
ScanTree::GetDirs=GetDirs;
4035
4036
+ ScanEntireDisk=false;
4037
+
4038
SetAllMaskDepth=0;
4039
*CurMask=0;
4040
*CurMaskW=0;
4041
4042
4043
bool ScanTree::PrepareMasks()
4044
{
4045
+ ScanEntireDisk=false;
4046
if (!FileMasks->GetString(CurMask,CurMaskW,sizeof(CurMask)))
4047
return(false);
4048
CurMask[ASIZE(CurMask)-1]=0;
4049
4050
#ifdef _WIN_32
4051
UnixSlashToDos(CurMask);
4052
#endif
4053
+
4054
+ // We wish to scan entire disk if mask like c:\ is specified
4055
+ // regardless of recursion mode. Use c:\*.* mask when need to scan only
4056
+ // the root directory.
4057
+ ScanEntireDisk=IsDiskLetter(CurMask) && IsPathDiv(CurMask[2]) && CurMask[3]==0;
4058
+
4059
char *Name=PointToName(CurMask);
4060
if (*Name==0)
4061
strcat(CurMask,MASKALL);
4062
4063
bool FindCode=!Wildcards && FindFile::FastFind(CurMask,CurMaskW,FindData,GetLinks);
4064
bool IsDir=FindCode && FindData->IsDir;
4065
bool SearchAll=!IsDir && (Depth>0 || Recurse==RECURSE_ALWAYS ||
4066
- Wildcards && Recurse==RECURSE_WILDCARDS);
4067
+ Wildcards && Recurse==RECURSE_WILDCARDS || ScanEntireDisk);
4068
if (Depth==0)
4069
SearchAllInRoot=SearchAll;
4070
if (SearchAll || Wildcards)
4071
4072
}
4073
if (GetDirs==SCAN_GETDIRSTWICE &&
4074
FindFile::FastFind(DirName,DirNameW,FindData,GetLinks) && FindData->IsDir)
4075
+ {
4076
+ FindData->Flags|=FDDF_SECONDDIR;
4077
return(Error ? SCAN_ERROR:SCAN_SUCCESS);
4078
+ }
4079
return(Error ? SCAN_ERROR:SCAN_NEXT);
4080
}
4081
4082
diff -uNr unrar/scantree.hpp unrar/scantree.hpp
4083
--- unrar/scantree.hpp 2008-02-26 14:28:59.000000000 +0100
4084
+++ unrar/scantree.hpp 2008-10-24 06:44:48.000000000 +0200
4085
4086
int GetDirs;
4087
int Errors;
4088
4089
+ // set when processing paths like c:\ (root directory without wildcards)
4090
+ bool ScanEntireDisk;
4091
+
4092
char CurMask[NM];
4093
wchar CurMaskW[NM];
4094
char OrigCurMask[NM];
4095
diff -uNr unrar/strfn.cpp unrar/strfn.cpp
4096
--- unrar/strfn.cpp 2008-02-26 14:28:59.000000000 +0100
4097
+++ unrar/strfn.cpp 2008-10-24 06:44:48.000000000 +0200
4098
4099
4100
char* RemoveEOL(char *Str)
4101
{
4102
- for (int I=strlen(Str)-1;I>=0 && (Str[I]=='\r' || Str[I]=='\n' || Str[I]==' ' || Str[I]=='\t');I--)
4103
+ for (int I=(int)strlen(Str)-1;I>=0 && (Str[I]=='\r' || Str[I]=='\n' || Str[I]==' ' || Str[I]=='\t');I--)
4104
Str[I]=0;
4105
return(Str);
4106
}
4107
4108
4109
char* RemoveLF(char *Str)
4110
{
4111
- for (int I=strlen(Str)-1;I>=0 && (Str[I]=='\r' || Str[I]=='\n');I--)
4112
+ for (int I=(int)strlen(Str)-1;I>=0 && (Str[I]=='\r' || Str[I]=='\n');I--)
4113
Str[I]=0;
4114
return(Str);
4115
}
4116
4117
unsigned int loctolower(byte ch)
4118
{
4119
#ifdef _WIN_32
4120
- return((int)CharLower((LPTSTR)ch));
4121
+ // convert to LPARAM first to avoid a warning in 64 bit mode
4122
+ return((int)(LPARAM)CharLower((LPTSTR)ch));
4123
#else
4124
return(tolower(ch));
4125
#endif
4126
4127
unsigned int loctoupper(byte ch)
4128
{
4129
#ifdef _WIN_32
4130
- return((int)CharUpper((LPTSTR)ch));
4131
+ // convert to LPARAM first to avoid a warning in 64 bit mode
4132
+ return((int)(LPARAM)CharUpper((LPTSTR)ch));
4133
#else
4134
return(toupper(ch));
4135
#endif
4136
diff -uNr unrar/strlist.cpp unrar/strlist.cpp
4137
--- unrar/strlist.cpp 2008-02-26 14:28:59.000000000 +0100
4138
+++ unrar/strlist.cpp 2008-10-24 06:44:48.000000000 +0200
4139
4140
unsigned int StringList::AddString(const char *Str,const wchar *StrW)
4141
{
4142
int PrevSize=StringData.Size();
4143
- StringData.Add(strlen(Str)+1);
4144
+ StringData.Add((int)(strlen(Str)+1));
4145
strcpy(&StringData[PrevSize],Str);
4146
if (StrW!=NULL && *StrW!=0)
4147
{
4148
diff -uNr unrar/timefn.cpp unrar/timefn.cpp
4149
--- unrar/timefn.cpp 2008-02-26 14:28:59.000000000 +0100
4150
+++ unrar/timefn.cpp 2008-10-24 06:44:48.000000000 +0200
4151
4152
#endif
4153
4154
4155
-#ifndef SFX_MODULE
4156
void RarTime::SetCurrentTime()
4157
{
4158
#ifdef _WIN_32
4159
4160
*this=st;
4161
#endif
4162
}
4163
-#endif
4164
4165
4166
#if !defined(SFX_MODULE) && !defined(_WIN_CE)
4167
diff -uNr unrar/ulinks.cpp unrar/ulinks.cpp
4168
--- unrar/ulinks.cpp 2008-02-26 14:28:59.000000000 +0100
4169
+++ unrar/ulinks.cpp 2008-10-24 06:44:48.000000000 +0200
4170
4171
else
4172
{
4173
Log(Arc.FileName,St(MErrCreateLnk),DestName);
4174
- ErrHandler.SetErrorCode(RAR_WARNING);
4175
+ ErrHandler.SetErrorCode(WARNING);
4176
}
4177
}
4178
int NameSize=Min(DataSize,strlen(FileName));
4179
diff -uNr unrar/unicode.cpp unrar/unicode.cpp
4180
--- unrar/unicode.cpp 2008-02-26 14:28:59.000000000 +0100
4181
+++ unrar/unicode.cpp 2008-10-24 06:44:48.000000000 +0200
4182
4183
#else
4184
#ifdef MBFUNCTIONS
4185
4186
- if (wcstombs(Dest,Src,DestSize)==(size_t)-1)
4187
+ size_t ResultingSize=wcstombs(Dest,Src,DestSize);
4188
+ if (ResultingSize==(size_t)-1)
4189
+ RetCode=false;
4190
+ if (ResultingSize==0 && *Src!=0)
4191
RetCode=false;
4192
4193
if ((!RetCode || *Dest==0 && *Src!=0) && DestSize>NM && strlenw(Src)<NM)
4194
4195
#else
4196
#ifdef MBFUNCTIONS
4197
4198
- if (mbstowcs(Dest,Src,DestSize)==(size_t)-1)
4199
+ size_t ResultingSize=mbstowcs(Dest,Src,DestSize);
4200
+ if (ResultingSize==(size_t)-1)
4201
+ RetCode=false;
4202
+ if (ResultingSize==0 && *Src!=0)
4203
RetCode=false;
4204
4205
if ((!RetCode || *Dest==0 && *Src!=0) && DestSize>NM && strlen(Src)<NM)
4206
4207
}
4208
4209
4210
-wchar* strncpyw(wchar *dest,const wchar *src,int n)
4211
+wchar* strncpyw(wchar *dest,const wchar *src,size_t n)
4212
{
4213
do {
4214
*(dest++)=*src;
4215
- } while (*(src++)!=0 && --n > 0);
4216
+ } while (*(src++)!=0 && (int)(--n) > 0);
4217
return(dest);
4218
}
4219
4220
4221
4222
4223
#ifndef SFX_MODULE
4224
-wchar* strncatw(wchar *dest,const wchar *src,int n)
4225
+wchar* strncatw(wchar *dest,const wchar *src,size_t n)
4226
{
4227
dest+=strlenw(dest);
4228
while (true)
4229
- if (--n<0)
4230
+ if ((int)(--n)<0)
4231
{
4232
*dest=0;
4233
break;
4234
4235
}
4236
4237
4238
-int strncmpw(const wchar *s1,const wchar *s2,int n)
4239
+int strncmpw(const wchar *s1,const wchar *s2,size_t n)
4240
{
4241
- while (n-->0)
4242
+ while ((int)(n--)>0)
4243
{
4244
if (*s1<*s2)
4245
return(-1);
4246
4247
4248
4249
#if !defined(SFX_MODULE) && !defined(_WIN_CE)
4250
-inline int strnicmpw_w2c(const wchar *s1,const wchar *s2,int n)
4251
+inline int strnicmpw_w2c(const wchar *s1,const wchar *s2,size_t n)
4252
{
4253
wchar Wide1[NM*2],Wide2[NM*2];
4254
strncpyw(Wide1,s1,sizeof(Wide1)/sizeof(Wide1[0])-1);
4255
4256
4257
4258
#ifndef SFX_MODULE
4259
-int strnicmpw(const wchar *s1,const wchar *s2,int n)
4260
+int strnicmpw(const wchar *s1,const wchar *s2,size_t n)
4261
{
4262
return(strnicmpw_w2c(s1,s2,n));
4263
}
4264
4265
4266
4267
#ifndef SFX_MODULE
4268
+wchar* strdupw(const wchar *Str)
4269
+{
4270
+ if (Str==NULL)
4271
+ return(NULL);
4272
+ wchar *n=(wchar *)malloc((strlenw(Str)+1)*sizeof(wchar));
4273
+ if (n==NULL)
4274
+ return(NULL);
4275
+ strcpyw(n,Str);
4276
+ return(n);
4277
+}
4278
+#endif
4279
+
4280
+
4281
+#ifndef SFX_MODULE
4282
int toupperw(int ch)
4283
{
4284
return((ch<128) ? loctoupper(ch):ch);
4285
diff -uNr unrar/unicode.hpp unrar/unicode.hpp
4286
--- unrar/unicode.hpp 2008-02-26 14:28:59.000000000 +0100
4287
+++ unrar/unicode.hpp 2008-10-24 06:44:48.000000000 +0200
4288
4289
4290
int strlenw(const wchar *str);
4291
wchar* strcpyw(wchar *dest,const wchar *src);
4292
-wchar* strncpyw(wchar *dest,const wchar *src,int n);
4293
+wchar* strncpyw(wchar *dest,const wchar *src,size_t n);
4294
wchar* strcatw(wchar *dest,const wchar *src);
4295
-wchar* strncatw(wchar *dest,const wchar *src,int n);
4296
+wchar* strncatw(wchar *dest,const wchar *src,size_t n);
4297
int strcmpw(const wchar *s1,const wchar *s2);
4298
-int strncmpw(const wchar *s1,const wchar *s2,int n);
4299
+int strncmpw(const wchar *s1,const wchar *s2,size_t n);
4300
int stricmpw(const wchar *s1,const wchar *s2);
4301
-int strnicmpw(const wchar *s1,const wchar *s2,int n);
4302
+int strnicmpw(const wchar *s1,const wchar *s2,size_t n);
4303
wchar *strchrw(const wchar *s,int c);
4304
wchar* strrchrw(const wchar *s,int c);
4305
wchar* strpbrkw(const wchar *s1,const wchar *s2);
4306
wchar* strlowerw(wchar *Str);
4307
wchar* strupperw(wchar *Str);
4308
+wchar* strdupw(const wchar *Str);
4309
int toupperw(int ch);
4310
int atoiw(const wchar *s);
4311
4312
diff -uNr unrar/unpack.cpp unrar/unpack.cpp
4313
--- unrar/unpack.cpp 2008-02-26 14:28:59.000000000 +0100
4314
+++ unrar/unpack.cpp 2008-10-24 06:44:48.000000000 +0200
4315
4316
}
4317
if (Failed)
4318
break;
4319
+
4320
+#ifdef _MSC_VER
4321
+ // avoid a warning about uninitialized 'Length' variable
4322
+ #pragma warning( disable : 4701 )
4323
+#endif
4324
CopyString(Length+32,Distance+2);
4325
continue;
4326
}
4327
diff -uNr unrar/uowners.cpp unrar/uowners.cpp
4328
--- unrar/uowners.cpp 2008-02-26 14:28:59.000000000 +0100
4329
+++ unrar/uowners.cpp 2008-10-24 06:44:48.000000000 +0200
4330
4331
if (Arc.HeaderCRC!=Arc.UOHead.HeadCRC)
4332
{
4333
Log(Arc.FileName,St(MOwnersBroken),FileName);
4334
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
4335
+ ErrHandler.SetErrorCode(CRC_ERROR);
4336
return;
4337
}
4338
4339
4340
if ((pw=getpwnam(Arc.UOHead.OwnerName))==NULL)
4341
{
4342
Log(Arc.FileName,St(MErrGetOwnerID),Arc.UOHead.OwnerName);
4343
- ErrHandler.SetErrorCode(RAR_WARNING);
4344
+ ErrHandler.SetErrorCode(WARNING);
4345
return;
4346
}
4347
uid_t OwnerID=pw->pw_uid;
4348
4349
if ((gr=getgrnam(Arc.UOHead.GroupName))==NULL)
4350
{
4351
Log(Arc.FileName,St(MErrGetGroupID),Arc.UOHead.GroupName);
4352
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
4353
+ ErrHandler.SetErrorCode(CRC_ERROR);
4354
return;
4355
}
4356
uint Attr=GetFileAttr(FileName,NULL);
4357
4358
#endif
4359
{
4360
Log(Arc.FileName,St(MSetOwnersError),FileName);
4361
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
4362
+ ErrHandler.SetErrorCode(CREATE_ERROR);
4363
}
4364
SetFileAttr(FileName,NULL,Attr);
4365
}
4366
4367
if ((pw=getpwnam(OwnerName))==NULL)
4368
{
4369
Log(Arc.FileName,St(MErrGetOwnerID),OwnerName);
4370
- ErrHandler.SetErrorCode(RAR_WARNING);
4371
+ ErrHandler.SetErrorCode(WARNING);
4372
return;
4373
}
4374
uid_t OwnerID=pw->pw_uid;
4375
4376
if ((gr=getgrnam(GroupName))==NULL)
4377
{
4378
Log(Arc.FileName,St(MErrGetGroupID),GroupName);
4379
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
4380
+ ErrHandler.SetErrorCode(CRC_ERROR);
4381
return;
4382
}
4383
uint Attr=GetFileAttr(FileName,NULL);
4384
4385
#endif
4386
{
4387
Log(Arc.FileName,St(MSetOwnersError),FileName);
4388
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
4389
+ ErrHandler.SetErrorCode(CREATE_ERROR);
4390
}
4391
SetFileAttr(FileName,NULL,Attr);
4392
}
4393
diff -uNr unrar/version.hpp unrar/version.hpp
4394
--- unrar/version.hpp 2008-02-26 14:28:59.000000000 +0100
4395
+++ unrar/version.hpp 2008-10-24 06:44:48.000000000 +0200
4396
4397
#define RARVER_MAJOR 3
4398
-#define RARVER_MINOR 71
4399
-#define RARVER_BETA 1
4400
-#define RARVER_DAY 10
4401
+#define RARVER_MINOR 80
4402
+#define RARVER_BETA 0
4403
+#define RARVER_DAY 16
4404
#define RARVER_MONTH 9
4405
-#define RARVER_YEAR 2007
4406
+#define RARVER_YEAR 2008
4407
diff -uNr unrar/volume.cpp unrar/volume.cpp
4408
--- unrar/volume.cpp 2008-02-26 14:28:59.000000000 +0100
4409
+++ unrar/volume.cpp 2008-10-24 06:44:48.000000000 +0200
4410
4411
}
4412
4413
Int64 PosBeforeClose=Arc.Tell();
4414
+
4415
+ if (DataIO!=NULL)
4416
+ DataIO->ProcessedArcSize+=Arc.FileLength();
4417
+
4418
Arc.Close();
4419
4420
char NextName[NM];
4421
wchar NextNameW[NM];
4422
- *NextNameW=0;
4423
strcpy(NextName,Arc.FileName);
4424
- NextVolumeName(NextName,(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
4425
-
4426
- if (*Arc.FileNameW!=0)
4427
- {
4428
- // Copy incremented trailing low ASCII volume name part to Unicode name.
4429
- // It is simpler than also implementing Unicode version of NextVolumeName.
4430
-
4431
- strcpyw(NextNameW,Arc.FileNameW);
4432
- char *NumPtr=GetVolNumPart(NextName);
4433
-
4434
- // moving to first digit in volume number
4435
- while (NumPtr>NextName && isdigit(*NumPtr) && isdigit(*(NumPtr-1)))
4436
- NumPtr--;
4437
-
4438
- // also copy the first character before volume number,
4439
- // because it can be changed when going from .r99 to .s00
4440
- if (NumPtr>NextName)
4441
- NumPtr--;
4442
-
4443
- int CharsToCopy=strlen(NextName)-(NumPtr-NextName);
4444
- int DestPos=strlenw(NextNameW)-CharsToCopy;
4445
- if (DestPos>0)
4446
- {
4447
- CharToWide(NumPtr,NextNameW+DestPos,ASIZE(NextNameW)-DestPos-1);
4448
- NextNameW[ASIZE(NextNameW)-1]=0;
4449
- }
4450
- }
4451
+ strcpyw(NextNameW,Arc.FileNameW);
4452
+ NextVolumeName(NextName,NextNameW,ASIZE(NextName),(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
4453
4454
#if !defined(SFX_MODULE) && !defined(RARDLL)
4455
bool RecoveryDone=false;
4456
4457
4458
while (!Arc.Open(NextName,NextNameW))
4459
{
4460
+ // We need to open a new volume which size was not calculated
4461
+ // in total size before, so we cannot calculate the total progress
4462
+ // anymore. Let's reset the total size to zero and stop
4463
+ // the total progress.
4464
+ if (DataIO!=NULL)
4465
+ DataIO->TotalArcSize=0;
4466
+
4467
if (!OldSchemeTested)
4468
{
4469
+ // Checking for new style volumes renamed by user to old style
4470
+ // name format. Some users did it for unknown reason.
4471
char AltNextName[NM];
4472
+ wchar AltNextNameW[NM];
4473
strcpy(AltNextName,Arc.FileName);
4474
- NextVolumeName(AltNextName,true);
4475
+ strcpyw(AltNextNameW,Arc.FileNameW);
4476
+ NextVolumeName(AltNextName,AltNextNameW,ASIZE(AltNextName),true);
4477
OldSchemeTested=true;
4478
- if (Arc.Open(AltNextName))
4479
+ if (Arc.Open(AltNextName,AltNextNameW))
4480
{
4481
strcpy(NextName,AltNextName);
4482
- *NextNameW=0;
4483
+ strcpyw(NextNameW,AltNextNameW);
4484
break;
4485
}
4486
}
4487
#ifdef RARDLL
4488
if (Cmd->Callback==NULL && Cmd->ChangeVolProc==NULL ||
4489
- Cmd->Callback!=NULL && Cmd->Callback(UCM_CHANGEVOLUME,Cmd->UserData,(LONG)NextName,RAR_VOL_ASK)==-1)
4490
+ Cmd->Callback!=NULL && Cmd->Callback(UCM_CHANGEVOLUME,Cmd->UserData,(LPARAM)NextName,RAR_VOL_ASK)==-1)
4491
{
4492
Cmd->DllError=ERAR_EOPEN;
4493
FailedOpen=true;
4494
4495
FailedOpen=true;
4496
break;
4497
}
4498
+
4499
#endif // RARDLL
4500
*NextNameW=0;
4501
}
4502
4503
Arc.CheckArc(true);
4504
#ifdef RARDLL
4505
if (Cmd->Callback!=NULL &&
4506
- Cmd->Callback(UCM_CHANGEVOLUME,Cmd->UserData,(LONG)NextName,RAR_VOL_NOTIFY)==-1)
4507
+ Cmd->Callback(UCM_CHANGEVOLUME,Cmd->UserData,(LPARAM)NextName,RAR_VOL_NOTIFY)==-1)
4508
return(false);
4509
if (Cmd->ChangeVolProc!=NULL)
4510
{
4511
4512
}
4513
#ifdef SFX_MODULE
4514
DataIO->UnpArcSize=Arc.FileLength();
4515
- DataIO->CurUnpRead=0;
4516
#endif
4517
+
4518
+ // Reset the size of packed data read from current volume. It is used
4519
+ // to display the total progress and preceding volumes are already
4520
+ // compensated with ProcessedArcSize, so we need to reset this variable.
4521
+ DataIO->CurUnpRead=0;
4522
+
4523
DataIO->PackedCRC=0xffffffff;
4524
// DataIO->SetFiles(&Arc,NULL);
4525
}
4526
diff -uNr unrar/win32acl.cpp unrar/win32acl.cpp
4527
--- unrar/win32acl.cpp 2008-02-26 14:28:59.000000000 +0100
4528
+++ unrar/win32acl.cpp 2008-10-24 06:44:48.000000000 +0200
4529
4530
if (Arc.HeaderCRC!=Arc.EAHead.HeadCRC)
4531
{
4532
Log(Arc.FileName,St(MACLBroken),FileName);
4533
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
4534
+ ErrHandler.SetErrorCode(CRC_ERROR);
4535
return;
4536
}
4537
4538
if (Arc.EAHead.Method<0x31 || Arc.EAHead.Method>0x35 || Arc.EAHead.UnpVer>PACK_VER)
4539
{
4540
Log(Arc.FileName,St(MACLUnknown),FileName);
4541
- ErrHandler.SetErrorCode(RAR_WARNING);
4542
+ ErrHandler.SetErrorCode(WARNING);
4543
return;
4544
}
4545
4546
4547
if (Arc.EAHead.EACRC!=~DataIO.UnpFileCRC)
4548
{
4549
Log(Arc.FileName,St(MACLBroken),FileName);
4550
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
4551
+ ErrHandler.SetErrorCode(CRC_ERROR);
4552
return;
4553
}
4554
4555
4556
{
4557
Log(Arc.FileName,St(MACLSetError),FileName);
4558
ErrHandler.SysErrMsg();
4559
- ErrHandler.SetErrorCode(RAR_WARNING);
4560
+ ErrHandler.SetErrorCode(WARNING);
4561
}
4562
}
4563
#endif
4564
4565
{
4566
Log(Arc.FileName,St(MACLSetError),FileName);
4567
ErrHandler.SysErrMsg();
4568
- ErrHandler.SetErrorCode(RAR_WARNING);
4569
+ ErrHandler.SetErrorCode(WARNING);
4570
}
4571
}
4572
4573
diff -uNr unrar/win32stm.cpp unrar/win32stm.cpp
4574
--- unrar/win32stm.cpp 2008-02-26 14:28:59.000000000 +0100
4575
+++ unrar/win32stm.cpp 2008-10-24 06:44:48.000000000 +0200
4576
4577
#ifndef SILENT
4578
Log(Arc.FileName,St(MStreamBroken),FileName);
4579
#endif
4580
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
4581
+ ErrHandler.SetErrorCode(CRC_ERROR);
4582
return;
4583
}
4584
4585
4586
#ifndef SILENT
4587
Log(Arc.FileName,St(MStreamUnknown),FileName);
4588
#endif
4589
- ErrHandler.SetErrorCode(RAR_WARNING);
4590
+ ErrHandler.SetErrorCode(WARNING);
4591
return;
4592
}
4593
4594
4595
#ifndef SILENT
4596
Log(Arc.FileName,St(MStreamBroken),FileName);
4597
#endif
4598
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
4599
+ ErrHandler.SetErrorCode(CRC_ERROR);
4600
return;
4601
}
4602
4603
4604
#ifndef SILENT
4605
Log(Arc.FileName,St(MStreamBroken),StreamName);
4606
#endif
4607
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
4608
+ ErrHandler.SetErrorCode(CRC_ERROR);
4609
}
4610
else
4611
CurFile.Close();
4612
4613
#if !defined(SILENT) && !defined(SFX_MODULE)
4614
Log(Arc.FileName,St(MStreamBroken),FileName);
4615
#endif
4616
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
4617
+ ErrHandler.SetErrorCode(CRC_ERROR);
4618
return;
4619
}
4620
4621
4622
#if !defined(SILENT) && !defined(SFX_MODULE)
4623
Log(Arc.FileName,St(MStreamBroken),FileName);
4624
#endif
4625
- ErrHandler.SetErrorCode(RAR_CRC_ERROR);
4626
+ ErrHandler.SetErrorCode(CRC_ERROR);
4627
return;
4628
}
4629
4630