Kaydet (Commit) c3dcdeb1 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

loplugin:nullptr (automatic rewrite)

Change-Id: Idec97093ca48c14b825c7b87ec050cc99aadc526
üst 2df257e9
......@@ -85,7 +85,7 @@ HWPDOFuncType HWPDOFuncTbl[] =
HWPDOFreeFormFunc,
};
static HMemIODev *hmem = 0;
static HMemIODev *hmem = NULL;
static int count = 0;
......@@ -299,7 +299,7 @@ static bool LoadCommonHeader(HWPDrawingObject * hdo, unsigned short * link_info)
hdo->property.contrast = 0;
hdo->property.greyscale = 0;
}
hdo->property.pPara = 0L;
hdo->property.pPara = NULL;
if( ( size > common_size ) && (hdo->property.flag & HWPDO_FLAG_AS_TEXTBOX) )
{
......@@ -392,7 +392,7 @@ static HWPDrawingObject *LoadDrawingObject(void)
return head;
}
else
return 0;
return NULL;
}
......@@ -423,7 +423,7 @@ static bool LoadDrawingObjectBlock(Picture * pic)
return false;
pic->picinfo.picdraw.hdo = LoadDrawingObject();
if (pic->picinfo.picdraw.hdo == 0)
if (pic->picinfo.picdraw.hdo == NULL)
return false;
return true;
}
......@@ -557,7 +557,7 @@ int cmd, void *argp, int argv)
{
case OBJFUNC_LOAD:
{
hdo->u.freeform.pt = 0;
hdo->u.freeform.pt = NULL;
if (ReadSizeField(4) < 4)
return OBJRET_FILE_ERROR;
if (!hmem->read4b(hdo->u.freeform.npt))
......@@ -625,7 +625,7 @@ static void FreeParaList(HWPPara * para)
static HWPPara *LoadParaList()
{
if (!hmem)
return 0;
return NULL;
HWPFile *hwpf = GetCurrentDoc();
HIODev *hio = hwpf->SetIODevice(hmem);
......@@ -635,7 +635,7 @@ static HWPPara *LoadParaList()
hwpf->ReadParaList(plist);
hwpf->SetIODevice(hio);
return plist.size()? plist.front() : 0;
return plist.size()? plist.front() : NULL;
}
......
......@@ -570,7 +570,7 @@ void Formula::makeBlock(Node *res)
int Formula::parse()
{
Node *res = 0L;
Node *res = nullptr;
if( !eq ) return 0;
if( isHwpEQ ){
MzString a;
......@@ -611,7 +611,7 @@ int Formula::parse()
if( buf[0] != '\0' )
res = mainParse( a.c_str() );
else
res = 0L;
res = nullptr;
free(buf);
}
else{
......@@ -659,7 +659,7 @@ void Formula::trim()
if( buf[0] != '\0' )
strcpy(eq, buf);
else
eq = 0L;
eq = nullptr;
free(buf);
}
......
......@@ -40,7 +40,7 @@ std::list<Node*> nodelist;
void yyerror(const char *);
Node *top=0L;
Node *top=nullptr;
int Node::count = 0;
......@@ -525,7 +525,7 @@ yyparse(YYPARSE_PARAM_ARG)
#endif
YYSTYPE yyval; /* the variable used to return */
yyval.dval = 0;
yyval.dval = nullptr;
/* semantic values from the action */
/* routines */
......@@ -1226,12 +1226,12 @@ yyerrhandle:
Node *mainParse(const char *_code)
{
initFlex( _code );
top = 0L;
top = nullptr;
yyparse();
if( top )
return top;
else
return 0L;
return nullptr;
}
void yyerror(const char * /*err*/)
......@@ -1244,7 +1244,7 @@ void yyerror(const char * /*err*/)
nodelist.pop_front();
delete pNode;
}
top = 0L;
top = nullptr;
}
#ifndef PARSE_DEBUG
......
......@@ -76,7 +76,7 @@ SkipData::SkipData(hchar hch)
: HBox(hch)
, data_block_len(0)
, dummy(0)
, data_block(0)
, data_block(nullptr)
{
}
......@@ -90,11 +90,11 @@ SkipData::~SkipData()
FieldCode::FieldCode()
: HBox(CH_FIELD)
, location_info(0)
, str1(NULL)
, str2(NULL)
, str3(NULL)
, bin(NULL)
, m_pDate(NULL)
, str1(nullptr)
, str2(nullptr)
, str3(nullptr)
, bin(nullptr)
, m_pDate(nullptr)
{
reserved1 = new char[4];
reserved2 = new char[22];
......@@ -316,8 +316,8 @@ FBox::FBox(hchar hch)
, pgy(0)
, pgno(0)
, showpg(0)
, prev(NULL)
, next(NULL)
, prev(nullptr)
, next(nullptr)
{
}
......@@ -341,9 +341,9 @@ TxtBox::TxtBox()
, type(0)
, nCell(0)
, protect(0)
, cell(0)
, m_pTable(NULL)
, plists(NULL)
, cell(nullptr)
, m_pTable(nullptr)
, plists(nullptr)
{
reserved[0] = reserved[1] = 0;
}
......@@ -385,7 +385,7 @@ Picture::Picture()
, cap_pos(0)
, num(0)
, pictype(0)
, follow(0)
, follow(nullptr)
, ishyper(false)
{
}
......@@ -525,7 +525,7 @@ static const hchar *GetOutlineStyleChars(int style)
};
if (style >= OLSTY_BULLET1 && style <= OLSTY_BULLET5)
return out_bul_style_entry[style - OLSTY_BULLET1];
return NULL;
return nullptr;
}
......
......@@ -28,7 +28,7 @@ HWPFont::HWPFont()
for (int ii = 0; ii < NLanguage; ii++)
{
nFonts[ii] = 0;
fontnames[ii] = NULL;
fontnames[ii] = nullptr;
}
}
......@@ -61,9 +61,9 @@ int HWPFont::AddFont(int lang, const char *font)
const char *HWPFont::GetFontName(int lang, int id)
{
if (!(lang >= 0 && lang < NLanguage))
return 0;
return nullptr;
if (id < 0 || nFonts[lang] <= id)
return 0;
return nullptr;
return fontnames[lang] + id * FONTNAMELEN;
}
......
......@@ -71,7 +71,7 @@ gz_stream *gz_open(HStream & _stream)
s->z_err = Z_OK;
s->z_eof = 0;
s->crc = crc32(0L, Z_NULL, 0);
s->msg = NULL;
s->msg = nullptr;
s->transparent = 0;
s->mode = 'r';
......@@ -134,7 +134,7 @@ local int destroy(gz_stream * s)
TRYFREE(s->msg);
if (s->stream.state != NULL)
if (s->stream.state != nullptr)
{
err = inflateEnd(&(s->stream));
}
......@@ -160,7 +160,7 @@ int gz_read(gz_stream * file, voidp buf, unsigned len)
gz_stream *s = file;
Bytef *start = static_cast<Bytef *>(buf); /* starting point for crc computation */
Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */
if (s == NULL)
if (s == nullptr)
return Z_STREAM_ERROR;
if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO)
......@@ -245,7 +245,7 @@ int gz_flush(gz_stream * file, int flush)
bool done = false;
gz_stream *s = file;
if (s == NULL || s->mode != 'w')
if (s == nullptr || s->mode != 'w')
return Z_STREAM_ERROR;
s->stream.avail_in = 0; /* should be zero already anyway */
......@@ -307,7 +307,7 @@ int gz_close(gz_stream * file)
// int err;
gz_stream *s = file;
if (s == NULL)
if (s == nullptr)
return Z_STREAM_ERROR;
#if 0
if (s->mode == 'w')
......
......@@ -56,7 +56,7 @@ HWPInfo::HWPInfo()
, compressed(0)
, reserved3(0)
, info_block_len(0)
, info_block(NULL)
, info_block(nullptr)
{
back_info.isset = false;
memset(reserved1, 0, sizeof(reserved1));
......@@ -67,7 +67,7 @@ HWPInfo::HWPInfo()
HWPInfo::~HWPInfo()
{
delete[] info_block;
info_block = 0;
info_block = nullptr;
}
......
......@@ -122,7 +122,7 @@ HStreamIODev::~HStreamIODev()
void HStreamIODev::init()
{
_gzfp = NULL;
_gzfp = nullptr;
compressed = false;
}
......@@ -148,7 +148,7 @@ void HStreamIODev::close()
this->flush();
if (_gzfp)
gz_close(_gzfp);
_gzfp = NULL;
_gzfp = nullptr;
}
......@@ -163,12 +163,12 @@ bool HStreamIODev::setCompressed(bool flag)
{
compressed = flag;
if (flag)
return 0 != (_gzfp = gz_open(*_stream));
return nullptr != (_gzfp = gz_open(*_stream));
else if (_gzfp)
{
gz_flush(_gzfp, Z_FINISH);
gz_close(_gzfp);
_gzfp = 0;
_gzfp = nullptr;
}
return true;
}
......@@ -278,7 +278,7 @@ HMemIODev::~HMemIODev()
void HMemIODev::init()
{
ptr = 0;
ptr = nullptr;
length = 0;
pos = 0;
}
......
......@@ -67,7 +67,7 @@ bool LineInfo::Read(HWPFile & hwpf, HWPPara *pPara)
}
HWPPara::HWPPara()
: _next(NULL)
: _next(nullptr)
, reuse_shape(0)
, nch(0)
, nline(0)
......@@ -78,9 +78,9 @@ HWPPara::HWPPara()
, ctrlflag(0)
, pstyno(0)
, pno(0)
, linfo(NULL)
, cshapep(NULL)
, hhstr(NULL)
, linfo(nullptr)
, cshapep(nullptr)
, hhstr(nullptr)
{
memset(&cshape, 0, sizeof(cshape));
memset(&pshape, 0, sizeof(pshape));
......@@ -186,11 +186,11 @@ bool HWPPara::Read(HWPFile & hwpf, unsigned char flag)
hhstr = ::comphelper::newArray_null<HBox *>(nch);
if (!hhstr) { return false; }
for (ii = 0; ii < nch; ii++)
hhstr[ii] = 0;
hhstr[ii] = nullptr;
ii = 0;
while (ii < nch)
{
if (0 == (hhstr[ii] = readHBox(hwpf)))
if (nullptr == (hhstr[ii] = readHBox(hwpf)))
return false;
if (hhstr[ii]->hh == CH_END_PARA)
break;
......@@ -218,12 +218,12 @@ HBox *HWPPara::readHBox(HWPFile & hwpf)
{
hchar hh;
if (!hwpf.Read2b(hh))
return 0;
return nullptr;
HBox *hbox = 0;
HBox *hbox = nullptr;
if (hwpf.State() != HWP_NoError)
return 0;
return nullptr;
if (hh > 31 || hh == CH_END_PARA)
hbox = new HBox(hh);
......@@ -310,7 +310,7 @@ HBox *HWPPara::readHBox(HWPFile & hwpf)
{
delete hbox;
return 0;
return nullptr;
}
if( hh == CH_TEXT_BOX || hh == CH_PICTURE || hh == CH_LINE )
{
......
......@@ -42,7 +42,7 @@ static char buffer[MAXSTYLENAME + 1];
HWPStyle::HWPStyle()
{
nstyles = 0;
style = 0;
style = nullptr;
}
......@@ -58,7 +58,7 @@ HWPStyle::~HWPStyle()
char *HWPStyle::GetName(int n) const
{
if (!(n >= 0 && n < nstyles))
return 0;
return nullptr;
return DATA[n].name;
}
......@@ -78,7 +78,7 @@ void HWPStyle::SetName(int n, char *name)
CharShape *HWPStyle::GetCharShape(int n) const
{
if (!(n >= 0 && n < nstyles))
return 0;
return nullptr;
return &DATA[n].cshape;
}
......@@ -98,7 +98,7 @@ void HWPStyle::SetCharShape(int n, CharShape * cshapep)
ParaShape *HWPStyle::GetParaShape(int n) const
{
if (!(n >= 0 && n < nstyles))
return 0;
return nullptr;
return &DATA[n].pshape;
}
......
......@@ -49,7 +49,7 @@ EmPicture::EmPicture(size_t tsize)
: size(tsize >= 32 ? tsize - 32 : 0)
{
if (size == 0)
data = 0;
data = nullptr;
else
data = new uchar[size];
}
......@@ -79,7 +79,7 @@ bool EmPicture::Read(HWPFile & hwpf)
OlePicture::OlePicture(int tsize)
: signature(0)
, pis(NULL)
, pis(nullptr)
{
size = tsize - 4;
if (size <= 0)
......@@ -139,7 +139,7 @@ bool OlePicture::Read(HWPFile & hwpf)
}
unlink(tname);
#else
if (pis == 0 || hwpf.ReadBlock(pis, size) == 0)
if (pis == nullptr || hwpf.ReadBlock(pis, size) == 0)
return false;
#endif
......
This diff is collapsed.
......@@ -36,7 +36,7 @@
#include <osl/diagnose.h>
HWPFile *HWPFile::cur_doc = 0;
HWPFile *HWPFile::cur_doc = nullptr;
static int ccount = 0;
static int pcount = 0;
static int datecodecount = 0;
......@@ -48,10 +48,10 @@ HWPFile::HWPFile()
, linenumber(0)
, info_block_len(0)
, error_code(HWP_NoError)
, oledata(0)
, oledata(nullptr)
, m_nCurrentPage(1)
, m_nMaxSettedPage(0)
, hiodev(0)
, hiodev(nullptr)
, currenthyper(0)
{
SetCurrentDoc(this);
......@@ -387,7 +387,7 @@ ColumnDef *HWPFile::GetColumnDef(int num)
if( it != columnlist.end() )
return (*it)->coldef;
else
return 0;
return nullptr;
}
/* Index of @return starts from 1 */
int HWPFile::GetPageMasterNum(int page)
......@@ -413,7 +413,7 @@ HyperText *HWPFile::GetHyperText()
}
currenthyper++;
return it != hyperlist.end() ? *it : NULL;
return it != hyperlist.end() ? *it : nullptr;
}
EmPicture *HWPFile::GetEmPicture(Picture * pic)
......@@ -428,7 +428,7 @@ EmPicture *HWPFile::GetEmPicture(Picture * pic)
for (; it != emblist.end(); ++it)
if (strcmp(name, (*it)->name) == 0)
return *it;
return 0;
return nullptr;
}
EmPicture *HWPFile::GetEmPictureByName(char * name)
......@@ -441,7 +441,7 @@ EmPicture *HWPFile::GetEmPictureByName(char * name)
for (; it != emblist.end(); ++it)
if (strcmp(name, (*it)->name) == 0)
return *it;
return 0;
return nullptr;
}
......@@ -455,7 +455,7 @@ void HWPFile::AddBox(FBox * box)
box->prev->next = box;
}
else
box->prev = 0;
box->prev = nullptr;
blist.push_back(box);
}
......@@ -469,7 +469,7 @@ ParaShape *HWPFile::getParaShape(int index)
break;
}
return it != pslist.end() ? *it : NULL;
return it != pslist.end() ? *it : nullptr;
}
......@@ -482,7 +482,7 @@ CharShape *HWPFile::getCharShape(int index)
break;
}
return it != cslist.end() ? *it : 0;
return it != cslist.end() ? *it : nullptr;
}
......@@ -495,7 +495,7 @@ FBoxStyle *HWPFile::getFBoxStyle(int index)
break;
}
return it != fbslist.end() ? *it : 0;
return it != fbslist.end() ? *it : nullptr;
}
DateCode *HWPFile::getDateCode(int index)
......@@ -507,7 +507,7 @@ DateCode *HWPFile::getDateCode(int index)
break;
}
return it != datecodes.end() ? *it : NULL;
return it != datecodes.end() ? *it : nullptr;
}
HeaderFooter *HWPFile::getHeaderFooter(int index)
......@@ -519,7 +519,7 @@ HeaderFooter *HWPFile::getHeaderFooter(int index)
break;
}
return it != headerfooters.end() ? *it : NULL;
return it != headerfooters.end() ? *it : nullptr;
}
ShowPageNum *HWPFile::getPageNumber(int index)
......@@ -531,7 +531,7 @@ ShowPageNum *HWPFile::getPageNumber(int index)
break;
}
return it != pagenumbers.end() ? *it : NULL;
return it != pagenumbers.end() ? *it : nullptr;
}
......@@ -544,7 +544,7 @@ Table *HWPFile::getTable(int index)
break;
}
return it != tables.end() ? *it : NULL;
return it != tables.end() ? *it : nullptr;
}
void HWPFile::AddParaShape(ParaShape * pshape)
......
......@@ -73,7 +73,7 @@ struct ColumnInfo{
ColumnInfo(int num){
start_page = num;
bIsSet = false;
coldef = 0;
coldef = NULL;
}
};
......
......@@ -359,7 +359,7 @@ bool TxtBox::Read(HWPFile & hwpf)
delete[] pArr;
}
else
m_pTable = 0L;
m_pTable = nullptr;
return !hwpf.State();
}
......@@ -443,7 +443,7 @@ bool Picture::Read(HWPFile & hwpf)
style.cell = picinfo.picdraw.hdo;
delete hmem;
hmem = 0;
hmem = nullptr;
}
else
{
......
This diff is collapsed.
......@@ -296,7 +296,7 @@ extern "C"
{
SAL_DLLPUBLIC_EXPORT void * SAL_CALL hwp_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * )
{
void * pRet = 0;
void * pRet = nullptr;
if (pServiceManager )
{
......
......@@ -185,7 +185,7 @@ struct yy_buffer_state
#define YY_BUFFER_EOF_PENDING 2
};
static YY_BUFFER_STATE yy_current_buffer = 0;
static YY_BUFFER_STATE yy_current_buffer = nullptr;
/* We provide macros for accessing buffer states in case in the
* future we want to put the buffer states in a more general
......@@ -1595,7 +1595,7 @@ static int yy_get_next_buffer()
}
else
/* Can't grow it, we don't own it. */
b->yy_ch_buf = 0;
b->yy_ch_buf = nullptr;
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR(
......@@ -1898,7 +1898,7 @@ yy_size_t size;
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
/* They forgot to leave room for the EOB's. */
return 0;
return nullptr;
b = static_cast<YY_BUFFER_STATE>(yy_flex_alloc( sizeof( struct yy_buffer_state ) ));
if ( ! b )
......@@ -1907,7 +1907,7 @@ yy_size_t size;
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
b->yy_buf_pos = b->yy_ch_buf = base;
b->yy_is_our_buffer = 0;
b->yy_input_file = 0;
b->yy_input_file = nullptr;
b->yy_n_chars = b->yy_buf_size;
b->yy_is_interactive = false;
b->yy_at_bol = 1;
......
......@@ -54,7 +54,7 @@ MzString::MzString()
{
Length = 0;
Allocated = 0;
Data = 0;
Data = nullptr;
}
......@@ -79,7 +79,7 @@ MzString &MzString::operator = (MzString &s)
MzString &MzString::operator = (const char *s)
{
if (s == NULL)
if (s == nullptr)
s = "";
int n = strlen(s);
if (allocate(n))
......@@ -122,7 +122,7 @@ void MzString::append(const char *s)
int MzString::compare(const char *s)
{
if (!Data) return -1;
if (s==NULL) return 1;
if (s==nullptr) return 1;
Data[Length] = 0;
return strcmp(Data, s);
......
......@@ -64,9 +64,9 @@ class Node{
public:
Node(int _id) : id(_id)
{
value = 0L;
child = 0L;
next = 0L;
value = NULL;
child = NULL;
next = NULL;
#ifdef NODE_DEBUG
count++;
printf("Node count : [%d]\n",count);
......@@ -77,8 +77,8 @@ public:
if( value ) free( value );
// if( child ) delete child;
// if( next ) delete next;
next = 0L;
child = 0L;
next = NULL;
child = NULL;
#ifdef NODE_DEBUG
count--;
printf("Node count : [%d]\n",count);
......
......@@ -25,7 +25,7 @@ double** mgcLinearSystemD::NewMatrix (int N)
{
double** A = new double*[N];
if ( !A )
return 0;
return nullptr;
for (int row = 0; row < N; row++)
{
......@@ -35,7 +35,7 @@ double** mgcLinearSystemD::NewMatrix (int N)
for (int i = 0; i < row; i++)
delete[] A[i];
delete[] A;
return 0;
return nullptr;
}
for (int col = 0; col < N; col++)
A[row][col] = 0;
......@@ -54,7 +54,7 @@ double* mgcLinearSystemD::NewVector (int N)
{
double* B = new double[N];
if ( !B )
return 0;
return nullptr;
for (int row = 0; row < N; row++)
B[row] = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment